#include "display.hh"
#include "screeninfo.hh"
#include "gccache.hh"
+#include "util.hh"
extern "C" {
#include <X11/keysym.h>
+#ifdef XKB
+#include <X11/XKBlib.h>
+#endif // XKB
+
#ifdef SHAPE
#include <X11/extensions/shape.h>
#endif // SHAPE
+#ifdef XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif // XINERAMA
+
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif // HAVE_STDIO_H
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif // HAVE_STDLIB_H
-
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif // HAVE_SIGNAL_H
Display *OBDisplay::display = (Display*) 0;
+bool OBDisplay::_xkb = false;
+int OBDisplay::_xkb_event_basep = 0;
bool OBDisplay::_shape = false;
int OBDisplay::_shape_event_basep = 0;
bool OBDisplay::_xinerama = false;
{
XGetErrorText(d, e->error_code, errtxt, 128);
printf("X Error: %s\n", errtxt);
+ if (e->error_code != BadWindow)
+ abort();
}
#else
(void)d;
// set the DISPLAY environment variable for any lauched children, to the
// display we're using, so they open in the right place.
// XXX rm -> std::string dtmp = "DISPLAY=" + DisplayString(display);
- if (putenv(const_cast<char*>((std::string("DISPLAY=") +
- DisplayString(display)).c_str()))) {
- printf(_("warning: couldn't set environment variable 'DISPLAY'\n"));
- perror("putenv()");
- }
+ putenv(std::string("DISPLAY=") + DisplayString(display));
// find the availability of X extensions we like to use
+#ifdef XKB
+ _xkb = XkbQueryExtension(display, &junk, &_xkb_event_basep, &junk, NULL,
+ NULL);
+#endif
+
#ifdef SHAPE
_shape = XShapeQueryExtension(display, &_shape_event_basep, &junk);
#endif
}
+const ScreenInfo* OBDisplay::findScreen(Window root)
+{
+ ScreenInfoList::iterator it, end = _screenInfoList.end();
+ for (it = _screenInfoList.begin(); it != end; ++it)
+ if (it->rootWindow() == root)
+ return &(*it);
+ return 0;
+}
+
+
void OBDisplay::grab()
{
if (_grab_count == 0)