From 73c1dbe4a7d8b5e54b6c16f82690200abaedf978 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 09 Mar 2007 12:53:26 +0000 Subject: CLeanup emulator shutdown --- diff --git a/Makefile.am b/Makefile.am index ac05c5d..4606e90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,8 +3,7 @@ SUBDIRS = lib po shell sugar services tools ACLOCAL_AMFLAGS = -I m4 bin_SCRIPTS = \ - sugar-emulator \ - sugar-emulator-shutdown + sugar-emulator DISTCLEANFILES = \ intltool-extract \ diff --git a/shell/data/kbdconfig b/shell/data/kbdconfig index 287de52..415c69f 100644 --- a/shell/data/kbdconfig +++ b/shell/data/kbdconfig @@ -5,5 +5,3 @@ n=next p=prev c=close - -q=!sugar-emulator-shutdown diff --git a/shell/view/keyhandler.py b/shell/view/keyhandler.py index 085b51c..0ef963a 100644 --- a/shell/view/keyhandler.py +++ b/shell/view/keyhandler.py @@ -1,3 +1,6 @@ +import os +import signal + import dbus import gobject @@ -34,7 +37,8 @@ _actions_table = { '0xEB' : 'rotate', 'r' : 'rotate', '0xEC' : 'keyboard_brightness', - 'Tab' : 'home' + 'Tab' : 'home', + 'q' : 'quit_emulator', } class KeyHandler(object): @@ -149,6 +153,11 @@ class KeyHandler(object): gobject.spawn_async(['xrandr', '-o', states[self._screen_rotation]], flags=gobject.SPAWN_SEARCH_PATH) + def handle_quit_emulator(self): + if os.environ.has_key('SUGAR_EMULATOR_PID'): + pid = int(os.environ['SUGAR_EMULATOR_PID']) + os.kill(pid, signal.SIGTERM) + def handle_home(self): # FIXME: finish alt+tab support pass diff --git a/sugar-emulator-shutdown b/sugar-emulator-shutdown deleted file mode 100755 index 75f6de0..0000000 --- a/sugar-emulator-shutdown +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2006, Red Hat, Inc. -# -# 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 os -import signal - -if os.environ.has_key('SUGAR_XEPHYR_PID'): - pid = int(os.environ['SUGAR_XEPHYR_PID']) - os.kill(pid, signal.SIGTERM) diff --git a/sugar/emulator.py b/sugar/emulator.py index 90d6cf9..bc06924 100644 --- a/sugar/emulator.py +++ b/sugar/emulator.py @@ -98,7 +98,7 @@ class XephyrProcess(Process): def start(self, standard_output=False): Process.start(self) os.environ['DISPLAY'] = ":%d" % (self._display) - os.environ['SUGAR_XEPHYR_PID'] = '%d' % self.pid + os.environ['SUGAR_EMULATOR_PID'] = '%d' % self.pid class Emulator(object): """The OLPC emulator""" -- cgit v0.9.1