Try harder to support wide screen
This commit is contained in:
parent
dade0b6931
commit
c1c5a78ca8
@ -78,12 +78,16 @@ if len(sys.argv) == 1:
|
|||||||
else:
|
else:
|
||||||
program = sys.argv[1]
|
program = sys.argv[1]
|
||||||
|
|
||||||
fullscreen = (gtk.gdk.screen_width() <= 1200 or
|
width = height = -1
|
||||||
gtk.gdk.screen_height() <= 900) and \
|
if gtk.gdk.screen_width() / 4 * 3 == gtk.gdk.screen_height():
|
||||||
(gtk.gdk.screen_width() / 4 * 3 ==
|
fullscreen = (gtk.gdk.screen_width() <= 1200 or
|
||||||
gtk.gdk.screen_height())
|
gtk.gdk.screen_height() <= 900)
|
||||||
|
else:
|
||||||
|
fullscreen = False
|
||||||
|
width = gtk.gdk.screen_width() - 50
|
||||||
|
height = width / 4 * 3
|
||||||
|
|
||||||
emulator = Emulator(fullscreen)
|
emulator = Emulator(width, height, fullscreen)
|
||||||
emulator.start()
|
emulator.start()
|
||||||
|
|
||||||
os.execlp('dbus-launch', 'dbus-launch', '--exit-with-session', program)
|
os.execlp('dbus-launch', 'dbus-launch', '--exit-with-session', program)
|
||||||
|
@ -78,13 +78,16 @@ class MatchboxProcess(Process):
|
|||||||
return 'Matchbox'
|
return 'Matchbox'
|
||||||
|
|
||||||
class XephyrProcess(Process):
|
class XephyrProcess(Process):
|
||||||
def __init__(self, fullscreen):
|
def __init__(self, width, height, fullscreen):
|
||||||
self._display = get_display_number()
|
self._display = get_display_number()
|
||||||
cmd = 'Xephyr :%d -ac ' % (self._display)
|
cmd = 'Xephyr :%d -ac ' % (self._display)
|
||||||
|
|
||||||
if fullscreen:
|
if fullscreen:
|
||||||
cmd += '-fullscreen '
|
cmd += ' -fullscreen '
|
||||||
else:
|
|
||||||
cmd += '-screen 1200x900'
|
if width > 0 and height > 0:
|
||||||
|
cmd += ' -screen %dx%d' % (width, height)
|
||||||
|
|
||||||
Process.__init__(self, cmd)
|
Process.__init__(self, cmd)
|
||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
@ -97,12 +100,15 @@ class XephyrProcess(Process):
|
|||||||
|
|
||||||
class Emulator(object):
|
class Emulator(object):
|
||||||
"""The OLPC emulator"""
|
"""The OLPC emulator"""
|
||||||
def __init__(self, fullscreen):
|
def __init__(self, width, height, fullscreen):
|
||||||
self._fullscreen = fullscreen
|
self._fullscreen = fullscreen
|
||||||
|
self._width = width
|
||||||
|
self._height = height
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
try:
|
try:
|
||||||
process = XephyrProcess(self._fullscreen)
|
process = XephyrProcess(self._width, self._height,
|
||||||
|
self._fullscreen)
|
||||||
process.start()
|
process.start()
|
||||||
except:
|
except:
|
||||||
print 'Cannot run the emulator. You need to install Xephyr'
|
print 'Cannot run the emulator. You need to install Xephyr'
|
||||||
|
Loading…
Reference in New Issue
Block a user