X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=otk%2Fdisplay.cc;h=7fafed0c092bc3611295042c9d9422a5f398970b;hb=f9107b5c5a4cc03bf544854e8d6d1ba83f6cd979;hp=4613b9ba9a5b5da75b8a5b5a43d5fdfeeb2c96e8;hpb=9d5865a1603733e62fda7c8d61024cb05bf6792c;p=chaz%2Fopenbox diff --git a/otk/display.cc b/otk/display.cc index 4613b9ba..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" @@ -51,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) @@ -172,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); +}