After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 154601 - Fix middle-frame-click-to-lower focus inconsistency
Fix middle-frame-click-to-lower focus inconsistency
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
2.8.x
Other Linux
: High normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2004-10-05 19:19 UTC by Elijah Newren
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix middle-click-on-frame-to-lower-window for mouse and sloppy focus modes. (1.66 KB, patch)
2004-10-05 19:21 UTC, Elijah Newren
accepted-commit_now Details | Review
Version of the patch to use iff the patch in bug 154598 is rejected (1.76 KB, patch)
2004-10-05 19:31 UTC, Elijah Newren
rejected Details | Review

Description Elijah Newren 2004-10-05 19:19:36 UTC
Apparently lowering a focused window via a middle click on the frame so that it
drops below another window and such that the mouse enters the new window results
in some funny behavior.  It causes a LeaveNotify event to be generated with
xcrossing.mode equal to neither NotifyGrab nor NotifyUngrab AND an EnterNotify
event to be generated with xcrossing.mode equal to NotifyUngrab.  This asymmetry
is _really_ odd (I would expect both events to come from grabs, or neither event
to come from a grab; I don't understand why there's a mixture).

Anyway, since the EnterNotify is considered to have come from a grab, we need to
manually focus the correct window in all focus modes (not just click to focus).

Manually focusing the correct window, though, isn't quite enough for mouse focus
because of another issue:  LeaveNotify events in display.c use window->has_focus
in order to determine whether to defocus the window in mouse focus mode.  The
patch I will attach changes this to window==display->expected_focus_window, but
that depends on the patch in bug 154598 first being applied in order for this
change to be correct.  You'll note that there's a comment for EnterNotify events
that says that window->has_focus has to be ignored due to possible race
conditions, so making this change is a good idea for probably more than just
this bug.
Comment 1 Elijah Newren 2004-10-05 19:21:40 UTC
Created attachment 32259 [details] [review]
Fix middle-click-on-frame-to-lower-window for mouse and sloppy focus modes.

I've tested this patch combined with the one in bug 154598 in all three focus
modes, and it fixes the bug for mouse and sloppy focus modes and leaves things
working correctly in click-to-focus.
Comment 2 Elijah Newren 2004-10-05 19:31:09 UTC
Created attachment 32260 [details] [review]
Version of the patch to use iff the patch in bug 154598 is rejected

Just in case Havoc likes the current meaning of expected_focus_window and
doesn't want to change it, here's a patch that works without needing the patch
in bug 154598.
Comment 3 Elijah Newren 2004-10-08 21:58:29 UTC
Comment on attachment 32260 [details] [review]
Version of the patch to use iff the patch in bug 154598 is rejected

The patch in bug 154598 was accepted, so the other patch is the right one to
use.
Comment 4 Havoc Pennington 2004-10-08 22:30:51 UTC
Comment on attachment 32259 [details] [review]
Fix middle-click-on-frame-to-lower-window for mouse and sloppy focus modes.

Works for me, thanks.