[gpointing-device-settings] pointingstick support.
- From: Hiroyuki Ikezoe <hiikezoe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gpointing-device-settings] pointingstick support.
- Date: Wed, 27 Jan 2010 10:40:14 +0000 (UTC)
commit a433b2e7fd234c7604de0b5e3ccb1769da2cdda8
Author: Hiroyuki Ikezoe <poincare ikezoe net>
Date: Tue Jan 26 19:45:56 2010 +0900
pointingstick support.
data/Makefile.am | 9 +-
data/pointingstick.ui | 419 ++++++++++++++++++++
modules/Makefile.am | 11 +-
modules/common/Makefile.am | 12 +-
modules/common/gpds-pointingstick-definitions.h | 32 ++
modules/common/gpds-pointingstick-xinput.c | 59 +++
modules/common/gpds-pointingstick-xinput.h | 40 ++
modules/gnome-settings-daemon-plugins/Makefile.am | 9 +-
.../gsd-pointingstick-manager.c | 150 +++++++
.../gsd-pointingstick-manager.h | 54 +++
modules/gpds-pointingstick-ui.c | 280 +++++++++++++
11 files changed, 1063 insertions(+), 12 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 04d1d8b..0c76d84 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,7 +1,8 @@
-gpds_ui_DATA = \
- main-window.ui \
- mouse.ui \
- touchpad.ui
+gpds_ui_DATA = \
+ main-window.ui \
+ pointingstick.ui \
+ touchpad.ui \
+ mouse.ui
gpds_icon_DATA = \
mouse.png \
diff --git a/data/pointingstick.ui b/data/pointingstick.ui
new file mode 100644
index 0000000..6d6b81c
--- /dev/null
+++ b/data/pointingstick.ui
@@ -0,0 +1,419 @@
+<?xml version="1.0" standalone="no"?>
+<interface>
+ <object class="GtkVBox" id="main-widget">
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+ <child>
+ <object class="GtkLabel" id="sensitivity_label">
+ <property name="label" translatable="yes"><b>Sensitivity</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="sensitivity_box">
+ <property name="border-width">5</property>
+ <child>
+ <object class="GtkAdjustment" id="sensitivity_scale_adjustment">
+ <property name="lower">1</property>
+ <property name="upper">255</property>
+ <property name="step-increment">5</property>
+ <property name="page_increment">5</property>
+ <property name="page_size">0</property>
+ </object>
+ <object class="GtkLabel" id="sensitivity_scale_label">
+ <property name="label" translatable="yes">_Sensitivity:</property>
+ <property name="mnemonic-widget">sensitivity_scale</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sensitivity_left_label">
+ <property name="label" translatable="yes" context="sensitivity"><i>Low</i></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHScale" id="sensitivity_scale">
+ <property name="can_focus">True</property>
+ <property name="draw_value">False</property>
+ <property name="value_pos">GTK_POS_TOP</property>
+ <property name="digits">0</property>
+ <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
+ <property name="inverted">False</property>
+ <property name="adjustment">sensitivity_scale_adjustment</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sensitivity_right_label">
+ <property name="label" translatable="yes" context="sensitivity"><i>High</i></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="scrolling_label">
+ <property name="label" translatable="yes"><b>Scrolling</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="scrolling">
+ <property name="label" translatable="yes">Enable sc_rolling</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="scrolling_box">
+ <property name="border-width">5</property>
+ <property name="homogeneous">False</property>
+ <child>
+ <object class="GtkHBox" id="middle_button_timeout_box">
+ <property name="border-width">5</property>
+ <child>
+ <object class="GtkAdjustment" id="middle_button_timeout_scale_adjustment">
+ <property name="lower">50</property>
+ <property name="upper">1000</property>
+ <property name="step-increment">50</property>
+ <property name="page_increment">50</property>
+ <property name="page_size">0</property>
+ </object>
+ <object class="GtkLabel" id="middle_button_timeout_label">
+ <property name="label" translatable="yes">Middle button _timeout:</property>
+ <property name="mnemonic-widget">middle_button_timeout_scale</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="middle_button_timeout_left_label">
+ <property name="label" translatable="yes" context="timeout"><i>Short</i></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHScale" id="middle_button_timeout_scale">
+ <property name="can_focus">True</property>
+ <property name="draw_value">False</property>
+ <property name="value_pos">GTK_POS_TOP</property>
+ <property name="digits">0</property>
+ <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
+ <property name="inverted">False</property>
+ <property name="adjustment">middle_button_timeout_scale_adjustment</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="middle_button_timeout_right_label">
+ <property name="label" translatable="yes" context="timeout"><i>Long</i></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="press_to_select_label">
+ <property name="label" translatable="yes"><b>Press to Select</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="press_to_select">
+ <property name="label" translatable="yes">Enable _Press to Select</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="press_to_select_box">
+ <property name="border-width">5</property>
+ <property name="homogeneous">False</property>
+ <child>
+ <object class="GtkHBox" id="press_to_select_threshold_hbox">
+ <property name="border-width">5</property>
+ <child>
+ <object class="GtkAdjustment" id="press_to_select_threshold_scale_adjustment">
+ <property name="lower">8</property>
+ <property name="upper">200</property>
+ <property name="step-increment">5</property>
+ <property name="page_increment">5</property>
+ <property name="page_size">0</property>
+ </object>
+ <object class="GtkLabel" id="press_to_select_threshold_label">
+ <property name="label" translatable="yes">_Threshold:</property>
+ <property name="mnemonic-widget">press_to_select_threshold_scale</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="press_to_select_threshold_left_label">
+ <property name="label" translatable="yes" context="threshold"><i>Low</i></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHScale" id="press_to_select_threshold_scale">
+ <property name="can_focus">True</property>
+ <property name="draw_value">False</property>
+ <property name="value_pos">GTK_POS_TOP</property>
+ <property name="digits">0</property>
+ <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
+ <property name="inverted">False</property>
+ <property name="adjustment">press_to_select_threshold_scale_adjustment</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="press_to_select_threshold_right_label">
+ <property name="label" translatable="yes" context="threshold"><i>High</i></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/modules/Makefile.am b/modules/Makefile.am
index b94173b..6d11b86 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -17,8 +17,9 @@ AM_LDFLAGS = \
-export-dynamic $(LIBTOOL_EXPORT_OPTIONS)
gpds_module_LTLIBRARIES = \
- mouse.la \
- touchpad.la
+ pointingstick.la \
+ touchpad.la \
+ mouse.la
LIBS = \
$(top_builddir)/src/libgpds.la \
@@ -35,3 +36,9 @@ touchpad_la_SOURCES = \
gpds-touchpad-ui.c
touchpad_la_LIBADD = $(top_builddir)/modules/common/libtouchpad_common.la
+
+pointingstick_la_SOURCES = \
+ gpds-pointingstick-ui.c
+
+pointingstick_la_LIBADD = $(top_builddir)/modules/common/libpointingstick_common.la
+
diff --git a/modules/common/Makefile.am b/modules/common/Makefile.am
index fa7d6cf..6da4fd6 100644
--- a/modules/common/Makefile.am
+++ b/modules/common/Makefile.am
@@ -8,9 +8,10 @@ AM_CFLAGS = \
$(GCONF2_CFLAGS) \
$(COVERAGE_CFLAGS)
-noinst_LTLIBRARIES = \
- libmouse_common.la \
- libtouchpad_common.la
+noinst_LTLIBRARIES = \
+ libpointingstick_common.la \
+ libtouchpad_common.la \
+ libmouse_common.la
LIBADD = \
$(top_builddir)/src/libgpds.la \
@@ -28,3 +29,8 @@ libtouchpad_common_la_SOURCES = \
gpds-touchpad-xinput.h \
gpds-touchpad-definitions.h
+libpointingstick_common_la_SOURCES = \
+ gpds-pointingstick-xinput.c \
+ gpds-pointingstick-xinput.h \
+ gpds-pointingstick-definitions.h
+
diff --git a/modules/common/gpds-pointingstick-definitions.h b/modules/common/gpds-pointingstick-definitions.h
new file mode 100644
index 0000000..d37ec33
--- /dev/null
+++ b/modules/common/gpds-pointingstick-definitions.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2010 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_POINTINGSTICK_GCONF_H__
+#define __GPDS_POINTINGSTICK_GCONF_H__
+
+#define GPDS_POINTINGSTICK_SENSITIVITY_KEY "sensitivity"
+#define GPDS_POINTINGSTICK_SCROLLING_KEY "scrolling"
+#define GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT_KEY "middle_button_timeout"
+#define GPDS_POINTINGSTICK_PRESS_TO_SELECT_KEY "press_to_select"
+#define GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD_KEY "press_to_select_threshold"
+
+#endif /* __GPDS_POINTINGSTICK_GCONF_H__ */
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
diff --git a/modules/common/gpds-pointingstick-xinput.c b/modules/common/gpds-pointingstick-xinput.c
new file mode 100644
index 0000000..c25207e
--- /dev/null
+++ b/modules/common/gpds-pointingstick-xinput.c
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2010 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 "gpds-pointingstick-xinput.h"
+#include <glib/gi18n.h>
+#include <gconf/gconf-client.h>
+#include <gpds-xinput.h>
+#include <gpds-xinput-utils.h>
+
+static const GpdsXInputPropertyEntry entries[] = {
+ {GPDS_POINTINGSTICK_SENSITIVITY, "PointingStick Sensitivity", G_TYPE_INT, 8, 1},
+ {GPDS_POINTINGSTICK_SCROLLING, "PointingStick Scrolling", G_TYPE_INT, 8, 1},
+ {GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT, "PointingStick Middle Button Timeout", G_TYPE_INT, 16, 1},
+ {GPDS_POINTINGSTICK_PRESS_TO_SELECT, "PointingStick Press to Select", G_TYPE_INT, 8, 1},
+ {GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD, "PointingStick Press to Select Threshold", G_TYPE_INT, 8, 1}
+};
+
+static const gint n_entries = G_N_ELEMENTS(entries);
+
+GpdsXInput *
+gpds_pointingstick_xinput_new (const gchar *device_name)
+{
+ GpdsXInput *xinput;
+
+ xinput = gpds_xinput_new(device_name);
+ gpds_xinput_register_property_entries(xinput, entries, n_entries);
+
+ return xinput;
+}
+
+void
+gpds_pointingstick_xinput_setup_property_entries (GpdsXInput *xinput)
+{
+ gpds_xinput_register_property_entries(xinput, entries, n_entries);
+}
+
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
diff --git a/modules/common/gpds-pointingstick-xinput.h b/modules/common/gpds-pointingstick-xinput.h
new file mode 100644
index 0000000..e792233
--- /dev/null
+++ b/modules/common/gpds-pointingstick-xinput.h
@@ -0,0 +1,40 @@
+/* -*- 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_POINTINGSTICK_XINPUT_H__
+#define __GPDS_POINTINGSTICK_XINPUT_H__
+
+#include <glib.h>
+#include <gpds-xinput.h>
+
+typedef enum {
+ GPDS_POINTINGSTICK_SENSITIVITY,
+ GPDS_POINTINGSTICK_SCROLLING,
+ GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT,
+ GPDS_POINTINGSTICK_PRESS_TO_SELECT,
+ GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD,
+} GpdsPointingStickProperty;
+
+GpdsXInput *gpds_pointingstick_xinput_new (const gchar *device_name);
+void gpds_pointingstick_xinput_setup_property_entries (GpdsXInput *xinput);
+
+#endif /* __GPDS_POINTINGSTICK_XINPUT_H__ */
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
diff --git a/modules/gnome-settings-daemon-plugins/Makefile.am b/modules/gnome-settings-daemon-plugins/Makefile.am
index 890ff74..b16db50 100644
--- a/modules/gnome-settings-daemon-plugins/Makefile.am
+++ b/modules/gnome-settings-daemon-plugins/Makefile.am
@@ -36,14 +36,17 @@ libpointing_device_la_SOURCES = \
gsd-pointing-device-plugin.c \
gsd-pointing-device-manager.h \
gsd-pointing-device-manager.c \
+ gsd-pointingstick-manager.h \
+ gsd-pointingstick-manager.c \
gsd-mouse-extension-manager.h \
gsd-mouse-extension-manager.c \
gsd-touchpad-manager.h \
gsd-touchpad-manager.c
-libpointing_device_la_LIBADD = \
- $(top_builddir)/modules/common/libmouse_common.la \
- $(top_builddir)/modules/common/libtouchpad_common.la
+libpointing_device_la_LIBADD = \
+ $(top_builddir)/modules/common/libpointingstick_common.la \
+ $(top_builddir)/modules/common/libtouchpad_common.la \
+ $(top_builddir)/modules/common/libmouse_common.la
gsd_plugin_in_files = \
pointing-device.gnome-settings-plugin.in
diff --git a/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.c b/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.c
new file mode 100644
index 0000000..e3eac31
--- /dev/null
+++ b/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.c
@@ -0,0 +1,150 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2010 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-pointingstick-manager.h"
+#include <glib/gi18n.h>
+#include <gconf/gconf-client.h>
+#include <gpds-xinput.h>
+#include <gpds-xinput-utils.h>
+#include <gpds-gconf.h>
+
+#include "gpds-pointingstick-definitions.h"
+#include "gpds-pointingstick-xinput.h"
+
+G_DEFINE_TYPE (GsdPointingStickManager, gsd_pointingstick_manager, GSD_TYPE_POINTING_DEVICE_MANAGER)
+
+static gboolean _start (GsdPointingDeviceManager *manager,
+ GError **error);
+static void _stop (GsdPointingDeviceManager *manager);
+static void _gconf_client_notify (GsdPointingDeviceManager *manager,
+ GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry);
+
+static void
+gsd_pointingstick_manager_init (GsdPointingStickManager *manager)
+{
+}
+
+static void
+gsd_pointingstick_manager_class_init (GsdPointingStickManagerClass *klass)
+{
+ GsdPointingDeviceManagerClass *manager_class = GSD_POINTING_DEVICE_MANAGER_CLASS(klass);
+
+ manager_class->start = _start;
+ manager_class->stop = _stop;
+ manager_class->gconf_client_notify = _gconf_client_notify;
+}
+
+DEFINE_SET_BOOLEAN_FUNCTION (scrolling, GPDS_POINTINGSTICK_SCROLLING)
+DEFINE_SET_BOOLEAN_FUNCTION (press_to_select, GPDS_POINTINGSTICK_PRESS_TO_SELECT)
+DEFINE_SET_INT_FUNCTION (middle_button_timeout, GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT)
+DEFINE_SET_INT_FUNCTION (sensitivity, GPDS_POINTINGSTICK_SENSITIVITY)
+DEFINE_SET_INT_FUNCTION (press_to_select_threshold, GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD)
+
+static gboolean
+start_manager (GsdPointingDeviceManager *manager)
+{
+ GpdsXInput *xinput;
+ GConfClient *gconf;
+
+ xinput = gsd_pointing_device_manager_get_xinput(manager);
+ if (!xinput)
+ return FALSE;
+
+ gconf = gconf_client_get_default();
+ if (!gconf) {
+ g_object_unref(xinput);
+ return FALSE;
+ }
+
+ gpds_pointingstick_xinput_setup_property_entries(xinput);
+ set_sensitivity(manager, xinput, gconf);
+ set_scrolling(manager, xinput, gconf);
+ set_middle_button_timeout(manager, xinput, gconf);
+ set_press_to_select(manager, xinput, gconf);
+ set_press_to_select_threshold(manager, xinput, gconf);
+
+ g_object_unref(gconf);
+ g_object_unref(xinput);
+
+ return FALSE;
+}
+
+static gboolean
+_start (GsdPointingDeviceManager *manager, GError **error)
+{
+ g_idle_add((GSourceFunc)start_manager, manager);
+
+ return TRUE;
+}
+
+static void
+_stop (GsdPointingDeviceManager *manager)
+{
+}
+
+static void
+_gconf_client_notify (GsdPointingDeviceManager *manager,
+ GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry)
+{
+ GConfValue *value;
+ const gchar *key;
+ GpdsXInput *xinput;
+
+ xinput = gsd_pointing_device_manager_get_xinput(manager);
+ if (!xinput)
+ return;
+
+ gpds_pointingstick_xinput_setup_property_entries(xinput);
+ value = gconf_entry_get_value(entry);
+ key = gpds_gconf_get_key_from_path(gconf_entry_get_key(entry));
+
+ switch (value->type) {
+ case GCONF_VALUE_BOOL:
+ if (!strcmp(key, GPDS_POINTINGSTICK_SCROLLING_KEY)) {
+ set_scrolling(manager, xinput, client);
+ } else if (!strcmp(key, GPDS_POINTINGSTICK_PRESS_TO_SELECT_KEY)) {
+ set_press_to_select(manager, xinput, client);
+ }
+ break;
+ case GCONF_VALUE_INT:
+ if (!strcmp(key, GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT_KEY))
+ set_middle_button_timeout(manager, xinput, client);
+ else if (!strcmp(key, GPDS_POINTINGSTICK_SENSITIVITY_KEY))
+ set_sensitivity(manager, xinput, client);
+ else if (!strcmp(key, GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD_KEY))
+ set_press_to_select_threshold(manager, xinput, client);
+ break;
+ default:
+ break;
+ }
+
+ g_object_unref(xinput);
+}
+
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
diff --git a/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.h b/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.h
new file mode 100644
index 0000000..5ad66cc
--- /dev/null
+++ b/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2010 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 __GSD_POINTINGSTICK_MANAGER_H__
+#define __GSD_POINTINGSTICK_MANAGER_H__
+
+#include "gsd-pointing-device-manager.h"
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_POINTINGSTICK_MANAGER (gsd_pointingstick_manager_get_type ())
+#define GSD_POINTINGSTICK_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_POINTINGSTICK_MANAGER, GsdPointingStickManager))
+#define GSD_POINTINGSTICK_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_POINTINGSTICK_MANAGER, GsdTracklassPointManagerClass))
+#define GSD_IS_POINTINGSTICK_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_POINTINGSTICK_MANAGER))
+#define GSD_IS_POINTINGSTICK_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSD_TYPE_POINTINGSTICK_MANAGER))
+#define GSD_POINTINGSTICK_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSD_TYPE_POINTINGSTICK_MANAGER, GsdTracklassPointManagerClass))
+
+typedef struct _GsdPointingStickManager GsdPointingStickManager;
+typedef struct _GsdPointingStickManagerClass GsdPointingStickManagerClass;
+
+struct _GsdPointingStickManager
+{
+ GsdPointingDeviceManager parent;
+};
+
+struct _GsdPointingStickManagerClass
+{
+ GsdPointingDeviceManagerClass parent_class;
+};
+
+GType gsd_pointingstick_manager_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GSD_POINTINGSTICK_MANAGER_H__ */
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
diff --git a/modules/gpds-pointingstick-ui.c b/modules/gpds-pointingstick-ui.c
new file mode 100644
index 0000000..79ae2e1
--- /dev/null
+++ b/modules/gpds-pointingstick-ui.c
@@ -0,0 +1,280 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2010 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 <gtk/gtk.h>
+#include <glib/gi18n.h>
+#include <gpointing-device-settings.h>
+#include <gpds-xinput-ui.h>
+#include <gpds-xinput-utils.h>
+#include <gconf/gconf-client.h>
+
+#include "gpds-pointingstick-definitions.h"
+#include "gpds-pointingstick-xinput.h"
+
+#define GPDS_TYPE_POINTINGSTICK_UI (gpds_pointingstick_ui_get_type())
+#define GPDS_POINTINGSTICK_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GPDS_TYPE_POINTINGSTICK_UI, GpdsMouseUI))
+#define GPDS_POINTINGSTICK_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GPDS_TYPE_POINTINGSTICK_UI, GpdsMouseUIClass))
+#define G_IS_POINTINGSTICK_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GPDS_TYPE_POINTINGSTICK_UI))
+#define G_IS_POINTINGSTICK_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GPDS_TYPE_POINTINGSTICK_UI))
+#define GPDS_POINTINGSTICK_UI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPDS_TYPE_POINTINGSTICK_UI, GpdsMouseUIClass))
+
+typedef struct _GpdsMouseUI GpdsMouseUI;
+typedef struct _GpdsMouseUIClass GpdsMouseUIClass;
+
+struct _GpdsMouseUI
+{
+ GpdsXInputUI parent;
+ gchar *ui_file_path;
+};
+
+struct _GpdsMouseUIClass
+{
+ GpdsXInputUIClass parent_class;
+};
+
+GType gpds_pointingstick_ui_get_type (void) G_GNUC_CONST;
+
+static void dispose (GObject *object);
+static gboolean is_available (GpdsUI *ui, GError **error);
+static gboolean build (GpdsUI *ui, GError **error);
+static GtkWidget *get_content_widget (GpdsUI *ui, GError **error);
+static GdkPixbuf *get_icon_pixbuf (GpdsUI *ui, GError **error);
+
+G_DEFINE_DYNAMIC_TYPE(GpdsMouseUI, gpds_pointingstick_ui, GPDS_TYPE_XINPUT_UI)
+
+static void
+gpds_pointingstick_ui_class_init (GpdsMouseUIClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+ GpdsUIClass *ui_class = GPDS_UI_CLASS(klass);
+
+ gobject_class->dispose = dispose;
+
+ ui_class->is_available = is_available;
+ ui_class->build = build;
+ ui_class->get_content_widget = get_content_widget;
+ ui_class->get_icon_pixbuf = get_icon_pixbuf;
+}
+
+static void
+gpds_pointingstick_ui_class_finalize (GpdsMouseUIClass *klass)
+{
+}
+
+static void
+gpds_pointingstick_ui_init (GpdsMouseUI *ui)
+{
+ ui->ui_file_path = g_build_filename(gpds_get_ui_file_directory(),
+ "pointingstick.ui",
+ NULL);
+}
+
+G_MODULE_EXPORT void
+GPDS_MODULE_IMPL_INIT (GTypeModule *type_module)
+{
+ gpds_pointingstick_ui_register_type(type_module);
+}
+
+G_MODULE_EXPORT void
+GPDS_MODULE_IMPL_EXIT (void)
+{
+}
+
+G_MODULE_EXPORT GObject *
+GPDS_MODULE_IMPL_INSTANTIATE (const gchar *first_property, va_list var_args)
+{
+ return g_object_new_valist(GPDS_TYPE_POINTINGSTICK_UI, first_property, var_args);
+}
+
+static void
+dispose (GObject *object)
+{
+ GpdsMouseUI *ui = GPDS_POINTINGSTICK_UI(object);
+
+ g_free(ui->ui_file_path);
+
+ if (G_OBJECT_CLASS(gpds_pointingstick_ui_parent_class)->dispose)
+ G_OBJECT_CLASS(gpds_pointingstick_ui_parent_class)->dispose(object);
+}
+
+static void
+show_error (GError *error)
+{
+ if (!error)
+ return;
+
+ g_print("%s\n", error->message);
+}
+
+GPDS_XINPUT_UI_DEFINE_TOGGLE_BUTTON_CALLBACK(scrolling,
+ GPDS_POINTINGSTICK_SCROLLING,
+ "scrolling_box")
+GPDS_XINPUT_UI_DEFINE_TOGGLE_BUTTON_CALLBACK(press_to_select,
+ GPDS_POINTINGSTICK_PRESS_TO_SELECT,
+ "press_to_select_box")
+
+GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(sensitivity_scale,
+ GPDS_POINTINGSTICK_SENSITIVITY)
+GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(middle_button_timeout_scale,
+ GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT)
+GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(press_to_select_threshold_scale,
+ GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD)
+
+static void
+setup_signals (GpdsUI *ui, GtkBuilder *builder)
+{
+ GObject *object;
+
+#define CONNECT(object_name, signal_name) \
+ object = gtk_builder_get_object(builder, #object_name); \
+ g_signal_connect(object, #signal_name, \
+ G_CALLBACK(cb_ ## object_name ## _ ## signal_name),\
+ ui)
+
+ CONNECT(scrolling, toggled);
+ CONNECT(press_to_select, toggled);
+ CONNECT(middle_button_timeout_scale, value_changed);
+ CONNECT(sensitivity_scale, value_changed);
+ CONNECT(press_to_select_threshold_scale, value_changed);
+
+#undef CONNECT
+}
+
+static void
+setup_current_values (GpdsUI *ui)
+{
+ GpdsXInputUI *xinput_ui = GPDS_XINPUT_UI(ui);
+
+#define SET_INT_VALUE(PROP_NAME, widget_name) \
+ gpds_xinput_ui_set_widget_value_from_preference( \
+ xinput_ui, \
+ PROP_NAME, \
+ PROP_NAME ## _KEY, \
+ widget_name);
+#define SET_BOOLEAN_VALUE(PROP_NAME, widget_name) \
+ gpds_xinput_ui_set_toggle_button_state_from_preference( \
+ xinput_ui, \
+ PROP_NAME, \
+ PROP_NAME ## _KEY, \
+ widget_name);
+
+ SET_BOOLEAN_VALUE(GPDS_POINTINGSTICK_SCROLLING,
+ "scrolling");
+ SET_BOOLEAN_VALUE(GPDS_POINTINGSTICK_PRESS_TO_SELECT,
+ "press_to_select");
+
+ SET_INT_VALUE(GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT,
+ "middle_button_timeout_scale");
+ SET_INT_VALUE(GPDS_POINTINGSTICK_SENSITIVITY,
+ "sensitivity_scale");
+ SET_INT_VALUE(GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD,
+ "press_to_select_threshold_scale");
+}
+
+static gboolean
+is_available (GpdsUI *ui, GError **error)
+{
+ if (GPDS_UI_CLASS(gpds_pointingstick_ui_parent_class)->is_available &&
+ !GPDS_UI_CLASS(gpds_pointingstick_ui_parent_class)->is_available(ui, error)) {
+ return FALSE;
+ }
+
+ if (!g_file_test(GPDS_POINTINGSTICK_UI(ui)->ui_file_path,
+ G_FILE_TEST_EXISTS)) {
+ g_set_error(error,
+ GPDS_UI_ERROR,
+ GPDS_UI_ERROR_NO_UI_FILE,
+ _("%s did not find."),
+ GPDS_POINTINGSTICK_UI(ui)->ui_file_path);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+build (GpdsUI *ui, GError **error)
+{
+ GtkBuilder *builder;
+ GpdsXInput *xinput;
+
+ builder = gpds_ui_get_builder(ui);
+
+ if (!gtk_builder_add_from_file(builder,
+ GPDS_POINTINGSTICK_UI(ui)->ui_file_path,
+ error)) {
+ return FALSE;
+ }
+
+ xinput = gpds_pointingstick_xinput_new(gpds_ui_get_device_name(ui));
+ if (!xinput) {
+ return FALSE;
+ }
+ gpds_xinput_ui_set_xinput(GPDS_XINPUT_UI(ui), xinput);
+ g_object_unref(xinput);
+
+ gpds_ui_set_gconf_string(ui, GPDS_GCONF_DEVICE_TYPE_KEY, "pointingstick");
+ setup_current_values(ui);
+ setup_signals(ui, builder);
+
+ return TRUE;
+}
+
+static GtkWidget *
+get_content_widget (GpdsUI *ui, GError **error)
+{
+ GtkBuilder *builder;
+ GObject *widget;
+
+ builder = gpds_ui_get_builder(ui);
+
+ widget = gtk_builder_get_object(builder, "main-widget");
+ if (!widget) {
+ g_set_error(error,
+ GPDS_UI_ERROR,
+ GPDS_UI_ERROR_NO_WIDGET,
+ _("There is no widget(%s)."),
+ "main-widget");
+ return NULL;
+ }
+
+ return GTK_WIDGET(widget);
+}
+
+static GdkPixbuf *
+get_icon_pixbuf (GpdsUI *ui, GError **error)
+{
+ gchar *path;
+ GdkPixbuf *pixbuf;
+
+ path = g_build_filename(gpds_get_icon_file_directory(),
+ "trackpoint.png", NULL);
+ pixbuf = gdk_pixbuf_new_from_file(path, error);
+ g_free(path);
+
+ return pixbuf;
+}
+
+/*
+vi:ts=4:nowrap:ai:expandtab:sw=4
+*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]