X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fdisplay.cc;h=7fafed0c092bc3611295042c9d9422a5f398970b;hb=2b2f81b93c89c2a2d6abc3b12dee66b8e2a0452d;hp=980fcaaadefa1ce89ba32f1ecd39a1d0cba5b781;hpb=16c00e34f310707bc8a8afde5c884e904c2e04db;p=chaz%2Fopenbox diff --git a/otk/display.cc b/otk/display.cc index 980fcaaa..7fafed0c 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -1,4 +1,4 @@ -// -*- mode: C++; indent-tabs-mode: nil; -*- +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- #ifdef HAVE_CONFIG_H # include "../config.h" @@ -11,6 +11,10 @@ extern "C" { #include +#ifdef SHAPE +#include +#endif // SHAPE + #ifdef HAVE_STDIO_H # include #endif // HAVE_STDIO_H @@ -47,6 +51,7 @@ int OBDisplay::_xinerama_event_basep = 0; unsigned int OBDisplay::_mask_list[8]; OBDisplay::ScreenInfoList OBDisplay::_screenInfoList; BGCCache *OBDisplay::_gccache = (BGCCache*) 0; +int OBDisplay::_grab_count = 0; int OBDisplay::xerrorHandler(Display *d, XErrorEvent *e) @@ -168,6 +173,21 @@ const ScreenInfo* OBDisplay::screenInfo(int snum) { } +void OBDisplay::grab() +{ + if (_grab_count == 0) + XGrabServer(display); + _grab_count++; +} + + +void OBDisplay::ungrab() +{ + if (_grab_count == 0) return; + _grab_count--; + if (_grab_count == 0) + XUngrabServer(display); +}