Bug 44079 - XI2 FocusOut events missing parent of focus'd window
Summary: XI2 FocusOut events missing parent of focus'd window
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/Input/Core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
URL:
Whiteboard: 2011BRB_Reviewed
Keywords:
Depends on:
Blocks: xserver-1.12
  Show dependency treegraph
 
Reported: 2011-12-22 14:17 UTC by Benjamin Otte
Modified: 2012-01-10 21:57 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Demonstration of problem (3.52 KB, text/plain)
2011-12-22 14:20 UTC, Benjamin Otte
no flags Details
dix: Send FocusOut events to all intermediates (920 bytes, patch)
2011-12-22 14:23 UTC, Benjamin Otte
no flags Details | Splinter Review
0001-dix-send-focus-events-to-the-immediate-parent-44079.patch (2.26 KB, patch)
2012-01-04 20:51 UTC, Peter Hutterer
no flags Details | Splinter Review
0001-dix-on-PointerRootWin-send-a-FocusIn-to-the-sprite-w.patch (989 bytes, patch)
2012-01-04 20:51 UTC, Peter Hutterer
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Otte 2011-12-22 14:17:20 UTC
When focus is moved from a window A to a window B, A's parent does not receive a FocusOut notification. FocusIn works fine.
Comment 1 Benjamin Otte 2011-12-22 14:20:44 UTC
Created attachment 54721 [details]
Demonstration of problem

You can see the missing event here. Run the compiled demo app and Alt-Tab out. It will show the proper events for the non-xi2 case but not emit the events for the "mid" window in xi2.
Comment 2 Benjamin Otte 2011-12-22 14:23:48 UTC
Created attachment 54722 [details] [review]
dix: Send FocusOut events to all intermediates

The code passed the parent to this function and then started with the
parent inside the function. So the first parent never received an event.
Comment 3 Benjamin Otte 2011-12-22 14:28:40 UTC
Fwiw, I'm not sure if the patch is correct in all cases or if just some callers need to be fixed to pass foo instead of foo->parent. The current patch seems to work for me so far at least.
Comment 4 Benjamin Otte 2011-12-22 14:29:57 UTC
Oh yeah, final note: This bug is triggered in gtk master currently, where GTK doesn't emit FocusOut events properly.
Comment 5 Peter Hutterer 2012-01-02 19:04:56 UTC
Patch does the right thing, but it's better to fix the one caller that is incorrect. 

http://patchwork.freedesktop.org/patch/8570/
Comment 6 Benjamin Otte 2012-01-02 19:35:18 UTC
There are at least 3 cases in DeviceFocusEvents() where 'from->parent' is used.
Shouldn't all of those cases use 'from' instead?
Comment 7 Peter Hutterer 2012-01-02 19:40:10 UTC
i need more coffee. you'd think staring at it for a while would show that but alas... you're right. I'll fix this up and run it through the test suite.
Comment 8 Peter Hutterer 2012-01-04 20:51:12 UTC
Created attachment 55148 [details] [review]
0001-dix-send-focus-events-to-the-immediate-parent-44079.patch

One of the two patches needed to restore correct behaviour
Comment 9 Peter Hutterer 2012-01-04 20:51:40 UTC
Created attachment 55149 [details] [review]
0001-dix-on-PointerRootWin-send-a-FocusIn-to-the-sprite-w.patch
Comment 10 Peter Hutterer 2012-01-10 21:57:34 UTC
commit a125aabda3a5cf27aa98cb61f16e49280b66f451
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Jan 5 07:02:51 2012 -0500

    dix: send focus events to the immediate parent (#44079)

commit 3ce102c362cadcd7087bdcf48440d9498eaf77d0
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Jan 5 07:08:01 2012 -0500

    dix: on PointerRootWin send a FocusIn to the sprite window too


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.