X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fscreen.cc;h=f8989a05a942949ad2ade4867a2bad798ca5b054;hb=edd539420796233d3f69e1cceaa0f491ffdb5c6a;hp=aa272009534334542d33d0e89e43caf2835e6486;hpb=c00829334d83d30cbc1bfc9a9be23e9cadc3307b;p=chaz%2Fopenbox diff --git a/src/screen.cc b/src/screen.cc index aa272009..f8989a05 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -713,8 +713,23 @@ void Screen::changeNumDesktops(long num) if (!(num > 0)) return; - // XXX: move windows on desktops that will no longer exist! - + // move windows on desktops that will no longer exist! + Client::List::iterator it, end = clients.end(); + for (it = clients.begin(); it != end; ++it) { + int d = (*it)->desktop(); + if (d >= num && !(d == 0xffffffff || d == Client::ICONIC_DESKTOP)) { + XEvent ce; + ce.xclient.type = ClientMessage; + ce.xclient.message_type = otk::Property::atoms.net_wm_desktop; + ce.xclient.display = **otk::display; + ce.xclient.window = (*it)->window(); + ce.xclient.format = 32; + ce.xclient.data.l[0] = num - 1; + XSendEvent(**otk::display, _info->rootWindow(), False, + SubstructureNotifyMask | SubstructureRedirectMask, &ce); + } + } + _num_desktops = num; otk::Property::set(_info->rootWindow(), otk::Property::atoms.net_number_of_desktops, @@ -731,6 +746,10 @@ void Screen::changeNumDesktops(long num) // update the work area hint changeWorkArea(); + + // change our desktop if we're on one that no longer exists! + if (_desktop >= num) + changeDesktop(num - 1); } @@ -767,7 +786,8 @@ void Screen::propertyHandler(const XPropertyEvent &e) // compress changes to a single property into a single change XEvent ce; - while (XCheckTypedEvent(**otk::display, e.type, &ce)) { + while (XCheckTypedWindowEvent(**otk::display, _info->rootWindow(), + e.type, &ce)) { // XXX: it would be nice to compress ALL changes to a property, not just // changes in a row without other props between. if (ce.xproperty.atom != e.atom) { @@ -792,7 +812,6 @@ void Screen::clientMessageHandler(const XClientMessageEvent &e) } else if (e.message_type == otk::Property::atoms.net_number_of_desktops) { changeNumDesktops(e.data.l[0]); } - // XXX: so many client messages to handle here! ..or not.. they go to clients }