configure request optimizations
This commit is contained in:
parent
8735c12d96
commit
a6f5b33ad9
3 changed files with 42 additions and 25 deletions
|
@ -802,7 +802,7 @@ void OBClient::shapeHandler(const XShapeEvent &e)
|
||||||
#endif
|
#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();
|
w -= _base_size.x();
|
||||||
h -= _base_size.y();
|
h -= _base_size.y();
|
||||||
|
@ -835,7 +835,9 @@ void OBClient::resize(Corner anchor, int w, int h)
|
||||||
w += _base_size.x();
|
w += _base_size.x();
|
||||||
h += _base_size.y();
|
h += _base_size.y();
|
||||||
|
|
||||||
int x = _area.x(), y = _area.y();
|
if (x == INT_MIN || y == INT_MIN) {
|
||||||
|
x = _area.x();
|
||||||
|
y = _area.y();
|
||||||
switch (anchor) {
|
switch (anchor) {
|
||||||
case TopLeft:
|
case TopLeft:
|
||||||
break;
|
break;
|
||||||
|
@ -850,8 +852,10 @@ void OBClient::resize(Corner anchor, int w, int h)
|
||||||
y -= h - _area.height();
|
y -= h - _area.height();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_area.setSize(w, h);
|
_area.setSize(w, h);
|
||||||
|
|
||||||
XResizeWindow(otk::OBDisplay::display, _window, w, h);
|
XResizeWindow(otk::OBDisplay::display, _window, w, h);
|
||||||
|
|
||||||
// resize the frame to match the request
|
// 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)
|
void OBClient::move(int x, int y)
|
||||||
{
|
{
|
||||||
_area.setPos(x, y);
|
_area.setPos(x, y);
|
||||||
|
|
||||||
// move the frame to be in the requested position
|
// move the frame to be in the requested position
|
||||||
frame->adjustPosition();
|
frame->adjustPosition();
|
||||||
}
|
}
|
||||||
|
@ -1048,10 +1053,14 @@ void OBClient::configureRequestHandler(const XConfigureRequestEvent &e)
|
||||||
corner = TopLeft;
|
corner = TopLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
resize(corner, w, h);
|
// if moving AND resizing ...
|
||||||
}
|
|
||||||
|
|
||||||
if (e.value_mask & (CWX | CWY)) {
|
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 x = (e.value_mask & CWX) ? e.x : _area.x();
|
||||||
int y = (e.value_mask & CWY) ? e.y : _area.y();
|
int y = (e.value_mask & CWY) ? e.y : _area.y();
|
||||||
move(x, y);
|
move(x, y);
|
||||||
|
|
|
@ -431,11 +431,17 @@ public:
|
||||||
//! Resizes the client window, anchoring it in a given corner
|
//! Resizes the client window, anchoring it in a given corner
|
||||||
/*!
|
/*!
|
||||||
This also maintains things like the client's minsize, and size increments.
|
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 anchor The corner to keep in the same position when resizing.
|
||||||
@param x The X component of the new size for the client
|
@param w The width component of the new size for the client.
|
||||||
@param y The Y 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.
|
//! Request the client to close its window.
|
||||||
void close();
|
void close();
|
||||||
|
|
|
@ -2282,11 +2282,13 @@ static PyObject *_wrap_OBClient_resize(PyObject *self, PyObject *args) {
|
||||||
int arg2 ;
|
int arg2 ;
|
||||||
int arg3 ;
|
int arg3 ;
|
||||||
int arg4 ;
|
int arg4 ;
|
||||||
|
int arg5 = (int) INT_MIN ;
|
||||||
|
int arg6 = (int) INT_MIN ;
|
||||||
PyObject * obj0 = 0 ;
|
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;
|
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;
|
Py_INCREF(Py_None); resultobj = Py_None;
|
||||||
return resultobj;
|
return resultobj;
|
||||||
|
|
Loading…
Reference in a new issue