screen = Openbox_screen(openbox, OBClient_screen(client))
OBScreen_restack(screen, 0, client)
+def toggle_shade(data):
+ client = Openbox_findClient(openbox, data.window())
+ if not client: return
+ print "toggle_shade"
+ OBClient_shade(client, not OBClient_shaded(client))
+
+def shade(data):
+ client = Openbox_findClient(openbox, data.window())
+ if not client: return
+ OBClient_shade(client, 1)
+
+def unshade(data):
+ client = Openbox_findClient(openbox, data.window())
+ if not client: return
+ OBClient_shade(client, 0)
+
print "Loaded builtins.py"
const otk::OBProperty *property = Openbox::instance->property();
_modal = _shaded = _max_horz = _max_vert = _fullscreen = _above = _below =
- false;
+ _skip_taskbar = _skip_pager = false;
unsigned long *state;
unsigned long num = (unsigned) -1;
else if (state[i] ==
property->atom(otk::OBProperty::net_wm_state_shaded))
_shaded = true;
+ else if (state[i] ==
+ property->atom(otk::OBProperty::net_wm_state_skip_taskbar))
+ _skip_taskbar = true;
+ else if (state[i] ==
+ property->atom(otk::OBProperty::net_wm_state_skip_pager))
+ _skip_pager = true;
else if (state[i] ==
property->atom(otk::OBProperty::net_wm_state_fullscreen))
_fullscreen = true;
action = _max_horz ? State_Remove : State_Add;
else if (state == property->atom(otk::OBProperty::net_wm_state_shaded))
action = _shaded ? State_Remove : State_Add;
+ else if (state ==
+ property->atom(otk::OBProperty::net_wm_state_skip_taskbar))
+ action = _skip_taskbar ? State_Remove : State_Add;
+ else if (state ==
+ property->atom(otk::OBProperty::net_wm_state_skip_pager))
+ action = _skip_pager ? State_Remove : State_Add;
else if (state ==
property->atom(otk::OBProperty::net_wm_state_fullscreen))
action = _fullscreen ? State_Remove : State_Add;
if (_shaded) continue;
_shaded = true;
// XXX: hide the client window
+ } else if (state ==
+ property->atom(otk::OBProperty::net_wm_state_skip_taskbar)) {
+ _skip_taskbar = true;
+ } else if (state ==
+ property->atom(otk::OBProperty::net_wm_state_skip_pager)) {
+ _skip_pager = true;
} else if (state ==
property->atom(otk::OBProperty::net_wm_state_fullscreen)) {
if (_fullscreen) continue;
if (!_shaded) continue;
_shaded = false;
// XXX: show the client window
+ } else if (state ==
+ property->atom(otk::OBProperty::net_wm_state_skip_taskbar)) {
+ _skip_taskbar = false;
+ } else if (state ==
+ property->atom(otk::OBProperty::net_wm_state_skip_pager)) {
+ _skip_pager = false;
} else if (state ==
property->atom(otk::OBProperty::net_wm_state_fullscreen)) {
if (!_fullscreen) continue;
}
+void OBClient::changeState()
+{
+ const otk::OBProperty *property = Openbox::instance->property();
+
+ unsigned long state[2];
+ state[0] = _wmstate;
+ state[1] = None;
+ property->set(_window, otk::OBProperty::wm_state, otk::OBProperty::wm_state,
+ state, 2);
+
+ Atom netstate[10];
+ int num = 0;
+ if (_modal)
+ netstate[num++] = property->atom(otk::OBProperty::net_wm_state_modal);
+ if (_shaded)
+ netstate[num++] = property->atom(otk::OBProperty::net_wm_state_shaded);
+ if (_iconic)
+ netstate[num++] = property->atom(otk::OBProperty::net_wm_state_hidden);
+ if (_skip_taskbar)
+ netstate[num++] =
+ property->atom(otk::OBProperty::net_wm_state_skip_taskbar);
+ if (_skip_pager)
+ netstate[num++] = property->atom(otk::OBProperty::net_wm_state_skip_pager);
+ if (_fullscreen)
+ netstate[num++] = property->atom(otk::OBProperty::net_wm_state_fullscreen);
+ if (_max_vert)
+ netstate[num++] =
+ property->atom(otk::OBProperty::net_wm_state_maximized_vert);
+ if (_max_horz)
+ netstate[num++] =
+ property->atom(otk::OBProperty::net_wm_state_maximized_horz);
+ if (_above)
+ netstate[num++] = property->atom(otk::OBProperty::net_wm_state_above);
+ if (_below)
+ netstate[num++] = property->atom(otk::OBProperty::net_wm_state_below);
+ property->set(_window, otk::OBProperty::net_wm_state,
+ otk::OBProperty::Atom_Atom, netstate, num);
+
+}
+
+void OBClient::shade(bool shade)
+{
+ if (shade == _shaded) return; // already done
+
+ _wmstate = shade ? IconicState : NormalState;
+ _shaded = shade;
+ changeState();
+ frame->adjustSize();
+}
+
+
bool OBClient::focus()
{
if (!_can_focus || _focused) return false;
bool _max_vert;
//! The window is maximized to fill the screen horizontally
bool _max_horz;
+ //! The window should not be displayed by pagers
+ bool _skip_pager;
+ //! The window should not be displayed by taskbars
+ bool _skip_taskbar;
//! The window is a 'fullscreen' window, and should be on top of all others
bool _fullscreen;
//! The window should be on top of other windows of the same type
void updateClass();
// XXX: updateTransientFor();
+ //! Change the client's state hints to match the class' data
+ void changeState();
+
public:
#ifndef SWIG
//! Constructs a new OBClient object around a specified window id
//! Request the client to close its window.
void close();
+ //! Shades or unshades the client window
+ /*!
+ @param shade true if the window should be shaded; false if it should be
+ unshaded.
+ */
+ void shade(bool shade);
+
//! Attempt to focus the client window
bool focus();
//! Remove focus from the client window
void unfocus();
-
+
virtual void focusHandler(const XFocusChangeEvent &e);
virtual void unfocusHandler(const XFocusChangeEvent &e);
virtual void propertyHandler(const XPropertyEvent &e);
// position/size all the windows
- resize(_innersize.left + _innersize.right + _client->area().width(),
- _innersize.top + _innersize.bottom + _client->area().height());
+ if (_client->shaded())
+ resize(_innersize.left + _innersize.right + _client->area().width(),
+ _titlebar.height());
+ else
+ resize(_innersize.left + _innersize.right + _client->area().width(),
+ _innersize.top + _innersize.bottom + _client->area().height());
_plate.setGeometry(_innersize.left - cbwidth, _innersize.top - cbwidth,
_client->area().width(), _client->area().height());
}
+static PyObject *_wrap_OBClient_shade(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ ob::OBClient *arg1 = (ob::OBClient *) 0 ;
+ bool arg2 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if(!PyArg_ParseTuple(args,(char *)"OO:OBClient_shade",&obj0,&obj1)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ arg2 = (bool) PyInt_AsLong(obj1);
+ if (PyErr_Occurred()) SWIG_fail;
+ (arg1)->shade(arg2);
+
+ Py_INCREF(Py_None); resultobj = Py_None;
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
static PyObject *_wrap_OBClient_focus(PyObject *self, PyObject *args) {
PyObject *resultobj;
ob::OBClient *arg1 = (ob::OBClient *) 0 ;
{ (char *)"OBClient_move", _wrap_OBClient_move, METH_VARARGS },
{ (char *)"OBClient_resize", _wrap_OBClient_resize, METH_VARARGS },
{ (char *)"OBClient_close", _wrap_OBClient_close, METH_VARARGS },
+ { (char *)"OBClient_shade", _wrap_OBClient_shade, METH_VARARGS },
{ (char *)"OBClient_focus", _wrap_OBClient_focus, METH_VARARGS },
{ (char *)"OBClient_unfocus", _wrap_OBClient_unfocus, METH_VARARGS },
{ (char *)"OBClient_focusHandler", _wrap_OBClient_focusHandler, METH_VARARGS },