diff options
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | anaconda | 4 | ||||
-rw-r--r-- | xutils.c | 24 |
3 files changed, 30 insertions, 2 deletions
@@ -36,8 +36,8 @@ xmouse.so: xmouse.c gcc -o xmouse.so -shared xmouse.o -L/usr/X11R6/$(LIBDIR) -lXxf86misc -lX11 -lXext xutils.so: xutils.c - gcc -ggdb -Wall -o xutils.o -fPIC -I/usr/X11R6/include -I$(PYTHONINCLUDE) -I $(PYTHONINCLUDE) -c xutils.c $(CFLAGS) - gcc -o xutils.so -shared xutils.o -ggdb -L/usr/X11R6/$(LIBDIR) -lX11 + gcc -ggdb -Wall -o xutils.o -fno-strict-aliasing -fPIC -I/usr/X11R6/include -I$(PYTHONINCLUDE) -I $(PYTHONINCLUDE) -c xutils.c $(CFLAGS) `pkg-config --cflags gdk-2.0` + gcc -o xutils.so -shared xutils.o -ggdb -L/usr/X11R6/$(LIBDIR) -lX11 `pkg-config --libs gdk-2.0` depend: rm -f *.o *.so *.pyc @@ -71,6 +71,10 @@ def doStartupX11Actions(): try: miniwm_pid = startMiniWM() log.info("Started mini-wm") + + import gtk + i = gtk.Invisible() + i.selection_owner_set("_ANACONDA_MINI_WM_RUNNING") except: miniwm_pid = None log.error("Unable to start mini-wm") @@ -18,17 +18,21 @@ #include <Python.h> #include <X11/Xlib.h> #include <X11/Xatom.h> +#include <gdk/gdkx.h> static PyObject * getRootResources(PyObject *s, PyObject *args); static PyObject * setRootResource(PyObject * s, PyObject * args); static PyObject * screenHeight (PyObject * s, PyObject * args); static PyObject * screenWidth (PyObject * s, PyObject * args); +static PyObject * getXatom(PyObject *s, PyObject *args); + static PyMethodDef xutilsMethods[] = { { "getRootResources", getRootResources, 1, NULL }, { "setRootResource", setRootResource, 1, NULL }, { "screenHeight", screenHeight, 1, NULL }, { "screenWidth", screenWidth, 1, NULL }, + { "getXatom", getXatom, 1, NULL }, { NULL, NULL, 0, NULL } }; @@ -313,6 +317,26 @@ screenWidth(PyObject *s, PyObject *args) return rc; } +/* 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 () { |