forked from AuroraMiddleware/gtk
mir: track focused window
https://bugzilla.gnome.org/show_bug.cgi?id=775732
This commit is contained in:
parent
ed0bd0bba2
commit
440e80c832
@ -107,6 +107,10 @@ void _gdk_mir_event_source_queue (GdkMirWindowReference *window_ref, const MirEv
|
||||
|
||||
MirPixelFormat _gdk_mir_display_get_pixel_format (GdkDisplay *display, MirBufferUsage usage);
|
||||
|
||||
void _gdk_mir_display_focus_window (GdkDisplay *display, GdkWindow *window);
|
||||
|
||||
void _gdk_mir_display_unfocus_window (GdkDisplay *display, GdkWindow *window);
|
||||
|
||||
gboolean _gdk_mir_display_init_egl_display (GdkDisplay *display);
|
||||
|
||||
EGLDisplay _gdk_mir_display_get_egl_display (GdkDisplay *display);
|
||||
|
@ -51,6 +51,8 @@ typedef struct GdkMirDisplay
|
||||
|
||||
GdkKeymap *keymap;
|
||||
|
||||
GdkWindow *focused_window;
|
||||
|
||||
MirPixelFormat sw_pixel_format;
|
||||
MirPixelFormat hw_pixel_format;
|
||||
|
||||
@ -622,6 +624,25 @@ _gdk_mir_display_get_pixel_format (GdkDisplay *display,
|
||||
return mir_dpy->sw_pixel_format;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_display_focus_window (GdkDisplay *display,
|
||||
GdkWindow *window)
|
||||
{
|
||||
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
|
||||
|
||||
g_set_object (&mir_display->focused_window, window);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_display_unfocus_window (GdkDisplay *display,
|
||||
GdkWindow *window)
|
||||
{
|
||||
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
|
||||
|
||||
if (window == mir_display->focused_window)
|
||||
g_clear_object (&mir_display->focused_window);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_mir_display_init_egl_display (GdkDisplay *display)
|
||||
{
|
||||
|
@ -240,9 +240,15 @@ generate_focus_event (GdkWindow *window, gboolean focused)
|
||||
GdkEvent *event;
|
||||
|
||||
if (focused)
|
||||
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
|
||||
{
|
||||
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
|
||||
_gdk_mir_display_focus_window (gdk_window_get_display (window), window);
|
||||
}
|
||||
else
|
||||
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
|
||||
{
|
||||
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
|
||||
_gdk_mir_display_unfocus_window (gdk_window_get_display (window), window);
|
||||
}
|
||||
|
||||
event = gdk_event_new (GDK_FOCUS_CHANGE);
|
||||
event->focus_change.send_event = FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user