[broadway] Report mouse pointer coordinates right

The windows argument to device_query_state can be a client side
window, but we must only handle the "native" part of it (i.e.
window->impl->wrapper).
This commit is contained in:
Alexander Larsson 2011-04-07 14:29:26 +02:00
parent 43aac66458
commit 1a7b76d49d

View File

@ -153,6 +153,8 @@ gdk_broadway_device_query_state (GdkDevice *device,
gint *win_y,
GdkModifierType *mask)
{
GdkWindow *toplevel;
GdkWindowImplBroadway *impl;
GdkDisplay *display;
GdkBroadwayDisplay *broadway_display;
GdkScreen *screen;
@ -164,6 +166,9 @@ gdk_broadway_device_query_state (GdkDevice *device,
display = gdk_device_get_display (device);
broadway_display = GDK_BROADWAY_DISPLAY (display);
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
toplevel = impl->wrapper;
if (root_window)
{
screen = gdk_window_get_screen (window);
@ -176,24 +181,23 @@ gdk_broadway_device_query_state (GdkDevice *device,
if (broadway_display->output)
{
_gdk_broadway_display_consume_all_input (display);
if (root_x)
*root_x = broadway_display->future_root_x;
if (root_y)
*root_y = broadway_display->future_root_y;
/* TODO: Should really use future_x/y when we get configure events */
if (win_x)
*win_x = broadway_display->future_root_x - window->x;
*win_x = broadway_display->future_root_x - toplevel->x;
if (win_y)
*win_y = broadway_display->future_root_y - window->y;
*win_y = broadway_display->future_root_y - toplevel->y;
if (child_window)
{
if (gdk_window_get_window_type (window) == GDK_WINDOW_ROOT)
if (gdk_window_get_window_type (toplevel) == GDK_WINDOW_ROOT)
*child_window =
g_hash_table_lookup (broadway_display->id_ht,
GINT_TO_POINTER (broadway_display->future_mouse_in_toplevel));
else
*child_window = window; /* No native children */
*child_window = toplevel; /* No native children */
}
return TRUE;
}
@ -208,21 +212,21 @@ gdk_broadway_device_query_state (GdkDevice *device,
if (root_y)
*root_y = device_root_y;
if (win_x)
*win_x = device_root_y - window->x;
*win_x = device_root_y - toplevel->x;
if (win_y)
*win_y = device_root_y - window->y;
*win_y = device_root_y - toplevel->y;
if (child_window)
{
if (gdk_window_get_window_type (window) == GDK_WINDOW_ROOT)
if (gdk_window_get_window_type (toplevel) == GDK_WINDOW_ROOT)
{
*child_window = broadway_display->mouse_in_toplevel;
if (*child_window == NULL)
*child_window = window;
*child_window = toplevel;
}
else
{
/* No native children */
*child_window = window;
*child_window = toplevel;
}
}