all repos — openbox @ a6f5b33ad90637705af9717c978bf895455c71ba

openbox fork - make it a bit more like ryudo

configure request optimizations
Dana Jansens danakj@orodu.net
commit

a6f5b33ad90637705af9717c978bf895455c71ba

parent

8735c12d9633738a5150c451457471d797fa9bf1

3 files changed, 42 insertions(+), 25 deletions(-)

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

@@ -802,7 +802,7 @@ }

#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 @@

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::move(int x, int y) { _area.setPos(x, y); + // move the frame to be in the requested position frame->adjustPosition(); }

@@ -1048,10 +1053,14 @@ default: // NorthWest, Static, etc

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);
M src/client.hhsrc/client.hh

@@ -431,11 +431,17 @@

//! Resizes the client window, anchoring it in a given corner /*! This also maintains things like the client's minsize, and size increments. - @param anchor The corner to keep in the same position when resizing - @param x The X component of the new size for the client - @param y The Y component of the new size for the client + @param anchor The corner to keep in the same position when resizing. + @param w The width component of the new size for the client. + @param h The height component of the new size for the client. + @param x An optional X coordinate to which the window will be moved + after resizing. + @param y An optional Y coordinate to which the window will be moved + after resizing. + The x and y coordinates must both be sepcified together, or they will have + no effect. When they are specified, the anchor is ignored. */ - void resize(Corner anchor, int x, int y); + void resize(Corner anchor, int w, int h, int x = INT_MIN, int y = INT_MIN); //! Request the client to close its window. void close();
M src/openbox_wrap.ccsrc/openbox_wrap.cc

@@ -2282,11 +2282,13 @@ ob::OBClient *arg1 = (ob::OBClient *) 0 ;

int arg2 ; int arg3 ; int arg4 ; + int arg5 = (int) INT_MIN ; + int arg6 = (int) INT_MIN ; PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"Oiii:OBClient_resize",&obj0,&arg2,&arg3,&arg4)) goto fail; + if(!PyArg_ParseTuple(args,(char *)"Oiii|ii:OBClient_resize",&obj0,&arg2,&arg3,&arg4,&arg5,&arg6)) goto fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - (arg1)->resize((ob::OBClient::Corner )arg2,arg3,arg4); + (arg1)->resize((ob::OBClient::Corner )arg2,arg3,arg4,arg5,arg6); Py_INCREF(Py_None); resultobj = Py_None; return resultobj;