wacom: Update from gnome-settings-daemon
This commit is contained in:
parent
29c49c9a48
commit
8d8cf75352
4 changed files with 25 additions and 7 deletions
|
@ -188,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)
|
||||
|
@ -250,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)
|
||||
{
|
||||
|
|
|
@ -61,9 +61,11 @@ gboolean device_is_touchpad (XDevice *xdevice);
|
|||
|
||||
gboolean device_info_is_touchpad (XDeviceInfo *device_info);
|
||||
gboolean device_info_is_touchscreen (XDeviceInfo *device_info);
|
||||
gboolean device_info_is_mouse (XDeviceInfo *device_info);
|
||||
|
||||
gboolean touchpad_is_present (void);
|
||||
gboolean touchscreen_is_present (void);
|
||||
gboolean mouse_is_present (void);
|
||||
|
||||
gboolean device_set_property (XDevice *xdevice,
|
||||
const char *device_name,
|
||||
|
|
|
@ -756,7 +756,7 @@ gsd_wacom_device_set_display (GsdWacomDevice *device,
|
|||
return;
|
||||
}
|
||||
|
||||
if (monitor >= 0)
|
||||
if (monitor > GSD_WACOM_SET_ALL_MONITORS)
|
||||
output = find_output_by_monitor (rr_screen, gdk_screen_get_default (), monitor);
|
||||
set_display_by_output (device, output);
|
||||
|
||||
|
@ -823,25 +823,25 @@ gsd_wacom_device_get_display_monitor (GsdWacomDevice *device)
|
|||
GnomeRRCrtc *crtc;
|
||||
gint area[4];
|
||||
|
||||
g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), -1);
|
||||
g_return_val_if_fail (GSD_IS_WACOM_DEVICE (device), GSD_WACOM_SET_ALL_MONITORS);
|
||||
|
||||
rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);
|
||||
if (rr_screen == NULL) {
|
||||
g_warning ("Failed to create GnomeRRScreen: %s", error->message);
|
||||
g_error_free (error);
|
||||
return -1;
|
||||
return GSD_WACOM_SET_ALL_MONITORS;
|
||||
}
|
||||
|
||||
rr_output = find_output (rr_screen, device);
|
||||
if (rr_output == NULL) {
|
||||
g_object_unref (rr_screen);
|
||||
return -1;
|
||||
return GSD_WACOM_SET_ALL_MONITORS;
|
||||
}
|
||||
|
||||
if (!is_on (rr_output)) {
|
||||
g_warning ("Output is not active.");
|
||||
g_object_unref (rr_screen);
|
||||
return -1;
|
||||
return GSD_WACOM_SET_ALL_MONITORS;
|
||||
}
|
||||
|
||||
crtc = gnome_rr_output_get_crtc (rr_output);
|
||||
|
@ -855,7 +855,7 @@ gsd_wacom_device_get_display_monitor (GsdWacomDevice *device)
|
|||
|
||||
if (area[2] <= 0 || area[3] <= 0) {
|
||||
g_warning ("Output has non-positive area.");
|
||||
return -1;
|
||||
return GSD_WACOM_SET_ALL_MONITORS;
|
||||
}
|
||||
|
||||
g_debug ("Area: %d,%d %dx%d", area[0], area[1], area[2], area[3]);
|
||||
|
@ -906,7 +906,7 @@ gsd_wacom_device_get_display_rotation (GsdWacomDevice *device)
|
|||
if (rr_screen == NULL) {
|
||||
g_warning ("Failed to create GnomeRRScreen: %s", error->message);
|
||||
g_error_free (error);
|
||||
return -1;
|
||||
return GSD_WACOM_ROTATION_NONE;
|
||||
}
|
||||
|
||||
rr_output = find_output (rr_screen, device);
|
||||
|
|
|
@ -122,6 +122,9 @@ typedef enum {
|
|||
WACOM_TYPE_ALL = WACOM_TYPE_STYLUS | WACOM_TYPE_ERASER | WACOM_TYPE_CURSOR | WACOM_TYPE_PAD | WACOM_TYPE_TOUCH
|
||||
} GsdWacomDeviceType;
|
||||
|
||||
/* We use -1 for entire screen when setting/getting monitor value */
|
||||
#define GSD_WACOM_SET_ALL_MONITORS -1
|
||||
|
||||
GType gsd_wacom_device_get_type (void);
|
||||
|
||||
void gsd_wacom_device_set_display (GsdWacomDevice *device,
|
||||
|
|
Loading…
Add table
Reference in a new issue