]> Dogcows Code - chaz/openbox/blobdiff - otk/display.cc
compiles with the new render subsystem...
[chaz/openbox] / otk / display.cc
index 9bacfca18431c7b8b85f08b459ec5b52dec2608c..68f0862b99e534c6f6a3b55c3fb977a0bc261253 100644 (file)
@@ -7,6 +7,7 @@
 #include "display.hh"
 #include "screeninfo.hh"
 #include "gccache.hh"
+#include "rendercontrol.hh"
 #include "util.hh"
 
 extern "C" {
@@ -83,12 +84,15 @@ Display::Display()
     _num_lock_mask(0),
     _scroll_lock_mask(0),
     _grab_count(0),
-    _screenInfoList(),
+    _screeninfo_list(0),
+    _rendercontrol_list(0),
     _gccache((GCCache*) 0)
 {
   int junk;
   (void)junk;
 
+  display = this;
+  
   // Open the X display
   if (!(_display = XOpenDisplay(NULL))) {
     printf(_("Unable to open connection to the X server. Please set the \n\
@@ -163,12 +167,16 @@ DISPLAY environment variable approriately.\n\n"));
   _mask_list[6] = _scroll_lock_mask | _num_lock_mask;
   _mask_list[7] = _scroll_lock_mask | LockMask | _num_lock_mask;
 
-  // Get information on all the screens which are available.
-  _screenInfoList.reserve(ScreenCount(_display));
-  for (int i = 0; i < ScreenCount(_display); ++i)
-    _screenInfoList.push_back(ScreenInfo(i));
+  // Get information on all the screens which are available, and create their
+  // RenderControl
+  _screeninfo_list = new ScreenInfo*[ScreenCount(_display)];
+  _rendercontrol_list = new RenderControl*[ScreenCount(_display)];
+  for (int i = 0; i < ScreenCount(_display); ++i) {
+    _screeninfo_list[i] = new ScreenInfo(i);
+    _rendercontrol_list[i] = RenderControl::getRenderControl(i);
+  }
 
-  _gccache = new GCCache(_screenInfoList.size());
+  _gccache = new GCCache(ScreenCount(_display));
 }
 
 
@@ -177,6 +185,14 @@ Display::~Display()
   delete _gccache;
   while (_grab_count > 0)
     ungrab();
+
+  for (int i = 0; i < ScreenCount(_display); ++i) {
+    delete _rendercontrol_list[i];
+    delete _screeninfo_list[i];
+  }
+  delete [] _rendercontrol_list;
+  delete [] _screeninfo_list;
+  
   XCloseDisplay(_display);
 }
 
@@ -184,21 +200,28 @@ Display::~Display()
 const ScreenInfo* Display::screenInfo(int snum)
 {
   assert(snum >= 0);
-  assert(snum < static_cast<int>(_screenInfoList.size()));
-  return &_screenInfoList[snum];
+  assert(snum < (signed) ScreenCount(_display));
+  return _screeninfo_list[snum];
 }
 
 
 const ScreenInfo* Display::findScreen(Window root)
 {
-  ScreenInfoList::iterator it, end = _screenInfoList.end();
-  for (it = _screenInfoList.begin(); it != end; ++it)
-    if (it->rootWindow() == root)
-      return &(*it);
+  for (int i = 0; i < ScreenCount(_display); ++i)
+    if (_screeninfo_list[i]->rootWindow() == root)
+      return _screeninfo_list[i];
   return 0;
 }
 
 
+const RenderControl *Display::renderControl(int snum)
+{
+  assert(snum >= 0);
+  assert(snum < (signed) ScreenCount(_display));
+  return _rendercontrol_list[snum];
+}
+
+
 void Display::grab()
 {
   if (_grab_count == 0)
This page took 0.024268 seconds and 4 git commands to generate.