situation: a maximized xterm changes its size (coz the user changes the font).

after unmaximizing the window it snaps back to its old values .. which are not
in sync with the sizehints anymore. hence we need to apply them for maximizing
/ unmaximizing and unfullscreen to avoid ugly visual appearance.
This commit is contained in:
mathias 2006-04-11 19:55:24 +00:00
parent be03b0a3dc
commit 48579408d1
2 changed files with 77 additions and 61 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.16: Changes for 0.9.16:
*06/04/11: *06/04/11:
* Ensure applying of size hints while maximizing (Mathias)
Window.cc
* Fix calculation of prevWorkspace (Mathias) * Fix calculation of prevWorkspace (Mathias)
Screen.cc Screen.cc
* Cosmetic, close #1467926 (thanx Jonas Koelker) * Cosmetic, close #1467926 (thanx Jonas Koelker)

View file

@ -170,7 +170,7 @@ WinClient *getRootTransientFor(WinClient *client) {
/// raise window and do the same for each transient of the current window /// raise window and do the same for each transient of the current window
void raiseFluxboxWindow(FluxboxWindow &win) { void raiseFluxboxWindow(FluxboxWindow &win) {
if (win.oplock) if (win.oplock)
return; return;
win.oplock = true; win.oplock = true;
@ -187,7 +187,7 @@ void raiseFluxboxWindow(FluxboxWindow &win) {
} }
// for each transient do raise // for each transient do raise
WinClient::TransientList::const_iterator it = win.winClient().transientList().begin(); WinClient::TransientList::const_iterator it = win.winClient().transientList().begin();
WinClient::TransientList::const_iterator it_end = win.winClient().transientList().end(); WinClient::TransientList::const_iterator it_end = win.winClient().transientList().end();
for (; it != it_end; ++it) { for (; it != it_end; ++it) {
@ -195,7 +195,7 @@ void raiseFluxboxWindow(FluxboxWindow &win) {
// TODO: should we also check if it is the active client? // TODO: should we also check if it is the active client?
raiseFluxboxWindow(*(*it)->fbwindow()); raiseFluxboxWindow(*(*it)->fbwindow());
} }
win.oplock = false; win.oplock = false;
@ -206,7 +206,7 @@ void raiseFluxboxWindow(FluxboxWindow &win) {
/// lower window and do the same for each transient it holds /// lower window and do the same for each transient it holds
void lowerFluxboxWindow(FluxboxWindow &win) { void lowerFluxboxWindow(FluxboxWindow &win) {
if (win.oplock) if (win.oplock)
return; return;
win.oplock = true; win.oplock = true;
@ -493,7 +493,7 @@ void FluxboxWindow::init() {
associateClientWindow(true, wattrib.x, wattrib.y, wattrib.width, wattrib.height); associateClientWindow(true, wattrib.x, wattrib.y, wattrib.width, wattrib.height);
Fluxbox::instance()->attachSignals(*this); Fluxbox::instance()->attachSignals(*this);
// this window is managed, we are now allowed to modify actual state // this window is managed, we are now allowed to modify actual state
@ -640,7 +640,7 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
FbTk::TextButton *button_insert_pos = NULL; FbTk::TextButton *button_insert_pos = NULL;
if (client_insert_pos != m_clientlist.end()) if (client_insert_pos != m_clientlist.end())
button_insert_pos = m_labelbuttons[*client_insert_pos]; button_insert_pos = m_labelbuttons[*client_insert_pos];
// make sure we set new window search for each client // make sure we set new window search for each client
ClientList::iterator client_it = old_win->clientList().begin(); ClientList::iterator client_it = old_win->clientList().begin();
ClientList::iterator client_it_end = old_win->clientList().end(); ClientList::iterator client_it_end = old_win->clientList().end();
@ -659,14 +659,14 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
// create a labelbutton for this client and // create a labelbutton for this client and
// associate it with the pointer // associate it with the pointer
associateClient(*(*client_it)); associateClient(*(*client_it));
//null if we want the new button at the end of the list //null if we want the new button at the end of the list
if (x >= 0 && button_insert_pos) if (x >= 0 && button_insert_pos)
frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos); frame().moveLabelButtonLeftOf(*m_labelbuttons[*client_it], *button_insert_pos);
(*client_it)->saveBlackboxAttribs(m_blackbox_attrib); (*client_it)->saveBlackboxAttribs(m_blackbox_attrib);
} }
// add client and move over all attached clients // add client and move over all attached clients
// from the old window to this list // from the old window to this list
m_clientlist.splice(client_insert_pos, old_win->m_clientlist); m_clientlist.splice(client_insert_pos, old_win->m_clientlist);
@ -866,7 +866,7 @@ void FluxboxWindow::moveClientLeft() {
if (m_clientlist.size() == 1 || if (m_clientlist.size() == 1 ||
*m_clientlist.begin() == &winClient()) *m_clientlist.begin() == &winClient())
return; return;
// move client in clientlist to the left // move client in clientlist to the left
ClientList::iterator oldpos = find(m_clientlist.begin(), m_clientlist.end(), &winClient()); ClientList::iterator oldpos = find(m_clientlist.begin(), m_clientlist.end(), &winClient());
ClientList::iterator newpos = oldpos; newpos--; ClientList::iterator newpos = oldpos; newpos--;
@ -881,7 +881,7 @@ void FluxboxWindow::moveClientRight() {
if (m_clientlist.size() == 1 || if (m_clientlist.size() == 1 ||
*m_clientlist.rbegin() == &winClient()) *m_clientlist.rbegin() == &winClient())
return; return;
ClientList::iterator oldpos = find(m_clientlist.begin(), m_clientlist.end(), &winClient()); ClientList::iterator oldpos = find(m_clientlist.begin(), m_clientlist.end(), &winClient());
ClientList::iterator newpos = oldpos; newpos++; ClientList::iterator newpos = oldpos; newpos++;
std::swap(*newpos, *oldpos); std::swap(*newpos, *oldpos);
@ -901,7 +901,7 @@ FluxboxWindow::ClientList::iterator FluxboxWindow::getClientInsertPosition(int x
&labelbutton)) &labelbutton))
return m_clientlist.end(); return m_clientlist.end();
Client2ButtonMap::iterator it = Client2ButtonMap::iterator it =
find_if(m_labelbuttons.begin(), find_if(m_labelbuttons.begin(),
m_labelbuttons.end(), m_labelbuttons.end(),
Compose(bind2nd(equal_to<Window>(), labelbutton), Compose(bind2nd(equal_to<Window>(), labelbutton),
@ -930,7 +930,7 @@ FluxboxWindow::ClientList::iterator FluxboxWindow::getClientInsertPosition(int x
return client; return client;
} }
void FluxboxWindow::moveClientTo(WinClient &win, int x, int y) { void FluxboxWindow::moveClientTo(WinClient &win, int x, int y) {
@ -942,7 +942,7 @@ void FluxboxWindow::moveClientTo(WinClient &win, int x, int y) {
&labelbutton)) &labelbutton))
return; return;
Client2ButtonMap::iterator it = Client2ButtonMap::iterator it =
find_if(m_labelbuttons.begin(), find_if(m_labelbuttons.begin(),
m_labelbuttons.end(), m_labelbuttons.end(),
Compose(bind2nd(equal_to<Window>(), labelbutton), Compose(bind2nd(equal_to<Window>(), labelbutton),
@ -960,7 +960,7 @@ void FluxboxWindow::moveClientTo(WinClient &win, int x, int y) {
dest_x, dest_y, &x, &y, dest_x, dest_y, &x, &y,
&child_return)) &child_return))
return; return;
if (x > (*it).second->width() / 2) if (x > (*it).second->width() / 2)
moveClientRightOf(win, *it->first); moveClientRightOf(win, *it->first);
else else
moveClientLeftOf(win, *it->first); moveClientLeftOf(win, *it->first);
@ -969,9 +969,9 @@ void FluxboxWindow::moveClientTo(WinClient &win, int x, int y) {
void FluxboxWindow::moveClientLeftOf(WinClient &win, WinClient &dest) { void FluxboxWindow::moveClientLeftOf(WinClient &win, WinClient &dest) {
frame().moveLabelButtonLeftOf(*m_labelbuttons[&win], *m_labelbuttons[&dest]); frame().moveLabelButtonLeftOf(*m_labelbuttons[&win], *m_labelbuttons[&dest]);
ClientList::iterator it = find(m_clientlist.begin(), ClientList::iterator it = find(m_clientlist.begin(),
m_clientlist.end(), m_clientlist.end(),
&win); &win);
@ -991,7 +991,7 @@ void FluxboxWindow::moveClientLeftOf(WinClient &win, WinClient &dest) {
m_clientlist.erase(it); m_clientlist.erase(it);
//insert on the new place //insert on the new place
m_clientlist.insert(new_pos, &win); m_clientlist.insert(new_pos, &win);
updateClientLeftWindow(); updateClientLeftWindow();
} }
@ -1011,9 +1011,9 @@ void FluxboxWindow::moveClientRightOf(WinClient &win, WinClient &dest) {
return; return;
//moving a button to the right of itself results in no change //moving a button to the right of itself results in no change
if (new_pos == it) if (new_pos == it)
return; return;
//remove from list //remove from list
m_clientlist.erase(it); m_clientlist.erase(it);
//need to insert into the next position //need to insert into the next position
@ -1023,7 +1023,7 @@ void FluxboxWindow::moveClientRightOf(WinClient &win, WinClient &dest) {
m_clientlist.push_back(&win); m_clientlist.push_back(&win);
else else
m_clientlist.insert(new_pos, &win); m_clientlist.insert(new_pos, &win);
updateClientLeftWindow(); updateClientLeftWindow();
} }
@ -1068,7 +1068,7 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) {
if (setinput && setInputFocus()) { if (setinput && setInputFocus()) {
return true; return true;
} }
return false; return false;
} }
@ -1569,14 +1569,14 @@ void FluxboxWindow::withdraw(bool interrupt_moving) {
} }
/** setFullscreen mode: /** setFullscreen mode:
- maximize as big as the screen is, dont care about slit / toolbar - maximize as big as the screen is, dont care about slit / toolbar
- raise to toplayer - raise to toplayer
*/ */
void FluxboxWindow::setFullscreen(bool flag) { void FluxboxWindow::setFullscreen(bool flag) {
const int head = screen().getHead(fbWindow()); const int head = screen().getHead(fbWindow());
if (flag && !isFullscreen()) { if (flag && !isFullscreen()) {
if (isIconic()) if (isIconic())
@ -1593,7 +1593,7 @@ void FluxboxWindow::setFullscreen(bool flag) {
m_old_pos_y = frame().y(); m_old_pos_y = frame().y();
m_old_width = frame().width(); m_old_width = frame().width();
m_old_height = frame().height(); m_old_height = frame().height();
// clear decorations // clear decorations
setDecorationMask(0); setDecorationMask(0);
@ -1609,16 +1609,24 @@ void FluxboxWindow::setFullscreen(bool flag) {
} else if (!flag && isFullscreen()) { } else if (!flag && isFullscreen()) {
fullscreen = false; fullscreen = false;
setDecorationMask(m_old_decoration_mask); setDecorationMask(m_old_decoration_mask);
frame().setUseShape(!m_shaped); frame().setUseShape(!m_shaped);
moveResize(m_old_pos_x, m_old_pos_y, m_old_width, m_old_height); // ensure we apply the sizehints here, otherwise some
// apps (eg xterm) end up a little bit .. crappy (visually)
m_last_resize_x = m_old_pos_x;
m_last_resize_y = m_old_pos_y;
m_last_resize_w = m_old_width;
m_last_resize_h = m_old_height;
fixsize();
moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h);
moveToLayer(m_old_layernum); moveToLayer(m_old_layernum);
m_old_decoration_mask = 0; m_old_decoration_mask = 0;
m_old_layernum = ::Layer::NORMAL; m_old_layernum = ::Layer::NORMAL;
stateSig().notify(); stateSig().notify();
} }
} }
@ -1630,7 +1638,7 @@ void FluxboxWindow::maximize(int type) {
if (isFullscreen()) if (isFullscreen())
return; return;
if (isIconic()) if (isIconic())
deiconify(); deiconify();
@ -1706,8 +1714,14 @@ void FluxboxWindow::maximize(int type) {
maximized ^= MAX_HORZ; maximized ^= MAX_HORZ;
} }
moveResize(new_x, new_y, new_w, new_h); // ensure we apply the sizehints here, otherwise some
// apps (eg xterm) end up a little bit .. crappy (visually)
m_last_resize_x = new_x;
m_last_resize_y = new_y;
m_last_resize_w = new_w;
m_last_resize_h = new_h;
fixsize();
moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h);
} }
/** /**
* Maximize window horizontal * Maximize window horizontal
@ -1843,7 +1857,7 @@ void FluxboxWindow::raise() {
// if we don't have any root window use this as root // if we don't have any root window use this as root
if (client == 0) if (client == 0)
client = m_client; client = m_client;
// if we have transient_for then we should put ourself last in // if we have transient_for then we should put ourself last in
// transients list so we get raised last and thus gets above the other transients // transients list so we get raised last and thus gets above the other transients
if (m_client->transientFor() && m_client != m_client->transientFor()->transientList().back()) { if (m_client->transientFor() && m_client != m_client->transientFor()->transientList().back()) {
// remove and push back so this window gets raised last // remove and push back so this window gets raised last
@ -1853,7 +1867,7 @@ void FluxboxWindow::raise() {
// raise this window and every transient in it with this one last // raise this window and every transient in it with this one last
if (client->fbwindow()) if (client->fbwindow())
raiseFluxboxWindow(*client->fbwindow()); raiseFluxboxWindow(*client->fbwindow());
} }
void FluxboxWindow::lower() { void FluxboxWindow::lower() {
@ -2676,7 +2690,7 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
if ((re.button == 1) && (re.state & Mod1Mask) && !screen().clickRaises()) if ((re.button == 1) && (re.state & Mod1Mask) && !screen().clickRaises())
if (!isMoving()) if (!isMoving())
raise(); raise();
if (isMoving()) if (isMoving())
stopMoving(); stopMoving();
else if (isResizing()) else if (isResizing())
@ -2726,7 +2740,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
WinClient *client = 0; WinClient *client = 0;
if (!inside_titlebar) { if (!inside_titlebar) {
// determine if we're in titlebar // determine if we're in titlebar
Client2ButtonMap::iterator it = Client2ButtonMap::iterator it =
find_if(m_labelbuttons.begin(), find_if(m_labelbuttons.begin(),
m_labelbuttons.end(), m_labelbuttons.end(),
Compose(bind2nd(equal_to<Window>(), me.window), Compose(bind2nd(equal_to<Window>(), me.window),
@ -2832,7 +2846,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
if (screen().getResizeModel() == BScreen::CENTERRESIZE) if (screen().getResizeModel() == BScreen::CENTERRESIZE)
m_resize_corner = ALLCORNERS; m_resize_corner = ALLCORNERS;
else else
m_resize_corner = RIGHTBOTTOM; m_resize_corner = RIGHTBOTTOM;
} else if (me.x < cx) } else if (me.x < cx)
m_resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM; m_resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM;
else else
@ -2841,12 +2855,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
startResizing(me.window, me.x, me.y); startResizing(me.window, me.x, me.y);
} else if (resizing) { } else if (resizing) {
int old_resize_x = m_last_resize_x; int old_resize_x = m_last_resize_x;
int old_resize_y = m_last_resize_y; int old_resize_y = m_last_resize_y;
int old_resize_w = m_last_resize_w; int old_resize_w = m_last_resize_w;
int old_resize_h = m_last_resize_h; int old_resize_h = m_last_resize_h;
// move rectangle // move rectangle
int gx = 0, gy = 0; int gx = 0, gy = 0;
@ -2872,7 +2886,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
int diff = 2 * (max(dx, dy) / 2); int diff = 2 * (max(dx, dy) / 2);
m_last_resize_h = frame().height() + diff; m_last_resize_h = frame().height() + diff;
m_last_resize_w = frame().width() + diff; m_last_resize_w = frame().width() + diff;
m_last_resize_x = frame().x() - diff/2; m_last_resize_x = frame().x() - diff/2;
m_last_resize_y = frame().y() - diff/2; m_last_resize_y = frame().y() - diff/2;
@ -2881,7 +2895,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
}; };
// if not on top or all corner then move bottom // if not on top or all corner then move bottom
if (!(m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP || if (!(m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP ||
m_resize_corner == ALLCORNERS)) m_resize_corner == ALLCORNERS))
m_last_resize_h = frame().height() + dy; m_last_resize_h = frame().height() + dy;
@ -2890,7 +2904,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
if (!(m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM || if (!(m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM ||
m_resize_corner == ALLCORNERS)) m_resize_corner == ALLCORNERS))
m_last_resize_w = frame().width() + dx; m_last_resize_w = frame().width() + dx;
fixsize(&gx, &gy); fixsize(&gx, &gy);
if (old_resize_x != m_last_resize_x || if (old_resize_x != m_last_resize_x ||
@ -2983,7 +2997,7 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
WinClient *client = 0; WinClient *client = 0;
if (screen().focusControl().isMouseTabFocus()) { if (screen().focusControl().isMouseTabFocus()) {
// determine if we're in a label button (tab) // determine if we're in a label button (tab)
Client2ButtonMap::iterator it = Client2ButtonMap::iterator it =
find_if(m_labelbuttons.begin(), find_if(m_labelbuttons.begin(),
m_labelbuttons.end(), m_labelbuttons.end(),
Compose(bind2nd(equal_to<Window>(), ev.window), Compose(bind2nd(equal_to<Window>(), ev.window),
@ -2991,7 +3005,7 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
Select2nd<Client2ButtonMap::value_type>()))); Select2nd<Client2ButtonMap::value_type>())));
if (it != m_labelbuttons.end()) if (it != m_labelbuttons.end())
client = (*it).first; client = (*it).first;
} }
if (ev.window == frame().window() || if (ev.window == frame().window() ||
@ -3103,7 +3117,7 @@ void FluxboxWindow::applyDecorations(bool initial) {
// tab deocration only affects if we're external // tab deocration only affects if we're external
// must do before the setTabMode in case it goes // must do before the setTabMode in case it goes
// to external and is meant to be hidden // to external and is meant to be hidden
if (decorations.tab) if (decorations.tab)
client_move |= frame().showTabs(); client_move |= frame().showTabs();
else else
client_move |= frame().hideTabs(); client_move |= frame().hideTabs();
@ -3209,7 +3223,7 @@ void FluxboxWindow::startMoving(Window win) {
moving = true; moving = true;
maximized = MAX_NONE; maximized = MAX_NONE;
Fluxbox *fluxbox = Fluxbox::instance(); Fluxbox *fluxbox = Fluxbox::instance();
// grabbing (and masking) on the root window allows us to // grabbing (and masking) on the root window allows us to
// freely map and unmap the window we're moving. // freely map and unmap the window we're moving.
@ -3355,7 +3369,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
int top = orig_top; // orig include the borders int top = orig_top; // orig include the borders
int left = orig_left; int left = orig_left;
int right = orig_left + width() + 2 * borderW; int right = orig_left + width() + 2 * borderW;
int bottom = orig_top + height() + 2 * borderW; int bottom = orig_top + height() + 2 * borderW;
@ -3420,10 +3434,10 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
unsigned int bw; unsigned int bw;
for (; it != it_end; it++) { for (; it != it_end; it++) {
if ((*it) == this) if ((*it) == this)
continue; // skip myself continue; // skip myself
bw = (*it)->decorationMask() & (DECORM_ENABLED|DECORM_BORDER|DECORM_HANDLE) ? bw = (*it)->decorationMask() & (DECORM_ENABLED|DECORM_BORDER|DECORM_HANDLE) ?
(*it)->frame().window().borderWidth() : 0; (*it)->frame().window().borderWidth() : 0;
snapToWindow(dx, dy, left, right, top, bottom, snapToWindow(dx, dy, left, right, top, bottom,
@ -3447,7 +3461,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
(*it)->x() - (*it)->xOffset() + (*it)->width() + 2 * bw + (*it)->widthOffset(), (*it)->x() - (*it)->xOffset() + (*it)->width() + 2 * bw + (*it)->widthOffset(),
(*it)->y() - (*it)->yOffset(), (*it)->y() - (*it)->yOffset(),
(*it)->y() - (*it)->yOffset() + (*it)->height() + 2 * bw + (*it)->heightOffset()); (*it)->y() - (*it)->yOffset() + (*it)->height() + 2 * bw + (*it)->heightOffset());
if (i_have_tabs) if (i_have_tabs)
snapToWindow(dx, dy, left - xoff, right - xoff + woff, top - yoff, bottom - yoff + hoff, snapToWindow(dx, dy, left - xoff, right - xoff + woff, top - yoff, bottom - yoff + hoff,
(*it)->x() - (*it)->xOffset(), (*it)->x() - (*it)->xOffset(),
@ -3502,7 +3516,7 @@ void FluxboxWindow::startResizing(Window win, int x, int y) {
void FluxboxWindow::stopResizing(bool interrupted) { void FluxboxWindow::stopResizing(bool interrupted) {
resizing = false; resizing = false;
parent().drawRectangle(screen().rootTheme().opGC(), parent().drawRectangle(screen().rootTheme().opGC(),
m_last_resize_x, m_last_resize_y, m_last_resize_x, m_last_resize_y,
m_last_resize_w - 1 + 2 * frame().window().borderWidth(), m_last_resize_w - 1 + 2 * frame().window().borderWidth(),
@ -3554,7 +3568,7 @@ void FluxboxWindow::attachTo(int x, int y, bool interrupted) {
inside_titlebar = client->fbwindow()->hasTitlebar() && inside_titlebar = client->fbwindow()->hasTitlebar() &&
client->fbwindow()->y() + client->fbwindow()->titlebarHeight() > dest_y; client->fbwindow()->y() + client->fbwindow()->titlebarHeight() > dest_y;
Fluxbox::TabsAttachArea area= Fluxbox::instance()->getTabsAttachArea(); Fluxbox::TabsAttachArea area= Fluxbox::instance()->getTabsAttachArea();
if (area == Fluxbox::ATTACH_AREA_WINDOW) if (area == Fluxbox::ATTACH_AREA_WINDOW)
attach_to_win = client->fbwindow(); attach_to_win = client->fbwindow();
@ -3794,7 +3808,7 @@ void FluxboxWindow::fixsize(int *user_w, int *user_h) {
// move X if necessary // move X if necessary
if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) { if (m_resize_corner == LEFTTOP || m_resize_corner == LEFTBOTTOM) {
m_last_resize_x = frame().x() + frame().width() - m_last_resize_w; m_last_resize_x = frame().x() + frame().width() - m_last_resize_w;
} }
if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) { if (m_resize_corner == LEFTTOP || m_resize_corner == RIGHTTOP) {
m_last_resize_y = frame().y() + frame().height() - m_last_resize_h; m_last_resize_y = frame().y() + frame().height() - m_last_resize_h;
@ -3920,13 +3934,13 @@ void FluxboxWindow::setupWindow() {
WinButton::Type titlebar_right[] = { WinButton::Type titlebar_right[] = {
WinButton::MINIMIZE, WinButton::MINIMIZE,
WinButton::MAXIMIZE, WinButton::MAXIMIZE,
WinButton::CLOSE WinButton::CLOSE
}; };
WinButton::Type *begin = 0; WinButton::Type *begin = 0;
WinButton::Type *end = 0; WinButton::Type *end = 0;
if (i == 0) { if (i == 0) {
begin = titlebar_left; begin = titlebar_left;
end = titlebar_left + 1; end = titlebar_left + 1;
@ -3935,13 +3949,13 @@ void FluxboxWindow::setupWindow() {
end = titlebar_right + 3; end = titlebar_right + 3;
} }
titlebar_side[i] = titlebar_side[i] =
new WinButtonsResource(rm, new WinButtonsResource(rm,
WinButtonsResource::Type(begin, end), WinButtonsResource::Type(begin, end),
titlebar_name[i], titlebar_alt_name[i]); titlebar_name[i], titlebar_alt_name[i]);
screen().addManagedResource(titlebar_side[i]); screen().addManagedResource(titlebar_side[i]);
} }
@ -3950,7 +3964,7 @@ void FluxboxWindow::setupWindow() {
for (size_t c = 0; c < 2 ; c++) { for (size_t c = 0; c < 2 ; c++) {
// get titlebar configuration for current side // get titlebar configuration for current side
const std::vector<WinButton::Type> &dir = *(*titlebar_side[c]); const std::vector<WinButton::Type> &dir = *(*titlebar_side[c]);
for (size_t i=0; i < dir.size(); ++i) { for (size_t i=0; i < dir.size(); ++i) {
//create new buttons //create new buttons
WinButton *winbtn = 0; WinButton *winbtn = 0;
@ -4002,7 +4016,7 @@ void FluxboxWindow::setupWindow() {
frame().titlebar(), frame().titlebar(),
0, 0, 10, 10); 0, 0, 10, 10);
stateSig().attach(winbtn); stateSig().attach(winbtn);
winbtn->setOnClick(shade_cmd); winbtn->setOnClick(shade_cmd);
break; break;
case WinButton::MENUICON: case WinButton::MENUICON:
winbtn = new WinButton(*this, winbutton_theme, winbtn = new WinButton(*this, winbutton_theme,
@ -4039,7 +4053,7 @@ void FluxboxWindow::setupWindow() {
int reverse = 0; int reverse = 0;
if (screen().getScrollReverse()) if (screen().getScrollReverse())
reverse = 1; reverse = 1;
if (StringUtil::toLower(screen().getScrollAction()) == std::string("shade")) { if (StringUtil::toLower(screen().getScrollAction()) == std::string("shade")) {
frame().setOnClickTitlebar(shade_on_cmd, 5 - reverse); // shade on mouse roll frame().setOnClickTitlebar(shade_on_cmd, 5 - reverse); // shade on mouse roll
frame().setOnClickTitlebar(shade_off_cmd, 4 + reverse); // unshade if rolled oposite direction frame().setOnClickTitlebar(shade_off_cmd, 4 + reverse); // unshade if rolled oposite direction
@ -4124,7 +4138,7 @@ void FluxboxWindow::associateClient(WinClient &client) {
Fluxbox::instance()->getTabsPadding()); Fluxbox::instance()->getTabsPadding());
m_labelbuttons[&client] = btn; m_labelbuttons[&client] = btn;
FbTk::EventManager &evm = *FbTk::EventManager::instance(); FbTk::EventManager &evm = *FbTk::EventManager::instance();