From 72af8cea6a0573f7d2c004102cd04f1a1ad88798 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 14 Apr 2002 13:58:17 +0000 Subject: [PATCH] using some references instead of pointers where possible in Screen, ScreenInfo, Slit, Toolbar, and Netizen --- src/BaseDisplay.cc | 21 ++- src/BaseDisplay.h | 6 +- src/Basemenu.cc | 2 +- src/Configmenu.cc | 8 +- src/Netizen.cc | 50 +++---- src/Netizen.h | 6 +- src/Rootmenu.cc | 4 +- src/Screen.cc | 360 ++++++++++++++++++++++----------------------- src/Screen.h | 6 +- src/Slit.cc | 217 ++++++++++++++------------- src/Slit.h | 6 +- src/Toolbar.cc | 353 ++++++++++++++++++++++---------------------- src/Toolbar.h | 6 +- src/Window.cc | 2 +- src/Windowmenu.cc | 2 +- src/Workspace.cc | 14 +- src/openbox.cc | 2 +- 17 files changed, 527 insertions(+), 538 deletions(-) diff --git a/src/BaseDisplay.cc b/src/BaseDisplay.cc index 0474fd1e..852fa8ca 100644 --- a/src/BaseDisplay.cc +++ b/src/BaseDisplay.cc @@ -337,7 +337,7 @@ BaseDisplay::BaseDisplay(char *app_name, char *dpy_name) { screenInfoList = new LinkedList; for (int i = 0; i < number_of_screens; i++) { - ScreenInfo *screeninfo = new ScreenInfo(this, i); + ScreenInfo *screeninfo = new ScreenInfo(*this, i); screenInfoList->insert(screeninfo); } @@ -574,17 +574,16 @@ void BaseDisplay::ungrabButton(unsigned int button, unsigned int modifiers, } -ScreenInfo::ScreenInfo(BaseDisplay *d, int num) { - basedisplay = d; +ScreenInfo::ScreenInfo(BaseDisplay &d, int num) : basedisplay(d) { screen_number = num; - root_window = RootWindow(basedisplay->getXDisplay(), screen_number); - depth = DefaultDepth(basedisplay->getXDisplay(), screen_number); + root_window = RootWindow(basedisplay.getXDisplay(), screen_number); + depth = DefaultDepth(basedisplay.getXDisplay(), screen_number); width = - WidthOfScreen(ScreenOfDisplay(basedisplay->getXDisplay(), screen_number)); + WidthOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(), screen_number)); height = - HeightOfScreen(ScreenOfDisplay(basedisplay->getXDisplay(), screen_number)); + HeightOfScreen(ScreenOfDisplay(basedisplay.getXDisplay(), screen_number)); // search for a TrueColor Visual... if we can't find one... we will use the // default visual for the screen @@ -596,7 +595,7 @@ ScreenInfo::ScreenInfo(BaseDisplay *d, int num) { visual = (Visual *) 0; - if ((vinfo_return = XGetVisualInfo(basedisplay->getXDisplay(), + if ((vinfo_return = XGetVisualInfo(basedisplay.getXDisplay(), VisualScreenMask | VisualClassMask, &vinfo_template, &vinfo_nitems)) && vinfo_nitems > 0) { @@ -611,10 +610,10 @@ ScreenInfo::ScreenInfo(BaseDisplay *d, int num) { } if (visual) { - colormap = XCreateColormap(basedisplay->getXDisplay(), root_window, + colormap = XCreateColormap(basedisplay.getXDisplay(), root_window, visual, AllocNone); } else { - visual = DefaultVisual(basedisplay->getXDisplay(), screen_number); - colormap = DefaultColormap(basedisplay->getXDisplay(), screen_number); + visual = DefaultVisual(basedisplay.getXDisplay(), screen_number); + colormap = DefaultColormap(basedisplay.getXDisplay(), screen_number); } } diff --git a/src/BaseDisplay.h b/src/BaseDisplay.h index 2aa82d76..38f12ada 100644 --- a/src/BaseDisplay.h +++ b/src/BaseDisplay.h @@ -328,7 +328,7 @@ public: class ScreenInfo { private: - BaseDisplay *basedisplay; + BaseDisplay &basedisplay; Visual *visual; Window root_window; Colormap colormap; @@ -338,9 +338,9 @@ private: public: - ScreenInfo(BaseDisplay *, int); + ScreenInfo(BaseDisplay &, int); - inline BaseDisplay *getBaseDisplay(void) { return basedisplay; } + inline BaseDisplay &getBaseDisplay(void) { return basedisplay; } inline Visual *getVisual(void) { return visual; } inline const Window &getRootWindow(void) const { return root_window; } diff --git a/src/Basemenu.cc b/src/Basemenu.cc index 1b9c7155..ba476c15 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc @@ -49,7 +49,7 @@ using namespace std; static Basemenu *shown = (Basemenu *) 0; -Basemenu::Basemenu(BScreen &scrn) : screen(scrn), openbox(*scrn.getOpenbox()) { +Basemenu::Basemenu(BScreen &scrn) : screen(scrn), openbox(scrn.getOpenbox()) { image_ctrl = screen.getImageControl(); display = openbox.getXDisplay(); parent = (Basemenu *) 0; diff --git a/src/Configmenu.cc b/src/Configmenu.cc index bae8e1b6..6a00463e 100644 --- a/src/Configmenu.cc +++ b/src/Configmenu.cc @@ -164,13 +164,13 @@ void Configmenu::Focusmenu::itemSelected(int button, int index) { configmenu->screen.saveSloppyFocus(False); configmenu->screen.saveAutoRaise(False); - if (! configmenu->screen.getOpenbox()->getFocusedWindow()) - XSetInputFocus(configmenu->screen.getOpenbox()->getXDisplay(), + if (! configmenu->screen.getOpenbox().getFocusedWindow()) + XSetInputFocus(configmenu->screen.getOpenbox().getXDisplay(), configmenu->screen.getToolbar()->getWindowID(), RevertToParent, CurrentTime); else - XSetInputFocus(configmenu->screen.getOpenbox()->getXDisplay(), - configmenu->screen.getOpenbox()-> + XSetInputFocus(configmenu->screen.getOpenbox().getXDisplay(), + configmenu->screen.getOpenbox(). getFocusedWindow()->getClientWindow(), RevertToParent, CurrentTime); diff --git a/src/Netizen.cc b/src/Netizen.cc index bb159483..0a0663b8 100644 --- a/src/Netizen.cc +++ b/src/Netizen.cc @@ -33,84 +33,82 @@ #include "Netizen.h" #include "Screen.h" -Netizen::Netizen(BScreen *scr, Window win) { - screen = scr; - basedisplay = screen->getBaseDisplay(); - window = win; - +Netizen::Netizen(BScreen &scr, Window win) : screen(scr), + basedisplay(scr.getBaseDisplay()), window(win) +{ event.type = ClientMessage; - event.xclient.message_type = basedisplay->getOpenboxStructureMessagesAtom(); - event.xclient.display = basedisplay->getXDisplay(); + event.xclient.message_type = basedisplay.getOpenboxStructureMessagesAtom(); + event.xclient.display = basedisplay.getXDisplay(); event.xclient.window = window; event.xclient.format = 32; - event.xclient.data.l[0] = basedisplay->getOpenboxNotifyStartupAtom(); + event.xclient.data.l[0] = basedisplay.getOpenboxNotifyStartupAtom(); event.xclient.data.l[1] = event.xclient.data.l[2] = event.xclient.data.l[3] = event.xclient.data.l[4] = 0l; - XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); + XSendEvent(basedisplay.getXDisplay(), window, False, NoEventMask, &event); } void Netizen::sendWorkspaceCount(void) { - event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWorkspaceCountAtom(); - event.xclient.data.l[1] = screen->getWorkspaceCount(); + event.xclient.data.l[0] = basedisplay.getOpenboxNotifyWorkspaceCountAtom(); + event.xclient.data.l[1] = screen.getWorkspaceCount(); - XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); + XSendEvent(basedisplay.getXDisplay(), window, False, NoEventMask, &event); } void Netizen::sendCurrentWorkspace(void) { - event.xclient.data.l[0] = basedisplay->getOpenboxNotifyCurrentWorkspaceAtom(); - event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); + event.xclient.data.l[0] = basedisplay.getOpenboxNotifyCurrentWorkspaceAtom(); + event.xclient.data.l[1] = screen.getCurrentWorkspaceID(); - XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); + XSendEvent(basedisplay.getXDisplay(), window, False, NoEventMask, &event); } void Netizen::sendWindowFocus(Window w) { - event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowFocusAtom(); + event.xclient.data.l[0] = basedisplay.getOpenboxNotifyWindowFocusAtom(); event.xclient.data.l[1] = w; - XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); + XSendEvent(basedisplay.getXDisplay(), window, False, NoEventMask, &event); } void Netizen::sendWindowAdd(Window w, unsigned long p) { - event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowAddAtom(); + event.xclient.data.l[0] = basedisplay.getOpenboxNotifyWindowAddAtom(); event.xclient.data.l[1] = w; event.xclient.data.l[2] = p; - XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); + XSendEvent(basedisplay.getXDisplay(), window, False, NoEventMask, &event); event.xclient.data.l[2] = 0l; } void Netizen::sendWindowDel(Window w) { - event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowDelAtom(); + event.xclient.data.l[0] = basedisplay.getOpenboxNotifyWindowDelAtom(); event.xclient.data.l[1] = w; - XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); + XSendEvent(basedisplay.getXDisplay(), window, False, NoEventMask, &event); } void Netizen::sendWindowRaise(Window w) { - event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowRaiseAtom(); + event.xclient.data.l[0] = basedisplay.getOpenboxNotifyWindowRaiseAtom(); event.xclient.data.l[1] = w; - XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); + XSendEvent(basedisplay.getXDisplay(), window, False, NoEventMask, &event); } void Netizen::sendWindowLower(Window w) { - event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowLowerAtom(); + event.xclient.data.l[0] = basedisplay.getOpenboxNotifyWindowLowerAtom(); event.xclient.data.l[1] = w; - XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); + XSendEvent(basedisplay.getXDisplay(), window, False, NoEventMask, &event); } void Netizen::sendConfigNotify(XEvent *e) { - XSendEvent(basedisplay->getXDisplay(), window, False, + XSendEvent(basedisplay.getXDisplay(), window, False, StructureNotifyMask, e); } diff --git a/src/Netizen.h b/src/Netizen.h index 85480f7b..9de223d7 100644 --- a/src/Netizen.h +++ b/src/Netizen.h @@ -32,15 +32,15 @@ class Netizen; class Netizen { private: - BaseDisplay *basedisplay; - BScreen *screen; + BaseDisplay &basedisplay; + BScreen &screen; Window window; XEvent event; protected: public: - Netizen(BScreen *, Window); + Netizen(BScreen &, Window); inline const Window &getWindowID(void) const { return window; } diff --git a/src/Rootmenu.cc b/src/Rootmenu.cc index 84ea402b..b8c8f2dd 100644 --- a/src/Rootmenu.cc +++ b/src/Rootmenu.cc @@ -53,7 +53,7 @@ Rootmenu::Rootmenu(BScreen &scrn) : Basemenu(scrn), screen(scrn), - openbox(*scrn.getOpenbox()) + openbox(scrn.getOpenbox()) { } @@ -73,7 +73,7 @@ void Rootmenu::itemSelected(int button, int index) { #ifndef __EMX__ char displaystring[MAXPATHLEN]; sprintf(displaystring, "DISPLAY=%s", - DisplayString(screen.getBaseDisplay()->getXDisplay())); + DisplayString(screen.getBaseDisplay().getXDisplay())); sprintf(displaystring + strlen(displaystring) - 1, "%d", screen.getScreenNumber()); diff --git a/src/Screen.cc b/src/Screen.cc index c357e167..78a9a399 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -180,16 +180,14 @@ static const char *getFontSize(const char *pattern, int *size) { } -BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { - openbox = ob; - +BScreen::BScreen(Openbox &ob, int scrn) : ScreenInfo(ob, scrn), openbox(ob) { event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask | SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning); - XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), event_mask); - XSync(getBaseDisplay()->getXDisplay(), False); + XSelectInput(getBaseDisplay().getXDisplay(), getRootWindow(), event_mask); + XSync(getBaseDisplay().getXDisplay(), False); XSetErrorHandler((XErrorHandler) old); managed = running; @@ -216,14 +214,14 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { #ifdef HAVE_GETPID pid_t bpid = getpid(); - XChangeProperty(getBaseDisplay()->getXDisplay(), getRootWindow(), - openbox->getOpenboxPidAtom(), XA_CARDINAL, + XChangeProperty(getBaseDisplay().getXDisplay(), getRootWindow(), + openbox.getOpenboxPidAtom(), XA_CARDINAL, sizeof(pid_t) * 8, PropModeReplace, (unsigned char *) &bpid, 1); #endif // HAVE_GETPID - XDefineCursor(getBaseDisplay()->getXDisplay(), getRootWindow(), - openbox->getSessionCursor()); + XDefineCursor(getBaseDisplay().getXDisplay(), getRootWindow(), + openbox.getSessionCursor()); workspaceNames = new LinkedList; workspacesList = new LinkedList; @@ -232,12 +230,12 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { iconList = new LinkedList; image_control = - new BImageControl(openbox, this, True, openbox->getColorsPerChannel(), - openbox->getCacheLife(), openbox->getCacheMax()); + new BImageControl(&openbox, this, True, openbox.getColorsPerChannel(), + openbox.getCacheLife(), openbox.getCacheMax()); image_control->installRootColormap(); root_colormap_installed = True; - openbox->load_rc(this); + openbox.load_rc(this); image_control->setDither(resource.image_dither); @@ -247,88 +245,88 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { unsigned long gc_value_mask = GCForeground; if (! i18n->multibyte()) gc_value_mask |= GCFont; - gcv.foreground = WhitePixel(getBaseDisplay()->getXDisplay(), + gcv.foreground = WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber()) - ^ BlackPixel(getBaseDisplay()->getXDisplay(), + ^ BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber()); gcv.function = GXxor; gcv.subwindow_mode = IncludeInferiors; - opGC = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + opGC = XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), GCForeground | GCFunction | GCSubwindowMode, &gcv); gcv.foreground = resource.wstyle.l_text_focus.getPixel(); if (resource.wstyle.font) gcv.font = resource.wstyle.font->fid; resource.wstyle.l_text_focus_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.wstyle.l_text_unfocus.getPixel(); if (resource.wstyle.font) gcv.font = resource.wstyle.font->fid; resource.wstyle.l_text_unfocus_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.wstyle.b_pic_focus.getPixel(); resource.wstyle.b_pic_focus_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), GCForeground, &gcv); gcv.foreground = resource.wstyle.b_pic_unfocus.getPixel(); resource.wstyle.b_pic_unfocus_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), GCForeground, &gcv); gcv.foreground = resource.mstyle.t_text.getPixel(); if (resource.mstyle.t_font) gcv.font = resource.mstyle.t_font->fid; resource.mstyle.t_text_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.mstyle.f_text.getPixel(); if (resource.mstyle.f_font) gcv.font = resource.mstyle.f_font->fid; resource.mstyle.f_text_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.mstyle.h_text.getPixel(); resource.mstyle.h_text_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.mstyle.d_text.getPixel(); resource.mstyle.d_text_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.mstyle.hilite.getColor()->getPixel(); resource.mstyle.hilite_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.tstyle.l_text.getPixel(); if (resource.tstyle.font) gcv.font = resource.tstyle.font->fid; resource.tstyle.l_text_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.tstyle.w_text.getPixel(); resource.tstyle.w_text_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.tstyle.c_text.getPixel(); resource.tstyle.c_text_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); gcv.foreground = resource.tstyle.b_pic.getPixel(); resource.tstyle.b_pic_gc = - XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateGC(getBaseDisplay().getXDisplay(), getRootWindow(), gc_value_mask, &gcv); const char *s = i18n->getMessage(ScreenSet, ScreenPositionLength, @@ -358,7 +356,7 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { attrib.save_under = True; geom_window = - XCreateWindow(getBaseDisplay()->getXDisplay(), getRootWindow(), + XCreateWindow(getBaseDisplay().getXDisplay(), getRootWindow(), 0, 0, geom_w, geom_h, resource.border_width, getDepth(), InputOutput, getVisual(), mask, &attrib); geom_visible = False; @@ -367,24 +365,24 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { if (resource.wstyle.t_focus.getTexture() == (BImage_Flat | BImage_Solid)) { geom_pixmap = None; - XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, + XSetWindowBackground(getBaseDisplay().getXDisplay(), geom_window, resource.wstyle.t_focus.getColor()->getPixel()); } else { geom_pixmap = image_control->renderImage(geom_w, geom_h, &resource.wstyle.t_focus); - XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), + XSetWindowBackgroundPixmap(getBaseDisplay().getXDisplay(), geom_window, geom_pixmap); } } else { if (resource.wstyle.l_focus.getTexture() == (BImage_Flat | BImage_Solid)) { geom_pixmap = None; - XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, + XSetWindowBackground(getBaseDisplay().getXDisplay(), geom_window, resource.wstyle.l_focus.getColor()->getPixel()); } else { geom_pixmap = image_control->renderImage(geom_w, geom_h, &resource.wstyle.l_focus); - XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), + XSetWindowBackgroundPixmap(getBaseDisplay().getXDisplay(), geom_window, geom_pixmap); } } @@ -413,10 +411,10 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { current_workspace = workspacesList->first(); workspacemenu->setItemSelected(2, True); - toolbar = new Toolbar(this); + toolbar = new Toolbar(*this); #ifdef SLIT - slit = new Slit(this); + slit = new Slit(*this); #endif // SLIT InitMenu(); @@ -429,14 +427,14 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { int i; unsigned int nchild; Window r, p, *children; - XQueryTree(getBaseDisplay()->getXDisplay(), getRootWindow(), &r, &p, + XQueryTree(getBaseDisplay().getXDisplay(), getRootWindow(), &r, &p, &children, &nchild); // preen the window list of all icon windows... for better dockapp support for (i = 0; i < (int) nchild; i++) { if (children[i] == None) continue; - XWMHints *wmhints = XGetWMHints(getBaseDisplay()->getXDisplay(), + XWMHints *wmhints = XGetWMHints(getBaseDisplay().getXDisplay(), children[i]); if (wmhints) { @@ -455,18 +453,18 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { // manage shown windows for (i = 0; i < (int) nchild; ++i) { - if (children[i] == None || (! openbox->validateWindow(children[i]))) + if (children[i] == None || (! openbox.validateWindow(children[i]))) continue; XWindowAttributes attrib; - if (XGetWindowAttributes(getBaseDisplay()->getXDisplay(), children[i], + if (XGetWindowAttributes(getBaseDisplay().getXDisplay(), children[i], &attrib)) { if (attrib.override_redirect) continue; if (attrib.map_state != IsUnmapped) { - new OpenboxWindow(openbox, children[i], this); + new OpenboxWindow(&openbox, children[i], this); - OpenboxWindow *win = openbox->searchWindow(children[i]); + OpenboxWindow *win = openbox.searchWindow(children[i]); if (win) { XMapRequestEvent mre; mre.window = children[i]; @@ -478,11 +476,11 @@ BScreen::BScreen(Openbox *ob, int scrn) : ScreenInfo(ob, scrn) { } if (! resource.sloppy_focus) - XSetInputFocus(getBaseDisplay()->getXDisplay(), toolbar->getWindowID(), + XSetInputFocus(getBaseDisplay().getXDisplay(), toolbar->getWindowID(), RevertToParent, CurrentTime); XFree(children); - XFlush(getBaseDisplay()->getXDisplay()); + XFlush(getBaseDisplay().getXDisplay()); } @@ -493,7 +491,7 @@ BScreen::~BScreen(void) { image_control->removeImage(geom_pixmap); if (geom_window != None) - XDestroyWindow(getBaseDisplay()->getXDisplay(), geom_window); + XDestroyWindow(getBaseDisplay().getXDisplay(), geom_window); removeWorkspaceNames(); @@ -533,54 +531,54 @@ BScreen::~BScreen(void) { delete netizenList; if (resource.wstyle.fontset) - XFreeFontSet(getBaseDisplay()->getXDisplay(), resource.wstyle.fontset); + XFreeFontSet(getBaseDisplay().getXDisplay(), resource.wstyle.fontset); if (resource.mstyle.t_fontset) - XFreeFontSet(getBaseDisplay()->getXDisplay(), resource.mstyle.t_fontset); + XFreeFontSet(getBaseDisplay().getXDisplay(), resource.mstyle.t_fontset); if (resource.mstyle.f_fontset) - XFreeFontSet(getBaseDisplay()->getXDisplay(), resource.mstyle.f_fontset); + XFreeFontSet(getBaseDisplay().getXDisplay(), resource.mstyle.f_fontset); if (resource.tstyle.fontset) - XFreeFontSet(getBaseDisplay()->getXDisplay(), resource.tstyle.fontset); + XFreeFontSet(getBaseDisplay().getXDisplay(), resource.tstyle.fontset); if (resource.wstyle.font) - XFreeFont(getBaseDisplay()->getXDisplay(), resource.wstyle.font); + XFreeFont(getBaseDisplay().getXDisplay(), resource.wstyle.font); if (resource.mstyle.t_font) - XFreeFont(getBaseDisplay()->getXDisplay(), resource.mstyle.t_font); + XFreeFont(getBaseDisplay().getXDisplay(), resource.mstyle.t_font); if (resource.mstyle.f_font) - XFreeFont(getBaseDisplay()->getXDisplay(), resource.mstyle.f_font); + XFreeFont(getBaseDisplay().getXDisplay(), resource.mstyle.f_font); if (resource.tstyle.font) - XFreeFont(getBaseDisplay()->getXDisplay(), resource.tstyle.font); + XFreeFont(getBaseDisplay().getXDisplay(), resource.tstyle.font); if (resource.root_command != NULL) delete [] resource.root_command; - XFreeGC(getBaseDisplay()->getXDisplay(), opGC); + XFreeGC(getBaseDisplay().getXDisplay(), opGC); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.wstyle.l_text_focus_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.wstyle.l_text_unfocus_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.wstyle.b_pic_focus_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.wstyle.b_pic_unfocus_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.mstyle.t_text_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.mstyle.f_text_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.mstyle.h_text_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.mstyle.d_text_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.mstyle.hilite_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.tstyle.l_text_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.tstyle.w_text_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.tstyle.c_text_gc); - XFreeGC(getBaseDisplay()->getXDisplay(), + XFreeGC(getBaseDisplay().getXDisplay(), resource.tstyle.b_pic_gc); } @@ -636,7 +634,7 @@ void BScreen::readDatabaseTexture(const char *rname, const char *rclass, if (xcol.blue >= 0xff) xcol.blue = 0xffff; else xcol.blue *= 0xff; - if (! XAllocColor(getBaseDisplay()->getXDisplay(), + if (! XAllocColor(getBaseDisplay().getXDisplay(), getColormap(), &xcol)) xcol.pixel = 0; @@ -652,7 +650,7 @@ void BScreen::readDatabaseTexture(const char *rname, const char *rclass, (unsigned int) ((texture->getColor()->getBlue() >> 2) + (texture->getColor()->getBlue() >> 1)) * 0xff; - if (! XAllocColor(getBaseDisplay()->getXDisplay(), + if (! XAllocColor(getBaseDisplay().getXDisplay(), getColormap(), &xcol)) xcol.pixel = 0; @@ -707,7 +705,7 @@ void BScreen::readDatabaseFontSet(const char *rname, const char *rclass, std::string s; if (*fontset) - XFreeFontSet(getBaseDisplay()->getXDisplay(), *fontset); + XFreeFontSet(getBaseDisplay().getXDisplay(), *fontset); if (resource.styleconfig.getValue(rname, rclass, s)) { if (! (*fontset = createFontSet(s.c_str()))) @@ -736,10 +734,10 @@ void BScreen::readDatabaseFont(const char *rname, const char *rclass, std::string s; if (*font) - XFreeFont(getBaseDisplay()->getXDisplay(), *font); + XFreeFont(getBaseDisplay().getXDisplay(), *font); if (resource.styleconfig.getValue(rname, rclass, s)) { - if ((*font = XLoadQueryFont(getBaseDisplay()->getXDisplay(), + if ((*font = XLoadQueryFont(getBaseDisplay().getXDisplay(), s.c_str())) == NULL) { fprintf(stderr, i18n->getMessage(ScreenSet, ScreenFontLoadFail, "BScreen::LoadStyle(): couldn't load font '%s'\n"), @@ -750,7 +748,7 @@ void BScreen::readDatabaseFont(const char *rname, const char *rclass, load_default = true; if (load_default) { - if ((*font = XLoadQueryFont(getBaseDisplay()->getXDisplay(), + if ((*font = XLoadQueryFont(getBaseDisplay().getXDisplay(), defaultFont)) == NULL) { fprintf(stderr, i18n->getMessage(ScreenSet, ScreenDefaultFontLoadFail, "BScreen::LoadStyle(): couldn't load default font.\n")); @@ -766,7 +764,7 @@ XFontSet BScreen::createFontSet(const char *fontname) { int nmissing, pixel_size = 0, buf_size = 0; char weight[FONT_ELEMENT_SIZE], slant[FONT_ELEMENT_SIZE]; - fs = XCreateFontSet(getBaseDisplay()->getXDisplay(), + fs = XCreateFontSet(getBaseDisplay().getXDisplay(), fontname, &missing, &nmissing, &def); if (fs && (! nmissing)) return fs; @@ -775,7 +773,7 @@ XFontSet BScreen::createFontSet(const char *fontname) { if (nmissing) XFreeStringList(missing); setlocale(LC_CTYPE, "C"); - fs = XCreateFontSet(getBaseDisplay()->getXDisplay(), fontname, + fs = XCreateFontSet(getBaseDisplay().getXDisplay(), fontname, &missing, &nmissing, &def); setlocale(LC_CTYPE, ""); } @@ -809,9 +807,9 @@ XFontSet BScreen::createFontSet(const char *fontname) { fontname = pattern2; if (nmissing) XFreeStringList(missing); - if (fs) XFreeFontSet(getBaseDisplay()->getXDisplay(), fs); + if (fs) XFreeFontSet(getBaseDisplay().getXDisplay(), fs); - fs = XCreateFontSet(getBaseDisplay()->getXDisplay(), fontname, + fs = XCreateFontSet(getBaseDisplay().getXDisplay(), fontname, &missing, &nmissing, &def); delete [] pattern2; @@ -826,71 +824,71 @@ void BScreen::reconfigure(void) { unsigned long gc_value_mask = GCForeground; if (! i18n->multibyte()) gc_value_mask |= GCFont; - gcv.foreground = WhitePixel(getBaseDisplay()->getXDisplay(), + gcv.foreground = WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber()); gcv.function = GXinvert; gcv.subwindow_mode = IncludeInferiors; - XChangeGC(getBaseDisplay()->getXDisplay(), opGC, + XChangeGC(getBaseDisplay().getXDisplay(), opGC, GCForeground | GCFunction | GCSubwindowMode, &gcv); gcv.foreground = resource.wstyle.l_text_focus.getPixel(); if (resource.wstyle.font) gcv.font = resource.wstyle.font->fid; - XChangeGC(getBaseDisplay()->getXDisplay(), resource.wstyle.l_text_focus_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.wstyle.l_text_focus_gc, gc_value_mask, &gcv); gcv.foreground = resource.wstyle.l_text_unfocus.getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.wstyle.l_text_unfocus_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.wstyle.l_text_unfocus_gc, gc_value_mask, &gcv); gcv.foreground = resource.wstyle.b_pic_focus.getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.wstyle.b_pic_focus_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.wstyle.b_pic_focus_gc, GCForeground, &gcv); gcv.foreground = resource.wstyle.b_pic_unfocus.getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.wstyle.b_pic_unfocus_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.wstyle.b_pic_unfocus_gc, GCForeground, &gcv); gcv.foreground = resource.mstyle.t_text.getPixel(); if (resource.mstyle.t_font) gcv.font = resource.mstyle.t_font->fid; - XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.t_text_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.mstyle.t_text_gc, gc_value_mask, &gcv); gcv.foreground = resource.mstyle.f_text.getPixel(); if (resource.mstyle.f_font) gcv.font = resource.mstyle.f_font->fid; - XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.f_text_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.mstyle.f_text_gc, gc_value_mask, &gcv); gcv.foreground = resource.mstyle.h_text.getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.h_text_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.mstyle.h_text_gc, gc_value_mask, &gcv); gcv.foreground = resource.mstyle.d_text.getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.d_text_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.mstyle.d_text_gc, gc_value_mask, &gcv); gcv.foreground = resource.mstyle.hilite.getColor()->getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.hilite_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.mstyle.hilite_gc, gc_value_mask, &gcv); gcv.foreground = resource.tstyle.l_text.getPixel(); if (resource.tstyle.font) gcv.font = resource.tstyle.font->fid; - XChangeGC(getBaseDisplay()->getXDisplay(), resource.tstyle.l_text_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.tstyle.l_text_gc, gc_value_mask, &gcv); gcv.foreground = resource.tstyle.w_text.getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.tstyle.w_text_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.tstyle.w_text_gc, gc_value_mask, &gcv); gcv.foreground = resource.tstyle.c_text.getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.tstyle.c_text_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.tstyle.c_text_gc, gc_value_mask, &gcv); gcv.foreground = resource.tstyle.b_pic.getPixel(); - XChangeGC(getBaseDisplay()->getXDisplay(), resource.tstyle.b_pic_gc, + XChangeGC(getBaseDisplay().getXDisplay(), resource.tstyle.b_pic_gc, gc_value_mask, &gcv); const char *s = i18n->getMessage(ScreenSet, ScreenPositionLength, @@ -918,32 +916,32 @@ void BScreen::reconfigure(void) { if (resource.wstyle.t_focus.getTexture() == (BImage_Flat | BImage_Solid)) { geom_pixmap = None; - XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, + XSetWindowBackground(getBaseDisplay().getXDisplay(), geom_window, resource.wstyle.t_focus.getColor()->getPixel()); } else { geom_pixmap = image_control->renderImage(geom_w, geom_h, &resource.wstyle.t_focus); - XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), + XSetWindowBackgroundPixmap(getBaseDisplay().getXDisplay(), geom_window, geom_pixmap); } } else { if (resource.wstyle.l_focus.getTexture() == (BImage_Flat | BImage_Solid)) { geom_pixmap = None; - XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, + XSetWindowBackground(getBaseDisplay().getXDisplay(), geom_window, resource.wstyle.l_focus.getColor()->getPixel()); } else { geom_pixmap = image_control->renderImage(geom_w, geom_h, &resource.wstyle.l_focus); - XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), + XSetWindowBackgroundPixmap(getBaseDisplay().getXDisplay(), geom_window, geom_pixmap); } } if (tmp) image_control->removeImage(tmp); - XSetWindowBorderWidth(getBaseDisplay()->getXDisplay(), geom_window, + XSetWindowBorderWidth(getBaseDisplay().getXDisplay(), geom_window, resource.border_width); - XSetWindowBorder(getBaseDisplay()->getXDisplay(), geom_window, + XSetWindowBorder(getBaseDisplay().getXDisplay(), geom_window, resource.border_color.getPixel()); workspacemenu->reconfigure(); @@ -995,7 +993,7 @@ void BScreen::removeWorkspaceNames(void) { void BScreen::LoadStyle(void) { obResource &conf = resource.styleconfig; - conf.setFile(openbox->getStyleFilename()); + conf.setFile(openbox.getStyleFilename()); if (!conf.load()) { conf.setFile(DEFAULTSTYLE); if (!conf.load()) { @@ -1043,77 +1041,77 @@ void BScreen::LoadStyle(void) { // load window config readDatabaseTexture("window.title.focus", "Window.Title.Focus", &resource.wstyle.t_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.title.unfocus", "Window.Title.Unfocus", &resource.wstyle.t_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.label.focus", "Window.Label.Focus", &resource.wstyle.l_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.label.unfocus", "Window.Label.Unfocus", &resource.wstyle.l_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.handle.focus", "Window.Handle.Focus", &resource.wstyle.h_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.handle.unfocus", "Window.Handle.Unfocus", &resource.wstyle.h_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.grip.focus", "Window.Grip.Focus", &resource.wstyle.g_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.grip.unfocus", "Window.Grip.Unfocus", &resource.wstyle.g_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.button.focus", "Window.Button.Focus", &resource.wstyle.b_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.button.unfocus", "Window.Button.Unfocus", &resource.wstyle.b_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("window.button.pressed", "Window.Button.Pressed", &resource.wstyle.b_pressed, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("window.frame.focusColor", "Window.Frame.FocusColor", &resource.wstyle.f_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("window.frame.unfocusColor", "Window.Frame.UnfocusColor", &resource.wstyle.f_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("window.label.focus.textColor", "Window.Label.Focus.TextColor", &resource.wstyle.l_text_focus, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor", &resource.wstyle.l_text_unfocus, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("window.button.focus.picColor", "Window.Button.Focus.PicColor", &resource.wstyle.b_pic_focus, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("window.button.unfocus.picColor", "Window.Button.Unfocus.PicColor", &resource.wstyle.b_pic_unfocus, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); if (conf.getValue("window.justify", "Window.Justify", s)) { @@ -1129,44 +1127,44 @@ void BScreen::LoadStyle(void) { // load toolbar config readDatabaseTexture("toolbar", "Toolbar", &resource.tstyle.toolbar, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("toolbar.label", "Toolbar.Label", &resource.tstyle.label, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("toolbar.windowLabel", "Toolbar.WindowLabel", &resource.tstyle.window, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("toolbar.button", "Toolbar.Button", &resource.tstyle.button, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("toolbar.button.pressed", "Toolbar.Button.Pressed", &resource.tstyle.pressed, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("toolbar.clock", "Toolbar.Clock", &resource.tstyle.clock, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("toolbar.label.textColor", "Toolbar.Label.TextColor", &resource.tstyle.l_text, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("toolbar.windowLabel.textColor", "Toolbar.WindowLabel.TextColor", &resource.tstyle.w_text, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("toolbar.clock.textColor", "Toolbar.Clock.TextColor", &resource.tstyle.c_text, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("toolbar.button.picColor", "Toolbar.Button.PicColor", &resource.tstyle.b_pic, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); if (conf.getValue("toolbar.justify", "Toolbar.Justify", s)) { @@ -1182,31 +1180,31 @@ void BScreen::LoadStyle(void) { // load menu config readDatabaseTexture("menu.title", "Menu.Title", &resource.mstyle.title, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("menu.frame", "Menu.Frame", &resource.mstyle.frame, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseTexture("menu.hilite", "Menu.Hilite", &resource.mstyle.hilite, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("menu.title.textColor", "Menu.Title.TextColor", &resource.mstyle.t_text, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("menu.frame.textColor", "Menu.Frame.TextColor", &resource.mstyle.f_text, - WhitePixel(getBaseDisplay()->getXDisplay(), + WhitePixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("menu.frame.disableColor", "Menu.Frame.DisableColor", &resource.mstyle.d_text, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); readDatabaseColor("menu.hilite.textColor", "Menu.Hilite.TextColor", &resource.mstyle.h_text, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); if (conf.getValue("menu.title.justify", "Menu.Title.Justify", s)) { @@ -1250,7 +1248,7 @@ void BScreen::LoadStyle(void) { resource.mstyle.bullet_pos = Basemenu::Left; readDatabaseColor("borderColor", "BorderColor", &resource.border_color, - BlackPixel(getBaseDisplay()->getXDisplay(), + BlackPixel(getBaseDisplay().getXDisplay(), getScreenNumber())); // load bevel, border and handle widths @@ -1291,7 +1289,7 @@ void BScreen::LoadStyle(void) { #ifndef __EMX__ char displaystring[MAXPATHLEN]; sprintf(displaystring, "DISPLAY=%s", - DisplayString(getBaseDisplay()->getXDisplay())); + DisplayString(getBaseDisplay().getXDisplay())); sprintf(displaystring + strlen(displaystring) - 1, "%d", getScreenNumber()); @@ -1389,11 +1387,11 @@ void BScreen::changeWorkspaceID(int id) { workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2, False); - if (openbox->getFocusedWindow() && - openbox->getFocusedWindow()->getScreen() == this && - (! openbox->getFocusedWindow()->isStuck())) { - current_workspace->setLastFocusedWindow(openbox->getFocusedWindow()); - openbox->setFocusedWindow((OpenboxWindow *) 0); + if (openbox.getFocusedWindow() && + openbox.getFocusedWindow()->getScreen() == this && + (! openbox.getFocusedWindow()->isStuck())) { + current_workspace->setLastFocusedWindow(openbox.getFocusedWindow()); + openbox.setFocusedWindow((OpenboxWindow *) 0); } current_workspace = getWorkspace(id); @@ -1405,7 +1403,7 @@ void BScreen::changeWorkspaceID(int id) { current_workspace->showAll(); if (resource.focus_last && current_workspace->getLastFocusedWindow()) { - XSync(openbox->getXDisplay(), False); + XSync(openbox.getXDisplay(), False); current_workspace->getLastFocusedWindow()->setInputFocus(); } } @@ -1427,8 +1425,8 @@ void BScreen::addNetizen(Netizen *n) { w->getWorkspaceID()); } - Window f = ((openbox->getFocusedWindow()) ? - openbox->getFocusedWindow()->getClientWindow() : None); + Window f = ((openbox.getFocusedWindow()) ? + openbox.getFocusedWindow()->getClientWindow() : None); n->sendWindowFocus(f); } @@ -1462,8 +1460,8 @@ void BScreen::updateNetizenWorkspaceCount(void) { void BScreen::updateNetizenWindowFocus(void) { - Window f = ((openbox->getFocusedWindow()) ? - openbox->getFocusedWindow()->getClientWindow() : None); + Window f = ((openbox.getFocusedWindow()) ? + openbox.getFocusedWindow()->getClientWindow() : None); LinkedListIterator it(netizenList); for (Netizen *n = it.current(); n; it++, n = it.current()) n->sendWindowFocus(f); @@ -1510,7 +1508,7 @@ void BScreen::raiseWindows(Window *workspace_stack, int num) { Window[(num + workspacesList->count() + rootmenuList->count() + 13)]; int i = 0, k = num; - XRaiseWindow(getBaseDisplay()->getXDisplay(), iconmenu->getWindowID()); + XRaiseWindow(getBaseDisplay().getXDisplay(), iconmenu->getWindowID()); *(session_stack + i++) = iconmenu->getWindowID(); LinkedListIterator wit(workspacesList); @@ -1549,7 +1547,7 @@ void BScreen::raiseWindows(Window *workspace_stack, int num) { while (k--) *(session_stack + i++) = *(workspace_stack + k); - XRestackWindows(getBaseDisplay()->getXDisplay(), session_stack, i); + XRestackWindows(getBaseDisplay().getXDisplay(), session_stack, i); delete [] session_stack; } @@ -1607,11 +1605,11 @@ void BScreen::nextFocus(void) { int focused_window_number = -1; OpenboxWindow *next; - if (openbox->getFocusedWindow()) { - if (openbox->getFocusedWindow()->getScreen()->getScreenNumber() == + if (openbox.getFocusedWindow()) { + if (openbox.getFocusedWindow()->getScreen()->getScreenNumber() == getScreenNumber()) { have_focused = True; - focused_window_number = openbox->getFocusedWindow()->getWindowNumber(); + focused_window_number = openbox.getFocusedWindow()->getWindowNumber(); } } @@ -1641,11 +1639,11 @@ void BScreen::prevFocus(void) { int focused_window_number = -1; OpenboxWindow *prev; - if (openbox->getFocusedWindow()) { - if (openbox->getFocusedWindow()->getScreen()->getScreenNumber() == + if (openbox.getFocusedWindow()) { + if (openbox.getFocusedWindow()->getScreen()->getScreenNumber() == getScreenNumber()) { have_focused = True; - focused_window_number = openbox->getFocusedWindow()->getWindowNumber(); + focused_window_number = openbox.getFocusedWindow()->getWindowNumber(); } } @@ -1674,17 +1672,17 @@ void BScreen::raiseFocus(void) { Bool have_focused = False; int focused_window_number = -1; - if (openbox->getFocusedWindow()) { - if (openbox->getFocusedWindow()->getScreen()->getScreenNumber() == + if (openbox.getFocusedWindow()) { + if (openbox.getFocusedWindow()->getScreen()->getScreenNumber() == getScreenNumber()) { have_focused = True; - focused_window_number = openbox->getFocusedWindow()->getWindowNumber(); + focused_window_number = openbox.getFocusedWindow()->getWindowNumber(); } } if ((getCurrentWorkspace()->getCount() > 1) && have_focused) - getWorkspace(openbox->getFocusedWindow()->getWorkspaceNumber())-> - raiseWindow(openbox->getFocusedWindow()); + getWorkspace(openbox.getFocusedWindow()->getWorkspaceNumber())-> + raiseWindow(openbox.getFocusedWindow()); } @@ -1700,16 +1698,16 @@ void BScreen::InitMenu(void) { } Bool defaultMenu = True; - if (openbox->getMenuFilename()) { - FILE *menu_file = fopen(openbox->getMenuFilename(), "r"); + if (openbox.getMenuFilename()) { + FILE *menu_file = fopen(openbox.getMenuFilename(), "r"); if (!menu_file) { - perror(openbox->getMenuFilename()); + perror(openbox.getMenuFilename()); } else { if (feof(menu_file)) { fprintf(stderr, i18n->getMessage(ScreenSet, ScreenEmptyMenuFile, "%s: Empty menu file"), - openbox->getMenuFilename()); + openbox.getMenuFilename()); } else { char line[1024], label[1024]; memset(line, 0, 1024); @@ -1763,7 +1761,7 @@ void BScreen::InitMenu(void) { rootmenu->insert(i18n->getMessage(ScreenSet, ScreenExit, "Exit"), BScreen::Exit); } else { - openbox->saveMenuFilename(openbox->getMenuFilename()); + openbox.saveMenuFilename(openbox.getMenuFilename()); } } @@ -1964,7 +1962,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { if (! feof(submenufile)) { if (! parseMenuFile(submenufile, menu)) - openbox->saveMenuFilename(newfile); + openbox.saveMenuFilename(newfile); fclose(submenufile); } @@ -2123,7 +2121,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { rootmenuList->insert(stylesmenu); } - openbox->saveMenuFilename(stylesdir); + openbox.saveMenuFilename(stylesdir); } else { fprintf(stderr, i18n->getMessage(ScreenSet, ScreenSTYLESDIRErrorNotDir, @@ -2165,10 +2163,10 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { void BScreen::shutdown(void) { - openbox->grab(); + openbox.grab(); - XSelectInput(getBaseDisplay()->getXDisplay(), getRootWindow(), NoEventMask); - XSync(getBaseDisplay()->getXDisplay(), False); + XSelectInput(getBaseDisplay().getXDisplay(), getRootWindow(), NoEventMask); + XSync(getBaseDisplay().getXDisplay(), False); LinkedListIterator it(workspacesList); for (Workspace *w = it.current(); w; it++, w = it.current()) @@ -2183,17 +2181,17 @@ void BScreen::shutdown(void) { slit->shutdown(); #endif // SLIT - openbox->ungrab(); + openbox.ungrab(); } void BScreen::showPosition(int x, int y) { if (! geom_visible) { - XMoveResizeWindow(getBaseDisplay()->getXDisplay(), geom_window, + XMoveResizeWindow(getBaseDisplay().getXDisplay(), geom_window, (getWidth() - geom_w) / 2, (getHeight() - geom_h) / 2, geom_w, geom_h); - XMapWindow(getBaseDisplay()->getXDisplay(), geom_window); - XRaiseWindow(getBaseDisplay()->getXDisplay(), geom_window); + XMapWindow(getBaseDisplay().getXDisplay(), geom_window); + XRaiseWindow(getBaseDisplay().getXDisplay(), geom_window); geom_visible = True; } @@ -2203,16 +2201,16 @@ void BScreen::showPosition(int x, int y) { sprintf(label, i18n->getMessage(ScreenSet, ScreenPositionFormat, "X: %4d x Y: %4d"), x, y); - XClearWindow(getBaseDisplay()->getXDisplay(), geom_window); + XClearWindow(getBaseDisplay().getXDisplay(), geom_window); if (i18n->multibyte()) { - XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window, + XmbDrawString(getBaseDisplay().getXDisplay(), geom_window, resource.wstyle.fontset, resource.wstyle.l_text_focus_gc, resource.bevel_width, resource.bevel_width - resource.wstyle.fontset_extents->max_ink_extent.y, label, strlen(label)); } else { - XDrawString(getBaseDisplay()->getXDisplay(), geom_window, + XDrawString(getBaseDisplay().getXDisplay(), geom_window, resource.wstyle.l_text_focus_gc, resource.bevel_width, resource.wstyle.font->ascent + @@ -2223,11 +2221,11 @@ void BScreen::showPosition(int x, int y) { void BScreen::showGeometry(unsigned int gx, unsigned int gy) { if (! geom_visible) { - XMoveResizeWindow(getBaseDisplay()->getXDisplay(), geom_window, + XMoveResizeWindow(getBaseDisplay().getXDisplay(), geom_window, (getWidth() - geom_w) / 2, (getHeight() - geom_h) / 2, geom_w, geom_h); - XMapWindow(getBaseDisplay()->getXDisplay(), geom_window); - XRaiseWindow(getBaseDisplay()->getXDisplay(), geom_window); + XMapWindow(getBaseDisplay().getXDisplay(), geom_window); + XRaiseWindow(getBaseDisplay().getXDisplay(), geom_window); geom_visible = True; } @@ -2237,16 +2235,16 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { sprintf(label, i18n->getMessage(ScreenSet, ScreenGeometryFormat, "W: %4d x H: %4d"), gx, gy); - XClearWindow(getBaseDisplay()->getXDisplay(), geom_window); + XClearWindow(getBaseDisplay().getXDisplay(), geom_window); if (i18n->multibyte()) { - XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window, + XmbDrawString(getBaseDisplay().getXDisplay(), geom_window, resource.wstyle.fontset, resource.wstyle.l_text_focus_gc, resource.bevel_width, resource.bevel_width - resource.wstyle.fontset_extents->max_ink_extent.y, label, strlen(label)); } else { - XDrawString(getBaseDisplay()->getXDisplay(), geom_window, + XDrawString(getBaseDisplay().getXDisplay(), geom_window, resource.wstyle.l_text_focus_gc, resource.bevel_width, resource.wstyle.font->ascent + @@ -2257,7 +2255,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { void BScreen::hideGeometry(void) { if (geom_visible) { - XUnmapWindow(getBaseDisplay()->getXDisplay(), geom_window); + XUnmapWindow(getBaseDisplay().getXDisplay(), geom_window); geom_visible = False; } } diff --git a/src/Screen.h b/src/Screen.h index 06a0c15c..bdeeaca5 100644 --- a/src/Screen.h +++ b/src/Screen.h @@ -102,7 +102,7 @@ private: Pixmap geom_pixmap; Window geom_window; - Openbox *openbox; + Openbox &openbox; BImageControl *image_control; Configmenu *configmenu; Iconmenu *iconmenu; @@ -175,7 +175,7 @@ protected: public: - BScreen(Openbox *, int); + BScreen(Openbox &, int); ~BScreen(void); inline const Bool &isToolbarOnTop(void) const @@ -199,7 +199,7 @@ public: inline const GC &getOpGC() const { return opGC; } - inline Openbox *getOpenbox(void) { return openbox; } + inline Openbox &getOpenbox(void) { return openbox; } inline BColor *getBorderColor(void) { return &resource.border_color; } inline BImageControl *getImageControl(void) { return image_control; } inline Rootmenu *getRootmenu(void) { return rootmenu; } diff --git a/src/Slit.cc b/src/Slit.cc index 85db2708..e07de151 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -42,18 +42,15 @@ #include "Toolbar.h" -Slit::Slit(BScreen *scr) { - screen = scr; - openbox = screen->getOpenbox(); +Slit::Slit(BScreen &scr) : screen(scr), openbox(scr.getOpenbox()) { + on_top = screen.isSlitOnTop(); + hidden = do_auto_hide = screen.doSlitAutoHide(); - on_top = screen->isSlitOnTop(); - hidden = do_auto_hide = screen->doSlitAutoHide(); - - display = screen->getBaseDisplay()->getXDisplay(); + display = screen.getBaseDisplay().getXDisplay(); frame.window = frame.pixmap = None; - timer = new BTimer(*openbox, *this); - timer->setTimeout(openbox->getAutoRaiseDelay()); + timer = new BTimer(openbox, *this); + timer->setTimeout(openbox.getAutoRaiseDelay()); timer->fireOnce(True); clientList = new LinkedList; @@ -65,8 +62,8 @@ Slit::Slit(BScreen *scr) { CWColormap | CWOverrideRedirect | CWEventMask; attrib.background_pixmap = None; attrib.background_pixel = attrib.border_pixel = - screen->getBorderColor()->getPixel(); - attrib.colormap = screen->getColormap(); + screen.getBorderColor()->getPixel(); + attrib.colormap = screen.getColormap(); attrib.override_redirect = True; attrib.event_mask = SubstructureRedirectMask | ButtonPressMask | EnterWindowMask | LeaveWindowMask; @@ -75,18 +72,18 @@ Slit::Slit(BScreen *scr) { frame.width = frame.height = 1; frame.window = - XCreateWindow(display, screen->getRootWindow(), frame.x, frame.y, - frame.width, frame.height, screen->getBorderWidth(), - screen->getDepth(), InputOutput, screen->getVisual(), + XCreateWindow(display, screen.getRootWindow(), frame.x, frame.y, + frame.width, frame.height, screen.getBorderWidth(), + screen.getDepth(), InputOutput, screen.getVisual(), create_mask, &attrib); - openbox->saveSlitSearch(frame.window, this); + openbox.saveSlitSearch(frame.window, this); reconfigure(); } Slit::~Slit() { - openbox->grab(); + openbox.grab(); if (timer->isTiming()) timer->stop(); delete timer; @@ -94,20 +91,20 @@ Slit::~Slit() { delete clientList; delete slitmenu; - screen->getImageControl()->removeImage(frame.pixmap); + screen.getImageControl()->removeImage(frame.pixmap); - openbox->removeSlitSearch(frame.window); + openbox.removeSlitSearch(frame.window); XDestroyWindow(display, frame.window); - openbox->ungrab(); + openbox.ungrab(); } void Slit::addClient(Window w) { - openbox->grab(); + openbox.grab(); - if (openbox->validateWindow(w)) { + if (openbox.validateWindow(w)) { SlitClient *client = new SlitClient; client->client_window = w; @@ -116,8 +113,8 @@ void Slit::addClient(Window w) { if (wmhints) { if ((wmhints->flags & IconWindowHint) && (wmhints->icon_window != None)) { - XMoveWindow(display, client->client_window, screen->getWidth() + 10, - screen->getHeight() + 10); + XMoveWindow(display, client->client_window, screen.getWidth() + 10, + screen.getHeight() + 10); XMapWindow(display, client->client_window); client->icon_window = wmhints->icon_window; @@ -158,26 +155,26 @@ void Slit::addClient(Window w) { clientList->insert(client); - openbox->saveSlitSearch(client->client_window, this); - openbox->saveSlitSearch(client->icon_window, this); + openbox.saveSlitSearch(client->client_window, this); + openbox.saveSlitSearch(client->icon_window, this); reconfigure(); } - openbox->ungrab(); + openbox.ungrab(); } void Slit::removeClient(SlitClient *client, Bool remap) { - openbox->removeSlitSearch(client->client_window); - openbox->removeSlitSearch(client->icon_window); + openbox.removeSlitSearch(client->client_window); + openbox.removeSlitSearch(client->icon_window); clientList->remove(client); - screen->removeNetizen(client->window); + screen.removeNetizen(client->window); - if (remap && openbox->validateWindow(client->window)) { + if (remap && openbox.validateWindow(client->window)) { XSelectInput(display, frame.window, NoEventMask); XSelectInput(display, client->window, NoEventMask); - XReparentWindow(display, client->window, screen->getRootWindow(), + XReparentWindow(display, client->window, screen.getRootWindow(), client->x, client->y); XChangeSaveSet(display, client->window, SetModeDelete); XSelectInput(display, frame.window, SubstructureRedirectMask | @@ -191,7 +188,7 @@ void Slit::removeClient(SlitClient *client, Bool remap) { void Slit::removeClient(Window w, Bool remap) { - openbox->grab(); + openbox.grab(); Bool reconf = False; @@ -207,7 +204,7 @@ void Slit::removeClient(Window w, Bool remap) { if (reconf) reconfigure(); - openbox->ungrab(); + openbox.ungrab(); } @@ -217,10 +214,10 @@ void Slit::reconfigure(void) { LinkedListIterator it(clientList); SlitClient *client; - switch (screen->getSlitDirection()) { + switch (screen.getSlitDirection()) { case Vertical: for (client = it.current(); client; it++, client = it.current()) { - frame.height += client->height + screen->getBevelWidth(); + frame.height += client->height + screen.getBevelWidth(); if (frame.width < client->width) frame.width = client->width; @@ -229,18 +226,18 @@ void Slit::reconfigure(void) { if (frame.width < 1) frame.width = 1; else - frame.width += (screen->getBevelWidth() * 2); + frame.width += (screen.getBevelWidth() * 2); if (frame.height < 1) frame.height = 1; else - frame.height += screen->getBevelWidth(); + frame.height += screen.getBevelWidth(); break; case Horizontal: for (client = it.current(); client; it++, client = it.current()) { - frame.width += client->width + screen->getBevelWidth(); + frame.width += client->width + screen.getBevelWidth(); if (frame.height < client->height) frame.height = client->height; @@ -249,21 +246,21 @@ void Slit::reconfigure(void) { if (frame.width < 1) frame.width = 1; else - frame.width += screen->getBevelWidth(); + frame.width += screen.getBevelWidth(); if (frame.height < 1) frame.height = 1; else - frame.height += (screen->getBevelWidth() * 2); + frame.height += (screen.getBevelWidth() * 2); break; } reposition(); - XSetWindowBorderWidth(display ,frame.window, screen->getBorderWidth()); + XSetWindowBorderWidth(display ,frame.window, screen.getBorderWidth()); XSetWindowBorder(display, frame.window, - screen->getBorderColor()->getPixel()); + screen.getBorderColor()->getPixel()); if (! clientList->count()) XUnmapWindow(display, frame.window); @@ -271,8 +268,8 @@ void Slit::reconfigure(void) { XMapWindow(display, frame.window); Pixmap tmp = frame.pixmap; - BImageControl *image_ctrl = screen->getImageControl(); - BTexture *texture = &(screen->getToolbarStyle()->toolbar); + BImageControl *image_ctrl = screen.getImageControl(); + BTexture *texture = &(screen.getToolbarStyle()->toolbar); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.pixmap = None; XSetWindowBackground(display, frame.window, @@ -288,10 +285,10 @@ void Slit::reconfigure(void) { int x, y; it.reset(); - switch (screen->getSlitDirection()) { + switch (screen.getSlitDirection()) { case Vertical: x = 0; - y = screen->getBevelWidth(); + y = screen.getBevelWidth(); for (client = it.current(); client; it++, client = it.current()) { x = (frame.width - client->width) / 2; @@ -320,13 +317,13 @@ void Slit::reconfigure(void) { XSendEvent(display, client->window, False, StructureNotifyMask, &event); - y += client->height + screen->getBevelWidth(); + y += client->height + screen.getBevelWidth(); } break; case Horizontal: - x = screen->getBevelWidth(); + x = screen.getBevelWidth(); y = 0; for (client = it.current(); client; it++, client = it.current()) { @@ -356,7 +353,7 @@ void Slit::reconfigure(void) { XSendEvent(display, client->window, False, StructureNotifyMask, &event); - x += client->width + screen->getBevelWidth(); + x += client->width + screen.getBevelWidth(); } break; @@ -368,120 +365,120 @@ void Slit::reconfigure(void) { void Slit::reposition(void) { // place the slit in the appropriate place - switch (screen->getSlitPlacement()) { + switch (screen.getSlitPlacement()) { case TopLeft: frame.x = 0; frame.y = 0; - if (screen->getSlitDirection() == Vertical) { - frame.x_hidden = screen->getBevelWidth() - screen->getBorderWidth() + if (screen.getSlitDirection() == Vertical) { + frame.x_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.width; frame.y_hidden = 0; } else { frame.x_hidden = 0; - frame.y_hidden = screen->getBevelWidth() - screen->getBorderWidth() + frame.y_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.height; } break; case CenterLeft: frame.x = 0; - frame.y = (screen->getHeight() - frame.height) / 2; - frame.x_hidden = screen->getBevelWidth() - screen->getBorderWidth() + frame.y = (screen.getHeight() - frame.height) / 2; + frame.x_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.width; frame.y_hidden = frame.y; break; case BottomLeft: frame.x = 0; - frame.y = screen->getHeight() - frame.height - - (screen->getBorderWidth() * 2); - if (screen->getSlitDirection() == Vertical) { - frame.x_hidden = screen->getBevelWidth() - screen->getBorderWidth() + frame.y = screen.getHeight() - frame.height + - (screen.getBorderWidth() * 2); + if (screen.getSlitDirection() == Vertical) { + frame.x_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.width; frame.y_hidden = frame.y; } else { frame.x_hidden = 0; - frame.y_hidden = screen->getHeight() - screen->getBevelWidth() - - screen->getBorderWidth(); + frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + - screen.getBorderWidth(); } break; case TopCenter: - frame.x = (screen->getWidth() - frame.width) / 2; + frame.x = (screen.getWidth() - frame.width) / 2; frame.y = 0; frame.x_hidden = frame.x; - frame.y_hidden = screen->getBevelWidth() - screen->getBorderWidth() + frame.y_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.height; break; case BottomCenter: - frame.x = (screen->getWidth() - frame.width) / 2; - frame.y = screen->getHeight() - frame.height - - (screen->getBorderWidth() * 2); + frame.x = (screen.getWidth() - frame.width) / 2; + frame.y = screen.getHeight() - frame.height + - (screen.getBorderWidth() * 2); frame.x_hidden = frame.x; - frame.y_hidden = screen->getHeight() - screen->getBevelWidth() - - screen->getBorderWidth(); + frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + - screen.getBorderWidth(); break; case TopRight: - frame.x = screen->getWidth() - frame.width - - (screen->getBorderWidth() * 2); + frame.x = screen.getWidth() - frame.width + - (screen.getBorderWidth() * 2); frame.y = 0; - if (screen->getSlitDirection() == Vertical) { - frame.x_hidden = screen->getWidth() - screen->getBevelWidth() - - screen->getBorderWidth(); + if (screen.getSlitDirection() == Vertical) { + frame.x_hidden = screen.getWidth() - screen.getBevelWidth() + - screen.getBorderWidth(); frame.y_hidden = 0; } else { frame.x_hidden = frame.x; - frame.y_hidden = screen->getBevelWidth() - screen->getBorderWidth() + frame.y_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.height; } break; case CenterRight: default: - frame.x = screen->getWidth() - frame.width - - (screen->getBorderWidth() * 2); - frame.y = (screen->getHeight() - frame.height) / 2; - frame.x_hidden = screen->getWidth() - screen->getBevelWidth() - - screen->getBorderWidth(); + frame.x = screen.getWidth() - frame.width + - (screen.getBorderWidth() * 2); + frame.y = (screen.getHeight() - frame.height) / 2; + frame.x_hidden = screen.getWidth() - screen.getBevelWidth() + - screen.getBorderWidth(); frame.y_hidden = frame.y; break; case BottomRight: - frame.x = screen->getWidth() - frame.width - - (screen->getBorderWidth() * 2); - frame.y = screen->getHeight() - frame.height - - (screen->getBorderWidth() * 2); - if (screen->getSlitDirection() == Vertical) { - frame.x_hidden = screen->getWidth() - screen->getBevelWidth() - - screen->getBorderWidth(); + frame.x = screen.getWidth() - frame.width + - (screen.getBorderWidth() * 2); + frame.y = screen.getHeight() - frame.height + - (screen.getBorderWidth() * 2); + if (screen.getSlitDirection() == Vertical) { + frame.x_hidden = screen.getWidth() - screen.getBevelWidth() + - screen.getBorderWidth(); frame.y_hidden = frame.y; } else { frame.x_hidden = frame.x; - frame.y_hidden = screen->getHeight() - screen->getBevelWidth() - - screen->getBorderWidth(); + frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + - screen.getBorderWidth(); } break; } - Toolbar *tbar = screen->getToolbar(); - int sw = frame.width + (screen->getBorderWidth() * 2), - sh = frame.height + (screen->getBorderWidth() * 2), - tw = tbar->getWidth() + screen->getBorderWidth(), - th = tbar->getHeight() + screen->getBorderWidth(); + Toolbar *tbar = screen.getToolbar(); + int sw = frame.width + (screen.getBorderWidth() * 2), + sh = frame.height + (screen.getBorderWidth() * 2), + tw = tbar->getWidth() + screen.getBorderWidth(), + th = tbar->getHeight() + screen.getBorderWidth(); if (tbar->getX() < frame.x + sw && tbar->getX() + tw > frame.x && tbar->getY() < frame.y + sh && tbar->getY() + th > frame.y) { if (frame.y < th) { frame.y += tbar->getExposedHeight(); - if (screen->getSlitDirection() == Vertical) + if (screen.getSlitDirection() == Vertical) frame.y_hidden += tbar->getExposedHeight(); else frame.y_hidden = frame.y; } else { frame.y -= tbar->getExposedHeight(); - if (screen->getSlitDirection() == Vertical) + if (screen.getSlitDirection() == Vertical) frame.y_hidden -= tbar->getExposedHeight(); else frame.y_hidden = frame.y; @@ -508,7 +505,7 @@ void Slit::buttonPressEvent(XButtonEvent *e) { if (e->button == Button1 && (! on_top)) { Window w[1] = { frame.window }; - screen->raiseWindows(w, 1); + screen.raiseWindows(w, 1); } else if (e->button == Button2 && (! on_top)) { XLowerWindow(display, frame.window); } else if (e->button == Button3) { @@ -520,13 +517,13 @@ void Slit::buttonPressEvent(XButtonEvent *e) { if (x < 0) x = 0; - else if (x + slitmenu->getWidth() > screen->getWidth()) - x = screen->getWidth() - slitmenu->getWidth(); + else if (x + slitmenu->getWidth() > screen.getWidth()) + x = screen.getWidth() - slitmenu->getWidth(); if (y < 0) y = 0; - else if (y + slitmenu->getHeight() > screen->getHeight()) - y = screen->getHeight() - slitmenu->getHeight(); + else if (y + slitmenu->getHeight() > screen.getHeight()) + y = screen.getHeight() - slitmenu->getHeight(); slitmenu->move(x, y); slitmenu->show(); @@ -562,9 +559,9 @@ void Slit::leaveNotifyEvent(XCrossingEvent *) { void Slit::configureRequestEvent(XConfigureRequestEvent *e) { - openbox->grab(); + openbox.grab(); - if (openbox->validateWindow(e->window)) { + if (openbox.validateWindow(e->window)) { Bool reconf = False; XWindowChanges xwc; @@ -596,7 +593,7 @@ void Slit::configureRequestEvent(XConfigureRequestEvent *e) { } - openbox->ungrab(); + openbox.ungrab(); } @@ -609,7 +606,7 @@ void Slit::timeout(void) { } -Slitmenu::Slitmenu(Slit &sl) : Basemenu(*sl.screen), slit(sl) { +Slitmenu::Slitmenu(Slit &sl) : Basemenu(sl.screen), slit(sl) { setLabel(i18n->getMessage(SlitSet, SlitSlitTitle, "Slit")); setInternalMenu(); @@ -649,7 +646,7 @@ void Slitmenu::itemSelected(int button, int index) { slit.on_top = change; setItemSelected(2, change); - if (slit.isOnTop()) slit.screen->raiseWindows((Window *) 0, 0); + if (slit.isOnTop()) slit.screen.raiseWindows((Window *) 0, 0); break; } @@ -680,7 +677,7 @@ void Slitmenu::reconfigure(void) { Slitmenu::Directionmenu::Directionmenu(Slitmenu &sm) - : Basemenu(*sm.slit.screen), slitmenu(sm) { + : Basemenu(sm.slit.screen), slitmenu(sm) { setLabel(i18n->getMessage(SlitSet, SlitSlitDirection, "Slit Direction")); setInternalMenu(); @@ -691,7 +688,7 @@ Slitmenu::Directionmenu::Directionmenu(Slitmenu &sm) update(); - if (sm.slit.screen->getSlitDirection() == Slit::Horizontal) + if (sm.slit.screen.getSlitDirection() == Slit::Horizontal) setItemSelected(0, True); else setItemSelected(1, True); @@ -705,7 +702,7 @@ void Slitmenu::Directionmenu::itemSelected(int button, int index) { BasemenuItem *item = find(index); if (! item) return; - slitmenu.slit.screen->saveSlitDirection(item->function()); + slitmenu.slit.screen.saveSlitDirection(item->function()); if (item->function() == Slit::Horizontal) { setItemSelected(0, True); @@ -721,7 +718,7 @@ void Slitmenu::Directionmenu::itemSelected(int button, int index) { Slitmenu::Placementmenu::Placementmenu(Slitmenu &sm) - : Basemenu(*sm.slit.screen), slitmenu(sm) { + : Basemenu(sm.slit.screen), slitmenu(sm) { setLabel(i18n->getMessage(SlitSet, SlitSlitPlacement, "Slit Placement")); setMinimumSublevels(3); @@ -759,7 +756,7 @@ void Slitmenu::Placementmenu::itemSelected(int button, int index) { BasemenuItem *item = find(index); if (! (item && item->function())) return; - slitmenu.slit.screen->saveSlitPlacement(item->function()); + slitmenu.slit.screen.saveSlitPlacement(item->function()); hide(); slitmenu.slit.reconfigure(); } diff --git a/src/Slit.h b/src/Slit.h index 1c644f2c..cef5d6c6 100644 --- a/src/Slit.h +++ b/src/Slit.h @@ -96,8 +96,8 @@ private: Bool on_top, hidden, do_auto_hide; Display *display; - Openbox *openbox; - BScreen *screen; + Openbox &openbox; + BScreen &screen; BTimer *timer; LinkedList *clientList; @@ -117,7 +117,7 @@ private: public: - Slit(BScreen *); + Slit(BScreen &); virtual ~Slit(); inline const Bool &isOnTop(void) const { return on_top; } diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 790deb6f..01e210fc 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -64,26 +64,23 @@ #endif // TIME_WITH_SYS_TIME -Toolbar::Toolbar(BScreen *scrn) { - screen = scrn; - openbox = screen->getOpenbox(); - +Toolbar::Toolbar(BScreen &scrn) : screen(scrn), openbox(scrn.getOpenbox()) { // get the clock updating every minute - clock_timer = new BTimer(*openbox, *this); + clock_timer = new BTimer(openbox, *this); timeval now; gettimeofday(&now, 0); clock_timer->setTimeout((60 - (now.tv_sec % 60)) * 1000); clock_timer->start(); hide_handler.toolbar = this; - hide_timer = new BTimer(*openbox, hide_handler); - hide_timer->setTimeout(openbox->getAutoRaiseDelay()); + hide_timer = new BTimer(openbox, hide_handler); + hide_timer->setTimeout(openbox.getAutoRaiseDelay()); hide_timer->fireOnce(True); - image_ctrl = screen->getImageControl(); + image_ctrl = screen.getImageControl(); - on_top = screen->isToolbarOnTop(); - hidden = do_auto_hide = screen->doToolbarAutoHide(); + on_top = screen.isToolbarOnTop(); + hidden = do_auto_hide = screen.doToolbarAutoHide(); editing = False; new_workspace_name = (char *) 0; @@ -92,61 +89,61 @@ Toolbar::Toolbar(BScreen *scrn) { toolbarmenu = new Toolbarmenu(*this); - display = openbox->getXDisplay(); + display = openbox.getXDisplay(); XSetWindowAttributes attrib; unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWEventMask; attrib.background_pixmap = None; attrib.background_pixel = attrib.border_pixel = - screen->getBorderColor()->getPixel(); - attrib.colormap = screen->getColormap(); + screen.getBorderColor()->getPixel(); + attrib.colormap = screen.getColormap(); attrib.override_redirect = True; attrib.event_mask = ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask; frame.window = - XCreateWindow(display, screen->getRootWindow(), 0, 0, 1, 1, 0, - screen->getDepth(), InputOutput, screen->getVisual(), + XCreateWindow(display, screen.getRootWindow(), 0, 0, 1, 1, 0, + screen.getDepth(), InputOutput, screen.getVisual(), create_mask, &attrib); - openbox->saveToolbarSearch(frame.window, this); + openbox.saveToolbarSearch(frame.window, this); attrib.event_mask = ButtonPressMask | ButtonReleaseMask | ExposureMask | KeyPressMask | EnterWindowMask; frame.workspace_label = - XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); - openbox->saveToolbarSearch(frame.workspace_label, this); + XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen.getDepth(), + InputOutput, screen.getVisual(), create_mask, &attrib); + openbox.saveToolbarSearch(frame.workspace_label, this); frame.window_label = - XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); - openbox->saveToolbarSearch(frame.window_label, this); + XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen.getDepth(), + InputOutput, screen.getVisual(), create_mask, &attrib); + openbox.saveToolbarSearch(frame.window_label, this); frame.clock = - XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); - openbox->saveToolbarSearch(frame.clock, this); + XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen.getDepth(), + InputOutput, screen.getVisual(), create_mask, &attrib); + openbox.saveToolbarSearch(frame.clock, this); frame.psbutton = - XCreateWindow(display ,frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); - openbox->saveToolbarSearch(frame.psbutton, this); + XCreateWindow(display ,frame.window, 0, 0, 1, 1, 0, screen.getDepth(), + InputOutput, screen.getVisual(), create_mask, &attrib); + openbox.saveToolbarSearch(frame.psbutton, this); frame.nsbutton = - XCreateWindow(display ,frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); - openbox->saveToolbarSearch(frame.nsbutton, this); + XCreateWindow(display ,frame.window, 0, 0, 1, 1, 0, screen.getDepth(), + InputOutput, screen.getVisual(), create_mask, &attrib); + openbox.saveToolbarSearch(frame.nsbutton, this); frame.pwbutton = - XCreateWindow(display ,frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); - openbox->saveToolbarSearch(frame.pwbutton, this); + XCreateWindow(display ,frame.window, 0, 0, 1, 1, 0, screen.getDepth(), + InputOutput, screen.getVisual(), create_mask, &attrib); + openbox.saveToolbarSearch(frame.pwbutton, this); frame.nwbutton = - XCreateWindow(display ,frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); - openbox->saveToolbarSearch(frame.nwbutton, this); + XCreateWindow(display ,frame.window, 0, 0, 1, 1, 0, screen.getDepth(), + InputOutput, screen.getVisual(), create_mask, &attrib); + openbox.saveToolbarSearch(frame.nwbutton, this); frame.base = frame.label = frame.wlabel = frame.clk = frame.button = frame.pbutton = None; @@ -168,14 +165,14 @@ Toolbar::~Toolbar(void) { if (frame.button) image_ctrl->removeImage(frame.button); if (frame.pbutton) image_ctrl->removeImage(frame.pbutton); - openbox->removeToolbarSearch(frame.window); - openbox->removeToolbarSearch(frame.workspace_label); - openbox->removeToolbarSearch(frame.window_label); - openbox->removeToolbarSearch(frame.clock); - openbox->removeToolbarSearch(frame.psbutton); - openbox->removeToolbarSearch(frame.nsbutton); - openbox->removeToolbarSearch(frame.pwbutton); - openbox->removeToolbarSearch(frame.nwbutton); + openbox.removeToolbarSearch(frame.window); + openbox.removeToolbarSearch(frame.workspace_label); + openbox.removeToolbarSearch(frame.window_label); + openbox.removeToolbarSearch(frame.clock); + openbox.removeToolbarSearch(frame.psbutton); + openbox.removeToolbarSearch(frame.nsbutton); + openbox.removeToolbarSearch(frame.pwbutton); + openbox.removeToolbarSearch(frame.nwbutton); XDestroyWindow(display, frame.workspace_label); XDestroyWindow(display, frame.window_label); @@ -190,73 +187,73 @@ Toolbar::~Toolbar(void) { void Toolbar::reconfigure(void) { - frame.bevel_w = screen->getBevelWidth(); - frame.width = screen->getWidth() * screen->getToolbarWidthPercent() / 100; + frame.bevel_w = screen.getBevelWidth(); + frame.width = screen.getWidth() * screen.getToolbarWidthPercent() / 100; if (i18n->multibyte()) frame.height = - screen->getToolbarStyle()->fontset_extents->max_ink_extent.height; + screen.getToolbarStyle()->fontset_extents->max_ink_extent.height; else - frame.height = screen->getToolbarStyle()->font->ascent + - screen->getToolbarStyle()->font->descent; + frame.height = screen.getToolbarStyle()->font->ascent + + screen.getToolbarStyle()->font->descent; frame.button_w = frame.height; frame.height += 2; frame.label_h = frame.height; frame.height += (frame.bevel_w * 2); - switch (screen->getToolbarPlacement()) { + switch (screen.getToolbarPlacement()) { case TopLeft: frame.x = 0; frame.y = 0; frame.x_hidden = 0; - frame.y_hidden = screen->getBevelWidth() - screen->getBorderWidth() + frame.y_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.height; break; case BottomLeft: frame.x = 0; - frame.y = screen->getHeight() - frame.height - - (screen->getBorderWidth() * 2); + frame.y = screen.getHeight() - frame.height + - (screen.getBorderWidth() * 2); frame.x_hidden = 0; - frame.y_hidden = screen->getHeight() - screen->getBevelWidth() - - screen->getBorderWidth(); + frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + - screen.getBorderWidth(); break; case TopCenter: - frame.x = (screen->getWidth() - frame.width) / 2; + frame.x = (screen.getWidth() - frame.width) / 2; frame.y = 0; frame.x_hidden = frame.x; - frame.y_hidden = screen->getBevelWidth() - screen->getBorderWidth() + frame.y_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.height; break; case BottomCenter: default: - frame.x = (screen->getWidth() - frame.width) / 2; - frame.y = screen->getHeight() - frame.height - - (screen->getBorderWidth() * 2); + frame.x = (screen.getWidth() - frame.width) / 2; + frame.y = screen.getHeight() - frame.height + - (screen.getBorderWidth() * 2); frame.x_hidden = frame.x; - frame.y_hidden = screen->getHeight() - screen->getBevelWidth() - - screen->getBorderWidth(); + frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + - screen.getBorderWidth(); break; case TopRight: - frame.x = screen->getWidth() - frame.width - - (screen->getBorderWidth() * 2); + frame.x = screen.getWidth() - frame.width + - (screen.getBorderWidth() * 2); frame.y = 0; frame.x_hidden = frame.x; - frame.y_hidden = screen->getBevelWidth() - screen->getBorderWidth() + frame.y_hidden = screen.getBevelWidth() - screen.getBorderWidth() - frame.height; break; case BottomRight: - frame.x = screen->getWidth() - frame.width - - (screen->getBorderWidth() * 2); - frame.y = screen->getHeight() - frame.height - - (screen->getBorderWidth() * 2); + frame.x = screen.getWidth() - frame.width + - (screen.getBorderWidth() * 2); + frame.y = screen.getHeight() - frame.height + - (screen.getBorderWidth() * 2); frame.x_hidden = frame.x; - frame.y_hidden = screen->getHeight() - screen->getBevelWidth() - - screen->getBorderWidth(); + frame.y_hidden = screen.getHeight() - screen.getBevelWidth() + - screen.getBorderWidth(); break; } @@ -268,31 +265,31 @@ void Toolbar::reconfigure(void) { tt = localtime(&ttmp); if (tt) { char t[1025], *time_string = (char *) 0; - int len = strftime(t, 1024, screen->getStrftimeFormat(), tt); + int len = strftime(t, 1024, screen.getStrftimeFormat(), tt); t[len++-1] = ' '; // add a space to the string for padding t[len] = '\0'; if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, t, len, &ink, + XmbTextExtents(screen.getToolbarStyle()->fontset, t, len, &ink, &logical); frame.clock_w = logical.width; // ben's additional solution to pad some space beside the numbers //frame.clock_w += - // screen->getToolbarStyle()->fontset_extents->max_logical_extent.width * + // screen.getToolbarStyle()->fontset_extents->max_logical_extent.width * // 4; // brad's solution, which is currently buggy, too big //frame.clock_w = - // screen->getToolbarStyle()->fontset_extents->max_logical_extent.width + // screen.getToolbarStyle()->fontset_extents->max_logical_extent.width // * len; } else { - frame.clock_w = XTextWidth(screen->getToolbarStyle()->font, t, len); + frame.clock_w = XTextWidth(screen.getToolbarStyle()->font, t, len); // ben's additional solution to pad some space beside the numbers - //frame.clock_w += screen->getToolbarStyle()->font->max_bounds.width * 4; + //frame.clock_w += screen.getToolbarStyle()->font->max_bounds.width * 4; // brad's solution again, too big - //frame.clock_w = screen->getToolbarStyle()->font->max_bounds.width * len; + //frame.clock_w = screen.getToolbarStyle()->font->max_bounds.width * len; } frame.clock_w += (frame.bevel_w * 4); @@ -305,7 +302,7 @@ void Toolbar::reconfigure(void) { } #else // !HAVE_STRFTIME frame.clock_w = - XTextWidth(screen->getToolbarStyle()->font, + XTextWidth(screen.getToolbarStyle()->font, i18n->getMessage(ToolbarSet, ToolbarNoStrftimeLength, "00:00000"), strlen(i18n->getMessage(ToolbarSet, ToolbarNoStrftimeLength, @@ -316,18 +313,18 @@ void Toolbar::reconfigure(void) { unsigned int w = 0; frame.workspace_label_w = 0; - for (i = 0; i < screen->getWorkspaceCount(); i++) { + for (i = 0; i < screen.getWorkspaceCount(); i++) { if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, - screen->getWorkspace(i)->getName(), - strlen(screen->getWorkspace(i)->getName()), + XmbTextExtents(screen.getToolbarStyle()->fontset, + screen.getWorkspace(i)->getName(), + strlen(screen.getWorkspace(i)->getName()), &ink, &logical); w = logical.width; } else { - w = XTextWidth(screen->getToolbarStyle()->font, - screen->getWorkspace(i)->getName(), - strlen(screen->getWorkspace(i)->getName())); + w = XTextWidth(screen.getToolbarStyle()->font, + screen.getWorkspace(i)->getName(), + strlen(screen.getWorkspace(i)->getName())); } w += (frame.bevel_w * 4); @@ -376,7 +373,7 @@ void Toolbar::reconfigure(void) { frame.label_h); Pixmap tmp = frame.base; - BTexture *texture = &(screen->getToolbarStyle()->toolbar); + BTexture *texture = &(screen.getToolbarStyle()->toolbar); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.base = None; XSetWindowBackground(display, frame.window, @@ -389,7 +386,7 @@ void Toolbar::reconfigure(void) { if (tmp) image_ctrl->removeImage(tmp); tmp = frame.label; - texture = &(screen->getToolbarStyle()->window); + texture = &(screen.getToolbarStyle()->window); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.label = None; XSetWindowBackground(display, frame.window_label, @@ -402,7 +399,7 @@ void Toolbar::reconfigure(void) { if (tmp) image_ctrl->removeImage(tmp); tmp = frame.wlabel; - texture = &(screen->getToolbarStyle()->label); + texture = &(screen.getToolbarStyle()->label); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.wlabel = None; XSetWindowBackground(display, frame.workspace_label, @@ -415,7 +412,7 @@ void Toolbar::reconfigure(void) { if (tmp) image_ctrl->removeImage(tmp); tmp = frame.clk; - texture = &(screen->getToolbarStyle()->clock); + texture = &(screen.getToolbarStyle()->clock); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.clk = None; XSetWindowBackground(display, frame.clock, @@ -428,7 +425,7 @@ void Toolbar::reconfigure(void) { if (tmp) image_ctrl->removeImage(tmp); tmp = frame.button; - texture = &(screen->getToolbarStyle()->button); + texture = &(screen.getToolbarStyle()->button); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.button = None; @@ -449,7 +446,7 @@ void Toolbar::reconfigure(void) { if (tmp) image_ctrl->removeImage(tmp); tmp = frame.pbutton; - texture = &(screen->getToolbarStyle()->pressed); + texture = &(screen.getToolbarStyle()->pressed); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.pbutton = None; frame.pbutton_pixel = texture->getColor()->getPixel(); @@ -460,8 +457,8 @@ void Toolbar::reconfigure(void) { if (tmp) image_ctrl->removeImage(tmp); XSetWindowBorder(display, frame.window, - screen->getBorderColor()->getPixel()); - XSetWindowBorderWidth(display, frame.window, screen->getBorderWidth()); + screen.getBorderColor()->getPixel()); + XSetWindowBorderWidth(display, frame.window, screen.getBorderWidth()); XClearWindow(display, frame.window); XClearWindow(display, frame.workspace_label); @@ -505,13 +502,13 @@ void Toolbar::checkClock(Bool redraw, Bool date) { if (redraw) { #ifdef HAVE_STRFTIME char t[1024]; - if (! strftime(t, 1024, screen->getStrftimeFormat(), tt)) + if (! strftime(t, 1024, screen.getStrftimeFormat(), tt)) return; #else // !HAVE_STRFTIME char t[9]; if (date) { // format the date... with special consideration for y2k ;) - if (screen->getDateFormat() == Openbox::B_EuropeanDate) + if (screen.getDateFormat() == Openbox::B_EuropeanDate) sprintf(t, 18n->getMessage(ToolbarSet, ToolbarNoStrftimeDateFormatEu, "%02d.%02d.%02d"), tt->tm_mday, tt->tm_mon + 1, @@ -522,7 +519,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) { tt->tm_mon + 1, tt->tm_mday, (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); } else { - if (screen->isClock24Hour()) + if (screen.isClock24Hour()) sprintf(t, i18n->getMessage(ToolbarSet, ToolbarNoStrftimeTimeFormat24, " %02d:%02d "), frame.hour, frame.minute); @@ -544,11 +541,11 @@ void Toolbar::checkClock(Bool redraw, Bool date) { if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, + XmbTextExtents(screen.getToolbarStyle()->fontset, t, dlen, &ink, &logical); l = logical.width; } else { - l = XTextWidth(screen->getToolbarStyle()->font, t, dlen); + l = XTextWidth(screen.getToolbarStyle()->font, t, dlen); } l += (frame.bevel_w * 4); @@ -557,11 +554,11 @@ void Toolbar::checkClock(Bool redraw, Bool date) { for (; dlen >= 0; dlen--) { if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, + XmbTextExtents(screen.getToolbarStyle()->fontset, t, dlen, &ink, &logical); l = logical.width; } else { - l = XTextWidth(screen->getToolbarStyle()->font, t, dlen); + l = XTextWidth(screen.getToolbarStyle()->font, t, dlen); } l+= (frame.bevel_w * 4); @@ -569,7 +566,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) { break; } } - switch (screen->getToolbarStyle()->justify) { + switch (screen.getToolbarStyle()->justify) { case BScreen::RightJustify: dx += frame.clock_w - l; break; @@ -579,7 +576,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) { break; } - ToolbarStyle *style = screen->getToolbarStyle(); + ToolbarStyle *style = screen.getToolbarStyle(); if (i18n->multibyte()) XmbDrawString(display, frame.clock, style->fontset, style->c_text_gc, dx, (1 - style->fontset_extents->max_ink_extent.y), @@ -592,23 +589,23 @@ void Toolbar::checkClock(Bool redraw, Bool date) { void Toolbar::redrawWindowLabel(Bool redraw) { - if (screen->getOpenbox()->getFocusedWindow()) { + if (screen.getOpenbox().getFocusedWindow()) { if (redraw) XClearWindow(display, frame.window_label); - OpenboxWindow *foc = screen->getOpenbox()->getFocusedWindow(); - if (foc->getScreen() != screen) return; + OpenboxWindow *foc = screen.getOpenbox().getFocusedWindow(); + if (foc->getScreen() != &screen) return; int dx = (frame.bevel_w * 2), dlen = strlen(*foc->getTitle()); unsigned int l; if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, *foc->getTitle(), + XmbTextExtents(screen.getToolbarStyle()->fontset, *foc->getTitle(), dlen, &ink, &logical); l = logical.width; } else { - l = XTextWidth(screen->getToolbarStyle()->font, *foc->getTitle(), dlen); + l = XTextWidth(screen.getToolbarStyle()->font, *foc->getTitle(), dlen); } l += (frame.bevel_w * 4); @@ -616,11 +613,11 @@ void Toolbar::redrawWindowLabel(Bool redraw) { for (; dlen >= 0; dlen--) { if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, + XmbTextExtents(screen.getToolbarStyle()->fontset, *foc->getTitle(), dlen, &ink, &logical); l = logical.width; } else { - l = XTextWidth(screen->getToolbarStyle()->font, + l = XTextWidth(screen.getToolbarStyle()->font, *foc->getTitle(), dlen); } l += (frame.bevel_w * 4); @@ -629,7 +626,7 @@ void Toolbar::redrawWindowLabel(Bool redraw) { break; } } - switch (screen->getToolbarStyle()->justify) { + switch (screen.getToolbarStyle()->justify) { case BScreen::RightJustify: dx += frame.window_label_w - l; break; @@ -639,7 +636,7 @@ void Toolbar::redrawWindowLabel(Bool redraw) { break; } - ToolbarStyle *style = screen->getToolbarStyle(); + ToolbarStyle *style = screen.getToolbarStyle(); if (i18n->multibyte()) XmbDrawString(display, frame.window_label, style->fontset, style->w_text_gc, dx, @@ -655,23 +652,23 @@ void Toolbar::redrawWindowLabel(Bool redraw) { void Toolbar::redrawWorkspaceLabel(Bool redraw) { - if (screen->getCurrentWorkspace()->getName()) { + if (screen.getCurrentWorkspace()->getName()) { if (redraw) XClearWindow(display, frame.workspace_label); int dx = (frame.bevel_w * 2), dlen = - strlen(screen->getCurrentWorkspace()->getName()); + strlen(screen.getCurrentWorkspace()->getName()); unsigned int l; if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, - screen->getCurrentWorkspace()->getName(), dlen, + XmbTextExtents(screen.getToolbarStyle()->fontset, + screen.getCurrentWorkspace()->getName(), dlen, &ink, &logical); l = logical.width; } else { - l = XTextWidth(screen->getToolbarStyle()->font, - screen->getCurrentWorkspace()->getName(), dlen); + l = XTextWidth(screen.getToolbarStyle()->font, + screen.getCurrentWorkspace()->getName(), dlen); } l += (frame.bevel_w * 4); @@ -679,13 +676,13 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) { for (; dlen >= 0; dlen--) { if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, - screen->getCurrentWorkspace()->getName(), dlen, + XmbTextExtents(screen.getToolbarStyle()->fontset, + screen.getCurrentWorkspace()->getName(), dlen, &ink, &logical); l = logical.width; } else { - l = XTextWidth(screen->getWindowStyle()->font, - screen->getCurrentWorkspace()->getName(), dlen); + l = XTextWidth(screen.getWindowStyle()->font, + screen.getCurrentWorkspace()->getName(), dlen); } l += (frame.bevel_w * 4); @@ -693,7 +690,7 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) { break; } } - switch (screen->getToolbarStyle()->justify) { + switch (screen.getToolbarStyle()->justify) { case BScreen::RightJustify: dx += frame.workspace_label_w - l; break; @@ -703,16 +700,16 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) { break; } - ToolbarStyle *style = screen->getToolbarStyle(); + ToolbarStyle *style = screen.getToolbarStyle(); if (i18n->multibyte()) XmbDrawString(display, frame.workspace_label, style->fontset, style->l_text_gc, dx, (1 - style->fontset_extents->max_ink_extent.y), - (char *) screen->getCurrentWorkspace()->getName(), dlen); + (char *) screen.getCurrentWorkspace()->getName(), dlen); else XDrawString(display, frame.workspace_label, style->l_text_gc, dx, (style->font->ascent + 1), - (char *) screen->getCurrentWorkspace()->getName(), dlen); + (char *) screen.getCurrentWorkspace()->getName(), dlen); } } @@ -740,7 +737,7 @@ void Toolbar::redrawPrevWorkspaceButton(Bool pressed, Bool redraw) { pts[1].x = 4; pts[1].y = 2; pts[2].x = 0; pts[2].y = -4; - XFillPolygon(display, frame.psbutton, screen->getToolbarStyle()->b_pic_gc, + XFillPolygon(display, frame.psbutton, screen.getToolbarStyle()->b_pic_gc, pts, 3, Convex, CoordModePrevious); } @@ -768,7 +765,7 @@ void Toolbar::redrawNextWorkspaceButton(Bool pressed, Bool redraw) { pts[1].x = 4; pts[1].y = 2; pts[2].x = -4; pts[2].y = 2; - XFillPolygon(display, frame.nsbutton, screen->getToolbarStyle()->b_pic_gc, + XFillPolygon(display, frame.nsbutton, screen.getToolbarStyle()->b_pic_gc, pts, 3, Convex, CoordModePrevious); } @@ -796,7 +793,7 @@ void Toolbar::redrawPrevWindowButton(Bool pressed, Bool redraw) { pts[1].x = 4; pts[1].y = 2; pts[2].x = 0; pts[2].y = -4; - XFillPolygon(display, frame.pwbutton, screen->getToolbarStyle()->b_pic_gc, + XFillPolygon(display, frame.pwbutton, screen.getToolbarStyle()->b_pic_gc, pts, 3, Convex, CoordModePrevious); } @@ -824,7 +821,7 @@ void Toolbar::redrawNextWindowButton(Bool pressed, Bool redraw) { pts[1].x = 4; pts[1].y = 2; pts[2].x = -4; pts[2].y = 2; - XFillPolygon(display, frame.nwbutton, screen->getToolbarStyle()->b_pic_gc, + XFillPolygon(display, frame.nwbutton, screen.getToolbarStyle()->b_pic_gc, pts, 3, Convex, CoordModePrevious); } @@ -839,23 +836,23 @@ void Toolbar::edit(void) { return; XSetInputFocus(display, frame.workspace_label, - ((screen->isSloppyFocus()) ? RevertToPointerRoot : + ((screen.isSloppyFocus()) ? RevertToPointerRoot : RevertToParent), CurrentTime); XClearWindow(display, frame.workspace_label); - openbox->setNoFocus(True); - if (openbox->getFocusedWindow()) - openbox->getFocusedWindow()->setFocusFlag(False); + openbox.setNoFocus(True); + if (openbox.getFocusedWindow()) + openbox.getFocusedWindow()->setFocusFlag(False); XDrawRectangle(display, frame.workspace_label, - screen->getWindowStyle()->l_text_focus_gc, + screen.getWindowStyle()->l_text_focus_gc, frame.workspace_label_w / 2, 0, 1, frame.label_h - 1); // change the background of the window to that of an active window label Pixmap tmp = frame.wlabel; - BTexture *texture = &(screen->getWindowStyle()->l_focus); + BTexture *texture = &(screen.getWindowStyle()->l_focus); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.wlabel = None; XSetWindowBackground(display, frame.workspace_label, @@ -887,7 +884,7 @@ void Toolbar::buttonPressEvent(XButtonEvent *be) { #endif // HAVE_STRFTIME else if (! on_top) { Window w[1] = { frame.window }; - screen->raiseWindows(w, 1); + screen.raiseWindows(w, 1); } } else if (be->button == 2 && (! on_top)) { XLowerWindow(display, frame.window); @@ -900,13 +897,13 @@ void Toolbar::buttonPressEvent(XButtonEvent *be) { if (x < 0) x = 0; - else if (x + toolbarmenu->getWidth() > screen->getWidth()) - x = screen->getWidth() - toolbarmenu->getWidth(); + else if (x + toolbarmenu->getWidth() > screen.getWidth()) + x = screen.getWidth() - toolbarmenu->getWidth(); if (y < 0) y = 0; - else if (y + toolbarmenu->getHeight() > screen->getHeight()) - y = screen->getHeight() - toolbarmenu->getHeight(); + else if (y + toolbarmenu->getHeight() > screen.getHeight()) + y = screen.getHeight() - toolbarmenu->getHeight(); toolbarmenu->move(x, y); toolbarmenu->show(); @@ -924,36 +921,36 @@ void Toolbar::buttonReleaseEvent(XButtonEvent *re) { if (re->x >= 0 && re->x < (signed) frame.button_w && re->y >= 0 && re->y < (signed) frame.button_w) - if (screen->getCurrentWorkspace()->getWorkspaceID() > 0) - screen->changeWorkspaceID(screen->getCurrentWorkspace()-> + if (screen.getCurrentWorkspace()->getWorkspaceID() > 0) + screen.changeWorkspaceID(screen.getCurrentWorkspace()-> getWorkspaceID() - 1); else - screen->changeWorkspaceID(screen->getWorkspaceCount() - 1); + screen.changeWorkspaceID(screen.getWorkspaceCount() - 1); } else if (re->window == frame.nsbutton) { redrawNextWorkspaceButton(False, True); if (re->x >= 0 && re->x < (signed) frame.button_w && re->y >= 0 && re->y < (signed) frame.button_w) - if (screen->getCurrentWorkspace()->getWorkspaceID() < - screen->getWorkspaceCount() - 1) - screen->changeWorkspaceID(screen->getCurrentWorkspace()-> + if (screen.getCurrentWorkspace()->getWorkspaceID() < + screen.getWorkspaceCount() - 1) + screen.changeWorkspaceID(screen.getCurrentWorkspace()-> getWorkspaceID() + 1); else - screen->changeWorkspaceID(0); + screen.changeWorkspaceID(0); } else if (re->window == frame.pwbutton) { redrawPrevWindowButton(False, True); if (re->x >= 0 && re->x < (signed) frame.button_w && re->y >= 0 && re->y < (signed) frame.button_w) - screen->prevFocus(); + screen.prevFocus(); } else if (re->window == frame.nwbutton) { redrawNextWindowButton(False, True); if (re->x >= 0 && re->x < (signed) frame.button_w && re->y >= 0 && re->y < (signed) frame.button_w) - screen->nextFocus(); + screen.nextFocus(); } else if (re->window == frame.window_label) - screen->raiseFocus(); + screen.raiseFocus(); #ifndef HAVE_STRFTIME else if (re->window == frame.clock) { XClearWindow(display, frame.clock); @@ -1001,7 +998,7 @@ void Toolbar::exposeEvent(XExposeEvent *ee) { void Toolbar::keyPressEvent(XKeyEvent *ke) { if (ke->window == frame.workspace_label && editing) { - openbox->grab(); + openbox.grab(); if (! new_workspace_name) { new_workspace_name = new char[128]; @@ -1020,10 +1017,10 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { editing = False; - openbox->setNoFocus(False); - if (openbox->getFocusedWindow()) { - openbox->getFocusedWindow()->setInputFocus(); - openbox->getFocusedWindow()->setFocusFlag(True); + openbox.setNoFocus(False); + if (openbox.getFocusedWindow()) { + openbox.getFocusedWindow()->setInputFocus(); + openbox.getFocusedWindow()->setFocusFlag(True); } else { XSetInputFocus(display, PointerRoot, None, CurrentTime); } @@ -1031,15 +1028,15 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { // workspace name which causes serious problems, especially for the // Openbox::LoadRC() method. if (*new_workspace_name) { - screen->getCurrentWorkspace()->setName(new_workspace_name); - screen->getCurrentWorkspace()->getMenu()->hide(); - screen->getWorkspacemenu()-> - remove(screen->getCurrentWorkspace()->getWorkspaceID() + 2); - screen->getWorkspacemenu()-> - insert(screen->getCurrentWorkspace()->getName(), - screen->getCurrentWorkspace()->getMenu(), - screen->getCurrentWorkspace()->getWorkspaceID() + 2); - screen->getWorkspacemenu()->update(); + screen.getCurrentWorkspace()->setName(new_workspace_name); + screen.getCurrentWorkspace()->getMenu()->hide(); + screen.getWorkspacemenu()-> + remove(screen.getCurrentWorkspace()->getWorkspaceID() + 2); + screen.getWorkspacemenu()-> + insert(screen.getCurrentWorkspace()->getName(), + screen.getCurrentWorkspace()->getMenu(), + screen.getCurrentWorkspace()->getWorkspaceID() + 2); + screen.getWorkspacemenu()->update(); } delete [] new_workspace_name; @@ -1049,7 +1046,7 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { // reset the background to that of the workspace label (its normal // setting) Pixmap tmp = frame.wlabel; - BTexture *texture = &(screen->getToolbarStyle()->label); + BTexture *texture = &(screen.getToolbarStyle()->label); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.wlabel = None; XSetWindowBackground(display, frame.workspace_label, @@ -1087,18 +1084,18 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { if (i18n->multibyte()) { XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, + XmbTextExtents(screen.getToolbarStyle()->fontset, new_workspace_name, l, &ink, &logical); tw = logical.width; } else { - tw = XTextWidth(screen->getToolbarStyle()->font, + tw = XTextWidth(screen.getToolbarStyle()->font, new_workspace_name, l); } x = (frame.workspace_label_w - tw) / 2; if (x < (signed) frame.bevel_w) x = frame.bevel_w; - WindowStyle *style = screen->getWindowStyle(); + WindowStyle *style = screen.getWindowStyle(); if (i18n->multibyte()) XmbDrawString(display, frame.workspace_label, style->fontset, style->l_text_focus_gc, x, @@ -1110,11 +1107,11 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { new_workspace_name, l); XDrawRectangle(display, frame.workspace_label, - screen->getWindowStyle()->l_text_focus_gc, x + tw, 0, 1, + screen.getWindowStyle()->l_text_focus_gc, x + tw, 0, 1, frame.label_h - 1); } - openbox->ungrab(); + openbox.ungrab(); } } @@ -1139,7 +1136,7 @@ void Toolbar::HideHandler::timeout(void) { } -Toolbarmenu::Toolbarmenu(Toolbar &tb) : Basemenu(*tb.screen), toolbar(tb) { +Toolbarmenu::Toolbarmenu(Toolbar &tb) : Basemenu(tb.screen), toolbar(tb) { setLabel(i18n->getMessage(ToolbarSet, ToolbarToolbarTitle, "Toolbar")); setInternalMenu(); @@ -1177,7 +1174,7 @@ void Toolbarmenu::itemSelected(int button, int index) { toolbar.on_top = change; setItemSelected(1, change); - if (toolbar.isOnTop()) toolbar.screen->raiseWindows((Window *) 0, 0); + if (toolbar.isOnTop()) toolbar.screen.raiseWindows((Window *) 0, 0); break; } @@ -1187,7 +1184,7 @@ void Toolbarmenu::itemSelected(int button, int index) { setItemSelected(2, change); #ifdef SLIT - toolbar.screen->getSlit()->reposition(); + toolbar.screen.getSlit()->reposition(); #endif // SLIT break; } @@ -1217,7 +1214,7 @@ void Toolbarmenu::reconfigure(void) { Toolbarmenu::Placementmenu::Placementmenu(Toolbarmenu &tm) - : Basemenu(*tm.toolbar.screen), toolbarmenu(tm) { + : Basemenu(tm.toolbar.screen), toolbarmenu(tm) { setLabel(i18n->getMessage(ToolbarSet, ToolbarToolbarPlacement, "Toolbar Placement")); setInternalMenu(); @@ -1246,13 +1243,13 @@ void Toolbarmenu::Placementmenu::itemSelected(int button, int index) { BasemenuItem *item = find(index); if (! item) return; - toolbarmenu.toolbar.screen->saveToolbarPlacement(item->function()); + toolbarmenu.toolbar.screen.saveToolbarPlacement(item->function()); hide(); toolbarmenu.toolbar.reconfigure(); #ifdef SLIT // reposition the slit as well to make sure it doesn't intersect the // toolbar - toolbarmenu.toolbar.screen->getSlit()->reposition(); + toolbarmenu.toolbar.screen.getSlit()->reposition(); #endif // SLIT } diff --git a/src/Toolbar.h b/src/Toolbar.h index 24892ccd..45962c95 100644 --- a/src/Toolbar.h +++ b/src/Toolbar.h @@ -88,9 +88,9 @@ private: virtual void timeout(void); } hide_handler; - Openbox *openbox; + Openbox &openbox; BImageControl *image_ctrl; - BScreen *screen; + BScreen &screen; BTimer *clock_timer, *hide_timer; Toolbarmenu *toolbarmenu; @@ -103,7 +103,7 @@ private: public: - Toolbar(BScreen *); + Toolbar(BScreen &); virtual ~Toolbar(void); inline Toolbarmenu *getMenu(void) { return toolbarmenu; } diff --git a/src/Window.cc b/src/Window.cc index 54cba742..9ec94fe5 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1005,7 +1005,7 @@ void OpenboxWindow::getWMProtocols(void) { else if (proto[i] == openbox->getWMTakeFocusAtom()) flags.send_focus_message = True; else if (proto[i] == openbox->getOpenboxStructureMessagesAtom()) - screen->addNetizen(new Netizen(screen, client.window)); + screen->addNetizen(new Netizen(*screen, client.window)); } XFree(proto); diff --git a/src/Windowmenu.cc b/src/Windowmenu.cc index 3bb9c497..8483f1ab 100644 --- a/src/Windowmenu.cc +++ b/src/Windowmenu.cc @@ -134,7 +134,7 @@ void Windowmenu::itemSelected(int button, int index) { break; case BScreen::WindowKill: - XKillClient(screen.getBaseDisplay()->getXDisplay(), + XKillClient(screen.getBaseDisplay().getXDisplay(), window.getClientWindow()); break; } diff --git a/src/Workspace.cc b/src/Workspace.cc index c899cc9a..130b0b40 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -120,12 +120,12 @@ const int Workspace::removeWindow(OpenboxWindow *w) { w->getTransientFor()->isVisible()) { w->getTransientFor()->setInputFocus(); } else if (screen->isSloppyFocus()) { - screen->getOpenbox()->setFocusedWindow((OpenboxWindow *) 0); + screen->getOpenbox().setFocusedWindow((OpenboxWindow *) 0); } else { OpenboxWindow *top = stackingList->first(); if (! top || ! top->setInputFocus()) { - screen->getOpenbox()->setFocusedWindow((OpenboxWindow *) 0); - XSetInputFocus(screen->getOpenbox()->getXDisplay(), + screen->getOpenbox().setFocusedWindow((OpenboxWindow *) 0); + XSetInputFocus(screen->getOpenbox().getXDisplay(), screen->getToolbar()->getWindowID(), RevertToParent, CurrentTime); } @@ -251,12 +251,12 @@ void Workspace::lowerWindow(OpenboxWindow *w) { win = win->getTransientFor(); } - screen->getOpenbox()->grab(); + screen->getOpenbox().grab(); - XLowerWindow(screen->getBaseDisplay()->getXDisplay(), *nstack); - XRestackWindows(screen->getBaseDisplay()->getXDisplay(), nstack, i); + XLowerWindow(screen->getBaseDisplay().getXDisplay(), *nstack); + XRestackWindows(screen->getBaseDisplay().getXDisplay(), nstack, i); - screen->getOpenbox()->ungrab(); + screen->getOpenbox().ungrab(); delete [] nstack; } diff --git a/src/openbox.cc b/src/openbox.cc index 2e4eb4c7..670c41c0 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -206,7 +206,7 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc) screenList = new LinkedList; for (int i = 0; i < getNumberOfScreens(); i++) { - BScreen *screen = new BScreen(this, i); + BScreen *screen = new BScreen(*this, i); if (! screen->isScreenManaged()) { delete screen; -- 2.45.2