Package: gtk+2.0 / 2.24.32-3

gdk-activate-window-on-keyboard-grabs.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Fri, 1 Jun 2018 16:43:01 +0200
Subject: gdk: activate window on keyboard grabs

In 01455399e83a ("gdk: do not deactivate surface on keyboard grabs"), we
made gdk avoid deactivating surfaces when another application takes a
keyboard grab, by using has_focus_window instead of has_focus. That however
broke activating surfaces when the gdk application acquired a grab itself,
in which case has_focus_window is false but has_focus is true.

We thus actually need to use both: surfaces should be activated either
because we have normal keyboard focus, or because we grabbed the keyboard.

This also renames HAS_FOCUS to APPEARS_FOCUSED to better reflect its
role.

Bug: #85
(cherry picked from commit 3287ac96e02ff236d74db10164c5b0c1e7b2b0bf)
(cherry picked from commit 039285deb92b6baf6ef594b0d718e8f7a7e1d0ac)
Origin: upstream, 2.24.33, commit:853f786727a954d10ed78405adc18e0772ccd1cb
---
 gdk/x11/gdkevents-x11.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 360b0c7..bef77b5 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -621,8 +621,8 @@ gdk_check_wm_state_changed (GdkWindow *window)
     do_net_wm_state_changes (window);
 }
 
-#define HAS_FOCUS(toplevel)                           \
-  ((toplevel)->has_focus_window || (toplevel)->has_pointer_focus)
+#define APPEARS_FOCUSED(toplevel)                           \
+  ((toplevel)->has_focus || (toplevel)->has_focus_window || (toplevel)->has_pointer_focus)
 
 static void
 generate_focus_event (GdkWindow *window,
@@ -1344,11 +1344,11 @@ gdk_event_translate (GdkDisplay *display,
 
 	  if (xevent->xcrossing.focus && !toplevel->has_focus_window)
 	    {
-	      gboolean had_focus = HAS_FOCUS (toplevel);
+	      gboolean had_focus = APPEARS_FOCUSED (toplevel);
 	      
 	      toplevel->has_pointer_focus = TRUE;
 	      
-	      if (HAS_FOCUS (toplevel) != had_focus)
+	      if (APPEARS_FOCUSED (toplevel) != had_focus)
 		generate_focus_event (window, TRUE);
 	    }
 	}
@@ -1441,11 +1441,11 @@ gdk_event_translate (GdkDisplay *display,
 
 	  if (xevent->xcrossing.focus && !toplevel->has_focus_window)
 	    {
-	      gboolean had_focus = HAS_FOCUS (toplevel);
+	      gboolean had_focus = APPEARS_FOCUSED (toplevel);
 	      
 	      toplevel->has_pointer_focus = FALSE;
 	      
-	      if (HAS_FOCUS (toplevel) != had_focus)
+	      if (APPEARS_FOCUSED (toplevel) != had_focus)
 		generate_focus_event (window, FALSE);
 	    }
 	}
@@ -1523,7 +1523,7 @@ gdk_event_translate (GdkDisplay *display,
       
       if (toplevel)
 	{
-	  gboolean had_focus = HAS_FOCUS (toplevel);
+	  gboolean had_focus = APPEARS_FOCUSED (toplevel);
 	  
 	  switch (xevent->xfocus.detail)
 	    {
@@ -1569,7 +1569,7 @@ gdk_event_translate (GdkDisplay *display,
 	      break;
 	    }
 
-	  if (HAS_FOCUS (toplevel) != had_focus)
+	  if (APPEARS_FOCUSED (toplevel) != had_focus)
 	    generate_focus_event (window, TRUE);
 	}
       break;
@@ -1582,7 +1582,7 @@ gdk_event_translate (GdkDisplay *display,
       
       if (toplevel)
 	{
-	  gboolean had_focus = HAS_FOCUS (toplevel);
+	  gboolean had_focus = APPEARS_FOCUSED (toplevel);
 	    
 	  switch (xevent->xfocus.detail)
 	    {
@@ -1620,7 +1620,7 @@ gdk_event_translate (GdkDisplay *display,
 	      break;
 	    }
 
-	  if (HAS_FOCUS (toplevel) != had_focus)
+	  if (APPEARS_FOCUSED (toplevel) != had_focus)
 	    generate_focus_event (window, FALSE);
 	}
       break;