diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-05-06 22:10:47 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-05-06 22:17:48 (GMT) |
commit | 8b296f2a0fc3edcb09c5a411514839424f13c8c2 (patch) | |
tree | 8b705cc5bf9831ff35a5c7c5f72494e19154303a | |
parent | 20ec64f442d7b461892b89b3f42e7adabdf1198a (diff) |
The idea is to always close sugar itself to exit the scripts
normally and avoid leaking processes.
-rw-r--r-- | lib/sugar-runner-window.c | 6 | ||||
-rw-r--r-- | scripts/sugar-runner.in | 18 |
2 files changed, 6 insertions, 18 deletions
diff --git a/lib/sugar-runner-window.c b/lib/sugar-runner-window.c index 8590056..77f60e1 100644 --- a/lib/sugar-runner-window.c +++ b/lib/sugar-runner-window.c @@ -53,12 +53,6 @@ sugar_runner_window_wait(void) DisplayHeight(display, 0) == configure_event.height); } - if (event.type == ClientMessage && - event.xclient.data.l[0] == wm_delete_window) { - XCloseDisplay(display); - return FALSE; - } - return TRUE; } diff --git a/scripts/sugar-runner.in b/scripts/sugar-runner.in index 1b1a50a..3c2f458 100644 --- a/scripts/sugar-runner.in +++ b/scripts/sugar-runner.in @@ -12,7 +12,6 @@ from gi.repository import SugarRunner helpers_dir = "@helpersdir@" -xinit_process = None window_process = None result = 0 @@ -22,15 +21,8 @@ def _usr1_signal_handler(number, frame): result = 1 -def _term_signal_handler(number, frame): - global window_process - global xinit_process - - for process in xinit_process, window_process: - if process: - process.terminate() - - sys.exit(0) +def _setpgrp_preexec(): + os.setpgrp() def _get_screen_dpi(): @@ -147,6 +139,9 @@ def _setup_variables(args, home_dirs): # Disable Unity custom gtk scrollbars os.environ["LIBOVERLAY_SCROLLBAR"] = "0" + # Allow to close with Shift+Alt+Q + os.environ["SUGAR_EMULATOR"] = "yes" + parser = argparse.ArgumentParser(description="Run sugar") parser.add_argument("--resolution", help="screen resolution") parser.add_argument("--output", help="name of the output") @@ -185,11 +180,10 @@ else: os.environ["SUGAR_RUNNER_PID"] = str(os.getpid()) -signal.signal(signal.SIGTERM, _term_signal_handler) signal.signal(signal.SIGUSR1, _usr1_signal_handler) try: - xinit_process = subprocess.Popen(xinit_args) + xinit_process = subprocess.Popen(xinit_args, preexec_fn=_setpgrp_preexec) result = None while result is None: |