Commit 1a765ccf authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Mac: constrain frame directly inside the move loop

For some reason, when we set the window's frame directly in the move
loop, frame constraints don't trigger right away (as they do during a
window server drag). Instead, the frame goes wherever we told it to,
then constraints kick in, so the window flickers back and forth between
the constrained and unconstrained position.

Since the real fix (window server drag in the move loop) is a ways off,
let's directly constrain inside the move loop.

Bug: 1099600
Change-Id: If71392f90453da868a09ef9f52a4589f9db25c19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2276291Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#783996}
parent 577ae720
......@@ -100,9 +100,10 @@ bool CocoaWindowMoveLoop::Run() {
if ([event type] == NSLeftMouseDragged) {
const NSPoint mouse_in_screen = [NSEvent mouseLocation];
const NSRect ns_frame = NSOffsetRect(
NSRect ns_frame = NSOffsetRect(
initial_frame, mouse_in_screen.x - initial_mouse_in_screen_.x,
mouse_in_screen.y - initial_mouse_in_screen_.y);
ns_frame = [window constrainFrameRect:ns_frame toScreen:window.screen];
[window setFrame:ns_frame display:NO animate:NO];
return event;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment