diff options
author | Jeremy Katz <katzj@redhat.com> | 2007-01-18 21:11:04 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2007-01-18 21:11:04 +0000 |
commit | 249c7b9acc5fbd5800b28337a228c75b66f2422c (patch) | |
tree | 123b4f3fb66c16613f043f434d0384647b8e7dcc /xutils.c | |
parent | aa19a2f26808bcc2dff2e5bb8fae741970901b54 (diff) | |
download | anaconda-249c7b9acc5fbd5800b28337a228c75b66f2422c.tar.gz anaconda-249c7b9acc5fbd5800b28337a228c75b66f2422c.tar.xz anaconda-249c7b9acc5fbd5800b28337a228c75b66f2422c.zip |
* anaconda (doStartupX11Actions): Set a selection if we're using
mini-wm so that we can tell later
* xutils.c (getXatom): Add support for seeing if a selection is set
* Makefile (xutils.so): Need gdk for this
Diffstat (limited to 'xutils.c')
-rw-r--r-- | xutils.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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 () { |