summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2016-02-12 21:59:29 +0100
committerCarlos Garnacho <carlosg@gnome.org>2016-02-12 22:05:30 +0100
commitd55b8151f27857ff4663ce05cbf6636b5ae50a02 (patch)
tree63423b97d2e23a8c82e5b0ce0a420f8250b16463
parent48d7219296084e73adcde7b09a8e550d7323deb7 (diff)
downloadgtk+-d55b8151f27857ff4663ce05cbf6636b5ae50a02.tar.gz
x11: Avoid setting has_pointer_focus if a EWMH compliant WM is present
This is mostly useful to have focus behave sanely on lack of WM, so avoid any check there if we're positive there is a WM handling focus. https://bugzilla.gnome.org/show_bug.cgi?id=677329
-rw-r--r--gdk/x11/gdkdevicemanager-core-x11.c6
-rw-r--r--gdk/x11/gdkeventsource.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c
index 8d6848869e..a16f931332 100644
--- a/gdk/x11/gdkdevicemanager-core-x11.c
+++ b/gdk/x11/gdkdevicemanager-core-x11.c
@@ -820,6 +820,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
int mode)
{
GdkToplevelX11 *toplevel;
+ GdkX11Screen *x11_screen;
gboolean had_focus;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -841,6 +842,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
return;
had_focus = HAS_FOCUS (toplevel);
+ x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (window));
switch (detail)
{
@@ -854,6 +856,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
* has_focus_window case.
*/
if (toplevel->has_pointer &&
+ !x11_screen->wmspec_check_window &&
mode != NotifyGrab &&
#ifdef XINPUT_2
mode != XINotifyPassiveGrab &&
@@ -884,7 +887,8 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
* but the pointer focus is ignored while a
* grab is in effect
*/
- if (mode != NotifyGrab &&
+ if (!x11_screen->wmspec_check_window &&
+ mode != NotifyGrab &&
#ifdef XINPUT_2
mode != XINotifyPassiveGrab &&
mode != XINotifyPassiveUngrab &&
diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c
index 7fff28f0c2..11929c61f9 100644
--- a/gdk/x11/gdkeventsource.c
+++ b/gdk/x11/gdkeventsource.c
@@ -132,11 +132,16 @@ static void
handle_focus_change (GdkEventCrossing *event)
{
GdkToplevelX11 *toplevel;
+ GdkX11Screen *x11_screen;
gboolean focus_in, had_focus;
toplevel = _gdk_x11_window_get_toplevel (event->window);
+ x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (event->window));
focus_in = (event->type == GDK_ENTER_NOTIFY);
+ if (x11_screen->wmspec_check_window)
+ return;
+
if (!toplevel || event->detail == GDK_NOTIFY_INFERIOR)
return;