diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-04 07:24:40 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-04 07:24:40 +0000 |
| commit | a6f5b33ad90637705af9717c978bf895455c71ba (patch) | |
| tree | 3065ff1c17888b1ac753887852b057bed5d3210c /src/client.cc | |
| parent | 8735c12d9633738a5150c451457471d797fa9bf1 (diff) | |
configure request optimizations
Diffstat (limited to 'src/client.cc')
| -rw-r--r-- | src/client.cc | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/client.cc b/src/client.cc index 289fcf16..80869e15 100644 --- a/src/client.cc +++ b/src/client.cc @@ -802,7 +802,7 @@ void OBClient::shapeHandler(const XShapeEvent &e) #endif -void OBClient::resize(Corner anchor, int w, int h) +void OBClient::resize(Corner anchor, int w, int h, int x, int y) { w -= _base_size.x(); h -= _base_size.y(); @@ -835,23 +835,27 @@ void OBClient::resize(Corner anchor, int w, int h) w += _base_size.x(); h += _base_size.y(); - int x = _area.x(), y = _area.y(); - switch (anchor) { - case TopLeft: - break; - case TopRight: - x -= w - _area.width(); - break; - case BottomLeft: - y -= h - _area.height(); - break; - case BottomRight: - x -= w - _area.width(); - y -= h - _area.height(); - break; + if (x == INT_MIN || y == INT_MIN) { + x = _area.x(); + y = _area.y(); + switch (anchor) { + case TopLeft: + break; + case TopRight: + x -= w - _area.width(); + break; + case BottomLeft: + y -= h - _area.height(); + break; + case BottomRight: + x -= w - _area.width(); + y -= h - _area.height(); + break; + } } _area.setSize(w, h); + XResizeWindow(otk::OBDisplay::display, _window, w, h); // resize the frame to match the request @@ -863,6 +867,7 @@ void OBClient::resize(Corner anchor, int w, int h) void OBClient::move(int x, int y) { _area.setPos(x, y); + // move the frame to be in the requested position frame->adjustPosition(); } @@ -1048,10 +1053,14 @@ void OBClient::configureRequestHandler(const XConfigureRequestEvent &e) corner = TopLeft; } - resize(corner, w, h); - } - - if (e.value_mask & (CWX | CWY)) { + // if moving AND resizing ... + if (e.value_mask & (CWX | CWY)) { + int x = (e.value_mask & CWX) ? e.x : _area.x(); + int y = (e.value_mask & CWY) ? e.y : _area.y(); + resize(corner, w, h, x, y); + } else // if JUST resizing... + resize(corner, w, h); + } else if (e.value_mask & (CWX | CWY)) { // if JUST moving... int x = (e.value_mask & CWX) ? e.x : _area.x(); int y = (e.value_mask & CWY) ? e.y : _area.y(); move(x, y); |
