diff options
-rw-r--r-- | xserver.py | 24 | ||||
-rw-r--r-- | xutils.c | 19 |
2 files changed, 28 insertions, 15 deletions
diff --git a/xserver.py b/xserver.py index ae6e166ec..1589a62d0 100644 --- a/xserver.py +++ b/xserver.py @@ -230,16 +230,20 @@ def testx(hwstate, mouse, keyboard): if miniwm_pid is not None: import xutils - if xutils.screenWidth() > 640: - dpi = "96" - else: - dpi = "75" - - xutils.setRootResource('Xft.antialias', '1') - xutils.setRootResource('Xft.dpi', dpi) - xutils.setRootResource('Xft.hinting', '1') - xutils.setRootResource('Xft.hintstyle', 'hintslight') - xutils.setRootResource('Xft.rgba', 'none') + try: + if xutils.screenWidth() > 640: + dpi = "96" + else: + dpi = "75" + + xutils.setRootResource('Xft.antialias', '1') + xutils.setRootResource('Xft.dpi', dpi) + xutils.setRootResource('Xft.hinting', '1') + xutils.setRootResource('Xft.hintstyle', 'hintslight') + xutils.setRootResource('Xft.rgba', 'none') + except: + sys.stderr.write("X SERVER STARTED, THEN FAILED"); + raise RuntimeError, "X server failed to start" child = os.fork() if (child): @@ -153,8 +153,10 @@ getRootResources(PyObject *s, PyObject *args) { Resource **resources, **p; PyObject *rc; - if (openDisplay(&dpy, &root) < 0) + if (openDisplay(&dpy, &root) < 0) { + PyErr_SetString(PyExc_SystemError, "Could not open display."); return NULL; + } resources = getCurrentResources(dpy); if (!resources) { @@ -185,11 +187,14 @@ setRootResource(PyObject *s, PyObject *args) char *key, *val, *rstring; int fnd, nrec; - if (!PyArg_ParseTuple(args, "ss", &key, &val)) + if (!PyArg_ParseTuple(args, "ss", &key, &val)) { return NULL; + } - if (openDisplay(&dpy, &root) < 0) + if (openDisplay(&dpy, &root) < 0) { + PyErr_SetString(PyExc_SystemError, "Could not open display."); return NULL; + } resources = getCurrentResources(dpy); fnd = 0; @@ -273,8 +278,10 @@ screenHeight(PyObject *s, PyObject *args) int scrn; PyObject *rc; - if (openDisplay(&dpy, &root) < 0) + if (openDisplay(&dpy, &root) < 0) { + PyErr_SetString(PyExc_SystemError, "Could not open display."); return NULL; + } scrn=DefaultScreen(dpy); @@ -292,8 +299,10 @@ screenWidth(PyObject *s, PyObject *args) int scrn; PyObject *rc; - if (openDisplay(&dpy, &root) < 0) + if (openDisplay(&dpy, &root) < 0) { + PyErr_SetString(PyExc_SystemError, "Could not open display."); return NULL; + } scrn=DefaultScreen(dpy); |