X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2FWindow.cc;h=80f201ad36a34a059f1685c11448db35bf523fbf;hb=788754fec3eb30dca567c047601d4c5791457c8c;hp=fe13f4c1771fa05e37502b9dc8dfc51f6402e1d2;hpb=e81b9d6a722b45f8895e70aa108ba4f879b48572;p=chaz%2Fopenbox diff --git a/src/Window.cc b/src/Window.cc index fe13f4c1..80f201ad 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -261,16 +261,16 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) { if (! screen->sloppyFocus()) openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask, - GrabModeSync, GrabModeSync, None, None); + GrabModeSync, GrabModeSync, frame.plate, None); openbox.grabButton(Button1, Mod1Mask, frame.window, True, ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, - GrabModeAsync, None, openbox.getMoveCursor()); + GrabModeAsync, frame.window, openbox.getMoveCursor()); openbox.grabButton(Button2, Mod1Mask, frame.window, True, - ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); + ButtonReleaseMask, GrabModeAsync, GrabModeAsync, frame.window, None); openbox.grabButton(Button3, Mod1Mask, frame.window, True, ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, - GrabModeAsync, None, None); + GrabModeAsync, frame.window, None); positionWindows(); XRaiseWindow(display, frame.plate); @@ -721,7 +721,7 @@ void OpenboxWindow::createMaximizeButton(void) { } -void OpenboxWindow::positionButtons(Bool redecorate_label) { +void OpenboxWindow::positionButtons() { const char *format = openbox.getTitleBarLayout(); const unsigned int bw = frame.bevel_w + 1; const unsigned int by = frame.bevel_w + 1; @@ -785,23 +785,22 @@ void OpenboxWindow::positionButtons(Bool redecorate_label) { } } - if (!hasclose) { - openbox.removeWindowSearch(frame.close_button); - XDestroyWindow(display, frame.close_button); - frame.close_button = None; + if (!hasclose && frame.close_button) { + openbox.removeWindowSearch(frame.close_button); + XDestroyWindow(display, frame.close_button); + frame.close_button = None; } - if (!hasiconify) { - openbox.removeWindowSearch(frame.iconify_button); - XDestroyWindow(display, frame.iconify_button); - frame.iconify_button = None; + if (!hasiconify && frame.iconify_button) { + openbox.removeWindowSearch(frame.iconify_button); + XDestroyWindow(display, frame.iconify_button); + frame.iconify_button = None; } - if (!hasmaximize) { - openbox.removeWindowSearch(frame.maximize_button); - XDestroyWindow(display, frame.maximize_button); - frame.maximize_button = None; + if (!hasmaximize && frame.iconify_button) { + openbox.removeWindowSearch(frame.maximize_button); + XDestroyWindow(display, frame.maximize_button); + frame.maximize_button = None; } - if (redecorate_label) - decorateLabel(); + redrawLabel(); redrawAllButtons(); } @@ -1302,10 +1301,9 @@ void OpenboxWindow::configure(int dx, int dy, XMoveWindow(display, frame.window, frame.x, frame.y); + setFocusFlag(flags.focused); positionWindows(); decorate(); - setFocusFlag(flags.focused); - redrawAllButtons(); } else { frame.x = dx; frame.y = dy; @@ -1534,7 +1532,7 @@ void OpenboxWindow::maximize(unsigned int button) { openbox_attrib.premax_x = openbox_attrib.premax_y = 0; openbox_attrib.premax_w = openbox_attrib.premax_h = 0; - redrawAllButtons(); + redrawMaximizeButton(flags.maximized); setState(current_state); return; } @@ -1608,7 +1606,7 @@ void OpenboxWindow::maximize(unsigned int button) { configure(dx, dy, dw, dh); screen->getWorkspace(workspace_number)->raiseWindow(this); - redrawAllButtons(); + redrawMaximizeButton(flags.maximized); setState(current_state); } @@ -2241,12 +2239,8 @@ void OpenboxWindow::mapNotifyEvent(XMapEvent *ne) { openbox.grab(); if (! validateClient()) return; - if (decorations.titlebar) positionButtons(); - setState(NormalState); - redrawAllButtons(); - if (flags.transient || screen->focusNew()) setInputFocus(); else @@ -2410,7 +2404,10 @@ void OpenboxWindow::propertyNotifyEvent(Atom atom) { if (decorations.close && (! frame.close_button)) { createCloseButton(); - if (decorations.titlebar) positionButtons(True); + if (decorations.titlebar) { + positionButtons(); + decorateLabel(); + } if (windowmenu) windowmenu->reconfigure(); } }