gdk-do-not-deactivate-surface-on-keyboard-grabs.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From: Samuel Thibault <samuel.thibault@ens-lyon.org>
  2. Date: Thu, 19 Apr 2018 14:10:23 +0200
  3. Subject: gdk: do not deactivate surface on keyboard grabs
  4. When pressing e.g. a window manager shortcut, which acquires keyboard grab,
  5. Xorg would send FocusOut NotifyGrab then FocusIn NotifyUngrab. Currently
  6. gdk would then deactivate the current surface, which makes accessibility
  7. screen readers think that we have switched to a non-accessible application
  8. and came back again, and thus reannounce the application frame etc. which we
  9. don't want when e.g. just raising volume.
  10. And actually, receiving FocusOut NotifyGrab does not mean losing the
  11. X focus, it only means an application aqcuired a grab, i.e. it is
  12. temporarily stealing keyboard events. On Wayland, this isn't even
  13. notified actually.
  14. This commit makes gdk only deactivate surfaces when there was an actual
  15. focus switch to another window, as determined by has_focus_window (instead
  16. of just has_focus), which happens either normally through FocusOut with
  17. NotifyNormal, or during grabs through FocusOut with NotifyWhileGrabbed.
  18. Bug: #85
  19. (cherry picked from commit 01455399e83a3dbafb0cdc6e12c7003b2f472a40)
  20. Origin: upstream, 2.24.33, commit:00b17063ac8e58d436b7ee5e79da83e74cbbbb30
  21. ---
  22. gdk/x11/gdkevents-x11.c | 2 +-
  23. 1 file changed, 1 insertion(+), 1 deletion(-)
  24. diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
  25. index 186a8f5..360b0c7 100644
  26. --- a/gdk/x11/gdkevents-x11.c
  27. +++ b/gdk/x11/gdkevents-x11.c
  28. @@ -622,7 +622,7 @@ gdk_check_wm_state_changed (GdkWindow *window)
  29. }
  30. #define HAS_FOCUS(toplevel) \
  31. - ((toplevel)->has_focus || (toplevel)->has_pointer_focus)
  32. + ((toplevel)->has_focus_window || (toplevel)->has_pointer_focus)
  33. static void
  34. generate_focus_event (GdkWindow *window,