I can't see that any of the resources we were setting changed the look of the installer at all. Now that we are using metacity instead of our own window manager, these things should all be getting set for us elsewhere. --- anaconda | 18 +--- pyanaconda/Makefile.am | 7 -- pyanaconda/gui.py | 1 - pyanaconda/xutils.c | 266 ------------------------------------------------ 4 files changed, 3 insertions(+), 289 deletions(-) delete mode 100644 pyanaconda/xutils.c diff --git a/anaconda b/anaconda index cd290d1..f9d9048 100755 --- a/anaconda +++ b/anaconda @@ -82,21 +82,9 @@ def doStartupX11Actions(): wm_pid = startMetacityWM() log.info("Starting window manager, pid %s." % (wm_pid,)) - if wm_pid is not None: - from pyanaconda import xutils - - try: - xutils.setRootResource('Xcursor.size', '24') - xutils.setRootResource('Xcursor.theme', 'Bluecurve') - xutils.setRootResource('Xcursor.theme_core', 'true') - - xutils.setRootResource('Xft.antialias', '1') - xutils.setRootResource('Xft.hinting', '1') - xutils.setRootResource('Xft.hintstyle', 'hintslight') - xutils.setRootResource('Xft.rgba', 'none') - except Exception as e: - sys.stderr.write("X SERVER STARTED, THEN FAILED"); - raise RuntimeError, "X server failed to start" + if wm_pid is None: + sys.stderr.write("X SERVER STARTED, THEN FAILED"); + raise RuntimeError, "X server failed to start" def set_x_resolution(runres): # cant do this if no window manager is running because otherwise when we diff --git a/pyanaconda/Makefile.am b/pyanaconda/Makefile.am index 707adcd..dda42d0 100644 --- a/pyanaconda/Makefile.am +++ b/pyanaconda/Makefile.am @@ -25,10 +25,3 @@ MAINTAINERCLEANFILES = Makefile.in pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME) anacondadir = $(pkgpyexecdir) anaconda_PYTHON = *.py -pkgpyexec_LTLIBRARIES = xutils.la - -xutils_la_CFLAGS = $(PYTHON_INCLUDES) $(GDK_CFLAGS) -fno-strict-aliasing -xutils_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) $(GDK_LDFLAGS) -xutils_la_LIBADD = $(PYTHON_LIBS) $(GDK_LIBS) -xutils_la_SOURCES = xutils.c - diff --git a/pyanaconda/gui.py b/pyanaconda/gui.py index 12aeb8c..ac90e2a 100755 --- a/pyanaconda/gui.py +++ b/pyanaconda/gui.py @@ -44,7 +44,6 @@ from constants import * from product import * import network from installinterfacebase import InstallInterfaceBase -import xutils import imp import iw diff --git a/pyanaconda/xutils.c b/pyanaconda/xutils.c deleted file mode 100644 index 6e49798..0000000 --- a/pyanaconda/xutils.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * xutils.c - a Python wrapper for common Xlib ops - * - * Copyright (C) 2002 Red Hat, Inc. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Author(s): Michael Fulbright <msf@xxxxxxxxxx> - */ - -#include <Python.h> -#include <X11/Xlib.h> -#include <X11/Xatom.h> -#include <gdk/gdkx.h> - -static PyObject * setRootResource(PyObject * s, PyObject * args); -static PyObject * getXatom(PyObject *s, PyObject *args); - - -static PyMethodDef xutilsMethods[] = { - { "setRootResource", setRootResource, 1, NULL }, - { "getXatom", getXatom, 1, NULL }, - { NULL, NULL, 0, NULL } -}; - -typedef struct _Resource { - char *key, *val; -} Resource; - -static int -openDisplay(Display **dpy, Window *root) -{ - int scrn; - - *dpy=XOpenDisplay(""); - if (!*dpy) - return -1; - - scrn=DefaultScreen(*dpy); - *root = RootWindow(*dpy, scrn); - return 0; -} - -static void -closeDisplay(Display *dpy) -{ - XCloseDisplay(dpy); -} - -static Resource ** -getCurrentResources(Display *dpy) -{ - char *resource_string, *p; - Resource **rc; - int nrec; - - /* read through current resources, split on newlines */ - resource_string = XResourceManagerString(dpy); - - if (!resource_string) - return NULL; - - rc = (Resource **)malloc(sizeof(Resource *)); - p = resource_string; - nrec = 0; - while (1) { - char *eol; - char *sep; - int nleft; - - /* find next newline, defines end of current record */ - eol = strchr(p, '\n'); - - if (!eol) - break; - - /* find colon separating key and value */ - /* if no colon skip this record */ - sep = strchr(p, ':'); - if (sep) { - int len; - Resource *newrec; - - newrec = (Resource *) malloc(sizeof(Resource)); - - len = sep - p + 1; - newrec->key = (char *) malloc(len*sizeof(char)); - memcpy(newrec->key, p, len); - newrec->key[len-1] = '\0'; - - len = eol - sep; - newrec->val = (char *) malloc(len*sizeof(char)); - memcpy(newrec->val, sep+1, len); - newrec->val[len-1] = '\0'; - - rc = (Resource **) realloc(rc, (nrec+1) * sizeof(Resource *)); - rc[nrec] = newrec; - nrec = nrec + 1; - } - - nleft = strlen(resource_string) - (eol-resource_string); - if (nleft <= 0) - break; - - p = eol + 1; - } - - if (nrec > 0) { - rc = (Resource **) realloc(rc, (nrec+1) * sizeof(Resource *)); - rc[nrec] = NULL; - } else { - rc = NULL; - } - - return rc; -} - -static void -freeResources(Resource **rc) -{ - int idx; - - if (!rc) - return; - - idx = 0; - while (rc[idx]) { - free(rc[idx]->key); - free(rc[idx]->val); - free(rc[idx]); - - idx++; - } - - free(rc); -} - -static PyObject * -setRootResource(PyObject *s, PyObject *args) -{ - Display *dpy; - Window root; - Resource **resources, **p; - char *key, *val, *rstring; - int fnd, nrec; - - if (!PyArg_ParseTuple(args, "ss", &key, &val)) { - return NULL; - } - - if (openDisplay(&dpy, &root) < 0) { - PyErr_SetString(PyExc_SystemError, "Could not open display."); - return NULL; - } - - resources = getCurrentResources(dpy); - fnd = 0; - nrec = 0; - if (resources) { - p = resources; - while (*p) { - if (!strcmp(key, (*p)->key)) { - free((*p)->val); - (*p)->val = strdup(val); - fnd = 1; - break; - } - - p++; - } - - p = resources; - while (*p) { - nrec++; - p++; - } - } - - if (!fnd) { - Resource *newrec; - - newrec = (Resource *) malloc(sizeof(Resource)); - newrec->key = strdup(key); - newrec->val = strdup(val); - - if (nrec > 0) - resources = (Resource **) realloc(resources, (nrec+2) * sizeof(Resource *)); - else - resources = (Resource **) malloc(2*sizeof(Resource *)); - - resources[nrec] = newrec; - resources[nrec+1] = NULL; - } - - rstring = NULL; - p = resources; - while (*p) { - int len; - char *tmpstr; - - len = strlen((*p)->key) + strlen((*p)->val) + 3; - tmpstr = (char *) malloc(len*sizeof(char)); - strcpy(tmpstr, (*p)->key); - strcat(tmpstr, ":"); - strcat(tmpstr, (*p)->val); - strcat(tmpstr, "\n"); - - if (rstring) { - rstring = (char *)realloc(rstring, (strlen(rstring)+len+1)*sizeof(char)); - strcat(rstring, tmpstr); - } else { - rstring = tmpstr; - } - - p++; - } - - XChangeProperty(dpy, root, XA_RESOURCE_MANAGER, XA_STRING, - 8, PropModeReplace, (unsigned char *)rstring, - strlen(rstring)); - - free(rstring); - freeResources(resources); - - closeDisplay(dpy); - - Py_INCREF(Py_None); - return Py_None; -} - -/* this assumes you've already imported gtk and thus have a display */ -static PyObject * -getXatom(PyObject *s, PyObject *args) -{ - char *atomname; - Atom theatom; - - if (!PyArg_ParseTuple(args, "s", &atomname)) { - return NULL; - } - - theatom = gdk_x11_get_xatom_by_name(atomname); - if (XGetSelectionOwner (GDK_DISPLAY(), theatom) != None) { - Py_INCREF(Py_True); - return Py_True; - } - Py_INCREF(Py_False); - return Py_False; -} - -void -initxutils () -{ - Py_InitModule ("xutils", xutilsMethods); -} -- 1.7.4.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list