mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
gdk: activate surface on keyboard grabs
In 01455399e8
("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.
Fixes #85
(cherry picked from commit 3287ac96e02ff236d74db10164c5b0c1e7b2b0bf)
This commit is contained in:
parent
83159ffabf
commit
f23bfc6b69
@ -29,8 +29,8 @@
|
||||
#include "gdkkeysyms.h"
|
||||
|
||||
|
||||
#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 gdk_x11_device_manager_core_finalize (GObject *object);
|
||||
static void gdk_x11_device_manager_core_constructed (GObject *object);
|
||||
@ -842,7 +842,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
|
||||
if (toplevel->focus_window == original)
|
||||
return;
|
||||
|
||||
had_focus = HAS_FOCUS (toplevel);
|
||||
had_focus = APPEARS_FOCUSED (toplevel);
|
||||
x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (window));
|
||||
|
||||
switch (detail)
|
||||
@ -904,7 +904,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
|
||||
break;
|
||||
}
|
||||
|
||||
if (HAS_FOCUS (toplevel) != had_focus)
|
||||
if (APPEARS_FOCUSED (toplevel) != had_focus)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
|
@ -32,8 +32,8 @@ static gboolean gdk_event_source_dispatch (GSource *source,
|
||||
gpointer user_data);
|
||||
static void gdk_event_source_finalize (GSource *source);
|
||||
|
||||
#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)
|
||||
|
||||
struct _GdkEventSource
|
||||
{
|
||||
@ -148,10 +148,10 @@ handle_focus_change (GdkEventCrossing *event)
|
||||
if (!event->focus || toplevel->has_focus_window)
|
||||
return;
|
||||
|
||||
had_focus = HAS_FOCUS (toplevel);
|
||||
had_focus = APPEARS_FOCUSED (toplevel);
|
||||
toplevel->has_pointer_focus = focus_in;
|
||||
|
||||
if (HAS_FOCUS (toplevel) != had_focus)
|
||||
if (APPEARS_FOCUSED (toplevel) != had_focus)
|
||||
{
|
||||
GdkEvent *focus_event;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user