windows stay on their desktops
This commit is contained in:
parent
f71a1fc7d2
commit
7175ac2b5a
4 changed files with 58 additions and 12 deletions
|
@ -91,9 +91,15 @@ void OBClient::getDesktop()
|
|||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -653,8 +659,17 @@ void OBClient::setDesktop(long target)
|
|||
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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1517,12 +1517,29 @@ static PyObject *_wrap_OBScreen_focuswindow(PyObject *self, PyObject *args) {
|
|||
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;
|
||||
|
@ -2901,6 +2918,7 @@ static PyMethodDef SwigMethods[] = {
|
|||
{ (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 },
|
||||
|
|
|
@ -502,9 +502,14 @@ void OBScreen::manageWindow(Window window)
|
|||
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
|
||||
|
||||
|
@ -520,9 +525,11 @@ void OBScreen::manageWindow(Window window)
|
|||
|
||||
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);
|
||||
|
@ -552,7 +559,7 @@ void OBScreen::unmanageWindow(OBClient *client)
|
|||
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;
|
||||
}
|
||||
|
@ -631,6 +638,8 @@ void OBScreen::changeDesktop(long desktop)
|
|||
|
||||
if (!(desktop >= 0 && desktop < _num_desktops)) return;
|
||||
|
||||
printf("Moving to desktop %ld\n", desktop);
|
||||
|
||||
long old = _desktop;
|
||||
|
||||
_desktop = desktop;
|
||||
|
@ -655,6 +664,8 @@ void OBScreen::changeNumDesktops(long num)
|
|||
|
||||
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,
|
||||
|
|
|
@ -141,7 +141,9 @@ public:
|
|||
//! 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.
|
||||
/*!
|
||||
|
|
Loading…
Reference in a new issue