mouse: Update from gnome-settings-daemon
This commit is contained in:
parent
8947021b3e
commit
daa8b098a4
2 changed files with 33 additions and 6 deletions
|
@ -83,6 +83,8 @@ device_set_property (XDevice *xdevice,
|
|||
xdevice, prop, realtype, realformat,
|
||||
PropModeReplace, data, nitems);
|
||||
|
||||
XFree (data);
|
||||
|
||||
if (gdk_error_trap_pop ()) {
|
||||
g_warning ("Error in setting \"%s\" for \"%s\"", property->name, device_name);
|
||||
return FALSE;
|
||||
|
@ -129,7 +131,14 @@ supports_xinput2_devices (int *opcode)
|
|||
|
||||
if (XIQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor) != Success) {
|
||||
gdk_error_trap_pop_ignored ();
|
||||
return FALSE;
|
||||
/* try for 2.2, maybe gtk has already announced 2.2 support */
|
||||
gdk_error_trap_push ();
|
||||
major = 2;
|
||||
minor = 2;
|
||||
if (XIQueryVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &major, &minor) != Success) {
|
||||
gdk_error_trap_pop_ignored ();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
gdk_error_trap_pop_ignored ();
|
||||
|
||||
|
@ -179,6 +188,12 @@ device_info_is_touchscreen (XDeviceInfo *device_info)
|
|||
return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_TOUCHSCREEN, False));
|
||||
}
|
||||
|
||||
gboolean
|
||||
device_info_is_mouse (XDeviceInfo *device_info)
|
||||
{
|
||||
return (device_info->type == XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), XI_MOUSE, False));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
device_type_is_present (InfoIdentifyFunc info_func,
|
||||
DeviceIdentifyFunc device_func)
|
||||
|
@ -241,6 +256,13 @@ touchpad_is_present (void)
|
|||
device_is_touchpad);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mouse_is_present (void)
|
||||
{
|
||||
return device_type_is_present (device_info_is_mouse,
|
||||
NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
xdevice_get_device_node (int deviceid)
|
||||
{
|
||||
|
@ -328,14 +350,16 @@ xdevice_get_last_tool_id (int deviceid)
|
|||
if (!prop)
|
||||
return -1;
|
||||
|
||||
data = NULL;
|
||||
|
||||
gdk_error_trap_push ();
|
||||
|
||||
if (!XIGetProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
||||
if (XIGetProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
||||
deviceid, prop, 0, 1000, False,
|
||||
AnyPropertyType, &act_type, &act_format,
|
||||
&nitems, &bytes_after, &data) == Success) {
|
||||
&nitems, &bytes_after, &data) != Success) {
|
||||
gdk_error_trap_pop_ignored ();
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (gdk_error_trap_pop ())
|
||||
|
@ -366,10 +390,11 @@ xdevice_get_last_tool_id (int deviceid)
|
|||
/* That means that no tool was set down yet */
|
||||
if (id == STYLUS_DEVICE_ID ||
|
||||
id == ERASER_DEVICE_ID)
|
||||
return 0x0;
|
||||
id = 0x0;
|
||||
|
||||
out:
|
||||
XFree (data);
|
||||
if (data != NULL)
|
||||
XFree (data);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue