]> Dogcows Code - chaz/openbox/blobdiff - otk/display.cc
add the swig generated files
[chaz/openbox] / otk / display.cc
index 459244283e4a99f59fa4aa50ca45346f5f0a802c..7fafed0c092bc3611295042c9d9422a5f398970b 100644 (file)
@@ -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"
 extern "C" {
 #include <X11/keysym.h>
 
+#ifdef    SHAPE
+#include <X11/extensions/shape.h>
+#endif // SHAPE
+
 #ifdef    HAVE_STDIO_H
 #  include <stdio.h>
 #endif // HAVE_STDIO_H
@@ -41,12 +45,13 @@ namespace otk {
 
 Display *OBDisplay::display = (Display*) 0;
 bool OBDisplay::_shape = false;
-int  OBDisplay::_shape_event_basep;
+int  OBDisplay::_shape_event_basep = 0;
 bool OBDisplay::_xinerama = false;
-int  OBDisplay::_xinerama_event_basep;
+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)
@@ -54,8 +59,11 @@ int OBDisplay::xerrorHandler(Display *d, XErrorEvent *e)
 #ifdef DEBUG
   char errtxt[128];
 
-  XGetErrorText(d, e->error_code, errtxt, 128);
-  printf("X Error: %s\n", errtxt);
+  //if (e->error_code != BadWindow)
+  {
+    XGetErrorText(d, e->error_code, errtxt, 128);
+    printf("X Error: %s\n", errtxt);
+  }
 #else
   (void)d;
   (void)e;
@@ -158,8 +166,28 @@ void OBDisplay::destroy()
 }
 
 
+const ScreenInfo* OBDisplay::screenInfo(int snum) {
+  assert(snum >= 0);
+  assert(snum < static_cast<int>(_screenInfoList.size()));
+  return &_screenInfoList[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);
+}
 
 
 
This page took 0.02502 seconds and 4 git commands to generate.