summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rwxr-xr-xanaconda4
-rw-r--r--xutils.c24
3 files changed, 30 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e59750c12..ddc141505 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/anaconda b/anaconda
index 907434432..c39a1b589 100755
--- a/anaconda
+++ b/anaconda
@@ -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")
diff --git a/xutils.c b/xutils.c
index abf625e37..8eb9ee1ac 100644
--- a/xutils.c
+++ b/xutils.c
@@ -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 ()
{