Commit 114b45c7 authored by Benjamin Otte's avatar Benjamin Otte

gdk: Make query_state() vfunc a void vfunc

... and make sure the backends implement it that way.

query_state() return value was ignored in all of GDK and caused crashes
when it failed.
parent 50e3f532
......@@ -1588,7 +1588,7 @@ _gdk_device_translate_axis (GdkDevice *device,
return TRUE;
}
gboolean
void
_gdk_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
......@@ -1599,15 +1599,15 @@ _gdk_device_query_state (GdkDevice *device,
gint *win_y,
GdkModifierType *mask)
{
return GDK_DEVICE_GET_CLASS (device)->query_state (device,
window,
root_window,
child_window,
root_x,
root_y,
win_x,
win_y,
mask);
GDK_DEVICE_GET_CLASS (device)->query_state (device,
window,
root_window,
child_window,
root_x,
root_y,
win_x,
win_y,
mask);
}
GdkWindow *
......
......@@ -82,7 +82,7 @@ struct _GdkDeviceClass
GdkScreen *screen,
gint x,
gint y);
gboolean (* query_state) (GdkDevice *device,
void (* query_state) (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
......@@ -151,7 +151,7 @@ void _gdk_device_add_slave (GdkDevice *device,
GdkDevice *slave);
void _gdk_device_remove_slave (GdkDevice *device,
GdkDevice *slave);
gboolean _gdk_device_query_state (GdkDevice *device,
void _gdk_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
......
......@@ -54,15 +54,15 @@ static void gdk_quartz_device_core_warp (GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
static gboolean gdk_quartz_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static void gdk_quartz_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static GdkGrabStatus gdk_quartz_device_core_grab (GdkDevice *device,
GdkWindow *window,
gboolean owner_events,
......@@ -255,7 +255,7 @@ gdk_quartz_device_core_query_state_helper (GdkWindow *window,
return found_window;
}
static gboolean
static void
gdk_quartz_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
......@@ -288,8 +288,6 @@ gdk_quartz_device_core_query_state (GdkDevice *device,
if (root_y)
*root_y = y_tmp;
return TRUE;
}
static GdkGrabStatus
......
......@@ -177,7 +177,7 @@ gdk_device_core_warp (GdkDevice *device,
{
}
static gboolean
static void
gdk_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
......@@ -208,8 +208,6 @@ gdk_device_core_query_state (GdkDevice *device,
*win_y = wd->surface_y;
if (mask)
*mask = wd->modifiers;
return TRUE;
}
static GdkGrabStatus
......
......@@ -238,7 +238,7 @@ get_current_mask (void)
return mask;
}
static gboolean
static void
gdk_device_win32_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
......@@ -303,8 +303,6 @@ gdk_device_win32_query_state (GdkDevice *device,
if (mask)
*mask = get_current_mask ();
return TRUE;
}
static GdkGrabStatus
......
......@@ -52,15 +52,15 @@ static void gdk_device_wintab_warp (GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
static gboolean gdk_device_wintab_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static void gdk_device_wintab_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static GdkGrabStatus gdk_device_wintab_grab (GdkDevice *device,
GdkWindow *window,
gboolean owner_events,
......@@ -161,7 +161,7 @@ gdk_device_wintab_warp (GdkDevice *device,
{
}
static gboolean
static void
gdk_device_wintab_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
......@@ -172,7 +172,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
gint *win_y,
GdkModifierType *mask)
{
return FALSE;
g_warning ("query_state unimplemented for wintab devices. Expect bad things.");
}
static GdkGrabStatus
......
......@@ -52,15 +52,15 @@ static void gdk_x11_device_core_warp (GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
static gboolean gdk_x11_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static void gdk_x11_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static GdkGrabStatus gdk_x11_device_core_grab (GdkDevice *device,
GdkWindow *window,
gboolean owner_events,
......@@ -235,7 +235,7 @@ gdk_x11_device_core_warp (GdkDevice *device,
XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0, x, y);
}
static gboolean
static void
gdk_x11_device_core_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
......@@ -255,17 +255,15 @@ gdk_x11_device_core_query_state (GdkDevice *device,
display = gdk_window_get_display (window);
default_screen = gdk_display_get_default_screen (display);
if (G_LIKELY (GDK_X11_DISPLAY (display)->trusted_client))
{
if (!XQueryPointer (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
&xroot_window,
&xchild_window,
&xroot_x, &xroot_y,
&xwin_x, &xwin_y,
&xmask))
return FALSE;
}
if (GDK_X11_DISPLAY (display)->trusted_client &&
XQueryPointer (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
&xroot_window,
&xchild_window,
&xroot_x, &xroot_y,
&xwin_x, &xwin_y,
&xmask))
return;
else
{
XSetWindowAttributes attributes;
......@@ -308,8 +306,6 @@ gdk_x11_device_core_query_state (GdkDevice *device,
if (mask)
*mask = xmask;
return TRUE;
}
static GdkGrabStatus
......
......@@ -78,15 +78,15 @@ static void gdk_x11_device_xi2_warp (GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
static gboolean gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static void gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static GdkGrabStatus gdk_x11_device_xi2_grab (GdkDevice *device,
GdkWindow *window,
......@@ -306,7 +306,7 @@ gdk_x11_device_xi2_warp (GdkDevice *device,
0, 0, 0, 0, x, y);
}
static gboolean
static void
gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
......@@ -326,26 +326,21 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
XIModifierState mod_state;
XIGroupState group_state;
if (!window || GDK_WINDOW_DESTROYED (window))
return FALSE;
display = gdk_window_get_display (window);
default_screen = gdk_display_get_default_screen (display);
if (G_LIKELY (GDK_X11_DISPLAY (display)->trusted_client))
{
if (!XIQueryPointer (GDK_WINDOW_XDISPLAY (window),
device_xi2->device_id,
GDK_WINDOW_XID (window),
&xroot_window,
&xchild_window,
&xroot_x, &xroot_y,
&xwin_x, &xwin_y,
&button_state,
&mod_state,
&group_state))
return FALSE;
}
if (GDK_X11_DISPLAY (display)->trusted_client &&
XIQueryPointer (GDK_WINDOW_XDISPLAY (window),
device_xi2->device_id,
GDK_WINDOW_XID (window),
&xroot_window,
&xchild_window,
&xroot_x, &xroot_y,
&xwin_x, &xwin_y,
&button_state,
&mod_state,
&group_state))
return;
else
{
XSetWindowAttributes attributes;
......@@ -393,8 +388,6 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state, &group_state);
free (button_state.mask);
return TRUE;
}
static GdkGrabStatus
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment