gpointing-device-settings r195 - in trunk: . modules modules/common modules/gnome-settings-daemon-plugins src test
- From: hiikezoe svn gnome org
- To: svn-commits-list gnome org
- Subject: gpointing-device-settings r195 - in trunk: . modules modules/common modules/gnome-settings-daemon-plugins src test
- Date: Tue, 10 Mar 2009 03:36:57 +0000 (UTC)
Author: hiikezoe
Date: Tue Mar 10 03:36:57 2009
New Revision: 195
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=195&view=rev
Log:
* define GpdsXInputPropertyEntry structure for conversion property enum to name or so.
* gpds_xinput_set_int_properties and gpds_xinput_get_int_properties needs enum instead of property name string and format type.
* New functions. gpds_xinput_set_int_properties_by_name_with_format_type and gpds_xinput_get_int_properties_by_name.
* New functions. gsd_pointing_device_manager_get_gconf_boolean and gsd_pointing_device_manager_get_gconf_int.
* New function. gpds_xinput_register_property_entries.
Modified:
trunk/NEWS
trunk/modules/common/gpds-mouse-xinput.c
trunk/modules/common/gpds-mouse-xinput.h
trunk/modules/common/gpds-touchpad-xinput.c
trunk/modules/common/gpds-touchpad-xinput.h
trunk/modules/gnome-settings-daemon-plugins/gsd-mouse-extension-manager.c
trunk/modules/gnome-settings-daemon-plugins/gsd-pointing-device-manager.c
trunk/modules/gnome-settings-daemon-plugins/gsd-pointing-device-manager.h
trunk/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c
trunk/modules/gpds-mouse-ui.c
trunk/modules/gpds-touchpad-ui.c
trunk/src/gpds-xinput.c
trunk/src/gpds-xinput.h
trunk/test/test-xinput.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Mar 10 03:36:57 2009
@@ -1,5 +1,5 @@
============================
-GPointinDeviceSettings 1.0.1
+GPointinDeviceSettings 1.1.0
============================
* Touchpad
@@ -10,7 +10,7 @@
GPointinDeviceSettings 1.0.0
============================
-* Overrall
+* Overall
- Try to show all XExtensionPointer
- Unify plugins for gnome-settings-daemon
* TrackPoint
@@ -20,7 +20,7 @@
GPointinDeviceSettings 0.9.1
============================
-* Overrall
+* Overall
- Address XInput-1.4.0
- Fix crashes due to X errors
* Touchpad
Modified: trunk/modules/common/gpds-mouse-xinput.c
==============================================================================
--- trunk/modules/common/gpds-mouse-xinput.c (original)
+++ trunk/modules/common/gpds-mouse-xinput.c Tue Mar 10 03:36:57 2009
@@ -27,56 +27,34 @@
#include <gpds-xinput.h>
#include <gpds-xinput-utils.h>
-static GpdsMouseXInputProperty properties[] = {
- {GPDS_MOUSE_MIDDLE_BUTTON_EMULATION, "Evdev Middle Button Emulation", 8, 1},
- {GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT, "Evdev Middle Button Timeout", 32, 1},
- {GPDS_MOUSE_WHEEL_EMULATION, "Evdev Wheel Emulation", 8, 1},
- {GPDS_MOUSE_WHEEL_EMULATION_INERTIA, "Evdev Wheel Emulation Inertia", 16, 1},
- {GPDS_MOUSE_WHEEL_EMULATION_AXES, "Evdev Wheel Emulation Axes", 8, 4},
- {GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT, "Evdev Wheel Emulation Timeout", 16, 1},
- {GPDS_MOUSE_WHEEL_EMULATION_BUTTON, "Evdev Wheel Emulation Button", 8, 1},
- {GPDS_MOUSE_DRAG_LOCK_BUTTONS, "Evdev Drag Lock Buttons", 8, 2}
+static const GpdsXInputPropertyEntry entries[] = {
+ {GPDS_MOUSE_MIDDLE_BUTTON_EMULATION, "Evdev Middle Button Emulation", G_TYPE_INT, 8, 1},
+ {GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT, "Evdev Middle Button Timeout", G_TYPE_INT, 32, 1},
+ {GPDS_MOUSE_WHEEL_EMULATION, "Evdev Wheel Emulation", G_TYPE_INT, 8, 1},
+ {GPDS_MOUSE_WHEEL_EMULATION_INERTIA, "Evdev Wheel Emulation Inertia", G_TYPE_INT, 16, 1},
+ {GPDS_MOUSE_WHEEL_EMULATION_AXES, "Evdev Wheel Emulation Axes", G_TYPE_INT, 8, 4},
+ {GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT, "Evdev Wheel Emulation Timeout", G_TYPE_INT, 16, 1},
+ {GPDS_MOUSE_WHEEL_EMULATION_BUTTON, "Evdev Wheel Emulation Button", G_TYPE_INT, 8, 1},
+ {GPDS_MOUSE_DRAG_LOCK_BUTTONS, "Evdev Drag Lock Buttons", G_TYPE_INT, 8, 2}
};
-static const gint n_properties = G_N_ELEMENTS(properties);
+static const gint n_entries = G_N_ELEMENTS(entries);
-const gchar *
-gpds_mouse_xinput_get_name (GpdsMouseProperty property)
+GpdsXInput *
+gpds_mouse_xinput_new (const gchar *device_name)
{
- gint i;
+ GpdsXInput *xinput;
- for (i = 0; i < n_properties; i++) {
- if (property == properties[i].property)
- return properties[i].name;
- }
+ xinput = gpds_xinput_new(device_name);
+ gpds_xinput_register_property_entries(xinput, entries, n_entries);
- return NULL;
+ return xinput;
}
-gint
-gpds_mouse_xinput_get_format_type (GpdsMouseProperty property)
+void
+gpds_mouse_xinput_setup_property_entries (GpdsXInput *xinput)
{
- gint i;
-
- for (i = 0; i < n_properties; i++) {
- if (property == properties[i].property)
- return properties[i].format_type;
- }
-
- return -1;
-}
-
-gint
-gpds_mouse_xinput_get_max_value_count (GpdsMouseProperty property)
-{
- gint i;
-
- for (i = 0; i < n_properties; i++) {
- if (property == properties[i].property)
- return properties[i].max_value_count;
- }
-
- return -1;
+ gpds_xinput_register_property_entries(xinput, entries, n_entries);
}
/*
Modified: trunk/modules/common/gpds-mouse-xinput.h
==============================================================================
--- trunk/modules/common/gpds-mouse-xinput.h (original)
+++ trunk/modules/common/gpds-mouse-xinput.h Tue Mar 10 03:36:57 2009
@@ -21,6 +21,7 @@
#define __GPDS_MOUSE_XINPUT_H__
#include <glib.h>
+#include <gpds-xinput.h>
typedef enum {
GPDS_MOUSE_MIDDLE_BUTTON_EMULATION,
@@ -33,18 +34,8 @@
GPDS_MOUSE_DRAG_LOCK_BUTTONS,
} GpdsMouseProperty;
-typedef struct _GpdsMouseXInputProperty GpdsMouseXInputProperty;
-struct _GpdsMouseXInputProperty
-{
- GpdsMouseProperty property;
- const gchar *name;
- gint format_type;
- gint max_value_count;
-};
-
-const gchar *gpds_mouse_xinput_get_name (GpdsMouseProperty property);
-gint gpds_mouse_xinput_get_format_type (GpdsMouseProperty property);
-gint gpds_mouse_xinput_get_max_value_count (GpdsMouseProperty property);
+GpdsXInput *gpds_mouse_xinput_new (const gchar *device_name);
+void gpds_mouse_xinput_setup_property_entries (GpdsXInput *xinput);
#endif /* __GPDS_MOUSE_XINPUT_H__ */
/*
Modified: trunk/modules/common/gpds-touchpad-xinput.c
==============================================================================
--- trunk/modules/common/gpds-touchpad-xinput.c (original)
+++ trunk/modules/common/gpds-touchpad-xinput.c Tue Mar 10 03:36:57 2009
@@ -27,79 +27,57 @@
#include <gpds-xinput.h>
#include <gpds-xinput-utils.h>
-static GpdsTouchpadXInputProperty properties[] = {
- {GPDS_TOUCHPAD_EDGES, "Synaptics Edges", G_TYPE_INT, 32, 4},
- {GPDS_TOUCHPAD_FINGER, "Synaptics Finger", G_TYPE_INT, 32, 3},
- {GPDS_TOUCHPAD_TAP_TIME, "Synaptics Tap Time", G_TYPE_INT, 32, 1},
- {GPDS_TOUCHPAD_TAP_MOVE, "Synaptics Tap Move", G_TYPE_INT, 32, 1},
- {GPDS_TOUCHPAD_TAP_DURATIONS, "Synaptics Tap Durations", G_TYPE_INT, 32, 3},
- {GPDS_TOUCHPAD_TAP_FAST_TAP, "Synaptics Tap FastTap", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_MIDDLE_BUTTON_TIMEOUT, "Synaptics Middle Button Timeout", G_TYPE_INT, 32, 1},
- {GPDS_TOUCHPAD_TWO_FINGER_PRESSURE, "Synaptics Two-Finger Pressure", G_TYPE_INT, 32, 1},
- {GPDS_TOUCHPAD_SCROLLING_DISTANCE, "Synaptics Scrolling Distance", G_TYPE_INT, 32, 2},
- {GPDS_TOUCHPAD_EDGE_SCROLLING, "Synaptics Edge Scrolling", G_TYPE_INT, 8, 3},
- {GPDS_TOUCHPAD_TWO_FINGER_SCROLLING, "Synaptics Two-Finger Scrolling", G_TYPE_INT, 8, 2},
- {GPDS_TOUCHPAD_SYNAPTICS_PROP_SPEED, "Synaptics Move Speed", G_TYPE_FLOAT, 0, 4},
- {GPDS_TOUCHPAD_EDGE_MOTION_PRESSURE, "Synaptics Edge Motion Pressure", G_TYPE_INT, 32, 2},
- {GPDS_TOUCHPAD_EDGE_MOTION_SPEED, "Synaptics Edge Motion Speed", G_TYPE_INT, 32, 2},
- {GPDS_TOUCHPAD_BUTTON_SCROLLING, "Synaptics Button Scrolling", G_TYPE_INT, 8, 2},
- {GPDS_TOUCHPAD_BUTTON_SCROLLING_REPEAT, "Synaptics Button Scrolling Repeat", G_TYPE_INT, 8, 2},
- {GPDS_TOUCHPAD_SCROLLING_TIME, "Synaptics Button Scrolling Time", G_TYPE_INT, 32, 1},
- {GPDS_TOUCHPAD_OFF, "Synaptics Off", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_GUESTMOUSE_OFF, "Synaptics Guestmouse Off", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_LOCKED_DRAGS, "Synaptics Locked Drags", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT, "Synaptics Locked Drags Timeout", G_TYPE_INT, 32, 1},
- {GPDS_TOUCHPAD_TAP_ACTION, "Synaptics Tap Action", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_CLICK_ACTION, "Synaptics Click Action", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_CIRCULAR_SCROLLING, "Synaptics Circular Scrolling", G_TYPE_INT, 8, 1},
+static const GpdsXInputPropertyEntry entries[] = {
+ {GPDS_TOUCHPAD_EDGES, "Synaptics Edges", G_TYPE_INT, 32, 4},
+ {GPDS_TOUCHPAD_FINGER, "Synaptics Finger", G_TYPE_INT, 32, 3},
+ {GPDS_TOUCHPAD_TAP_TIME, "Synaptics Tap Time", G_TYPE_INT, 32, 1},
+ {GPDS_TOUCHPAD_TAP_MOVE, "Synaptics Tap Move", G_TYPE_INT, 32, 1},
+ {GPDS_TOUCHPAD_TAP_DURATIONS, "Synaptics Tap Durations", G_TYPE_INT, 32, 3},
+ {GPDS_TOUCHPAD_TAP_FAST_TAP, "Synaptics Tap FastTap", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_MIDDLE_BUTTON_TIMEOUT, "Synaptics Middle Button Timeout", G_TYPE_INT, 32, 1},
+ {GPDS_TOUCHPAD_TWO_FINGER_PRESSURE, "Synaptics Two-Finger Pressure", G_TYPE_INT, 32, 1},
+ {GPDS_TOUCHPAD_SCROLLING_DISTANCE, "Synaptics Scrolling Distance", G_TYPE_INT, 32, 2},
+ {GPDS_TOUCHPAD_EDGE_SCROLLING, "Synaptics Edge Scrolling", G_TYPE_INT, 8, 3},
+ {GPDS_TOUCHPAD_TWO_FINGER_SCROLLING, "Synaptics Two-Finger Scrolling", G_TYPE_INT, 8, 2},
+ {GPDS_TOUCHPAD_SYNAPTICS_PROP_SPEED, "Synaptics Move Speed", G_TYPE_FLOAT, 0, 4},
+ {GPDS_TOUCHPAD_EDGE_MOTION_PRESSURE, "Synaptics Edge Motion Pressure", G_TYPE_INT, 32, 2},
+ {GPDS_TOUCHPAD_EDGE_MOTION_SPEED, "Synaptics Edge Motion Speed", G_TYPE_INT, 32, 2},
+ {GPDS_TOUCHPAD_BUTTON_SCROLLING, "Synaptics Button Scrolling", G_TYPE_INT, 8, 2},
+ {GPDS_TOUCHPAD_BUTTON_SCROLLING_REPEAT, "Synaptics Button Scrolling Repeat", G_TYPE_INT, 8, 2},
+ {GPDS_TOUCHPAD_SCROLLING_TIME, "Synaptics Button Scrolling Time", G_TYPE_INT, 32, 1},
+ {GPDS_TOUCHPAD_OFF, "Synaptics Off", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_GUESTMOUSE_OFF, "Synaptics Guestmouse Off", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_LOCKED_DRAGS, "Synaptics Locked Drags", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT, "Synaptics Locked Drags Timeout", G_TYPE_INT, 32, 1},
+ {GPDS_TOUCHPAD_TAP_ACTION, "Synaptics Tap Action", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_CLICK_ACTION, "Synaptics Click Action", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_CIRCULAR_SCROLLING, "Synaptics Circular Scrolling", G_TYPE_INT, 8, 1},
{GPDS_TOUCHPAD_CIRCULAR_SCROLLING_DISTANCE,"Synaptics Circular Scrolling Distance", G_TYPE_FLOAT, 0, 1},
- {GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER, "Synaptics Circular Scrolling Trigger", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_CIRCULAR_PAD, "Synaptics Circular Pad", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_PALM_DETECTION, "Synaptics Palm Detection", G_TYPE_INT, 8, 1},
- {GPDS_TOUCHPAD_PALM_DIMENSIONS, "Synaptics Palm Dimensions", G_TYPE_INT, 32, 2},
- {GPDS_TOUCHPAD_PRESSURE_MOTION, "Synaptics Pressure Motion", G_TYPE_INT, 32, 2},
- {GPDS_TOUCHPAD_GRAB_EVENT_DEVICE, "Synaptics Grab Event Device", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER, "Synaptics Circular Scrolling Trigger", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_CIRCULAR_PAD, "Synaptics Circular Pad", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_PALM_DETECTION, "Synaptics Palm Detection", G_TYPE_INT, 8, 1},
+ {GPDS_TOUCHPAD_PALM_DIMENSIONS, "Synaptics Palm Dimensions", G_TYPE_INT, 32, 2},
+ {GPDS_TOUCHPAD_PRESSURE_MOTION, "Synaptics Pressure Motion", G_TYPE_INT, 32, 2},
+ {GPDS_TOUCHPAD_GRAB_EVENT_DEVICE, "Synaptics Grab Event Device", G_TYPE_INT, 8, 1},
};
-static const gint n_properties = G_N_ELEMENTS(properties);
+static const gint n_entries = G_N_ELEMENTS(entries);
-const gchar *
-gpds_touchpad_xinput_get_name (GpdsTouchpadProperty property)
+GpdsXInput *
+gpds_touchpad_xinput_new (const gchar *device_name)
{
- gint i;
+ GpdsXInput *xinput;
- for (i = 0; i < n_properties; i++) {
- if (property == properties[i].property)
- return properties[i].name;
- }
+ xinput = gpds_xinput_new(device_name);
+ gpds_xinput_register_property_entries(xinput, entries, n_entries);
- return NULL;
+ return xinput;
}
-gint
-gpds_touchpad_xinput_get_format_type (GpdsTouchpadProperty property)
+void
+gpds_touchpad_xinput_setup_property_entries (GpdsXInput *xinput)
{
- gint i;
-
- for (i = 0; i < n_properties; i++) {
- if (property == properties[i].property)
- return properties[i].format_type;
- }
-
- return -1;
-}
-
-gint
-gpds_touchpad_xinput_get_max_value_count (GpdsTouchpadProperty property)
-{
- gint i;
-
- for (i = 0; i < n_properties; i++) {
- if (property == properties[i].property)
- return properties[i].max_value_count;
- }
-
- return -1;
+ gpds_xinput_register_property_entries(xinput, entries, n_entries);
}
/*
Modified: trunk/modules/common/gpds-touchpad-xinput.h
==============================================================================
--- trunk/modules/common/gpds-touchpad-xinput.h (original)
+++ trunk/modules/common/gpds-touchpad-xinput.h Tue Mar 10 03:36:57 2009
@@ -21,6 +21,7 @@
#define __GPDS_TOUCHPAD_XINPUT_H__
#include <glib-object.h>
+#include <gpds-xinput.h>
typedef enum {
GPDS_TOUCHPAD_EDGES,
@@ -74,19 +75,8 @@
GPDS_TOUCHPAD_USE_TYPE_TAPPING_AND_SCROLLING_OFF,
} GpdsTouchpadUseType;
-typedef struct _GpdsTouchpadXInputProperty GpdsTouchpadXInputProperty;
-struct _GpdsTouchpadXInputProperty
-{
- GpdsTouchpadProperty property;
- const gchar *name;
- GType property_type; /* G_TYPE_INT or G_TYPE_FLOAT */
- gint format_type;
- gint max_value_count;
-};
-
-const gchar *gpds_touchpad_xinput_get_name (GpdsTouchpadProperty property);
-gint gpds_touchpad_xinput_get_format_type (GpdsTouchpadProperty property);
-gint gpds_touchpad_xinput_get_max_value_count (GpdsTouchpadProperty property);
+GpdsXInput *gpds_touchpad_xinput_new (const gchar *device_name);
+void gpds_touchpad_xinput_setup_property_entries (GpdsXInput *xinput);
#endif /* __GPDS_TOUCHPAD_XINPUT_H__ */
/*
Modified: trunk/modules/gnome-settings-daemon-plugins/gsd-mouse-extension-manager.c
==============================================================================
--- trunk/modules/gnome-settings-daemon-plugins/gsd-mouse-extension-manager.c (original)
+++ trunk/modules/gnome-settings-daemon-plugins/gsd-mouse-extension-manager.c Tue Mar 10 03:36:57 2009
@@ -56,36 +56,6 @@
manager_class->gconf_client_notify = _gconf_client_notify;
}
-#define DEFINE_SET_VALUE_FUNCTION(function_name, key_name, value_type) \
-static void \
-set_ ## function_name (GsdPointingDeviceManager *manager, \
- GpdsXInput *xinput, \
- GConfClient *gconf) \
-{ \
- g ## value_type value; \
- gint properties[1]; \
- gchar *key; \
- gboolean value_exist; \
- key = gsd_pointing_device_manager_build_gconf_key(manager, key_name ## _KEY); \
- value_exist = gpds_gconf_get_ ## value_type (gconf, key_name ## _KEY, &value); \
- g_free(key); \
- if (!value_exist) \
- return; \
- properties[0] = value; \
- gpds_xinput_set_int_properties(xinput, \
- gpds_mouse_xinput_get_name(key_name), \
- gpds_mouse_xinput_get_format_type(key_name), \
- NULL, \
- properties, \
- 1); \
-}
-
-#define DEFINE_SET_BOOLEAN_FUNCTION(function_name, key_name) \
- DEFINE_SET_VALUE_FUNCTION(function_name, key_name, boolean)
-
-#define DEFINE_SET_INT_FUNCTION(function_name, key_name) \
- DEFINE_SET_VALUE_FUNCTION(function_name, key_name, int)
-
DEFINE_SET_BOOLEAN_FUNCTION (wheel_emulation, GPDS_MOUSE_WHEEL_EMULATION)
DEFINE_SET_BOOLEAN_FUNCTION (middle_button_emulation, GPDS_MOUSE_MIDDLE_BUTTON_EMULATION)
DEFINE_SET_INT_FUNCTION (middle_button_timeout, GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT)
@@ -101,10 +71,18 @@
gboolean y_enable, x_enable;
gint properties[4];
- if (!gpds_gconf_get_boolean(gconf, GPDS_MOUSE_WHEEL_EMULATION_Y_AXIS_KEY, &y_enable))
+ if (!gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_MOUSE_WHEEL_EMULATION_Y_AXIS_KEY,
+ &y_enable)) {
return;
- if (!gpds_gconf_get_boolean(gconf, GPDS_MOUSE_WHEEL_EMULATION_X_AXIS_KEY, &x_enable))
+ }
+ if (!gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_MOUSE_WHEEL_EMULATION_X_AXIS_KEY,
+ &x_enable)) {
return;
+ }
if (y_enable) {
properties[0] = 6;
@@ -121,8 +99,7 @@
properties[3] = 0;
}
gpds_xinput_set_int_properties(xinput,
- gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_AXES),
- gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION_AXES),
+ GPDS_MOUSE_WHEEL_EMULATION_AXES,
NULL,
properties,
4);
@@ -144,6 +121,7 @@
return FALSE;
}
+ gpds_mouse_xinput_setup_property_entries(xinput);
set_middle_button_emulation(manager, xinput, gconf);
set_wheel_emulation(manager, xinput, gconf);
set_middle_button_timeout(manager, xinput, gconf);
@@ -177,6 +155,7 @@
if (!xinput)
return;
+ gpds_mouse_xinput_setup_property_entries(xinput);
value = gconf_entry_get_value(entry);
key = gpds_gconf_get_key_from_path(gconf_entry_get_key(entry));
Modified: trunk/modules/gnome-settings-daemon-plugins/gsd-pointing-device-manager.c
==============================================================================
--- trunk/modules/gnome-settings-daemon-plugins/gsd-pointing-device-manager.c (original)
+++ trunk/modules/gnome-settings-daemon-plugins/gsd-pointing-device-manager.c Tue Mar 10 03:36:57 2009
@@ -281,6 +281,39 @@
return gconf_key;
}
+
+gboolean
+gsd_pointing_device_manager_get_gconf_boolean (GsdPointingDeviceManager *manager,
+ GConfClient *gconf,
+ const gchar *key,
+ gboolean *value)
+{
+ gboolean value_exist;
+ gchar *gconf_key;
+
+ gconf_key = gsd_pointing_device_manager_build_gconf_key(manager, key);
+ value_exist = gpds_gconf_get_boolean(gconf, gconf_key, value);
+ g_free(gconf_key);
+
+ return value_exist;
+}
+
+gboolean
+gsd_pointing_device_manager_get_gconf_int (GsdPointingDeviceManager *manager,
+ GConfClient *gconf,
+ const gchar *key,
+ gint *value)
+{
+ gint value_exist;
+ gchar *gconf_key;
+
+ gconf_key = gsd_pointing_device_manager_build_gconf_key(manager, key);
+ value_exist = gpds_gconf_get_int(gconf, gconf_key, value);
+ g_free(gconf_key);
+
+ return value_exist;
+}
+
/*
vi:ts=4:nowrap:ai:expandtab:sw=4
*/
Modified: trunk/modules/gnome-settings-daemon-plugins/gsd-pointing-device-manager.h
==============================================================================
--- trunk/modules/gnome-settings-daemon-plugins/gsd-pointing-device-manager.h (original)
+++ trunk/modules/gnome-settings-daemon-plugins/gsd-pointing-device-manager.h Tue Mar 10 03:36:57 2009
@@ -68,6 +68,43 @@
gchar *gsd_pointing_device_manager_build_gconf_key
(GsdPointingDeviceManager *manager,
const gchar *key);
+gboolean gsd_pointing_device_manager_get_gconf_boolean
+ (GsdPointingDeviceManager *manager,
+ GConfClient *gconf,
+ const gchar *key,
+ gboolean *value);
+gboolean gsd_pointing_device_manager_get_gconf_int
+ (GsdPointingDeviceManager *manager,
+ GConfClient *gconf,
+ const gchar *key,
+ gint *value);
+
+#define DEFINE_SET_VALUE_FUNCTION(function_name, key_name, value_type) \
+static void \
+set_ ## function_name (GsdPointingDeviceManager *manager, \
+ GpdsXInput *xinput, \
+ GConfClient *gconf) \
+{ \
+ g ## value_type value; \
+ gint properties[1]; \
+ if (!gsd_pointing_device_manager_get_gconf_ ## value_type (manager, \
+ gconf, \
+ key_name ## _KEY, \
+ &value)) \
+ return; \
+ properties[0] = value; \
+ gpds_xinput_set_int_properties(xinput, \
+ key_name, \
+ NULL, \
+ properties, \
+ 1); \
+}
+
+#define DEFINE_SET_BOOLEAN_FUNCTION(function_name, key_name) \
+ DEFINE_SET_VALUE_FUNCTION(function_name, key_name, boolean)
+
+#define DEFINE_SET_INT_FUNCTION(function_name, key_name) \
+ DEFINE_SET_VALUE_FUNCTION(function_name, key_name, int)
G_END_DECLS
Modified: trunk/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c
==============================================================================
--- trunk/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c (original)
+++ trunk/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c Tue Mar 10 03:36:57 2009
@@ -56,51 +56,6 @@
manager_class->gconf_client_notify = _gconf_client_notify;
}
-static GpdsXInput *
-get_xinput (GsdPointingDeviceManager *manager)
-{
- const gchar *device_name;
-
- device_name = gsd_pointing_device_manager_get_device_name(manager);
- if (!device_name)
- return NULL;
-
- if (!gpds_xinput_utils_exist_device(device_name))
- return NULL;
-
- return gpds_xinput_new(device_name);
-}
-
-#define DEFINE_SET_VALUE_FUNCTION(function_name, key_name, value_type) \
-static void \
-set_ ## function_name (GsdPointingDeviceManager *manager, \
- GpdsXInput *xinput, \
- GConfClient *gconf) \
-{ \
- g ## value_type value; \
- gint properties[1]; \
- gchar *key; \
- gboolean value_exist; \
- key = gsd_pointing_device_manager_build_gconf_key(manager, key_name ## _KEY); \
- value_exist = gpds_gconf_get_ ## value_type (gconf, key_name ## _KEY, &value); \
- g_free(key); \
- if (!value_exist) \
- return; \
- properties[0] = value; \
- gpds_xinput_set_int_properties(xinput, \
- gpds_touchpad_xinput_get_name(key_name), \
- gpds_touchpad_xinput_get_format_type(key_name), \
- NULL, \
- properties, \
- 1); \
-}
-
-#define DEFINE_SET_BOOLEAN_FUNCTION(function_name, key_name) \
- DEFINE_SET_VALUE_FUNCTION(function_name, key_name, boolean)
-
-#define DEFINE_SET_INT_FUNCTION(function_name, key_name) \
- DEFINE_SET_VALUE_FUNCTION(function_name, key_name, int)
-
DEFINE_SET_BOOLEAN_FUNCTION (tap_fast_tap, GPDS_TOUCHPAD_TAP_FAST_TAP)
DEFINE_SET_BOOLEAN_FUNCTION (circular_scrolling, GPDS_TOUCHPAD_CIRCULAR_SCROLLING)
DEFINE_SET_INT_FUNCTION (touchpad_off, GPDS_TOUCHPAD_OFF)
@@ -115,19 +70,30 @@
gboolean h_enable, v_enable, c_enable = FALSE;
gint properties[3];
- if (!gpds_gconf_get_boolean(gconf, GPDS_TOUCHPAD_VERTICAL_SCROLLING_KEY, &v_enable))
+ if (!gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_TOUCHPAD_VERTICAL_SCROLLING_KEY,
+ &v_enable)) {
return;
- if (!gpds_gconf_get_boolean(gconf, GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_KEY, &h_enable))
+ }
+ if (!gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_KEY,
+ &h_enable)) {
return;
- gpds_gconf_get_boolean(gconf, GPDS_TOUCHPAD_CONTINUOUS_EDGE_SCROLLING_KEY, &c_enable);
+ }
+
+ gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_TOUCHPAD_CONTINUOUS_EDGE_SCROLLING_KEY,
+ &c_enable);
properties[0] = v_enable ? 1 : 0;
properties[1] = h_enable ? 1 : 0;
properties[2] = c_enable ? 1 : 0;
gpds_xinput_set_int_properties(xinput,
- gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_EDGE_SCROLLING),
- gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_EDGE_SCROLLING),
+ GPDS_TOUCHPAD_EDGE_SCROLLING,
NULL,
properties,
3);
@@ -141,17 +107,24 @@
gboolean h_enable, v_enable;
gint properties[2];
- if (!gpds_gconf_get_boolean(gconf, GPDS_TOUCHPAD_TWO_FINGER_VERTICAL_SCROLLING_KEY, &v_enable))
+ if (!gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_TOUCHPAD_TWO_FINGER_VERTICAL_SCROLLING_KEY,
+ &v_enable)) {
return;
- if (!gpds_gconf_get_boolean(gconf, GPDS_TOUCHPAD_TWO_FINGER_HORIZONTAL_SCROLLING_KEY, &h_enable))
+ }
+ if (!gsd_pointing_device_manager_get_gconf_boolean(manager,
+ gconf,
+ GPDS_TOUCHPAD_TWO_FINGER_HORIZONTAL_SCROLLING_KEY,
+ &h_enable)) {
return;
+ }
properties[0] = v_enable ? 1 : 0;
properties[1] = h_enable ? 1 : 0;
gpds_xinput_set_int_properties(xinput,
- gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_TWO_FINGER_SCROLLING),
- gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_TWO_FINGER_SCROLLING),
+ GPDS_TOUCHPAD_TWO_FINGER_SCROLLING,
NULL,
properties,
2);
@@ -165,17 +138,24 @@
gint h_distance, v_distance;
gint properties[2];
- if (!gpds_gconf_get_boolean(gconf, GPDS_TOUCHPAD_VERTICAL_SCROLLING_DISTANCE_KEY, &v_distance))
+ if (!gsd_pointing_device_manager_get_gconf_int(manager,
+ gconf,
+ GPDS_TOUCHPAD_VERTICAL_SCROLLING_DISTANCE_KEY,
+ &v_distance)) {
return;
- if (!gpds_gconf_get_boolean(gconf, GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_DISTANCE_KEY, &h_distance))
+ }
+ if (!gsd_pointing_device_manager_get_gconf_int(manager,
+ gconf,
+ GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_DISTANCE_KEY,
+ &h_distance)) {
return;
+ }
- properties[0] = v_distance ? 1 : 0;
- properties[1] = h_distance ? 1 : 0;
+ properties[0] = v_distance;
+ properties[1] = h_distance;
gpds_xinput_set_int_properties(xinput,
- gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
- gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
+ GPDS_TOUCHPAD_SCROLLING_DISTANCE,
NULL,
properties,
2);
@@ -187,10 +167,12 @@
GpdsXInput *xinput;
GConfClient *gconf;
- xinput = get_xinput(manager);
+ xinput = gsd_pointing_device_manager_get_xinput(manager);
if (!xinput)
return FALSE;
+ gpds_touchpad_xinput_setup_property_entries(xinput);
+
gconf = gconf_client_get_default();
if (!gconf) {
g_object_unref(xinput);
@@ -231,6 +213,8 @@
if (!xinput)
return;
+ gpds_touchpad_xinput_setup_property_entries(xinput);
+
value = gconf_entry_get_value(entry);
key = gpds_gconf_get_key_from_path(gconf_entry_get_key(entry));
Modified: trunk/modules/gpds-mouse-ui.c
==============================================================================
--- trunk/modules/gpds-mouse-ui.c (original)
+++ trunk/modules/gpds-mouse-ui.c Tue Mar 10 03:36:57 2009
@@ -138,18 +138,13 @@
{
GError *error = NULL;
gboolean active;
- const gchar *property_name;
- gint format_type;
gint properties[1];
active = gtk_toggle_button_get_active(button);
- property_name = gpds_mouse_xinput_get_name(property);
- format_type = gpds_mouse_xinput_get_format_type(property);
properties[0] = active ? 1 : 0;
gpds_xinput_set_int_properties(xinput,
- property_name,
- format_type,
+ property,
&error,
properties,
1);
@@ -164,18 +159,13 @@
{
GError *error = NULL;
gdouble value;
- const gchar *property_name;
- gint format_type;
gint properties[1];
value = gtk_spin_button_get_value(button);
- property_name = gpds_mouse_xinput_get_name(property);
- format_type = gpds_mouse_xinput_get_format_type(property);
properties[0] = (gint)value;
gpds_xinput_set_int_properties(xinput,
- property_name,
- format_type,
+ property,
&error,
properties,
1);
@@ -238,8 +228,7 @@
properties[0] = gtk_combo_box_get_active(combo);
if (!gpds_xinput_set_int_properties(ui->xinput,
- gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_BUTTON),
- gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION_BUTTON),
+ GPDS_MOUSE_WHEEL_EMULATION_BUTTON,
&error,
properties,
1)) {
@@ -259,8 +248,6 @@
GtkToggleButton *button;
GError *error = NULL;
gboolean active;
- const gchar *property_name;
- gint format_type;
gint properties[4];
builder = gpds_ui_get_builder(GPDS_UI(ui));
@@ -285,12 +272,8 @@
properties[3] = 0;
}
- property_name = gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_AXES);
- format_type = gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION_AXES);
-
gpds_xinput_set_int_properties(ui->xinput,
- property_name,
- format_type,
+ GPDS_MOUSE_WHEEL_EMULATION_AXES,
&error,
properties,
4);
@@ -379,13 +362,13 @@
}
static gboolean
-get_integer_properties (GpdsXInput *xinput, const gchar *property_name,
+get_integer_properties (GpdsXInput *xinput, gint property_enum,
gint **values, gulong *n_values)
{
GError *error = NULL;
if (!gpds_xinput_get_int_properties(xinput,
- property_name,
+ property_enum,
&error,
values, n_values)) {
if (error) {
@@ -410,11 +393,8 @@
gint *values;
gulong n_values;
gint value;
- const gchar *property_name;
-
- property_name = gpds_mouse_xinput_get_name(property);
- if (!get_integer_properties(ui->xinput, property_name,
+ if (!get_integer_properties(ui->xinput, property,
&values, &n_values)) {
return;
}
@@ -438,12 +418,9 @@
gint *values;
gulong n_values;
gboolean enable;
- const gchar *property_name;
gchar *box_name;
- property_name = gpds_mouse_xinput_get_name(property);
-
- if (!get_integer_properties(ui->xinput, property_name,
+ if (!get_integer_properties(ui->xinput, property,
&values, &n_values)) {
return;
}
@@ -468,11 +445,9 @@
gint *values;
gulong n_values;
gboolean horizontal_enable = FALSE, vertical_enable = FALSE;
- const gchar *property_name;
-
- property_name = gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_AXES);
- if (!get_integer_properties(ui->xinput, property_name,
+ if (!get_integer_properties(ui->xinput,
+ GPDS_MOUSE_WHEEL_EMULATION_AXES,
&values, &n_values)) {
return;
}
@@ -539,7 +514,7 @@
gint button;
if (!get_integer_properties(ui->xinput,
- gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_BUTTON),
+ GPDS_MOUSE_WHEEL_EMULATION_BUTTON,
&values, &n_values)) {
return;
}
@@ -619,7 +594,7 @@
}
gpds_ui_set_gconf_string(ui, GPDS_GCONF_DEVICE_TYPE_KEY, "mouse");
- GPDS_MOUSE_UI(ui)->xinput = gpds_xinput_new(gpds_ui_get_device_name(ui));
+ GPDS_MOUSE_UI(ui)->xinput = gpds_mouse_xinput_new(gpds_ui_get_device_name(ui));
setup_current_values(ui, builder);
setup_signals(ui, builder);
Modified: trunk/modules/gpds-touchpad-ui.c
==============================================================================
--- trunk/modules/gpds-touchpad-ui.c (original)
+++ trunk/modules/gpds-touchpad-ui.c Tue Mar 10 03:36:57 2009
@@ -151,8 +151,7 @@
properties[0] = gtk_toggle_button_get_active(button) ? 1 : 0;
if (!gpds_xinput_set_int_properties(xinput,
- gpds_touchpad_xinput_get_name(property),
- gpds_touchpad_xinput_get_format_type(property),
+ property,
&error,
properties,
1)) {
@@ -182,8 +181,7 @@
properties[2] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)) ? 1 :0;
if (!gpds_xinput_set_int_properties(xinput,
- gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_EDGE_SCROLLING),
- gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_EDGE_SCROLLING),
+ GPDS_TOUCHPAD_EDGE_SCROLLING,
&error,
properties,
3)) {
@@ -211,8 +209,7 @@
properties[2] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)) ? 1 :0;
if (!gpds_xinput_set_int_properties(xinput,
- gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_TWO_FINGER_SCROLLING),
- gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_TWO_FINGER_SCROLLING),
+ GPDS_TOUCHPAD_TWO_FINGER_SCROLLING,
&error,
properties,
2)) {
@@ -231,8 +228,7 @@
properties[0] = (gint)gtk_range_get_value(range);
if (!gpds_xinput_set_int_properties(xinput,
- gpds_touchpad_xinput_get_name(property),
- gpds_touchpad_xinput_get_format_type(property),
+ property,
&error,
properties,
1)) {
@@ -257,8 +253,7 @@
properties[1] = (gint)gtk_range_get_value(GTK_RANGE(object));
if (!gpds_xinput_set_int_properties(xinput,
- gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
- gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
+ GPDS_TOUCHPAD_SCROLLING_DISTANCE,
&error,
properties,
2)) {
@@ -278,8 +273,7 @@
properties[0] = trigger;
if (!gpds_xinput_set_int_properties(ui->xinput,
- gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER),
- gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER),
+ GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER,
&error,
properties,
1)) {
@@ -521,8 +515,7 @@
properties[0] = gtk_combo_box_get_active(combo);
if (!gpds_xinput_set_int_properties(ui->xinput,
- gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_OFF),
- gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_OFF),
+ GPDS_TOUCHPAD_OFF,
&error,
properties,
1)) {
@@ -579,7 +572,7 @@
GError *error = NULL;
if (!gpds_xinput_get_int_properties(xinput,
- gpds_touchpad_xinput_get_name(property),
+ property,
&error,
values, n_values)) {
if (error) {
@@ -857,7 +850,7 @@
}
gpds_ui_set_gconf_string(ui, GPDS_GCONF_DEVICE_TYPE_KEY, "touchpad");
- GPDS_TOUCHPAD_UI(ui)->xinput = gpds_xinput_new(gpds_ui_get_device_name(ui));
+ GPDS_TOUCHPAD_UI(ui)->xinput = gpds_touchpad_xinput_new(gpds_ui_get_device_name(ui));
setup_current_values(ui, builder);
setup_signals(ui, builder);
Modified: trunk/src/gpds-xinput.c
==============================================================================
--- trunk/src/gpds-xinput.c (original)
+++ trunk/src/gpds-xinput.c Tue Mar 10 03:36:57 2009
@@ -37,6 +37,8 @@
gchar *device_name;
XDeviceInfo *device_info_list;
XDevice *device;
+ GpdsXInputPropertyEntry *property_entries;
+ guint n_property_entries;
};
enum
@@ -88,6 +90,7 @@
priv->device_name = NULL;
priv->device_info_list = NULL;
priv->device = NULL;
+ priv->property_entries = NULL;
}
static void
@@ -107,6 +110,14 @@
priv->device = NULL;
}
+ if (priv->property_entries) {
+ guint i;
+ for (i = 0; i < priv->n_property_entries; i++) {
+ g_free((gchar *)priv->property_entries[i].name);
+ }
+ g_free(priv->property_entries);
+ }
+
if (G_OBJECT_CLASS(gpds_xinput_parent_class)->dispose)
G_OBJECT_CLASS(gpds_xinput_parent_class)->dispose(object);
}
@@ -179,7 +190,8 @@
}
gboolean
-gpds_xinput_set_int_properties (GpdsXInput *xinput,
+gpds_xinput_set_int_properties_by_name_with_format_type
+ (GpdsXInput *xinput,
const gchar *property_name,
gint format_type,
GError **error,
@@ -239,6 +251,78 @@
return TRUE;
}
+static const gchar *
+get_property_name_from_property_enum (GpdsXInput *xinput, gint property_enum)
+{
+ gint i;
+ GpdsXInputPriv *priv = GPDS_XINPUT_GET_PRIVATE(xinput);
+
+ for (i = 0; i < priv->n_property_entries; i++) {
+ if (property_enum == priv->property_entries[i].property_enum)
+ return priv->property_entries[i].name;
+ }
+
+ return NULL;
+}
+
+static gint
+get_format_type_from_property_enum (GpdsXInput *xinput, gint property_enum)
+{
+ gint i;
+ GpdsXInputPriv *priv = GPDS_XINPUT_GET_PRIVATE(xinput);
+
+ for (i = 0; i < priv->n_property_entries; i++) {
+ if (property_enum == priv->property_entries[i].property_enum)
+ return priv->property_entries[i].format_type;
+ }
+
+ return -1;
+}
+
+static gint
+get_max_value_count_type_from_property_enum (GpdsXInput *xinput, gint property_enum)
+{
+ gint i;
+ GpdsXInputPriv *priv = GPDS_XINPUT_GET_PRIVATE(xinput);
+
+ for (i = 0; i < priv->n_property_entries; i++) {
+ if (property_enum == priv->property_entries[i].property_enum)
+ return priv->property_entries[i].max_value_count;
+ }
+
+ return -1;
+}
+
+gboolean
+gpds_xinput_set_int_properties (GpdsXInput *xinput,
+ gint property_enum,
+ GError **error,
+ gint *properties,
+ guint n_properties)
+{
+ const gchar *property_name;
+ gint format_type;
+
+ g_return_val_if_fail(GPDS_IS_XINPUT(xinput), FALSE);
+
+ property_name = get_property_name_from_property_enum(xinput, property_enum);
+ if (!property_name) {
+ return FALSE;
+ }
+
+ format_type = get_format_type_from_property_enum(xinput, property_enum);
+ if (format_type < 0) {
+ return FALSE;
+ }
+
+ return gpds_xinput_set_int_properties_by_name_with_format_type(xinput,
+ property_name,
+ format_type,
+ error,
+ properties,
+ n_properties);
+}
+
static Atom
get_atom (GpdsXInput *xinput, const gchar *property_name, GError **error)
{
@@ -331,11 +415,11 @@
}
gboolean
-gpds_xinput_get_int_properties (GpdsXInput *xinput,
- const gchar *property_name,
- GError **error,
- gint **values,
- gulong *n_values)
+gpds_xinput_get_int_properties_by_name (GpdsXInput *xinput,
+ const gchar *property_name,
+ GError **error,
+ gint **values,
+ gulong *n_values)
{
XDevice *device;
@@ -349,6 +433,26 @@
}
gboolean
+gpds_xinput_get_int_properties (GpdsXInput *xinput,
+ gint property_enum,
+ GError **error,
+ gint **values,
+ gulong *n_values)
+{
+ const gchar *property_name;
+
+ g_return_val_if_fail(GPDS_IS_XINPUT(xinput), FALSE);
+
+ property_name = get_property_name_from_property_enum(xinput, property_enum);
+ if (!property_name) {
+ return FALSE;
+ }
+
+ return get_int_properties(xinput,
+ property_name, error, values, n_values);
+}
+
+gboolean
gpds_xinput_set_float_properties (GpdsXInput *xinput,
const gchar *property_name,
GError **error,
@@ -447,6 +551,29 @@
return TRUE;
}
+void
+gpds_xinput_register_property_entries (GpdsXInput *xinput,
+ const GpdsXInputPropertyEntry *entries,
+ guint n_entries)
+{
+ guint i;
+ GpdsXInputPriv *priv;
+
+ g_return_if_fail(GPDS_IS_XINPUT(xinput));
+
+ priv = GPDS_XINPUT_GET_PRIVATE(xinput);
+ priv->property_entries = g_new0(GpdsXInputPropertyEntry, n_entries);
+ priv->n_property_entries = n_entries;
+
+ for (i = 0; i < n_entries; i++) {
+ priv->property_entries[i].property_enum = entries[i].property_enum;
+ priv->property_entries[i].name = g_strdup(entries[i].name);
+ priv->property_entries[i].property_type = entries[i].property_type;
+ priv->property_entries[i].format_type = entries[i].format_type;
+ priv->property_entries[i].max_value_count = entries[i].max_value_count;
+ }
+}
+
/*
vi:ts=4:nowrap:ai:expandtab:sw=4
*/
Modified: trunk/src/gpds-xinput.h
==============================================================================
--- trunk/src/gpds-xinput.h (original)
+++ trunk/src/gpds-xinput.h Tue Mar 10 03:36:57 2009
@@ -31,6 +31,16 @@
#define GPDS_IS_XINPUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GPDS_TYPE_XINPUT))
#define GPDS_XINPUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPDS_TYPE_XINPUT, GpdsXInputClass))
+typedef struct _GpdsXInputPropertyEntry GpdsXInputPropertyEntry;
+struct _GpdsXInputPropertyEntry
+{
+ gint property_enum;
+ const gchar *name;
+ GType property_type; /* G_TYPE_INT or G_TYPE_FLOAT */
+ gint format_type;
+ gint max_value_count;
+};
+
typedef struct _GpdsXInput GpdsXInput;
typedef struct _GpdsXInputClass GpdsXInputClass;
@@ -48,13 +58,30 @@
GpdsXInput *gpds_xinput_new (const gchar *device_name);
const gchar *gpds_xinput_get_device_name (GpdsXInput *xinput);
+void gpds_xinput_register_property_entries
+ (GpdsXInput *xinput,
+ const GpdsXInputPropertyEntry *entries,
+ guint n_entries);
gboolean gpds_xinput_set_int_properties (GpdsXInput *xinput,
+ gint property_enum,
+ GError **error,
+ gint *properties,
+ guint n_properties);
+gboolean gpds_xinput_set_int_properties_by_name_with_format_type
+ (GpdsXInput *xinput,
const gchar *property_name,
gint format_type,
GError **error,
gint *properties,
guint n_properties);
-gboolean gpds_xinput_get_int_properties (GpdsXInput *xinput,
+gboolean gpds_xinput_get_int_properties
+ (GpdsXInput *xinput,
+ gint property_enum,
+ GError **error,
+ gint **values,
+ gulong *n_values);
+gboolean gpds_xinput_get_int_properties_by_name
+ (GpdsXInput *xinput,
const gchar *property_name,
GError **error,
gint **values,
Modified: trunk/test/test-xinput.c
==============================================================================
--- trunk/test/test-xinput.c (original)
+++ trunk/test/test-xinput.c Tue Mar 10 03:36:57 2009
@@ -50,14 +50,16 @@
{
cut_trace(test_new());
- cut_assert_true(gpds_xinput_get_int_properties(xinput,
+ cut_assert_true(gpds_xinput_get_int_properties_by_name
+ (xinput,
"Evdev Middle Button Emulation",
&error,
&values, &n_values));
gcut_assert_error(error);
cut_assert_equal_int(1, n_values);
- cut_assert_true(gpds_xinput_set_int_properties(xinput,
+ cut_assert_true(gpds_xinput_set_int_properties_by_name_with_format_type
+ (xinput,
"Evdev Middle Button Emulation",
8,
&error,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]