]> Dogcows Code - chaz/openbox/blobdiff - src/screen.cc
new timer infrastructure. takes a function pointer for the timeout, with a void*...
[chaz/openbox] / src / screen.cc
index 37e5a1945bf54a0ae26c522c8e49f5937d0bee9e..f8b998e6687f0bddfd51faaa47bc549853792931 100644 (file)
@@ -1,25 +1,4 @@
 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
-// Screen.cc for Blackbox - an X11 Window manager
-// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh@debian.org>
-// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
 
 #ifdef    HAVE_CONFIG_H
 #include "../config.h"
@@ -75,11 +54,12 @@ extern "C" {
 #include <string>
 using std::string;
 
-#include "blackbox.hh"
-#include "font.hh"
-#include "gccache.hh"
-#include "image.hh"
 #include "screen.hh"
+#include "otk/font.hh"
+#include "otk/gccache.hh"
+#include "otk/image.hh"
+#include "otk/assassin.hh"
+#include "openbox.hh"
 #include "util.hh"
 #include "window.hh"
 #include "workspace.hh"
@@ -90,6 +70,7 @@ using std::string;
 #define   FONT_ELEMENT_SIZE 50
 #endif // FONT_ELEMENT_SIZE
 
+namespace ob {
 
 static bool running = True;
 
@@ -105,7 +86,7 @@ static int anotherWMRunning(Display *display, XErrorEvent *) {
 }
 
 
-BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) {
+BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(scrn) {
   blackbox = bb;
   screenstr = "session.screen" + itostring(scrn) + '.';
   config = blackbox->getConfig();
@@ -115,8 +96,8 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) {
     SubstructureRedirectMask | ButtonPressMask | ButtonReleaseMask;
 
   XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning);
-  XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), event_mask);
-  XSync(getBaseDisplay()->getXDisplay(), False);
+  XSelectInput(otk::OBDisplay::display, getRootWindow(), event_mask);
+  XSync(otk::OBDisplay::display, False);
   XSetErrorHandler((XErrorHandler) old);
 
   managed = running;
@@ -127,7 +108,7 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) {
           getScreenNumber(), XVisualIDFromVisual(getVisual()),
           getDepth());
 
-  resource.wstyle.font = (BFont *) 0;
+  resource.wstyle.font = (otk::BFont *) 0;
 
   geom_pixmap = None;
 
@@ -145,14 +126,15 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) {
                   XAtom::cardinal, viewport, 2);
                   
 
-  XDefineCursor(blackbox->getXDisplay(), getRootWindow(),
+  XDefineCursor(otk::OBDisplay::display, getRootWindow(),
                 blackbox->getSessionCursor());
 
   updateAvailableArea();
 
   image_control =
-    new BImageControl(blackbox, this, True, blackbox->getColorsPerChannel(),
-                      blackbox->getCacheLife(), blackbox->getCacheMax());
+    new otk::BImageControl(Openbox::instance->timerManager(),
+                           this, True, blackbox->getColorsPerChannel(),
+                           blackbox->getCacheLife(), blackbox->getCacheMax());
   image_control->installRootColormap();
   root_colormap_installed = True;
 
@@ -160,11 +142,11 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) {
   LoadStyle();
 
   XGCValues gcv;
-  gcv.foreground = WhitePixel(blackbox->getXDisplay(), getScreenNumber())
-    ^ BlackPixel(blackbox->getXDisplay(), getScreenNumber());
+  gcv.foreground = WhitePixel(otk::OBDisplay::display, getScreenNumber())
+    ^ BlackPixel(otk::OBDisplay::display, getScreenNumber());
   gcv.function = GXxor;
   gcv.subwindow_mode = IncludeInferiors;
-  opGC = XCreateGC(blackbox->getXDisplay(), getRootWindow(),
+  opGC = XCreateGC(otk::OBDisplay::display, getRootWindow(),
                    GCForeground | GCFunction | GCSubwindowMode, &gcv);
 
   const char *s = "0: 0000 x 0: 0000";
@@ -177,23 +159,23 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) {
   attrib.colormap = getColormap();
   attrib.save_under = True;
 
-  geom_window = XCreateWindow(blackbox->getXDisplay(), getRootWindow(),
+  geom_window = XCreateWindow(otk::OBDisplay::display, getRootWindow(),
                               0, 0, geom_w, geom_h, resource.border_width,
                               getDepth(), InputOutput, getVisual(),
                               mask, &attrib);
   geom_visible = False;
 
-  BTexture* texture = &(resource.wstyle.l_focus);
+  otk::BTexture* texture = &(resource.wstyle.l_focus);
   geom_pixmap = texture->render(geom_w, geom_h, geom_pixmap);
   if (geom_pixmap == ParentRelative) {
     texture = &(resource.wstyle.t_focus);
     geom_pixmap = texture->render(geom_w, geom_h, geom_pixmap);
   }
   if (! geom_pixmap)
-    XSetWindowBackground(blackbox->getXDisplay(), geom_window,
+    XSetWindowBackground(otk::OBDisplay::display, geom_window,
                          texture->color().pixel());
   else
-    XSetWindowBackgroundPixmap(blackbox->getXDisplay(),
+    XSetWindowBackgroundPixmap(otk::OBDisplay::display,
                                geom_window, geom_pixmap);
 
   if (resource.workspaces > 0) {
@@ -224,14 +206,14 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) {
 
   unsigned int i, j, nchild;
   Window r, p, *children;
-  XQueryTree(blackbox->getXDisplay(), getRootWindow(), &r, &p,
+  XQueryTree(otk::OBDisplay::display, getRootWindow(), &r, &p,
              &children, &nchild);
 
   // preen the window list of all icon windows... for better dockapp support
   for (i = 0; i < nchild; i++) {
     if (children[i] == None) continue;
 
-    XWMHints *wmhints = XGetWMHints(blackbox->getXDisplay(),
+    XWMHints *wmhints = XGetWMHints(otk::OBDisplay::display,
                                     children[i]);
 
     if (wmhints) {
@@ -255,7 +237,7 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) {
       continue;
 
     XWindowAttributes attrib;
-    if (XGetWindowAttributes(blackbox->getXDisplay(), children[i], &attrib)) {
+    if (XGetWindowAttributes(otk::OBDisplay::display, children[i], &attrib)) {
       if (attrib.override_redirect) continue;
 
       if (attrib.map_state != IsUnmapped) {
@@ -278,12 +260,12 @@ BScreen::~BScreen(void) {
     image_control->removeImage(geom_pixmap);
 
   if (geom_window != None)
-    XDestroyWindow(blackbox->getXDisplay(), geom_window);
+    XDestroyWindow(otk::OBDisplay::display, geom_window);
 
   std::for_each(workspacesList.begin(), workspacesList.end(),
-                PointerAssassin());
+                otk::PointerAssassin());
 
-  std::for_each(iconList.begin(), iconList.end(), PointerAssassin());
+  std::for_each(iconList.begin(), iconList.end(), otk::PointerAssassin());
 
   while (! systrayWindowList.empty())
     removeSystrayWindow(systrayWindowList[0]);
@@ -293,22 +275,20 @@ BScreen::~BScreen(void) {
   if (resource.wstyle.font)
     delete resource.wstyle.font;
 
-#ifdef    BITMAPBUTTONS
   if (resource.wstyle.close_button.mask != None)
-    XFreePixmap(blackbox->getXDisplay(), resource.wstyle.close_button.mask);
+    XFreePixmap(otk::OBDisplay::display, resource.wstyle.close_button.mask);
   if (resource.wstyle.max_button.mask != None)
-    XFreePixmap(blackbox->getXDisplay(), resource.wstyle.max_button.mask);
+    XFreePixmap(otk::OBDisplay::display, resource.wstyle.max_button.mask);
   if (resource.wstyle.icon_button.mask != None)
-    XFreePixmap(blackbox->getXDisplay(), resource.wstyle.icon_button.mask);
+    XFreePixmap(otk::OBDisplay::display, resource.wstyle.icon_button.mask);
   if (resource.wstyle.stick_button.mask != None)
-    XFreePixmap(blackbox->getXDisplay(), resource.wstyle.stick_button.mask);
+    XFreePixmap(otk::OBDisplay::display, resource.wstyle.stick_button.mask);
 
   resource.wstyle.max_button.mask = resource.wstyle.close_button.mask =
     resource.wstyle.icon_button.mask =
     resource.wstyle.stick_button.mask = None;
-#endif // BITMAPBUTTONS
   
-  XFreeGC(blackbox->getXDisplay(), opGC);
+  XFreeGC(otk::OBDisplay::display, opGC);
 }
 
 
@@ -745,7 +725,7 @@ void BScreen::changeWorkspaceCount(unsigned int new_count) {
 void BScreen::reconfigure(void) {
   // don't reconfigure while saving the initial rc file, it's a waste and it
   // breaks somethings (workspace names)
-  if (blackbox->isStartup()) return;
+  if (blackbox->state() == Openbox::State_Starting) return;
 
   load_rc();
   LoadStyle();
@@ -755,11 +735,11 @@ void BScreen::reconfigure(void) {
   changeWorkspaceCount(resource.workspaces);
 
   XGCValues gcv;
-  gcv.foreground = WhitePixel(blackbox->getXDisplay(),
+  gcv.foreground = WhitePixel(otk::OBDisplay::display,
                               getScreenNumber());
   gcv.function = GXinvert;
   gcv.subwindow_mode = IncludeInferiors;
-  XChangeGC(blackbox->getXDisplay(), opGC,
+  XChangeGC(otk::OBDisplay::display, opGC,
             GCForeground | GCFunction | GCSubwindowMode, &gcv);
 
   const char *s = "0: 0000 x 0: 0000";
@@ -767,22 +747,22 @@ void BScreen::reconfigure(void) {
   geom_w = resource.wstyle.font->measureString(s) + resource.bevel_width * 2;
   geom_h = resource.wstyle.font->height() + resource.bevel_width * 2;
 
-  BTexture* texture = &(resource.wstyle.l_focus);
+  otk::BTexture* texture = &(resource.wstyle.l_focus);
   geom_pixmap = texture->render(geom_w, geom_h, geom_pixmap);
   if (geom_pixmap == ParentRelative) {
     texture = &(resource.wstyle.t_focus);
     geom_pixmap = texture->render(geom_w, geom_h, geom_pixmap);
   }
   if (! geom_pixmap)
-    XSetWindowBackground(blackbox->getXDisplay(), geom_window,
+    XSetWindowBackground(otk::OBDisplay::display, geom_window,
                          texture->color().pixel());
   else
-    XSetWindowBackgroundPixmap(blackbox->getXDisplay(),
+    XSetWindowBackgroundPixmap(otk::OBDisplay::display,
                                geom_window, geom_pixmap);
 
-  XSetWindowBorderWidth(blackbox->getXDisplay(), geom_window,
+  XSetWindowBorderWidth(otk::OBDisplay::display, geom_window,
                         resource.border_width);
-  XSetWindowBorder(blackbox->getXDisplay(), geom_window,
+  XSetWindowBorder(otk::OBDisplay::display, geom_window,
                    resource.border_color.pixel());
 
   typedef std::vector<int> SubList;
@@ -800,7 +780,7 @@ void BScreen::reconfigure(void) {
       bw->reconfigure();
   }
 
-  image_control->timeout();
+  otk::BImageControl::timeout(image_control);
 }
 
 
@@ -858,15 +838,14 @@ void BScreen::LoadStyle(void) {
   resource.wstyle.b_pressed_unfocus =
     readDatabaseTexture("window.button.pressed.unfocus", "black", style, true);
 
-#ifdef    BITMAPBUTTONS
   if (resource.wstyle.close_button.mask != None)
-    XFreePixmap(blackbox->getXDisplay(), resource.wstyle.close_button.mask);
+    XFreePixmap(otk::OBDisplay::display, resource.wstyle.close_button.mask);
   if (resource.wstyle.max_button.mask != None)
-    XFreePixmap(blackbox->getXDisplay(), resource.wstyle.max_button.mask);
+    XFreePixmap(otk::OBDisplay::display, resource.wstyle.max_button.mask);
   if (resource.wstyle.icon_button.mask != None)
-    XFreePixmap(blackbox->getXDisplay(), resource.wstyle.icon_button.mask);
+    XFreePixmap(otk::OBDisplay::display, resource.wstyle.icon_button.mask);
   if (resource.wstyle.stick_button.mask != None)
-    XFreePixmap(blackbox->getXDisplay(), resource.wstyle.stick_button.mask);
+    XFreePixmap(otk::OBDisplay::display, resource.wstyle.stick_button.mask);
 
   resource.wstyle.close_button.mask = resource.wstyle.max_button.mask =
     resource.wstyle.icon_button.mask =
@@ -880,18 +859,18 @@ void BScreen::LoadStyle(void) {
                    style);
   readDatabaseMask("window.button.stick.mask", resource.wstyle.stick_button,
                    style);
-#endif // BITMAPBUTTONS
 
   // we create the window.frame texture by hand because it exists only to
   // make the code cleaner and is not actually used for display
-  BColor color = readDatabaseColor("window.frame.focusColor", "white", style);
-  resource.wstyle.f_focus = BTexture("solid flat", getBaseDisplay(),
-                                     getScreenNumber(), image_control);
+  otk::BColor color = readDatabaseColor("window.frame.focusColor", "white",
+                                        style);
+  resource.wstyle.f_focus = otk::BTexture("solid flat", getScreenNumber(),
+                                          image_control);
   resource.wstyle.f_focus.setColor(color);
 
   color = readDatabaseColor("window.frame.unfocusColor", "white", style);
-  resource.wstyle.f_unfocus = BTexture("solid flat", getBaseDisplay(),
-                                       getScreenNumber(), image_control);
+  resource.wstyle.f_unfocus = otk::BTexture("solid flat", getScreenNumber(),
+                                            image_control);
   resource.wstyle.f_unfocus.setColor(color);
 
   resource.wstyle.l_text_focus =
@@ -912,13 +891,13 @@ void BScreen::LoadStyle(void) {
   }
 
   // sanity checks
-  if (resource.wstyle.t_focus.texture() == BTexture::Parent_Relative)
+  if (resource.wstyle.t_focus.texture() == otk::BTexture::Parent_Relative)
     resource.wstyle.t_focus = resource.wstyle.f_focus;
-  if (resource.wstyle.t_unfocus.texture() == BTexture::Parent_Relative)
+  if (resource.wstyle.t_unfocus.texture() == otk::BTexture::Parent_Relative)
     resource.wstyle.t_unfocus = resource.wstyle.f_unfocus;
-  if (resource.wstyle.h_focus.texture() == BTexture::Parent_Relative)
+  if (resource.wstyle.h_focus.texture() == otk::BTexture::Parent_Relative)
     resource.wstyle.h_focus = resource.wstyle.f_focus;
-  if (resource.wstyle.h_unfocus.texture() == BTexture::Parent_Relative)
+  if (resource.wstyle.h_unfocus.texture() == otk::BTexture::Parent_Relative)
     resource.wstyle.h_unfocus = resource.wstyle.f_unfocus;
 
   resource.border_color =
@@ -1046,12 +1025,12 @@ void BScreen::changeWorkspaceID(unsigned int id) {
   BlackboxWindow *win = (BlackboxWindow *) 0;
   bool f = False;
 
-  XSync(blackbox->getXDisplay(), False);
+  XSync(otk::OBDisplay::display, False);
 
   // If sloppy focus and we can find the client window under the pointer,
   // try to focus it.  
   if (resource.sloppy_focus &&
-      XQueryPointer(blackbox->getXDisplay(), getRootWindow(), &r, &c,
+      XQueryPointer(otk::OBDisplay::display, getRootWindow(), &r, &c,
                     &rx, &ry, &x, &y, &m) &&
       c != None) {
     if ( (win = blackbox->searchWindow(c)) )
@@ -1137,21 +1116,21 @@ void BScreen::updateStackingList(void) {
 
 
 void BScreen::addSystrayWindow(Window window) {
-  XGrabServer(blackbox->getXDisplay());
+  XGrabServer(otk::OBDisplay::display);
   
-  XSelectInput(blackbox->getXDisplay(), window, StructureNotifyMask);
+  XSelectInput(otk::OBDisplay::display, window, StructureNotifyMask);
   systrayWindowList.push_back(window);
   xatom->setValue(getRootWindow(), XAtom::kde_net_system_tray_windows,
                   XAtom::window,
                   &systrayWindowList[0], systrayWindowList.size());
   blackbox->saveSystrayWindowSearch(window, this);
 
-  XUngrabServer(blackbox->getXDisplay());
+  XUngrabServer(otk::OBDisplay::display);
 }
 
 
 void BScreen::removeSystrayWindow(Window window) {
-  XGrabServer(blackbox->getXDisplay());
+  XGrabServer(otk::OBDisplay::display);
   
   WindowList::iterator it = systrayWindowList.begin();
   const WindowList::iterator end = systrayWindowList.end();
@@ -1162,13 +1141,13 @@ void BScreen::removeSystrayWindow(Window window) {
                       XAtom::window,
                       &systrayWindowList[0], systrayWindowList.size());
       blackbox->removeSystrayWindowSearch(window);
-      XSelectInput(blackbox->getXDisplay(), window, NoEventMask);
+      XSelectInput(otk::OBDisplay::display, window, NoEventMask);
       break;
     }
 
   assert(it != end);    // not a systray window
 
-  XUngrabServer(blackbox->getXDisplay());
+  XUngrabServer(otk::OBDisplay::display);
 }
 
 
@@ -1182,7 +1161,7 @@ void BScreen::manageWindow(Window w) {
   }
 
   // is the window a docking app
-  XWMHints *wmhint = XGetWMHints(blackbox->getXDisplay(), w);
+  XWMHints *wmhint = XGetWMHints(otk::OBDisplay::display, w);
   if (wmhint && (wmhint->flags & StateHint) &&
       wmhint->initial_state == WithdrawnState) {
     //slit->addClient(w);
@@ -1208,7 +1187,9 @@ void BScreen::manageWindow(Window w) {
   
   XMapRequestEvent mre;
   mre.window = w;
-  if (blackbox->isStartup() && win->isNormal()) win->restoreAttributes();
+  if (blackbox->state() == Openbox::State_Starting &&
+      win->isNormal())
+    win->restoreAttributes();
   win->mapRequestEvent(&mre);
 }
 
@@ -1284,7 +1265,7 @@ void BScreen::updateWorkArea(void) {
     unsigned long *dims = new unsigned long[4 * workspacesList.size()];
     for (unsigned int i = 0, m = workspacesList.size(); i < m; ++i) {
       // XXX: this could be different for each workspace
-      const Rect &area = availableArea();
+      const otk::Rect &area = availableArea();
       dims[(i * 4) + 0] = area.x();
       dims[(i * 4) + 1] = area.y();
       dims[(i * 4) + 2] = area.width();
@@ -1334,7 +1315,7 @@ void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) {
   while (k--)
     *(session_stack + i++) = *(workspace_stack + k);
 
-  XRestackWindows(blackbox->getXDisplay(), session_stack, i);
+  XRestackWindows(otk::OBDisplay::display, session_stack, i);
 
   delete [] session_stack;
 
@@ -1348,7 +1329,7 @@ void BScreen::lowerWindows(Window *workspace_stack, unsigned int num) {
   Window *session_stack = new Window[(num + desktopWindowList.size())];
   unsigned int i = 0, k = num;
 
-  XLowerWindow(blackbox->getXDisplay(), workspace_stack[0]);
+  XLowerWindow(otk::OBDisplay::display, workspace_stack[0]);
 
   while (k--)
     *(session_stack + i++) = *(workspace_stack + k);
@@ -1358,7 +1339,7 @@ void BScreen::lowerWindows(Window *workspace_stack, unsigned int num) {
   for (; dit != d_end; ++dit)
     *(session_stack + i++) = *dit;
 
-  XRestackWindows(blackbox->getXDisplay(), session_stack, i);
+  XRestackWindows(otk::OBDisplay::display, session_stack, i);
 
   delete [] session_stack;
 
@@ -1463,8 +1444,8 @@ void BScreen::raiseFocus(void) const {
 
 
 void BScreen::shutdown(void) {
-  XSelectInput(blackbox->getXDisplay(), getRootWindow(), NoEventMask);
-  XSync(blackbox->getXDisplay(), False);
+  XSelectInput(otk::OBDisplay::display, getRootWindow(), NoEventMask);
+  XSync(otk::OBDisplay::display, False);
 
   while(! windowList.empty())
     unmanageWindow(windowList.front(), True);
@@ -1479,11 +1460,11 @@ void BScreen::shutdown(void) {
 
 void BScreen::showPosition(int x, int y) {
   if (! geom_visible) {
-    XMoveResizeWindow(blackbox->getXDisplay(), geom_window,
+    XMoveResizeWindow(otk::OBDisplay::display, geom_window,
                       (getWidth() - geom_w) / 2,
                       (getHeight() - geom_h) / 2, geom_w, geom_h);
-    XMapWindow(blackbox->getXDisplay(), geom_window);
-    XRaiseWindow(blackbox->getXDisplay(), geom_window);
+    XMapWindow(otk::OBDisplay::display, geom_window);
+    XRaiseWindow(otk::OBDisplay::display, geom_window);
 
     geom_visible = True;
   }
@@ -1492,7 +1473,7 @@ void BScreen::showPosition(int x, int y) {
 
   sprintf(label, "X: %4d x Y: %4d", x, y);
 
-  XClearWindow(blackbox->getXDisplay(), geom_window);
+  XClearWindow(otk::OBDisplay::display, geom_window);
 
   resource.wstyle.font->drawString(geom_window,
                                    resource.bevel_width, resource.bevel_width,
@@ -1503,11 +1484,11 @@ void BScreen::showPosition(int x, int y) {
 
 void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
   if (! geom_visible) {
-    XMoveResizeWindow(blackbox->getXDisplay(), geom_window,
+    XMoveResizeWindow(otk::OBDisplay::display, geom_window,
                       (getWidth() - geom_w) / 2,
                       (getHeight() - geom_h) / 2, geom_w, geom_h);
-    XMapWindow(blackbox->getXDisplay(), geom_window);
-    XRaiseWindow(blackbox->getXDisplay(), geom_window);
+    XMapWindow(otk::OBDisplay::display, geom_window);
+    XRaiseWindow(otk::OBDisplay::display, geom_window);
 
     geom_visible = True;
   }
@@ -1516,7 +1497,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
 
   sprintf(label, "W: %4d x H: %4d", gx, gy);
 
-  XClearWindow(blackbox->getXDisplay(), geom_window);
+  XClearWindow(otk::OBDisplay::display, geom_window);
 
   resource.wstyle.font->drawString(geom_window,
                                    resource.bevel_width, resource.bevel_width,
@@ -1527,7 +1508,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
 
 void BScreen::hideGeometry(void) {
   if (geom_visible) {
-    XUnmapWindow(blackbox->getXDisplay(), geom_window);
+    XUnmapWindow(otk::OBDisplay::display, geom_window);
     geom_visible = False;
   }
 }
@@ -1543,7 +1524,7 @@ void BScreen::removeStrut(Strut *strut) {
 }
 
 
-const Rect& BScreen::availableArea(void) const {
+const otk::Rect& BScreen::availableArea(void) const {
   if (doFullMax())
     return getRect(); // return the full screen
   return usableArea;
@@ -1563,7 +1544,7 @@ const RectList& BScreen::allAvailableAreas(void) const {
 
 
 void BScreen::updateAvailableArea(void) {
-  Rect old_area = usableArea;
+  otk::Rect old_area = usableArea;
   usableArea = getRect(); // reset to full screen
 
 #ifdef    XINERAMA
@@ -1691,7 +1672,6 @@ void BScreen::toggleFocusModel(FocusModel model) {
                 std::mem_fun(&BlackboxWindow::grabButtons));
 }
 
-#ifdef    BITMAPBUTTONS
 void BScreen::readDatabaseMask(const string &rname, PixmapMask &pixmapMask,
                                const Configuration &style) {
   string s;
@@ -1703,11 +1683,11 @@ void BScreen::readDatabaseMask(const string &rname, PixmapMask &pixmapMask,
     if (s[0] != '/' && s[0] != '~')
     {
       std::string xbmFile = std::string("~/.openbox/buttons/") + s;
-      ret = XReadBitmapFile(blackbox->getXDisplay(), getRootWindow(),
+      ret = XReadBitmapFile(otk::OBDisplay::display, getRootWindow(),
                             expandTilde(xbmFile).c_str(), &pixmapMask.w,
                             &pixmapMask.h, &pixmapMask.mask, &hx, &hy);
     } else
-      ret = XReadBitmapFile(blackbox->getXDisplay(), getRootWindow(),
+      ret = XReadBitmapFile(otk::OBDisplay::display, getRootWindow(),
                             expandTilde(s).c_str(), &pixmapMask.w,
                             &pixmapMask.h, &pixmapMask.mask, &hx, &hy);
     
@@ -1718,27 +1698,26 @@ void BScreen::readDatabaseMask(const string &rname, PixmapMask &pixmapMask,
   pixmapMask.mask = None;
   pixmapMask.w = pixmapMask.h = 0;
 }
-#endif // BITMAPSUCCESS
 
-BTexture BScreen::readDatabaseTexture(const string &rname,
-                                      const string &default_color,
-                                      const Configuration &style, 
-                                      bool allowNoTexture) {
-  BTexture texture;
+otk::BTexture BScreen::readDatabaseTexture(const string &rname,
+                                           const string &default_color,
+                                           const Configuration &style, 
+                                           bool allowNoTexture) {
+  otk::BTexture texture;
   string s;
 
   if (style.getValue(rname, s))
-    texture = BTexture(s);
+    texture = otk::BTexture(s);
   else if (allowNoTexture) //no default
-    texture.setTexture(BTexture::NoTexture);
+    texture.setTexture(otk::BTexture::NoTexture);
   else
-    texture.setTexture(BTexture::Solid | BTexture::Flat);
+    texture.setTexture(otk::BTexture::Solid | otk::BTexture::Flat);
 
   // associate this texture with this screen
-  texture.setDisplay(getBaseDisplay(), getScreenNumber());
+  texture.setScreen(getScreenNumber());
   texture.setImageControl(image_control);
 
-  if (texture.texture() != BTexture::NoTexture) {
+  if (texture.texture() != otk::BTexture::NoTexture) {
     texture.setColor(readDatabaseColor(rname + ".color", default_color,
                                        style));
     texture.setColorTo(readDatabaseColor(rname + ".colorTo", default_color,
@@ -1751,21 +1730,21 @@ BTexture BScreen::readDatabaseTexture(const string &rname,
 }
 
 
-BColor BScreen::readDatabaseColor(const string &rname,
-                                  const string &default_color,
-                                  const Configuration &style) {
-  BColor color;
+otk::BColor BScreen::readDatabaseColor(const string &rname,
+                                       const string &default_color,
+                                       const Configuration &style) {
+  otk::BColor color;
   string s;
   if (style.getValue(rname, s))
-    color = BColor(s, getBaseDisplay(), getScreenNumber());
+    color = otk::BColor(s, getScreenNumber());
   else
-    color = BColor(default_color, getBaseDisplay(), getScreenNumber());
+    color = otk::BColor(default_color, getScreenNumber());
   return color;
 }
 
 
-BFont *BScreen::readDatabaseFont(const string &rbasename,
-                                 const Configuration &style) {
+otk::BFont *BScreen::readDatabaseFont(const string &rbasename,
+                                      const Configuration &style) {
   string fontname;
 
   string s;
@@ -1800,9 +1779,9 @@ BFont *BScreen::readDatabaseFont(const string &rbasename,
     }
 
     
-    BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold,
-                         italic, dropShadow && resource.shadow_fonts, offset, 
-                         tint, resource.aa_fonts);
+    otk::BFont *b = new otk::BFont(getScreenNumber(), family, i, bold, italic,
+                                   dropShadow && resource.shadow_fonts,
+                                   offset, tint, resource.aa_fonts);
     if (b->valid())
       return b;
     delete b;
@@ -1810,3 +1789,5 @@ BFont *BScreen::readDatabaseFont(const string &rbasename,
     
   exit(2);  // can't continue without a font
 }
+
+}
This page took 0.051275 seconds and 4 git commands to generate.