all repos — openbox @ e81b9d6a722b45f8895e70aa108ba4f879b48572

openbox fork - make it a bit more like ryudo

fix for changing window buttons order. destroy them properly when they no longer exist and recreate them if they dont exist yet
Dana Jansens danakj@orodu.net
commit

e81b9d6a722b45f8895e70aa108ba4f879b48572

parent

d6c02ad70c42f074a4c3d8c433de5bb2c63dea8e

2 files changed, 19 insertions(+), 30 deletions(-)

jump to
M src/Window.ccsrc/Window.cc

@@ -538,24 +538,6 @@

if (decorations.iconify) createIconifyButton(); if (decorations.maximize) createMaximizeButton(); if (decorations.close) createCloseButton(); - - if (frame.ubutton) { - if (frame.close_button) - XSetWindowBackgroundPixmap(display, frame.close_button, frame.ubutton); - if (frame.maximize_button) - XSetWindowBackgroundPixmap(display, frame.maximize_button, - frame.ubutton); - if (frame.iconify_button) - XSetWindowBackgroundPixmap(display, frame.iconify_button, frame.ubutton); - } else { - if (frame.close_button) - XSetWindowBackground(display, frame.close_button, frame.ubutton_pixel); - if (frame.maximize_button) - XSetWindowBackground(display, frame.maximize_button, - frame.ubutton_pixel); - if (frame.iconify_button) - XSetWindowBackground(display, frame.iconify_button, frame.ubutton_pixel); - } }

@@ -760,37 +742,40 @@

for (int i = 0; format[i] != '\0' && i < 4; i++) { switch(format[i]) { case 'C': - if (decorations.close && frame.close_button != None) { + if (decorations.close) { + if (frame.close_button == None) + createCloseButton(); XMoveResizeWindow(display, frame.close_button, bx, by, frame.button_w, frame.button_h); XMapWindow(display, frame.close_button); XClearWindow(display, frame.close_button); bx += frame.button_w + bw; hasclose = true; - } else if (frame.close_button) - XUnmapWindow(display, frame.close_button); + } break; case 'I': - if (decorations.iconify && frame.iconify_button != None) { + if (decorations.iconify) { + if (frame.iconify_button == None) + createIconifyButton(); XMoveResizeWindow(display, frame.iconify_button, bx, by, frame.button_w, frame.button_h); XMapWindow(display, frame.iconify_button); XClearWindow(display, frame.iconify_button); bx += frame.button_w + bw; hasiconify = true; - } else if (frame.close_button) - XUnmapWindow(display, frame.close_button); + } break; case 'M': - if (decorations.maximize && frame.maximize_button != None) { + if (decorations.maximize) { + if (frame.maximize_button == None) + createMaximizeButton(); XMoveResizeWindow(display, frame.maximize_button, bx, by, frame.button_w, frame.button_h); XMapWindow(display, frame.maximize_button); XClearWindow(display, frame.maximize_button); bx += frame.button_w + bw; hasmaximize = true; - } else if (frame.close_button) - XUnmapWindow(display, frame.close_button); + } break; case 'L': XMoveResizeWindow(display, frame.label, bx, by - 1,

@@ -802,15 +787,18 @@ }

if (!hasclose) { openbox.removeWindowSearch(frame.close_button); - XDestroyWindow(display, 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 (!hasmaximize) { openbox.removeWindowSearch(frame.maximize_button); XDestroyWindow(display, frame.maximize_button); + frame.maximize_button = None; } if (redecorate_label) decorateLabel();

@@ -1626,6 +1614,7 @@ }

void OpenboxWindow::setWorkspace(int n) { + ASSERT(n < screen->getWorkspaceCount()); workspace_number = n; openbox_attrib.flags |= AttribWorkspace;
M src/Workspace.ccsrc/Workspace.cc

@@ -86,8 +86,6 @@

const int Workspace::addWindow(OpenboxWindow *w, Bool place) { if (! w) return -1; - if (place) placeWindow(*w); - w->setWorkspace(id); w->setWindowNumber(_windows.size());

@@ -100,6 +98,8 @@

screen.updateNetizenWindowAdd(w->getClientWindow(), id); raiseWindow(w); + + if (place) placeWindow(*w); return w->getWindowNumber(); }