X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fdisplay.cc;h=cf4e22e33face83d08e9b8c15247a291ad9b6d25;hb=02b63185a22e64edaed916daa8559d769eb7bc5f;hp=be8696bfe5a2182c645570368dea9d168c19ad77;hpb=91c7e5c378b1a639c6f5383915ed68b36b7735d4;p=chaz%2Fopenbox diff --git a/otk/display.cc b/otk/display.cc index be8696bf..cf4e22e3 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -41,7 +41,7 @@ extern "C" { # include #endif // HAVE_UNISTD_H -#include "gettext.h" +#include "../src/gettext.h" #define _(str) gettext(str) } @@ -52,21 +52,22 @@ Display *display = (Display*) 0; static int xerrorHandler(::Display *d, XErrorEvent *e) { + if (!display->ignoreErrors()) { #ifdef DEBUG - char errtxt[128]; - - //if (e->error_code != BadWindow) - { - XGetErrorText(d, e->error_code, errtxt, 128); - printf("X Error: %s\n", errtxt); - if (e->error_code != BadWindow) - abort(); - } + char errtxt[128]; + + //if (e->error_code != BadWindow) + { + XGetErrorText(d, e->error_code, errtxt, 127); + printf("X Error: %s\n", errtxt); + if (e->error_code != BadWindow) + abort(); + } #else - (void)d; - (void)e; + (void)d; + (void)e; #endif - + } return false; } @@ -216,10 +217,19 @@ const RenderControl *Display::renderControl(int snum) const } +void Display::setIgnoreErrors(bool t) +{ + _ignore_errors = t; + // sync up so that anything already sent is/isn't ignored! + XSync(_display, false); +} + void Display::grab() { - if (_grab_count == 0) + if (_grab_count == 0) { XGrabServer(_display); + XSync(_display, false); // make sure it kicks in + } _grab_count++; } @@ -228,8 +238,10 @@ void Display::ungrab() { if (_grab_count == 0) return; _grab_count--; - if (_grab_count == 0) + if (_grab_count == 0) { XUngrabServer(_display); + XFlush(_display); // ungrab as soon as possible + } }