-
-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix window resizing not always updating layout #1378
Conversation
Fixes koekeishiya#1199: resizing a window didn't always update the layout split. The underlying reason is that the mouse down coordinates for window resizing are not always within the `CGRect` of the window's frame; often they are just outside the window's frame when the resize cursor appears. I changed the event tap location to `kCGAnnotatedSessionEventTap`, which includes the field `kCGMouseEventWindowUnderMousePointerThatCanHandleThisEvent` in the event metadata that always accurately identifies the window that the click affects. This **does** alter the point in the input stack at which Yabai observes events, but examining `EVENT_TAP_CALLBACK(mouse_handler)` and user-testing the mouse features seems to show that changing the observation point does not cause any regression.
Ooooh! I hadn't seen the issue but I'm glad to know it's not just me. Any chance this fix would also resolve the issue where Yabai doesn't always refresh when a window is dragged? |
It might, because, before this fix, Yabai was matching mouse-down cursor coordinates to window frame extents. I can't imagine why that would go wrong when you have to drag from inside a window's frame in order to move it, but it seems reasonable that getting the window ID directly from the event stream might eliminate ambiguity. Let me know if this does resolve the issue. |
This doesn't actually fix the core issue of #1199 , which is caused by event order. https:/koekeishiya/yabai/blob/master/src/mouse.c#L3 is the logic that causes problem, because the AX API has not yet reported that the window size has changed, so we use an outdated cached value and perform an incorrect comparison, causing the layout not to update. This code is triggered from a mouse-up event. If we actually fail to determine the window on a mouse-down event as you mention in the description, that would be another bug. |
tl;dr: Agreed, this is only a partial fix for #1199. Would you merge but leave the issue open? ExplanationDuring troubleshooting, I added some debug statements to the code to print:
What I discovered was that sometimes the size in I never observed the case of the late-arriving Now that I've rambled out my inner thoughts... I agree that this does not completely close #1199. Should I open a separate issue, or would you consider merging this as a partial fix referencing that issue and leave it open? |
I did some further investigation and implemented a preliminary fix to handle the late I added some debug prints of the before & after sizes seen by the See my non-working patch here: overhacked/yabai@b2a995f |
Found a different fix. |
Fixes #1199: resizing a window didn't always update
the layout split. The underlying reason is that the
mouse down coordinates for window resizing are not
always within the
CGRect
of the window's frame;often they are just outside the window's frame when
the resize cursor appears.
I changed the event tap location to
kCGAnnotatedSessionEventTap
,which includes the field
kCGMouseEventWindowUnderMousePointerThatCanHandleThisEvent
in the event metadata that always accurately identifies the window
that the click affects. This does alter the point in the input
stack at which Yabai observes events, but examining
EVENT_TAP_CALLBACK(mouse_handler)
and user-testing the mouse features seems to show that changing
the observation point does not cause any regression.
I might be wrong about this. Please let me know if changing
the event tap location is a bad idea, and I will try to find
another workaround for this problem.