X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fclient.cc;h=f60a8da62e33882c38631cd62f3d9751ae5f6e0f;hb=8a7bff7a05b20b2f330c4d4e5f768a9bacb44ff9;hp=55fe4c24d39454506016a97b71d089c7291eb4c8;hpb=3cca07840b571a18e599d66b4108626cbd48788d;p=chaz%2Fopenbox diff --git a/src/client.cc b/src/client.cc index 55fe4c24..f60a8da6 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1071,12 +1071,19 @@ void Client::internal_resize(Corner anchor, int w, int h, bool user, w -= _base_size.x(); h -= _base_size.y(); - // for interactive resizing. have to move half an increment in each - // direction. - w += _size_inc.x() / 2; - h += _size_inc.y() / 2; - if (user) { + // for interactive resizing. have to move half an increment in each + // direction. + int mw = w % _size_inc.x(); // how far we are towards the next size inc + int mh = h % _size_inc.y(); + int aw = _size_inc.x() / 2; // amount to add + int ah = _size_inc.y() / 2; + // don't let us move into a new size increment + if (mw + aw >= _size_inc.x()) aw = _size_inc.x() - mw - 1; + if (mh + ah >= _size_inc.y()) ah = _size_inc.y() - mh - 1; + w += aw; + h += ah; + // if this is a user-requested resize, then check against min/max sizes // and aspect ratios @@ -1277,6 +1284,22 @@ void Client::changeAllowedActions(void) } +void Client::remaximize() +{ + int dir; + if (_max_horz && _max_vert) + dir = 0; + else if (_max_horz) + dir = 1; + else if (_max_vert) + dir = 2; + else + return; // not maximized + _max_horz = _max_vert = false; + maximize(true, dir, false); +} + + void Client::applyStartupState() { // these are in a carefully crafted order.. @@ -1405,8 +1428,6 @@ void Client::maximize(bool max, int dir, bool savearea) y = a.y() + frame->size().top; h = a.height() - frame->size().top - frame->size().bottom; } - - printf("dir %d x %d y %d w %d h %d\n", dir, x, y, w, h); } else { long *dimensions; long unsigned n = 4;