~ubuntu-branches/ubuntu/wily/unity-settings-daemon/wily-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2010 Bastien Nocera <hadess@hadess.net>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef __GSD_INPUT_HELPER_H
#define __GSD_INPUT_HELPER_H

G_BEGIN_DECLS

#include <glib.h>

#include <X11/extensions/XInput.h>
#include <X11/extensions/XIproto.h>

#define WACOM_SERIAL_IDS_PROP "Wacom Serial IDs"

typedef enum {
        COMMAND_DEVICE_ADDED,
        COMMAND_DEVICE_REMOVED,
        COMMAND_DEVICE_PRESENT
} CustomCommand;

/* Generic property setting code. Fill up the struct property with the property
 * data and pass it into device_set_property together with the device to be
 * changed.  Note: doesn't cater for non-zero offsets yet, but we don't have
 * any settings that require that.
 */
typedef struct {
        const char *name;       /* property name */
        gint nitems;            /* number of items in data */
        gint format;            /* CARD8 or CARD32 sized-items */
        gint type;              /* Atom representing data type */
        union {
                const gchar *c; /* 8 bit data */
                const gint *i;  /* 32 bit data */
        } data;
} PropertyHelper;

gboolean  supports_xinput_devices  (void);
gboolean  supports_xinput2_devices (int *opcode);
gboolean  supports_xtest           (void);

gboolean set_device_enabled       (int device_id,
                                   gboolean enabled);

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_tablet (XDeviceInfo         *device_info);
gboolean  device_info_is_mouse       (XDeviceInfo         *device_info);
gboolean  device_info_is_trackball   (XDeviceInfo         *device_info);

gboolean  touchpad_is_present     (void);
gboolean  touchscreen_is_present  (void);
gboolean  mouse_is_present        (void);
gboolean  trackball_is_present    (void);

gboolean  device_set_property     (XDevice                *xdevice,
                                   const char             *device_name,
                                   PropertyHelper         *property);

gboolean  run_custom_command      (GdkDevice              *device,
                                   CustomCommand           command);

GList *   get_disabled_devices     (GdkDeviceManager       *manager);
char *    xdevice_get_device_node  (int                     deviceid);
int       xdevice_get_last_tool_id (int                     deviceid);
gboolean  xdevice_get_dimensions   (int                     deviceid,
                                    guint                  *width,
                                    guint                  *height);
void      xdevice_close      (XDevice                *xdevice);

G_END_DECLS

#endif /* __GSD_INPUT_HELPER_H */