Merge lp:~jpakkane/libgrip/input_type_expose into lp:libgrip

Proposed by Jussi Pakkanen
Status: Merged
Merged at revision: 56
Proposed branch: lp:~jpakkane/libgrip/input_type_expose
Merge into: lp:libgrip
Diff against target: 122 lines (+36/-31)
5 files modified
src/gripgesturemanager.c (+0/-16)
src/gripgesturemanager.h (+0/-13)
src/gripinputdevice.c (+14/-2)
src/gripinputdevice.h (+18/-0)
src/libgrip.ver (+4/-0)
To merge this branch: bzr merge lp:~jpakkane/libgrip/input_type_expose
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
Review via email: mp+70829@code.launchpad.net

Description of the change

Expose input type detector function through API.

I moved it to gripinputdevice.c/h because it seemed like a more natural place.

I would have called the function grip_input_device_get_type but that one already exists and is used by the Glib object system (I think).

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote :

Exactly how I would have done it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/gripgesturemanager.c'
2--- src/gripgesturemanager.c 2011-08-08 09:44:29 +0000
3+++ src/gripgesturemanager.c 2011-08-09 08:39:29 +0000
4@@ -419,22 +419,6 @@
5 return input_device;
6 }
7
8-static
9-GripDeviceType
10-grip_get_device_type (GripInputDevice *input_device) {
11- gboolean is_direct = grip_input_device_is_direct (input_device);
12- gboolean is_independent = grip_input_device_is_independent (input_device);
13- if (is_direct && !is_independent)
14- return GRIP_DEVICE_TOUCHSCREEN;
15- if (!is_direct && !is_independent)
16- return GRIP_DEVICE_TOUCHPAD;
17- if (!is_direct && is_independent)
18- return GRIP_DEVICE_INDEPENDENT;
19-
20- g_critical("Unknown touch device type.");
21- return GRIP_DEVICE_TOUCHSCREEN;
22-}
23-
24 /*
25 * registration_for_input_device:
26 * @registrations: A collection of #GripGestureRegistration
27
28=== modified file 'src/gripgesturemanager.h'
29--- src/gripgesturemanager.h 2011-08-03 22:18:13 +0000
30+++ src/gripgesturemanager.h 2011-08-09 08:39:29 +0000
31@@ -123,19 +123,6 @@
32 GRIP_GESTURE_TAP = 15
33 } GripGestureType;
34
35-/**
36- * GripDeviceType:
37- * @GRIP_DEVICE_TOUCHSCREEN: device is a touchscreen.
38- * @GRIP_DEVICE_TOUCHPAD: device is a touchpad
39- * @GRIP_DEVICE_INDEPENDENT: device is a Magic Mouse
40- *
41- * Describes certain properties of a gesture input device.
42- */
43-typedef enum {
44- GRIP_DEVICE_TOUCHSCREEN = 1,
45- GRIP_DEVICE_TOUCHPAD = 2,
46- GRIP_DEVICE_INDEPENDENT = 4,
47-} GripDeviceType;
48
49 #define GRIP_DEVICE_ALL (GRIP_DEVICE_TOUCHSCREEN | GRIP_DEVICE_TOUCHPAD | GRIP_DEVICE_INDEPENDENT)
50
51
52=== modified file 'src/gripinputdevice.c'
53--- src/gripinputdevice.c 2011-08-04 00:39:00 +0000
54+++ src/gripinputdevice.c 2011-08-09 08:39:29 +0000
55@@ -322,5 +322,17 @@
56 G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
57 }
58
59-
60-
61+GripDeviceType
62+grip_get_device_type (GripInputDevice *input_device) {
63+ gboolean is_direct = grip_input_device_is_direct (input_device);
64+ gboolean is_independent = grip_input_device_is_independent (input_device);
65+ if (is_direct && !is_independent)
66+ return GRIP_DEVICE_TOUCHSCREEN;
67+ if (!is_direct && !is_independent)
68+ return GRIP_DEVICE_TOUCHPAD;
69+ if (!is_direct && is_independent)
70+ return GRIP_DEVICE_INDEPENDENT;
71+
72+ g_critical("Unknown touch device type.");
73+ return GRIP_DEVICE_TOUCHSCREEN;
74+}
75
76=== modified file 'src/gripinputdevice.h'
77--- src/gripinputdevice.h 2011-08-04 00:39:00 +0000
78+++ src/gripinputdevice.h 2011-08-09 08:39:29 +0000
79@@ -27,6 +27,20 @@
80 G_BEGIN_DECLS
81
82 /**
83+ * GripDeviceType:
84+ * @GRIP_DEVICE_TOUCHSCREEN: device is a touchscreen.
85+ * @GRIP_DEVICE_TOUCHPAD: device is a touchpad
86+ * @GRIP_DEVICE_INDEPENDENT: device is a Magic Mouse
87+ *
88+ * Describes certain properties of a gesture input device.
89+ */
90+typedef enum {
91+ GRIP_DEVICE_TOUCHSCREEN = 1,
92+ GRIP_DEVICE_TOUCHPAD = 2,
93+ GRIP_DEVICE_INDEPENDENT = 4,
94+} GripDeviceType;
95+
96+/**
97 * SECTION:GripInputDevice
98 *
99 * The Grip input device represents input devices known to the uTouch gesture
100@@ -99,6 +113,10 @@
101 AxisExtents *
102 grip_input_device_get_y_extents(GripInputDevice *input_device);
103
104+
105+GripDeviceType
106+grip_get_device_type (GripInputDevice *input_device);
107+
108 G_END_DECLS
109
110 #endif /* GRIP_INPUT_DEVICE_H_ */
111
112=== modified file 'src/libgrip.ver'
113--- src/libgrip.ver 2011-08-04 00:39:00 +0000
114+++ src/libgrip.ver 2011-08-09 08:39:29 +0000
115@@ -53,3 +53,7 @@
116 grip_input_device_is_independent;
117 } GRIP_0.1;
118
119+GRIP_0.3 {
120+ global:
121+ grip_get_device_type;
122+} GRIP_0.2.2;

Subscribers

People subscribed via source and target branches