gdk: Keep track of the last slave device used

This last slave device (stored per master) is used to fill
in the missing slave device in synthesized crossing events
that are not directly caused by a device event (ie due to
configure events or grabs).
This commit is contained in:
Carlos Garnacho 2011-12-03 15:04:19 +01:00 committed by Matthias Clasen
parent 367cc4fc0f
commit 5b014bfdfb
3 changed files with 17 additions and 4 deletions

View File

@ -75,6 +75,7 @@ typedef struct
gdouble toplevel_x, toplevel_y;
guint32 state;
guint32 button;
GdkDevice *last_slave;
} GdkPointerWindowInfo;
typedef struct

View File

@ -9045,7 +9045,7 @@ do_synthesize_crossing_event (gpointer data)
_gdk_synthesize_crossing_events (display,
pointer_info->window_under_pointer,
new_window_under_pointer,
device, NULL,
device, pointer_info->last_slave,
GDK_CROSSING_NORMAL,
pointer_info->toplevel_x,
pointer_info->toplevel_y,
@ -9571,6 +9571,17 @@ _gdk_windowing_got_event (GdkDisplay *display,
{
GdkInputMode mode;
pointer_info = _gdk_display_get_pointer_info (display, device);
if (pointer_info)
{
if (source_device != pointer_info->last_slave &&
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE)
pointer_info->last_slave = source_device;
else
source_device = pointer_info->last_slave;
}
g_object_get (device, "input-mode", &mode, NULL);
_gdk_display_device_grab_update (display, device, source_device, serial);
@ -9589,8 +9600,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
if (!event_window)
return;
pointer_info = _gdk_display_get_pointer_info (display, device);
#ifdef DEBUG_WINDOW_PRINTING
if (event->type == GDK_KEY_PRESS &&
(event->key.keyval == 0xa7 ||

View File

@ -1579,9 +1579,12 @@ device_grab_update_callback (GdkDisplay *display,
gpointer data,
gulong serial)
{
GdkPointerWindowInfo *pointer_info;
GdkDevice *device = data;
_gdk_display_device_grab_update (display, device, NULL, serial);
pointer_info = _gdk_display_get_pointer_info (display, device);
_gdk_display_device_grab_update (display, device,
pointer_info->last_slave, serial);
}
#define XSERVER_TIME_IS_LATER(time1, time2) \