Pass the X dpi to Xephyr. Default to a minimum of 96, some distros appear to be broken.
This commit is contained in:
parent
3baf796d83
commit
b473b4f17c
@ -36,6 +36,7 @@ else:
|
|||||||
from sugar import env
|
from sugar import env
|
||||||
from sugar import util
|
from sugar import util
|
||||||
from sugar.emulator import Emulator
|
from sugar.emulator import Emulator
|
||||||
|
import _sugar
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
program = 'sugar-shell'
|
program = 'sugar-shell'
|
||||||
@ -51,7 +52,9 @@ else:
|
|||||||
width = 1200
|
width = 1200
|
||||||
height = 900
|
height = 900
|
||||||
|
|
||||||
emulator = Emulator(width, height, fullscreen)
|
dpi = min(_sugar.get_screen_dpi(), 96)
|
||||||
|
|
||||||
|
emulator = Emulator(width, height, fullscreen, dpi)
|
||||||
emulator.start()
|
emulator.start()
|
||||||
|
|
||||||
if sourcedir:
|
if sourcedir:
|
||||||
|
@ -78,7 +78,7 @@ class MatchboxProcess(Process):
|
|||||||
return 'Matchbox'
|
return 'Matchbox'
|
||||||
|
|
||||||
class XephyrProcess(Process):
|
class XephyrProcess(Process):
|
||||||
def __init__(self, width, height, fullscreen):
|
def __init__(self, width, height, fullscreen, dpi):
|
||||||
self._display = get_display_number()
|
self._display = get_display_number()
|
||||||
cmd = 'Xephyr :%d -ac ' % (self._display)
|
cmd = 'Xephyr :%d -ac ' % (self._display)
|
||||||
|
|
||||||
@ -88,6 +88,9 @@ class XephyrProcess(Process):
|
|||||||
if width > 0 and height > 0:
|
if width > 0 and height > 0:
|
||||||
cmd += ' -screen %dx%d' % (width, height)
|
cmd += ' -screen %dx%d' % (width, height)
|
||||||
|
|
||||||
|
if dpi > 0:
|
||||||
|
cmd += ' -dpi %d' % (dpi)
|
||||||
|
|
||||||
Process.__init__(self, cmd)
|
Process.__init__(self, cmd)
|
||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
@ -100,15 +103,16 @@ class XephyrProcess(Process):
|
|||||||
|
|
||||||
class Emulator(object):
|
class Emulator(object):
|
||||||
"""The OLPC emulator"""
|
"""The OLPC emulator"""
|
||||||
def __init__(self, width, height, fullscreen):
|
def __init__(self, width, height, fullscreen, dpi):
|
||||||
self._fullscreen = fullscreen
|
self._fullscreen = fullscreen
|
||||||
self._width = width
|
self._width = width
|
||||||
self._height = height
|
self._height = height
|
||||||
|
self._dpi = dpi
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
try:
|
try:
|
||||||
process = XephyrProcess(self._width, self._height,
|
process = XephyrProcess(self._width, self._height,
|
||||||
self._fullscreen)
|
self._fullscreen, self._dpi)
|
||||||
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