X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=otk%2Fdisplay.cc;h=c1d6c61e0dfeb242a909eb98ac09063695d45414;hb=19bfac5195a1917f4a0bbcf910e90d5b800c5146;hp=3a15ff22ecb16b05a30fee590047b359ce108759;hpb=f3865bb12c2b3506e181f15f09b8429a59a618f8;p=chaz%2Fopenbox diff --git a/otk/display.cc b/otk/display.cc index 3a15ff22..c1d6c61e 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -11,10 +11,18 @@ extern "C" { #include +#ifdef XKB +#include +#endif // XKB + #ifdef SHAPE #include #endif // SHAPE +#ifdef XINERAMA +#include +#endif // XINERAMA + #ifdef HAVE_STDIO_H # include #endif // HAVE_STDIO_H @@ -44,6 +52,8 @@ namespace otk { 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; @@ -65,6 +75,8 @@ int OBDisplay::xerrorHandler(Display *d, XErrorEvent *e) { XGetErrorText(d, e->error_code, errtxt, 128); printf("X Error: %s\n", errtxt); + if (e->error_code != BadWindow) + abort(); } #else (void)d; @@ -81,6 +93,7 @@ void OBDisplay::initialize(char *name) (void)junk; // Open the X display + printf("getenv(DISPLAY)=%s\n", getenv("DISPLAY")); if (!(display = XOpenDisplay(name))) { printf(_("Unable to open connection to the X server. Please set the \n\ DISPLAY environment variable approriately, or use the '-display' command \n\ @@ -105,6 +118,11 @@ line argument.\n\n")); } // 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 @@ -176,6 +194,16 @@ const ScreenInfo* OBDisplay::screenInfo(int snum) { } +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)