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);
|
(klass->set_window_cursor) (pointer, xwindow, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
Window *root_ret,
|
Window *root_ret,
|
||||||
@ -85,17 +85,18 @@ meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
|||||||
MetaDevicePointerClass *klass;
|
MetaDevicePointerClass *klass;
|
||||||
gint root_x, root_y, x, y;
|
gint root_x, root_y, x, y;
|
||||||
Window root, child;
|
Window root, child;
|
||||||
|
gboolean retval;
|
||||||
guint mask;
|
guint mask;
|
||||||
|
|
||||||
g_return_if_fail (META_IS_DEVICE_POINTER (pointer));
|
g_return_val_if_fail (META_IS_DEVICE_POINTER (pointer), FALSE);
|
||||||
g_return_if_fail (xwindow != None);
|
g_return_val_if_fail (xwindow != None, FALSE);
|
||||||
|
|
||||||
klass = META_DEVICE_POINTER_GET_CLASS (pointer);
|
klass = META_DEVICE_POINTER_GET_CLASS (pointer);
|
||||||
|
|
||||||
if (!klass->query_position)
|
if (!klass->query_position)
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
(klass->query_position) (pointer, xwindow, &root, &child,
|
retval = (klass->query_position) (pointer, xwindow, &root, &child,
|
||||||
&root_x, &root_y, &x, &y, &mask);
|
&root_x, &root_y, &x, &y, &mask);
|
||||||
|
|
||||||
if (root_ret)
|
if (root_ret)
|
||||||
@ -118,4 +119,6 @@ meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
|||||||
|
|
||||||
if (mask_ret)
|
if (mask_ret)
|
||||||
*mask_ret = mask;
|
*mask_ret = mask;
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ struct _MetaDevicePointerClass
|
|||||||
void (* set_window_cursor) (MetaDevicePointer *pointer,
|
void (* set_window_cursor) (MetaDevicePointer *pointer,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
MetaCursor cursor);
|
MetaCursor cursor);
|
||||||
void (* query_position) (MetaDevicePointer *pointer,
|
gboolean (* query_position) (MetaDevicePointer *pointer,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
Window *root,
|
Window *root,
|
||||||
Window *child,
|
Window *child,
|
||||||
@ -82,7 +82,7 @@ void meta_device_pointer_set_window_cursor (MetaDevicePointer *pointer,
|
|||||||
Window xwindow,
|
Window xwindow,
|
||||||
MetaCursor cursor);
|
MetaCursor cursor);
|
||||||
|
|
||||||
void meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
gboolean meta_device_pointer_query_position (MetaDevicePointer *pointer,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
Window *root,
|
Window *root,
|
||||||
Window *child,
|
Window *child,
|
||||||
|
@ -114,7 +114,7 @@ meta_device_pointer_core_set_window_cursor (MetaDevicePointer *pointer,
|
|||||||
XFreeCursor (display->xdisplay, xcursor);
|
XFreeCursor (display->xdisplay, xcursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
meta_device_pointer_core_query_position (MetaDevicePointer *pointer,
|
meta_device_pointer_core_query_position (MetaDevicePointer *pointer,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
Window *root,
|
Window *root,
|
||||||
@ -128,7 +128,7 @@ meta_device_pointer_core_query_position (MetaDevicePointer *pointer,
|
|||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
|
|
||||||
display = meta_device_get_display (META_DEVICE (pointer));
|
display = meta_device_get_display (META_DEVICE (pointer));
|
||||||
XQueryPointer (display->xdisplay, xwindow,
|
return XQueryPointer (display->xdisplay, xwindow,
|
||||||
root, child, root_x, root_y,
|
root, child, root_x, root_y,
|
||||||
x, y, mask);
|
x, y, mask);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ meta_device_pointer_xi2_set_window_cursor (MetaDevicePointer *pointer,
|
|||||||
XIUndefineCursor (display->xdisplay, device_id, xwindow);
|
XIUndefineCursor (display->xdisplay, device_id, xwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
meta_device_pointer_xi2_query_position (MetaDevicePointer *pointer,
|
meta_device_pointer_xi2_query_position (MetaDevicePointer *pointer,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
Window *root_ret,
|
Window *root_ret,
|
||||||
@ -210,11 +210,12 @@ meta_device_pointer_xi2_query_position (MetaDevicePointer *pointer,
|
|||||||
XIButtonState buttons;
|
XIButtonState buttons;
|
||||||
gdouble root_x, root_y, x, y;
|
gdouble root_x, root_y, x, y;
|
||||||
int device_id;
|
int device_id;
|
||||||
|
gboolean retval;
|
||||||
|
|
||||||
display = meta_device_get_display (META_DEVICE (pointer));
|
display = meta_device_get_display (META_DEVICE (pointer));
|
||||||
device_id = meta_device_get_id (META_DEVICE (pointer));
|
device_id = meta_device_get_id (META_DEVICE (pointer));
|
||||||
|
|
||||||
XIQueryPointer (display->xdisplay,
|
retval = XIQueryPointer (display->xdisplay,
|
||||||
device_id, xwindow,
|
device_id, xwindow,
|
||||||
root_ret, child_ret,
|
root_ret, child_ret,
|
||||||
&root_x, &root_y, &x, &y,
|
&root_x, &root_y, &x, &y,
|
||||||
@ -243,6 +244,8 @@ meta_device_pointer_xi2_query_position (MetaDevicePointer *pointer,
|
|||||||
|
|
||||||
if (y_ret)
|
if (y_ret)
|
||||||
*y_ret = (int) y;
|
*y_ret = (int) y;
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user