gpointing-device-settings r88 - trunk/modules
- From: hiikezoe svn gnome org
- To: svn-commits-list gnome org
- Subject: gpointing-device-settings r88 - trunk/modules
- Date: Mon, 2 Mar 2009 03:27:00 +0000 (UTC)
Author: hiikezoe
Date: Mon Mar 2 03:26:59 2009
New Revision: 88
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=88&view=rev
Log:
added utility functions for obtain property name and format type of XInput extension.
These functions shoule be integrated in GpdsXInput?
Added:
trunk/modules/gpds-touchpad-xinput.c
trunk/modules/gpds-touchpad-xinput.h
Modified:
trunk/modules/Makefile.am
trunk/modules/gpds-touchpad-definitions.h
trunk/modules/gpds-touchpad-ui.c
trunk/modules/gsd-touchpad-manager.c
Modified: trunk/modules/Makefile.am
==============================================================================
--- trunk/modules/Makefile.am (original)
+++ trunk/modules/Makefile.am Mon Mar 2 03:26:59 2009
@@ -34,9 +34,14 @@
gpds-trackpoint-ui.c \
$(trackpoint_common_SOURCES)
+touchpad_common_SOURCES = \
+ gpds-touchpad-xinput.c \
+ gpds-touchpad-xinput.h \
+ gpds-touchpad-definitions.h
+
touchpad_la_SOURCES = \
gpds-touchpad-ui.c \
- gpds-touchpad-definitions.h
+ $(touchpad_common_SOURCES)
# plugins for gnome-settings-daemon
gsd_plugin_LTLIBRARIES = \
@@ -59,7 +64,8 @@
libtouchpad_la_SOURCES = \
gsd-touchpad-plugin.c \
gsd-touchpad-manager.h \
- gsd-touchpad-manager.c
+ gsd-touchpad-manager.c \
+ $(touchpad_common_SOURCES)
gsd_plugin_in_files = \
trackpoint.gnome-settings-plugin.in \
Modified: trunk/modules/gpds-touchpad-definitions.h
==============================================================================
--- trunk/modules/gpds-touchpad-definitions.h (original)
+++ trunk/modules/gpds-touchpad-definitions.h Mon Mar 2 03:26:59 2009
@@ -22,37 +22,6 @@
#define GPDS_TOUCHPAD_DEVICE_NAME "SynPS/2 Synaptics TouchPad"
-#define GPDS_TOUCHPAD_EDGES "Synaptics Edges"
-#define GPDS_TOUCHPAD_FINGER "Synaptics Finger"
-#define GPDS_TOUCHPAD_TAP_TIME "Synaptics Tap Time"
-#define GPDS_TOUCHPAD_TAP_MOVE "Synaptics Tap Move"
-#define GPDS_TOUCHPAD_TAP_DURATIONS "Synaptics Tap Durations"
-#define GPDS_TOUCHPAD_TAP_FAST_TAP "Synaptics Tap FastTap"
-#define GPDS_TOUCHPAD_MIDDLE_BUTTON_TIMEOUT "Synaptics Middle Button Timeout"
-#define GPDS_TOUCHPAD_TWO_FINGER_PRESSURE "Synaptics Two-Finger Pressure"
-#define GPDS_TOUCHPAD_SCROLLING_DISTANCE "Synaptics Scrolling Distance"
-#define GPDS_TOUCHPAD_EDGE_SCROLLING "Synaptics Edge Scrolling"
-#define GPDS_TOUCHPAD_TWO_FINGER_SCROLLING "Synaptics Two-Finger Scrolling"
-#define GPDS_TOUCHPAD_EDGE_MOTION_PRESSURE "Synaptics Edge Motion Pressure"
-#define GPDS_TOUCHPAD_EDGE_MOTION_SPEED "Synaptics Edge Motion Speed"
-#define GPDS_TOUCHPAD_EDGE_MOTION_ALWAYS "Synaptics Edge Motion Always"
-#define GPDS_TOUCHPAD_BUTTON_SCROLLING "Synaptics Button Scrolling"
-#define GPDS_TOUCHPAD_BUTTON_SCROLLING_REPEAT "Synaptics Button Scrolling Repeat"
-#define GPDS_TOUCHPAD_SCROLLING_TIME "Synaptics Button Scrolling Time"
-#define GPDS_TOUCHPAD_OFF "Synaptics Off"
-#define GPDS_TOUCHPAD_GUESTMOUSE_OFF "Synaptics Guestmouse Off"
-#define GPDS_TOUCHPAD_LOCKED_DRAGS "Synaptics Locked Drags"
-#define GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT "Synaptics Locked Drags Timeout"
-#define GPDS_TOUCHPAD_TAP_ACTION "Synaptics Tap Action"
-#define GPDS_TOUCHPAD_CLICK_ACTION "Synaptics Click Action"
-#define GPDS_TOUCHPAD_CIRCULAR_SCROLLING "Synaptics Circular Scrolling"
-#define GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER "Synaptics Circular Scrolling Trigger"
-#define GPDS_TOUCHPAD_CIRCULAR_PAD "Synaptics Circular Pad"
-#define GPDS_TOUCHPAD_PALM_DETECTION "Synaptics Palm Detection"
-#define GPDS_TOUCHPAD_PALM_DIMENSIONS "Synaptics Palm Dimensions"
-#define GPDS_TOUCHPAD_PRESSURE_MOTION "Synaptics Pressure Motion"
-#define GPDS_TOUCHPAD_GRAB_EVENT_DEVICE "Synaptics Grab Event Device"
-
#define GPDS_TOUCHPAD_GCONF_DIR "/desktop/gnome/peripherals/touchpad"
#define GPDS_TOUCHPAD_EDGES_KEY GPDS_TOUCHPAD_GCONF_DIR "/edges"
Modified: trunk/modules/gpds-touchpad-ui.c
==============================================================================
--- trunk/modules/gpds-touchpad-ui.c (original)
+++ trunk/modules/gpds-touchpad-ui.c Mon Mar 2 03:26:59 2009
@@ -28,7 +28,7 @@
#include <gconf/gconf-client.h>
#include "gpds-touchpad-definitions.h"
-
+#include "gpds-touchpad-xinput.h"
static const gchar *touchpad_device_names[] =
{
@@ -174,15 +174,15 @@
}
static void
-set_toggle_property (GpdsXInput *xinput, GtkToggleButton *button, const gchar *property_name)
+set_toggle_property (GpdsXInput *xinput, GtkToggleButton *button, GpdsTouchpadProperty property)
{
GError *error = NULL;
gboolean active;
active = gtk_toggle_button_get_active(button);
if (!gpds_xinput_set_property(xinput,
- property_name,
- 8,
+ gpds_touchpad_xinput_get_name(property),
+ gpds_touchpad_xinput_get_format_type(property),
&error,
active ? 1 : 0,
NULL)) {
@@ -210,8 +210,8 @@
set_widget_sensitivity(builder, "horizontal_scroll_box", GTK_TOGGLE_BUTTON(object));
if (!gpds_xinput_set_property(xinput,
- GPDS_TOUCHPAD_EDGE_SCROLLING,
- 16,
+ gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_EDGE_SCROLLING),
+ gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_EDGE_SCROLLING),
&error,
vertical_scrolling_active ? 1 : 0,
horizontal_scrolling_active ? 1 : 0,
@@ -224,15 +224,15 @@
}
static void
-set_range_property (GpdsXInput *xinput, GtkRange *range, const gchar *property_name)
+set_range_property (GpdsXInput *xinput, GtkRange *range, GpdsTouchpadProperty property)
{
GError *error = NULL;
gdouble value;
value = gtk_range_get_value(range);
if (!gpds_xinput_set_property(xinput,
- property_name,
- 16,
+ gpds_touchpad_xinput_get_name(property),
+ gpds_touchpad_xinput_get_format_type(property),
&error,
(gint)value,
NULL)) {
@@ -258,8 +258,8 @@
horizontal_scrolling_distance = gtk_range_get_value(GTK_RANGE(object));
if (!gpds_xinput_set_property(xinput,
- GPDS_TOUCHPAD_SCROLLING_DISTANCE,
- 16,
+ gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
+ gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
&error,
(gint)vertical_scrolling_distance,
(gint)horizontal_scrolling_distance,
@@ -399,13 +399,13 @@
}
static gboolean
-get_integer_property (GpdsXInput *xinput, const gchar *property_name,
+get_integer_property (GpdsXInput *xinput, GpdsTouchpadProperty property,
gint **values, gulong *n_values)
{
GError *error = NULL;
if (!gpds_xinput_get_property(xinput,
- property_name,
+ gpds_touchpad_xinput_get_name(property),
&error,
values, n_values)) {
if (error) {
@@ -421,7 +421,7 @@
static void
set_integer_property_from_preference (GpdsTouchpadUI *ui,
- const gchar *property_name,
+ GpdsTouchpadProperty property,
const gchar *gconf_key_name,
GtkBuilder *builder,
const gchar *object_name)
@@ -432,7 +432,7 @@
gint value;
gboolean dir_exists;
- if (!get_integer_property(ui->xinput, property_name,
+ if (!get_integer_property(ui->xinput, property,
&values, &n_values)) {
return;
}
@@ -449,7 +449,7 @@
static void
set_boolean_property_from_preference (GpdsTouchpadUI *ui,
- const gchar *property_name,
+ GpdsTouchpadProperty property,
const gchar *gconf_key_name,
GtkBuilder *builder,
const gchar *object_name)
@@ -459,7 +459,7 @@
gulong n_values;
gboolean enable, dir_exists;
- if (!get_integer_property(ui->xinput, property_name,
+ if (!get_integer_property(ui->xinput, property,
&values, &n_values)) {
return;
}
Added: trunk/modules/gpds-touchpad-xinput.c
==============================================================================
--- (empty file)
+++ trunk/modules/gpds-touchpad-xinput.c Mon Mar 2 03:26:59 2009
@@ -0,0 +1,109 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2009 Hiroyuki Ikezoe <poincare ikezoe net>
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include "gsd-trackpoint-manager.h"
+#include <glib/gi18n.h>
+#include <gconf/gconf-client.h>
+#include <gpds-xinput.h>
+
+#include "gpds-touchpad-xinput.h"
+
+static GpdsTouchpadXInputProperty properties[] = {
+ {GPDS_TOUCHPAD_EDGES, "Synaptics Edges", 32, 4},
+ {GPDS_TOUCHPAD_FINGER, "Synaptics Finger", 32, 3},
+ {GPDS_TOUCHPAD_TAP_TIME, "Synaptics Tap Time", 32, 1},
+ {GPDS_TOUCHPAD_TAP_MOVE, "Synaptics Tap Move", 32, 1},
+ {GPDS_TOUCHPAD_TAP_DURATIONS, "Synaptics Tap Durations", 32, 3},
+ {GPDS_TOUCHPAD_TAP_FAST_TAP, "Synaptics Tap FastTap", 8, 1},
+ {GPDS_TOUCHPAD_MIDDLE_BUTTON_TIMEOUT, "Synaptics Middle Button Timeout", 32, 1},
+ {GPDS_TOUCHPAD_TWO_FINGER_PRESSURE, "Synaptics Two-Finger Pressure", 32, 1},
+ {GPDS_TOUCHPAD_SCROLLING_DISTANCE, "Synaptics Scrolling Distance", 32, 2},
+ {GPDS_TOUCHPAD_EDGE_SCROLLING, "Synaptics Edge Scrolling", 8, 3},
+ {GPDS_TOUCHPAD_TWO_FINGER_SCROLLING, "Synaptics Two-Finger Scrolling", 8, 2},
+ {GPDS_TOUCHPAD_SYNAPTICS_PROP_SPEED, "Synaptics Move Speed", 32, 4},
+ {GPDS_TOUCHPAD_EDGE_MOTION_PRESSURE, "Synaptics Edge Motion Pressure", 32, 2},
+ {GPDS_TOUCHPAD_EDGE_MOTION_SPEED, "Synaptics Edge Motion Speed", 32, 2},
+ {GPDS_TOUCHPAD_BUTTON_SCROLLING, "Synaptics Button Scrolling", 8, 2},
+ {GPDS_TOUCHPAD_BUTTON_SCROLLING_REPEAT, "Synaptics Button Scrolling Repeat", 8, 2},
+ {GPDS_TOUCHPAD_SCROLLING_TIME, "Synaptics Button Scrolling Time", 32, 1},
+ {GPDS_TOUCHPAD_OFF, "Synaptics Off", 8, 1},
+ {GPDS_TOUCHPAD_GUESTMOUSE_OFF, "Synaptics Guestmouse Off", 8, 1},
+ {GPDS_TOUCHPAD_LOCKED_DRAGS, "Synaptics Locked Drags", 8, 1},
+ {GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT, "Synaptics Locked Drags Timeout", 32, 1},
+ {GPDS_TOUCHPAD_TAP_ACTION, "Synaptics Tap Action", 8, 1},
+ {GPDS_TOUCHPAD_CLICK_ACTION, "Synaptics Click Action", 8, 1},
+ {GPDS_TOUCHPAD_CIRCULAR_SCROLLING, "Synaptics Circular Scrolling", 8, 1},
+ {GPDS_TOUCHPAD_CIRCULAR_SCROLLING_DISTANCE,"Synaptics Circular Scrolling Distance", 32, 1},
+ {GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER, "Synaptics Circular Scrolling Trigger", 8, 1},
+ {GPDS_TOUCHPAD_CIRCULAR_PAD, "Synaptics Circular Pad", 8, 1},
+ {GPDS_TOUCHPAD_PALM_DETECTION, "Synaptics Palm Detection", 8, 1},
+ {GPDS_TOUCHPAD_PALM_DIMENSIONS, "Synaptics Palm Dimensions", 32, 2},
+ {GPDS_TOUCHPAD_PRESSURE_MOTION, "Synaptics Pressure Motion", 32, 2},
+ {GPDS_TOUCHPAD_GRAB_EVENT_DEVICE, "Synaptics Grab Event Device", 8, 1},
+};
+
+static const gint n_properties = G_N_ELEMENTS(properties);
+
+const gchar *
+gpds_touchpad_xinput_get_name (GpdsTouchpadProperty property)
+{
+ gint i;
+
+ for (i = 0; i < n_properties; i++) {
+ if (property == properties[i].property)
+ return properties[i].name;
+ }
+
+ return NULL;
+}
+
+gint
+gpds_touchpad_xinput_get_format_type (GpdsTouchpadProperty property)
+{
+ 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;
+}
+
+
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
Added: trunk/modules/gpds-touchpad-xinput.h
==============================================================================
--- (empty file)
+++ trunk/modules/gpds-touchpad-xinput.h Mon Mar 2 03:26:59 2009
@@ -0,0 +1,73 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2009 Hiroyuki Ikezoe <poincare ikezoe net>
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef __GPDS_TOUCHPAD_XINPUT_H__
+#define __GPDS_TOUCHPAD_XINPUT_H__
+
+typedef enum {
+ GPDS_TOUCHPAD_EDGES,
+ GPDS_TOUCHPAD_FINGER,
+ GPDS_TOUCHPAD_TAP_TIME,
+ GPDS_TOUCHPAD_TAP_MOVE,
+ GPDS_TOUCHPAD_TAP_DURATIONS,
+ GPDS_TOUCHPAD_TAP_FAST_TAP,
+ GPDS_TOUCHPAD_MIDDLE_BUTTON_TIMEOUT,
+ GPDS_TOUCHPAD_TWO_FINGER_PRESSURE,
+ GPDS_TOUCHPAD_SCROLLING_DISTANCE,
+ GPDS_TOUCHPAD_EDGE_SCROLLING,
+ GPDS_TOUCHPAD_TWO_FINGER_SCROLLING,
+ GPDS_TOUCHPAD_SYNAPTICS_PROP_SPEED,
+ GPDS_TOUCHPAD_EDGE_MOTION_PRESSURE,
+ GPDS_TOUCHPAD_EDGE_MOTION_SPEED,
+ GPDS_TOUCHPAD_BUTTON_SCROLLING,
+ GPDS_TOUCHPAD_BUTTON_SCROLLING_REPEAT,
+ GPDS_TOUCHPAD_SCROLLING_TIME,
+ GPDS_TOUCHPAD_OFF,
+ GPDS_TOUCHPAD_GUESTMOUSE_OFF,
+ GPDS_TOUCHPAD_LOCKED_DRAGS,
+ GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT,
+ GPDS_TOUCHPAD_TAP_ACTION,
+ GPDS_TOUCHPAD_CLICK_ACTION,
+ GPDS_TOUCHPAD_CIRCULAR_SCROLLING,
+ GPDS_TOUCHPAD_CIRCULAR_SCROLLING_DISTANCE,
+ GPDS_TOUCHPAD_CIRCULAR_SCROLLING_TRIGGER,
+ GPDS_TOUCHPAD_CIRCULAR_PAD,
+ GPDS_TOUCHPAD_PALM_DETECTION,
+ GPDS_TOUCHPAD_PALM_DIMENSIONS,
+ GPDS_TOUCHPAD_PRESSURE_MOTION,
+ GPDS_TOUCHPAD_GRAB_EVENT_DEVICE
+} GpdsTouchpadProperty;
+
+typedef struct _GpdsTouchpadXInputProperty GpdsTouchpadXInputProperty;
+struct _GpdsTouchpadXInputProperty
+{
+ GpdsTouchpadProperty property;
+ const gchar *name;
+ 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);
+
+#endif /* __GPDS_TOUCHPAD_XINPUT_H__ */
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
Modified: trunk/modules/gsd-touchpad-manager.c
==============================================================================
--- trunk/modules/gsd-touchpad-manager.c (original)
+++ trunk/modules/gsd-touchpad-manager.c Mon Mar 2 03:26:59 2009
@@ -27,6 +27,7 @@
#include <gpds-xinput.h>
#include "gpds-touchpad-definitions.h"
+#include "gpds-touchpad-xinput.h"
#define GSD_TOUCHPAD_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GSD_TYPE_TOUCHPAD_MANAGER, GsdTouchpadManagerPrivate))
@@ -95,15 +96,15 @@
case GCONF_VALUE_BOOL:
if (!strcmp(key, GPDS_TOUCHPAD_TAP_FAST_TAP_KEY)) {
gpds_xinput_set_property(xinput,
- GPDS_TOUCHPAD_TAP_FAST_TAP,
- 8,
+ gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_TAP_FAST_TAP),
+ gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_TAP_FAST_TAP),
NULL,
gconf_value_get_bool(value),
NULL);
} else if (!strcmp(key, GPDS_TOUCHPAD_CIRCULAR_SCROLLING_KEY)) {
gpds_xinput_set_property(xinput,
- GPDS_TOUCHPAD_CIRCULAR_SCROLLING,
- 8,
+ gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_CIRCULAR_SCROLLING),
+ gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_CIRCULAR_SCROLLING),
NULL,
gconf_value_get_bool(value),
NULL);
@@ -118,8 +119,8 @@
NULL);
gpds_xinput_set_property(xinput,
- GPDS_TOUCHPAD_EDGE_SCROLLING,
- 16,
+ gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_EDGE_SCROLLING),
+ gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_EDGE_SCROLLING),
NULL,
enable_vertical ? 1 : 0,
enable_horizontal ? 1 : 0,
@@ -129,8 +130,8 @@
case GCONF_VALUE_INT:
if (!strcmp(key, GPDS_TOUCHPAD_TAP_TIME_KEY)) {
gpds_xinput_set_property(xinput,
- GPDS_TOUCHPAD_TAP_TIME,
- 16,
+ gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_TAP_TIME),
+ gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_TAP_TIME),
NULL,
gconf_value_get_int(value),
NULL);
@@ -148,8 +149,8 @@
GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_DISTANCE_KEY,
NULL);
gpds_xinput_set_property(xinput,
- GPDS_TOUCHPAD_SCROLLING_DISTANCE,
- 16,
+ gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
+ gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
NULL,
vertical_scrolling_distance,
horizontal_scrolling_distance,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]