aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-01-04 02:15:29 (GMT)
committermarkt <markt>2007-01-04 02:15:29 (GMT)
commite71346bd50f28be68ea8ca51f55dab2af23409fa (patch)
tree48832f7fbb98aa050596e389241d56a7a187fd89 /src/Window.cc
parent1dc07de3188c8c78f69e273694b27fa580423b55 (diff)
downloadfluxbox-e71346bd50f28be68ea8ca51f55dab2af23409fa.zip
fluxbox-e71346bd50f28be68ea8ca51f55dab2af23409fa.tar.bz2
set IconicState on all unmapped clients, and unmap all clients when set to IconicState
also, a little bug fix for previous commit
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc53
1 files changed, 41 insertions, 12 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 53ec88d..9d79deb 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1536,6 +1536,7 @@ void FluxboxWindow::hide(bool interrupt_moving) {
1536 1536
1537 menu().hide(); 1537 menu().hide();
1538 frame().hide(); 1538 frame().hide();
1539 setState(IconicState,false);
1539} 1540}
1540 1541
1541void FluxboxWindow::show() { 1542void FluxboxWindow::show() {
@@ -1554,8 +1555,6 @@ void FluxboxWindow::iconify() {
1554 1555
1555 iconic = true; 1556 iconic = true;
1556 1557
1557 setState(IconicState, false);
1558
1559 hide(true); 1558 hide(true);
1560 1559
1561 screen().focusControl().setFocusBack(this); 1560 screen().focusControl().setFocusBack(this);
@@ -1897,16 +1896,10 @@ void FluxboxWindow::shade() {
1897 shaded = false; 1896 shaded = false;
1898 m_blackbox_attrib.flags ^= ATTRIB_SHADED; 1897 m_blackbox_attrib.flags ^= ATTRIB_SHADED;
1899 m_blackbox_attrib.attrib ^= ATTRIB_SHADED; 1898 m_blackbox_attrib.attrib ^= ATTRIB_SHADED;
1900
1901 if (m_initialized)
1902 setState(NormalState, false);
1903 } else { 1899 } else {
1904 shaded = true; 1900 shaded = true;
1905 m_blackbox_attrib.flags |= ATTRIB_SHADED; 1901 m_blackbox_attrib.flags |= ATTRIB_SHADED;
1906 m_blackbox_attrib.attrib |= ATTRIB_SHADED; 1902 m_blackbox_attrib.attrib |= ATTRIB_SHADED;
1907 // shading is the same as iconic
1908 if (m_initialized)
1909 setState(IconicState, false);
1910 } 1903 }
1911 1904
1912} 1905}
@@ -2248,10 +2241,29 @@ void FluxboxWindow::setState(unsigned long new_state, bool setting_up) {
2248 state[0] = (unsigned long) m_current_state; 2241 state[0] = (unsigned long) m_current_state;
2249 state[1] = (unsigned long) None; 2242 state[1] = (unsigned long) None;
2250 2243
2251 for_each(m_clientlist.begin(), m_clientlist.end(), 2244 FbTk::ChangeProperty chg(display, FbAtoms::instance()->getWMStateAtom(),
2252 FbTk::ChangeProperty(display, FbAtoms::instance()->getWMStateAtom(), 2245 PropModeReplace, (unsigned char *)state, 2);
2253 PropModeReplace, 2246
2254 (unsigned char *)state, 2)); 2247 ClientList::iterator it = m_clientlist.begin();
2248 ClientList::iterator it_end = m_clientlist.end();
2249 for (; it != it_end; ++it) {
2250 chg(*it);
2251
2252 // ICCCM Section 4.1.4:
2253 // Once a client's window has left the Withdrawn state, the
2254 // window will be mapped if it is in the Normal state and the
2255 // window will be unmapped if it is in the Iconic state.
2256 // Reparenting window managers must unmap the client's window when
2257 // it is in the Iconic state, even if an ancestor window being
2258 // unmapped renders the client's window unviewable. Conversely, if a
2259 // reparenting window manager renders the client's window unviewable
2260 // by unmapping an ancestor, the client's window is by definition in
2261 // the Iconic state and must also be unmapped.
2262 if (new_state == IconicState)
2263 (*it)->hide();
2264 else if (new_state == NormalState)
2265 (*it)->show();
2266 }
2255 2267
2256 saveBlackboxAttribs(); 2268 saveBlackboxAttribs();
2257 //notify state changed 2269 //notify state changed
@@ -2566,6 +2578,23 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent &ue) {
2566 if (client == 0) 2578 if (client == 0)
2567 return; 2579 return;
2568 2580
2581 Atom atom_return;
2582 bool ret = false;
2583 int foo;
2584 unsigned long *state, ulfoo, nitems;
2585 if (client->property(FbAtoms::instance()->getWMStateAtom(),
2586 0l, 2l, false, FbAtoms::instance()->getWMStateAtom(),
2587 &atom_return, &foo, &nitems, &ulfoo,
2588 (unsigned char **) &state) && state) {
2589
2590 if (nitems >= 1 && static_cast<unsigned long>(state[0]) != WithdrawnState);
2591 ret = true;
2592
2593 XFree(static_cast<void *>(state));
2594 if (ret)
2595 return;
2596 }
2597
2569#ifdef DEBUG 2598#ifdef DEBUG
2570 cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<client->window()<<dec<<endl; 2599 cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<client->window()<<dec<<endl;
2571 cerr<<__FILE__<<"("<<__FUNCTION__<<"): title="<<client->title()<<endl; 2600 cerr<<__FILE__<<"("<<__FUNCTION__<<"): title="<<client->title()<<endl;