// defaults to the current desktop
_desktop = Openbox::instance->screen(_screen)->desktop();
- property->get(_window, otk::OBProperty::net_wm_desktop,
- otk::OBProperty::Atom_Cardinal,
- (long unsigned*)&_desktop);
+ if (!property->get(_window, otk::OBProperty::net_wm_desktop,
+ otk::OBProperty::Atom_Cardinal,
+ (long unsigned*)&_desktop)) {
+ // make sure the hint exists
+ Openbox::instance->property()->set(_window,
+ otk::OBProperty::net_wm_desktop,
+ otk::OBProperty::Atom_Cardinal,
+ (unsigned)_desktop);
+ }
}
assert(target >= 0 || target == (signed)0xffffffff);
//assert(target == 0xffffffff || target < MAX);
- // XXX: move the window to the new desktop (and set root property)
+ if (!(target >= 0 || target == (signed)0xffffffff)) return;
+
_desktop = target;
+
+ Openbox::instance->property()->set(_window,
+ otk::OBProperty::net_wm_desktop,
+ otk::OBProperty::Atom_Cardinal,
+ (unsigned)_desktop);
+
+
+ // XXX: move the window to the new desktop
}
static PyObject *_wrap_OBScreen_desktop(PyObject *self, PyObject *args) {
PyObject *resultobj;
ob::OBScreen *arg1 = (ob::OBScreen *) 0 ;
- unsigned long result;
+ long result;
PyObject * obj0 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"O:OBScreen_desktop",&obj0)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBScreen,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- result = (unsigned long)((ob::OBScreen const *)arg1)->desktop();
+ result = (long)((ob::OBScreen const *)arg1)->desktop();
+
+ resultobj = PyInt_FromLong((long)result);
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
+static PyObject *_wrap_OBScreen_numDesktops(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ ob::OBScreen *arg1 = (ob::OBScreen *) 0 ;
+ long result;
+ PyObject * obj0 = 0 ;
+
+ if(!PyArg_ParseTuple(args,(char *)"O:OBScreen_numDesktops",&obj0)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBScreen,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ result = (long)((ob::OBScreen const *)arg1)->numDesktops();
resultobj = PyInt_FromLong((long)result);
return resultobj;
{ (char *)"OBScreen_style", _wrap_OBScreen_style, METH_VARARGS },
{ (char *)"OBScreen_focuswindow", _wrap_OBScreen_focuswindow, METH_VARARGS },
{ (char *)"OBScreen_desktop", _wrap_OBScreen_desktop, METH_VARARGS },
+ { (char *)"OBScreen_numDesktops", _wrap_OBScreen_numDesktops, METH_VARARGS },
{ (char *)"OBScreen_updateStrut", _wrap_OBScreen_updateStrut, METH_VARARGS },
{ (char *)"OBScreen_manageExisting", _wrap_OBScreen_manageExisting, METH_VARARGS },
{ (char *)"OBScreen_manageWindow", _wrap_OBScreen_manageWindow, METH_VARARGS },
Openbox::instance->addClient(client->frame->grip_left(), client);
Openbox::instance->addClient(client->frame->grip_right(), client);
+ bool shown = false;
+
// if on the current desktop.. (or all desktops)
- if (client->desktop() == _desktop || client->desktop() == (signed)0xffffffff)
+ if (client->desktop() == _desktop ||
+ client->desktop() == (signed)0xffffffff) {
+ shown = true;
client->frame->show();
+ }
// XXX: handle any requested states such as maximized
Openbox::instance->bindings()->grabButtons(true, client);
- // XXX: make this optional or more intelligent
- if (client->normal())
- client->focus();
+ if (shown) {
+ // XXX: make this optional or more intelligent
+ if (client->normal())
+ client->focus();
+ }
// call the python NEWWINDOW binding
EventData *data = new_event_data(window, EventNewWindow, 0);
OBClient *newfocus = 0;
OBClient::List::iterator it, end = _stacking.end();
for (it = _stacking.begin(); it != end; ++it)
- if ((*it)->normal() && (*it)->focus()) {
+ if ((*it)->desktop() == _desktop && (*it)->normal() && (*it)->focus()) {
newfocus = *it;
break;
}
if (!(desktop >= 0 && desktop < _num_desktops)) return;
+ printf("Moving to desktop %ld\n", desktop);
+
long old = _desktop;
_desktop = desktop;
if (!(num > 0)) return;
+ // XXX: move windows on desktops that will no longer exist!
+
_num_desktops = num;
Openbox::instance->property()->set(_info->rootWindow(),
otk::OBProperty::net_number_of_desktops,
//! An offscreen window which gets focus when nothing else has it
inline Window focuswindow() const { return _focuswindow; }
//! Returns the desktop being displayed
- inline unsigned long desktop() const { return _desktop; }
+ inline long desktop() const { return _desktop; }
+ //! Returns the number of desktops
+ inline long numDesktops() const { return _num_desktops; }
//! Update's the screen's combined strut of all the clients.
/*!