fix for changing window buttons order. destroy them properly when they no longer exist and recreate them if they dont exist yet
This commit is contained in:
parent
d6c02ad70c
commit
e81b9d6a72
2 changed files with 19 additions and 30 deletions
|
@ -538,24 +538,6 @@ void OpenboxWindow::associateClientWindow(void) {
|
||||||
if (decorations.iconify) createIconifyButton();
|
if (decorations.iconify) createIconifyButton();
|
||||||
if (decorations.maximize) createMaximizeButton();
|
if (decorations.maximize) createMaximizeButton();
|
||||||
if (decorations.close) createCloseButton();
|
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 @@ void OpenboxWindow::positionButtons(Bool redecorate_label) {
|
||||||
for (int i = 0; format[i] != '\0' && i < 4; i++) {
|
for (int i = 0; format[i] != '\0' && i < 4; i++) {
|
||||||
switch(format[i]) {
|
switch(format[i]) {
|
||||||
case 'C':
|
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,
|
XMoveResizeWindow(display, frame.close_button, bx, by,
|
||||||
frame.button_w, frame.button_h);
|
frame.button_w, frame.button_h);
|
||||||
XMapWindow(display, frame.close_button);
|
XMapWindow(display, frame.close_button);
|
||||||
XClearWindow(display, frame.close_button);
|
XClearWindow(display, frame.close_button);
|
||||||
bx += frame.button_w + bw;
|
bx += frame.button_w + bw;
|
||||||
hasclose = true;
|
hasclose = true;
|
||||||
} else if (frame.close_button)
|
}
|
||||||
XUnmapWindow(display, frame.close_button);
|
|
||||||
break;
|
break;
|
||||||
case 'I':
|
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,
|
XMoveResizeWindow(display, frame.iconify_button, bx, by,
|
||||||
frame.button_w, frame.button_h);
|
frame.button_w, frame.button_h);
|
||||||
XMapWindow(display, frame.iconify_button);
|
XMapWindow(display, frame.iconify_button);
|
||||||
XClearWindow(display, frame.iconify_button);
|
XClearWindow(display, frame.iconify_button);
|
||||||
bx += frame.button_w + bw;
|
bx += frame.button_w + bw;
|
||||||
hasiconify = true;
|
hasiconify = true;
|
||||||
} else if (frame.close_button)
|
}
|
||||||
XUnmapWindow(display, frame.close_button);
|
|
||||||
break;
|
break;
|
||||||
case 'M':
|
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,
|
XMoveResizeWindow(display, frame.maximize_button, bx, by,
|
||||||
frame.button_w, frame.button_h);
|
frame.button_w, frame.button_h);
|
||||||
XMapWindow(display, frame.maximize_button);
|
XMapWindow(display, frame.maximize_button);
|
||||||
XClearWindow(display, frame.maximize_button);
|
XClearWindow(display, frame.maximize_button);
|
||||||
bx += frame.button_w + bw;
|
bx += frame.button_w + bw;
|
||||||
hasmaximize = true;
|
hasmaximize = true;
|
||||||
} else if (frame.close_button)
|
}
|
||||||
XUnmapWindow(display, frame.close_button);
|
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
XMoveResizeWindow(display, frame.label, bx, by - 1,
|
XMoveResizeWindow(display, frame.label, bx, by - 1,
|
||||||
|
@ -803,14 +788,17 @@ void OpenboxWindow::positionButtons(Bool redecorate_label) {
|
||||||
if (!hasclose) {
|
if (!hasclose) {
|
||||||
openbox.removeWindowSearch(frame.close_button);
|
openbox.removeWindowSearch(frame.close_button);
|
||||||
XDestroyWindow(display, frame.close_button);
|
XDestroyWindow(display, frame.close_button);
|
||||||
|
frame.close_button = None;
|
||||||
}
|
}
|
||||||
if (!hasiconify) {
|
if (!hasiconify) {
|
||||||
openbox.removeWindowSearch(frame.iconify_button);
|
openbox.removeWindowSearch(frame.iconify_button);
|
||||||
XDestroyWindow(display, frame.iconify_button);
|
XDestroyWindow(display, frame.iconify_button);
|
||||||
|
frame.iconify_button = None;
|
||||||
}
|
}
|
||||||
if (!hasmaximize) {
|
if (!hasmaximize) {
|
||||||
openbox.removeWindowSearch(frame.maximize_button);
|
openbox.removeWindowSearch(frame.maximize_button);
|
||||||
XDestroyWindow(display, frame.maximize_button);
|
XDestroyWindow(display, frame.maximize_button);
|
||||||
|
frame.maximize_button = None;
|
||||||
}
|
}
|
||||||
if (redecorate_label)
|
if (redecorate_label)
|
||||||
decorateLabel();
|
decorateLabel();
|
||||||
|
@ -1626,6 +1614,7 @@ void OpenboxWindow::maximize(unsigned int button) {
|
||||||
|
|
||||||
|
|
||||||
void OpenboxWindow::setWorkspace(int n) {
|
void OpenboxWindow::setWorkspace(int n) {
|
||||||
|
ASSERT(n < screen->getWorkspaceCount());
|
||||||
workspace_number = n;
|
workspace_number = n;
|
||||||
|
|
||||||
openbox_attrib.flags |= AttribWorkspace;
|
openbox_attrib.flags |= AttribWorkspace;
|
||||||
|
|
|
@ -86,8 +86,6 @@ Workspace::~Workspace(void) {
|
||||||
const int Workspace::addWindow(OpenboxWindow *w, Bool place) {
|
const int Workspace::addWindow(OpenboxWindow *w, Bool place) {
|
||||||
if (! w) return -1;
|
if (! w) return -1;
|
||||||
|
|
||||||
if (place) placeWindow(*w);
|
|
||||||
|
|
||||||
w->setWorkspace(id);
|
w->setWorkspace(id);
|
||||||
w->setWindowNumber(_windows.size());
|
w->setWindowNumber(_windows.size());
|
||||||
|
|
||||||
|
@ -101,6 +99,8 @@ const int Workspace::addWindow(OpenboxWindow *w, Bool place) {
|
||||||
|
|
||||||
raiseWindow(w);
|
raiseWindow(w);
|
||||||
|
|
||||||
|
if (place) placeWindow(*w);
|
||||||
|
|
||||||
return w->getWindowNumber();
|
return w->getWindowNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue