add the allowed actions hint setting.
}
}
- // XXX: changeAllowedActions();
+ changeAllowedActions();
}
#endif
-void Client::resize(Corner anchor, int w, int h, int x, int y)
+void Client::resize(Corner anchor, int w, int h)
+{
+ if (!(_functions & Func_Resize)) return;
+ internal_resize(anchor, w, h);
+}
+
+
+void Client::internal_resize(Corner anchor, int w, int h, int x, int y)
{
w -= _base_size.x();
h -= _base_size.y();
// resize the frame to match the request
frame->adjustSize();
- move(x, y);
+ internal_move(x, y);
}
void Client::move(int x, int y)
+{
+ if (!(_functions & Func_Move)) return;
+ internal_move(x, y);
+}
+
+
+void Client::internal_move(int x, int y)
{
_area.setPos(x, y);
}
+void Client::changeAllowedActions(void)
+{
+ Atom actions[7];
+ int num = 0;
+
+ actions[num++] = otk::Property::atoms.net_wm_action_shade;
+ actions[num++] = otk::Property::atoms.net_wm_action_change_desktop;
+
+ if (_functions & Func_Close)
+ actions[num++] = otk::Property::atoms.net_wm_action_close;
+ if (_functions & Func_Move)
+ actions[num++] = otk::Property::atoms.net_wm_action_move;
+ if (_functions & Func_Resize)
+ actions[num++] = otk::Property::atoms.net_wm_action_resize;
+ if (_functions & Func_Maximize) {
+ actions[num++] = otk::Property::atoms.net_wm_action_maximize_horz;
+ actions[num++] = otk::Property::atoms.net_wm_action_maximize_vert;
+ }
+
+ otk::Property::set(_window, otk::Property::atoms.net_wm_allowed_actions,
+ otk::Property::atoms.atom, actions, num);
+}
+
+
void Client::shade(bool shade)
{
if (shade == _shaded) return; // already done
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);
+ internal_resize(corner, w, h, x, y);
} else // if JUST resizing...
- resize(corner, w, h);
+ internal_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);
+ internal_move(x, y);
}
if (e.value_mask & CWStackMode) {
//! Change the client's state hints to match the class' data
void changeState();
+ //! Change the allowed actions set on the client
+ void changeAllowedActions();
//! Request the client to close its window.
void close();
unshaded.
*/
void shade(bool shade);
-
+
+ //! Internal version of the Client::move function
+ /*!
+ @param x The X coordinate to move to.
+ @param y The Y coordinate to move to.
+ */
+ void internal_move(int x, int y);
+ //! Internal version of the Client::resize function
+ /*!
+ 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 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 internal_resize(Corner anchor, int w, int h,
+ int x = INT_MIN, int y = INT_MIN);
+
public:
#ifndef SWIG
//! Constructs a new Client object around a specified window id
@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 w, int h, int x = INT_MIN, int y = INT_MIN);
+ void resize(Corner anchor, int w, int h);
//! Attempt to focus the client window
bool focus() const;
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|ii:Client_resize",&obj0,&arg2,&arg3,&arg4,&arg5,&arg6)) goto fail;
+ if(!PyArg_ParseTuple(args,(char *)"Oiii:Client_resize",&obj0,&arg2,&arg3,&arg4)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__Client,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- (arg1)->resize((ob::Client::Corner )arg2,arg3,arg4,arg5,arg6);
+ (arg1)->resize((ob::Client::Corner )arg2,arg3,arg4);
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;