Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/rpms/sugar/0040-Globalkey-for-touchpad-device-icon.patch
diff options
context:
space:
mode:
Diffstat (limited to 'rpms/sugar/0040-Globalkey-for-touchpad-device-icon.patch')
-rw-r--r--rpms/sugar/0040-Globalkey-for-touchpad-device-icon.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/rpms/sugar/0040-Globalkey-for-touchpad-device-icon.patch b/rpms/sugar/0040-Globalkey-for-touchpad-device-icon.patch
new file mode 100644
index 0000000..9b595ac
--- /dev/null
+++ b/rpms/sugar/0040-Globalkey-for-touchpad-device-icon.patch
@@ -0,0 +1,120 @@
+From 2d77d002d70ce8a4f7cd53567592e538654a7ac7 Mon Sep 17 00:00:00 2001
+From: Martin Abente <martin.abente.lahaye@gmail.com>
+Date: Wed, 3 Nov 2010 18:27:30 -0300
+Subject: [PATCH sugar 40/74] Globalkey for touchpad device icon
+
+Add a new keyboard shortcut as a globalkey, this will
+toggle the touchpad mode when <Alt + m> is pressed.
+
+Also change DeviceView.palette indentifier for
+DeviceView._palette. Palette was not showing
+because of that.
+
+Dextrose version
+---
+ extensions/deviceicon/touchpad.py | 16 ++++++++++------
+ extensions/globalkey/Makefile.am | 1 +
+ extensions/globalkey/touchpad.py | 33 +++++++++++++++++++++++++++++++++
+ 3 files changed, 44 insertions(+), 6 deletions(-)
+ create mode 100644 extensions/globalkey/touchpad.py
+
+diff --git a/extensions/deviceicon/touchpad.py b/extensions/deviceicon/touchpad.py
+index 6773afc..ba02037 100644
+--- a/extensions/deviceicon/touchpad.py
++++ b/extensions/deviceicon/touchpad.py
+@@ -45,6 +45,8 @@
+ # NODE_PATH is used to communicate with the touchpad device.
+ NODE_PATH = '/sys/devices/platform/i8042/serio1/ptmode'
+
++_view = None
++
+
+ class DeviceView(TrayIcon):
+ """ Manage the touchpad mode from the device palette on the Frame. """
+@@ -66,14 +68,14 @@ def create_palette(self):
+ """ Create a palette for this icon; called by the Sugar framework
+ when a palette needs to be displayed. """
+ label = glib.markup_escape_text(_('My touchpad'))
+- self.palette = ResourcePalette(label, self.icon)
+- self.palette.set_group_id('frame')
+- return self.palette
++ self._palette = ResourcePalette(label, self.icon)
++ self._palette.set_group_id('frame')
++ return self._palette
+
+ def __button_release_event_cb(self, widget, event):
+ """ Callback for button release event; used to invoke touchpad-mode
+ change. """
+- self.palette.toggle_mode()
++ self._palette.toggle_mode()
+ return True
+
+
+@@ -111,10 +113,12 @@ def toggle_mode(self):
+
+
+ def setup(tray):
+- """ Initialize the devic icon; called by the shell when initializing the
++ """ Initialize the device icon; called by the shell when initializing the
+ Frame. """
++ global _view
+ if os.path.exists(NODE_PATH):
+- tray.add_device(DeviceView())
++ _view = DeviceView()
++ tray.add_device(_view)
+ _write_touchpad_mode(TOUCHPAD_MODE_CAPACITIVE)
+
+
+diff --git a/extensions/globalkey/Makefile.am b/extensions/globalkey/Makefile.am
+index b44626e..e3aaa8a 100644
+--- a/extensions/globalkey/Makefile.am
++++ b/extensions/globalkey/Makefile.am
+@@ -4,5 +4,6 @@ sugar_PYTHON = \
+ __init__.py \
+ magnifier.py \
+ screenshot.py \
++ touchpad.py \
+ viewsource.py \
+ virtualkeyboard.py
+diff --git a/extensions/globalkey/touchpad.py b/extensions/globalkey/touchpad.py
+new file mode 100644
+index 0000000..eeaba40
+--- /dev/null
++++ b/extensions/globalkey/touchpad.py
+@@ -0,0 +1,33 @@
++# Copyright (C) 2010, Martin Abente
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++
++import logging
++
++BOUND_KEYS = ['<alt>m']
++touchpad = None
++
++def handle_key_press(key):
++ global touchpad
++ if touchpad is None:
++ try:
++ touchpad = __import__('deviceicon.touchpad', globals(),
++ locals(), ['touchpad'])
++ except Exception:
++ logging.error('Could not import touchpad module.')
++ return
++
++ if touchpad._view is not None:
++ touchpad._view._palette.toggle_mode()
+--
+1.7.6
+