diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-29 08:50:12 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-29 08:50:12 +0000 |
| commit | 0f2bcee0cdad317a86230b43f437e0243165277b (patch) | |
| tree | 9704152f4be6b4e59e75eb6486fffd0928a19173 | |
| parent | c5b2de2e1ae3e27e38fadf4add790511ec597453 (diff) | |
allow for ignoring x errors.
make grab() sunc immediately and ungrab() flush
| -rw-r--r-- | otk/display.cc | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/otk/display.cc b/otk/display.cc index 21c348ea..21215e2b 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -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, 128); + 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 + } } |
