aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsimonb <simonb>2005-06-19 15:40:43 (GMT)
committersimonb <simonb>2005-06-19 15:40:43 (GMT)
commitc912f7a32aae713f24ab32464cd1f443043ad59f (patch)
treee1e02c8eb0d5d088fc5711a368d5faadbe91534d /src
parent3fd472679d5a885105a2d810cf6aa36c6f9dbf67 (diff)
downloadfluxbox-c912f7a32aae713f24ab32464cd1f443043ad59f.zip
fluxbox-c912f7a32aae713f24ab32464cd1f443043ad59f.tar.bz2
fix handling of shaded and iconic windows, particularly on restart
Diffstat (limited to 'src')
-rw-r--r--src/Window.cc88
1 files changed, 44 insertions, 44 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 2c7103b..6d33a5c 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -512,7 +512,6 @@ void FluxboxWindow::init() {
512 m_initialized = true; 512 m_initialized = true;
513 513
514 514
515
516 applyDecorations(true); 515 applyDecorations(true);
517 516
518 grabButtons(); 517 grabButtons();
@@ -570,17 +569,9 @@ void FluxboxWindow::init() {
570 if (!place_window) 569 if (!place_window)
571 moveResize(frame().x(), frame().y(), frame().width(), frame().height()); 570 moveResize(frame().x(), frame().y(), frame().width(), frame().height());
572 571
573
574
575 screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); 572 screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window);
576 setWorkspace(m_workspace_number); 573 setWorkspace(m_workspace_number);
577 574
578
579 if (shaded) { // start shaded
580 shaded = false;
581 shade();
582 }
583
584 if (maximized && functions.maximize) { // start maximized 575 if (maximized && functions.maximize) { // start maximized
585 // This will set it to the appropriate style of maximisation 576 // This will set it to the appropriate style of maximisation
586 int req_maximized = maximized; 577 int req_maximized = maximized;
@@ -595,6 +586,16 @@ void FluxboxWindow::init() {
595 deiconify(); //we're omnipresent and visible 586 deiconify(); //we're omnipresent and visible
596 } 587 }
597 588
589 if (shaded) { // start shaded
590 shaded = false;
591 shade();
592 }
593
594 if (iconic) {
595 iconic = false;
596 iconify();
597 }
598
598 sendConfigureNotify(); 599 sendConfigureNotify();
599 // no focus default 600 // no focus default
600 setFocusFlag(false); 601 setFocusFlag(false);
@@ -1259,6 +1260,9 @@ void FluxboxWindow::updateBlackboxHintsFromClient(const WinClient &client) {
1259 if (hint->flags & ATTRIB_SHADED) 1260 if (hint->flags & ATTRIB_SHADED)
1260 shaded = (hint->attrib & ATTRIB_SHADED); 1261 shaded = (hint->attrib & ATTRIB_SHADED);
1261 1262
1263 if (hint->flags & ATTRIB_HIDDEN)
1264 iconic = (hint->attrib & ATTRIB_HIDDEN);
1265
1262 if ((hint->flags & ATTRIB_MAXHORIZ) && 1266 if ((hint->flags & ATTRIB_MAXHORIZ) &&
1263 (hint->flags & ATTRIB_MAXVERT)) 1267 (hint->flags & ATTRIB_MAXVERT))
1264 maximized = ((hint->attrib & 1268 maximized = ((hint->attrib &
@@ -1474,6 +1478,9 @@ void FluxboxWindow::iconify() {
1474 if (isIconic()) // no need to iconify if we're already 1478 if (isIconic()) // no need to iconify if we're already
1475 return; 1479 return;
1476 1480
1481 m_blackbox_attrib.flags |= ATTRIB_HIDDEN;
1482 m_blackbox_attrib.attrib |= ATTRIB_HIDDEN;
1483
1477 iconic = true; 1484 iconic = true;
1478 1485
1479 setState(IconicState, false); 1486 setState(IconicState, false);
@@ -1522,7 +1529,9 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
1522 1529
1523 bool was_iconic = iconic; 1530 bool was_iconic = iconic;
1524 1531
1532 m_blackbox_attrib.flags &= ~ATTRIB_HIDDEN;
1525 iconic = false; 1533 iconic = false;
1534
1526 setState(NormalState, false); 1535 setState(NormalState, false);
1527 1536
1528 ClientList::iterator client_it = clientList().begin(); 1537 ClientList::iterator client_it = clientList().begin();
@@ -1776,7 +1785,9 @@ void FluxboxWindow::shade() {
1776 if (!decorations.titlebar) 1785 if (!decorations.titlebar)
1777 return; 1786 return;
1778 1787
1779 frame().shade(); 1788 // we're toggling, so if they're equal now, we need to change it
1789 if (isInitialized() && m_frame.isShaded() == shaded)
1790 frame().shade();
1780 1791
1781 if (shaded) { 1792 if (shaded) {
1782 shaded = false; 1793 shaded = false;
@@ -2007,11 +2018,6 @@ void FluxboxWindow::moveToLayer(int layernum) {
2007} 2018}
2008 2019
2009void FluxboxWindow::setFocusHidden(bool value) { 2020void FluxboxWindow::setFocusHidden(bool value) {
2010 if(value)
2011 m_blackbox_attrib.flags |= ATTRIB_HIDDEN;
2012 else
2013 m_blackbox_attrib.flags ^= ATTRIB_HIDDEN;
2014
2015 if (isInitialized()) 2021 if (isInitialized())
2016 m_statesig.notify(); 2022 m_statesig.notify();
2017} 2023}
@@ -2163,8 +2169,11 @@ bool FluxboxWindow::getState() {
2163 * (so the caller can set defaults etc as well) 2169 * (so the caller can set defaults etc as well)
2164 */ 2170 */
2165void FluxboxWindow::restoreAttributes() { 2171void FluxboxWindow::restoreAttributes() {
2166 if (!getState()) 2172 if (!getState()) {
2167 m_current_state = m_client->initial_state; 2173 m_current_state = m_client->initial_state;
2174 if (m_current_state == IconicState)
2175 iconic = true;
2176 }
2168 2177
2169 Atom atom_return; 2178 Atom atom_return;
2170 int foo; 2179 int foo;
@@ -2198,6 +2207,11 @@ void FluxboxWindow::restoreAttributes() {
2198 m_blackbox_attrib.attrib & ATTRIB_SHADED) 2207 m_blackbox_attrib.attrib & ATTRIB_SHADED)
2199 shaded = true; 2208 shaded = true;
2200 2209
2210 if (m_blackbox_attrib.flags & ATTRIB_HIDDEN &&
2211 m_blackbox_attrib.attrib & ATTRIB_HIDDEN) {
2212 iconic = true;
2213 }
2214
2201 if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) && 2215 if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) &&
2202 ( m_blackbox_attrib.workspace < screen().getCount())) 2216 ( m_blackbox_attrib.workspace < screen().getCount()))
2203 m_workspace_number = m_blackbox_attrib.workspace; 2217 m_workspace_number = m_blackbox_attrib.workspace;
@@ -2361,27 +2375,11 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
2361 return; 2375 return;
2362 } 2376 }
2363 2377
2364 Fluxbox *fluxbox = Fluxbox::instance(); 2378 // rest of current state checking is in initialisation
2365 2379 if (m_current_state == WithdrawnState)
2366 bool get_state_ret = getState();
2367 if (!(get_state_ret && fluxbox->isStartup())) {
2368 if (m_client->wm_hint_flags & StateHint)
2369 m_current_state = m_client->initial_state;
2370 } else if (iconic)
2371 m_current_state = NormalState;
2372
2373 setState(m_current_state, false);
2374
2375 switch (m_current_state) {
2376 case IconicState:
2377 iconify();
2378 break;
2379
2380 case WithdrawnState:
2381 withdraw(true); 2380 withdraw(true);
2382 break; 2381 else {
2383 2382
2384 case NormalState: {
2385 // if this window was destroyed while autogrouping 2383 // if this window was destroyed while autogrouping
2386 bool destroyed = false; 2384 bool destroyed = false;
2387 2385
@@ -2394,18 +2392,10 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
2394 destroyed = wsp->checkGrouping(*this); 2392 destroyed = wsp->checkGrouping(*this);
2395 2393
2396 // if we weren't grouped with another window we deiconify ourself 2394 // if we weren't grouped with another window we deiconify ourself
2397 if (!destroyed) 2395 if (!destroyed && !iconic)
2398 deiconify(false); 2396 deiconify(false);
2399 2397
2400
2401 } break;
2402 case InactiveState:
2403 case ZoomState:
2404 default:
2405 deiconify(false);
2406 break;
2407 } 2398 }
2408
2409} 2399}
2410 2400
2411 2401
@@ -3595,6 +3585,16 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) {
3595 (net.attrib & ATTRIB_SHADED))) 3585 (net.attrib & ATTRIB_SHADED)))
3596 shade(); 3586 shade();
3597 3587
3588 if ((net.flags & ATTRIB_HIDDEN) &&
3589 ((m_blackbox_attrib.attrib & ATTRIB_HIDDEN) !=
3590 (net.attrib & ATTRIB_HIDDEN))) {
3591 bool want_iconic = net.attrib & ATTRIB_HIDDEN;
3592 if (!iconic && want_iconic)
3593 iconify();
3594 else if (iconic && !want_iconic)
3595 deiconify();
3596 }
3597
3598 if (net.flags & (ATTRIB_MAXVERT | ATTRIB_MAXHORIZ)) { 3598 if (net.flags & (ATTRIB_MAXVERT | ATTRIB_MAXHORIZ)) {
3599 // make maximise look like the net maximise flags 3599 // make maximise look like the net maximise flags
3600 int want_max = MAX_NONE; 3600 int want_max = MAX_NONE;