diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-02-03 08:30:41 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-02-03 08:30:41 +0000 |
| commit | 2472004b8ca1bbf0cc99f3fd1601191862c3d15b (patch) | |
| tree | fda622fc4d599aa83d2d2c0270c1a4c43abbd7f1 | |
| parent | c00829334d83d30cbc1bfc9a9be23e9cadc3307b (diff) | |
watch for windows on desktops being removed, and change desktops if on one being removed
| -rw-r--r-- | src/screen.cc | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/screen.cc b/src/screen.cc index aa272009..cdc8d93c 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); } |
