mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 18:40:40 -05:00
devices: make meta_device_pointer_query_position() return a boolean
like in XQueryPointer/XIQueryPointer, the return value tells whether the pointer device is on the same screen than the passed window.
This commit is contained in:
parent
bde0d28f1b
commit
656fa71649
@ -71,7 +71,7 @@ meta_device_pointer_set_window_cursor (MetaDevicePointer *pointer,
|
||||
(klass->set_window_cursor) (pointer, xwindow, cursor);
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
||||
Window xwindow,
|
||||
Window *root_ret,
|
||||
@ -85,18 +85,19 @@ meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
||||
MetaDevicePointerClass *klass;
|
||||
gint root_x, root_y, x, y;
|
||||
Window root, child;
|
||||
gboolean retval;
|
||||
guint mask;
|
||||
|
||||
g_return_if_fail (META_IS_DEVICE_POINTER (pointer));
|
||||
g_return_if_fail (xwindow != None);
|
||||
g_return_val_if_fail (META_IS_DEVICE_POINTER (pointer), FALSE);
|
||||
g_return_val_if_fail (xwindow != None, FALSE);
|
||||
|
||||
klass = META_DEVICE_POINTER_GET_CLASS (pointer);
|
||||
|
||||
if (!klass->query_position)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
(klass->query_position) (pointer, xwindow, &root, &child,
|
||||
&root_x, &root_y, &x, &y, &mask);
|
||||
retval = (klass->query_position) (pointer, xwindow, &root, &child,
|
||||
&root_x, &root_y, &x, &y, &mask);
|
||||
|
||||
if (root_ret)
|
||||
*root_ret = root;
|
||||
@ -118,4 +119,6 @@ meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
||||
|
||||
if (mask_ret)
|
||||
*mask_ret = mask;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ struct _MetaDevicePointerClass
|
||||
void (* set_window_cursor) (MetaDevicePointer *pointer,
|
||||
Window xwindow,
|
||||
MetaCursor cursor);
|
||||
void (* query_position) (MetaDevicePointer *pointer,
|
||||
gboolean (* query_position) (MetaDevicePointer *pointer,
|
||||
Window xwindow,
|
||||
Window *root,
|
||||
Window *child,
|
||||
@ -82,7 +82,7 @@ void meta_device_pointer_set_window_cursor (MetaDevicePointer *pointer,
|
||||
Window xwindow,
|
||||
MetaCursor cursor);
|
||||
|
||||
void meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
||||
gboolean meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
||||
Window xwindow,
|
||||
Window *root,
|
||||
Window *child,
|
||||
|
@ -114,7 +114,7 @@ meta_device_pointer_core_set_window_cursor (MetaDevicePointer *pointer,
|
||||
XFreeCursor (display->xdisplay, xcursor);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
meta_device_pointer_core_query_position (MetaDevicePointer *pointer,
|
||||
Window xwindow,
|
||||
Window *root,
|
||||
@ -128,9 +128,9 @@ meta_device_pointer_core_query_position (MetaDevicePointer *pointer,
|
||||
MetaDisplay *display;
|
||||
|
||||
display = meta_device_get_display (META_DEVICE (pointer));
|
||||
XQueryPointer (display->xdisplay, xwindow,
|
||||
root, child, root_x, root_y,
|
||||
x, y, mask);
|
||||
return XQueryPointer (display->xdisplay, xwindow,
|
||||
root, child, root_x, root_y,
|
||||
x, y, mask);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -193,7 +193,7 @@ meta_device_pointer_xi2_set_window_cursor (MetaDevicePointer *pointer,
|
||||
XIUndefineCursor (display->xdisplay, device_id, xwindow);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
meta_device_pointer_xi2_query_position (MetaDevicePointer *pointer,
|
||||
Window xwindow,
|
||||
Window *root_ret,
|
||||
@ -210,16 +210,17 @@ meta_device_pointer_xi2_query_position (MetaDevicePointer *pointer,
|
||||
XIButtonState buttons;
|
||||
gdouble root_x, root_y, x, y;
|
||||
int device_id;
|
||||
gboolean retval;
|
||||
|
||||
display = meta_device_get_display (META_DEVICE (pointer));
|
||||
device_id = meta_device_get_id (META_DEVICE (pointer));
|
||||
|
||||
XIQueryPointer (display->xdisplay,
|
||||
device_id, xwindow,
|
||||
root_ret, child_ret,
|
||||
&root_x, &root_y, &x, &y,
|
||||
&buttons, &mods,
|
||||
&group_unused);
|
||||
retval = XIQueryPointer (display->xdisplay,
|
||||
device_id, xwindow,
|
||||
root_ret, child_ret,
|
||||
&root_x, &root_y, &x, &y,
|
||||
&buttons, &mods,
|
||||
&group_unused);
|
||||
if (mask_ret)
|
||||
{
|
||||
*mask_ret = mods.effective;
|
||||
@ -243,6 +244,8 @@ meta_device_pointer_xi2_query_position (MetaDevicePointer *pointer,
|
||||
|
||||
if (y_ret)
|
||||
*y_ret = (int) y;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user