Ticket #1432: sugar-1432.patch

File sugar-1432.patch, 3.3 KB (added by alsroot, 15 years ago)
  • bin/sugar-emulator

    From a06df8995da36e9160626896834dfc341d3b2c86 Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Sat, 26 Sep 2009 18:33:49 +0000
    Subject: sugar-emulator starts sugar out of Xephyr #1432
    
    ---
     bin/sugar-emulator |   17 +++++++++--------
     bin/sugar.in       |   33 ++++++++++++++++++++++++++++++++-
     2 files changed, 41 insertions(+), 9 deletions(-)
    
    diff --git a/bin/sugar-emulator b/bin/sugar-emulator
    index 7f06609..99856dc 100644
    a b def _start_xephyr(dpi, dimensions, fullscreen): 
    7373    # FIXME evil workaround until F10 Xephyr is fixed
    7474    if os.path.exists('/etc/fedora-release'):
    7575        if open('/etc/fedora-release').read().startswith('Fedora release 10'):
    76             _run_xephyr(random.randint(100, 500), dpi, dimensions, fullscreen)
    77             return
     76            display = random.randint(100, 500)
     77            _run_xephyr(display, dpi, dimensions, fullscreen)
     78            return  display
    7879
    7980    for display in range(100, 110):
    8081        if not _check_xephyr(display):
    def _start_xephyr(dpi, dimensions, fullscreen): 
    8384            tries = 10
    8485            while tries > 0:
    8586                if _check_xephyr(display):
    86                     return
     87                    return display
    8788                else:
    8889                    tries -= 1
    8990                    time.sleep(0.1)
    9091
    91 def _start_window_manager():
     92def _start_window_manager(display):
    9293    cmd = ['metacity']
    9394
    94     cmd.extend(['--no-force-fullscreen'])
     95    cmd.extend(['--no-force-fullscreen', '-d', ':%d' % display])
    9596
    9697    gobject.spawn_async(cmd, flags=gobject.SPAWN_SEARCH_PATH)
    9798
    def main(): 
    146147
    147148    _setup_env()
    148149
    149     _start_xephyr(options.dpi, options.dimensions, options.fullscreen)
     150    display = _start_xephyr(options.dpi, options.dimensions, options.fullscreen)
    150151
    151152    if options.scaling:
    152153        os.environ['SUGAR_SCALING'] = options.scaling
    def main(): 
    154155    command = ['dbus-launch', 'dbus-launch', '--exit-with-session']
    155156
    156157    if not args:
    157         command.append('sugar')
     158        command.extend(['sugar', '-d', ':%d' % display])
    158159    else:
    159         _start_window_manager()
     160        _start_window_manager(display)
    160161
    161162        if args[0].endswith('.py'):
    162163            command.append('python')
  • bin/sugar.in

    diff --git a/bin/sugar.in b/bin/sugar.in
    index 1c29a12..0cc97ca 100644
    a b  
    11#!/bin/sh
    22
     3usage() {
     4    cat <<EOF
     5Usage: sugar [OPTION]..
     6
     7Start Sugar window manager.
     8
     9Optional arguments.
     10  -d, --display DISPLAY     Display to start sugar
     11  -s, --scaling SCALING     Scale Sugar theme
     12                            Supported values: 72, 100
     13EOF
     14    exit 0
     15}
     16
     17while [ $# -ne 0 ] ; do
     18    case "$1" in
     19        -d | --display)
     20            shift
     21            export DISPLAY="$1"
     22            ;;
     23        -s | --scaling)
     24            shift
     25            export SUGAR_SCALING="$1"
     26            ;;
     27        -h | --help)
     28            usage
     29            ;;
     30    esac
     31    shift
     32done
     33
    334if test -z "$SUGAR_SCALING"; then
    435    export SUGAR_SCALING=72
    536fi
    if [ -f ~/.sugar/debug ]; then 
    1950        . ~/.sugar/debug
    2051fi
    2152
    22 metacity --no-force-fullscreen &
     53metacity --no-force-fullscreen -d $DISPLAY &
    2354
    2455exec sugar-session