summaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc65
1 files changed, 48 insertions, 17 deletions
diff --git a/src/Window.cc b/src/Window.cc
index fdb636d..4498428 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -280,7 +280,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
280 m_themelistener(*this), 280 m_themelistener(*this),
281 moving(false), resizing(false), shaded(false), 281 moving(false), resizing(false), shaded(false),
282 iconic(false), focused(false), 282 iconic(false), focused(false),
283 stuck(false), m_managed(false), fullscreen(false), 283 stuck(false), m_initialized(false), fullscreen(false),
284 maximized(MAX_NONE), 284 maximized(MAX_NONE),
285 m_attaching_tab(0), 285 m_attaching_tab(0),
286 m_screen(client.screen()), 286 m_screen(client.screen()),
@@ -490,11 +490,16 @@ void FluxboxWindow::init() {
490 return; 490 return;
491 } 491 }
492 492
493 m_managed = true; //this window is managed
494
495 Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this); 493 Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this);
496 Fluxbox::instance()->attachSignals(*this); 494 Fluxbox::instance()->attachSignals(*this);
497 495
496 /**************************************************/
497 /* Read state above here, apply state below here. */
498 /**************************************************/
499
500 // this window is managed, we are now allowed to modify actual state
501 m_initialized = true;
502
498 // update transient infomation 503 // update transient infomation
499 m_client->updateTransientInfo(); 504 m_client->updateTransientInfo();
500 505
@@ -566,12 +571,12 @@ void FluxboxWindow::init() {
566 m_client->transientFor()->fbwindow()->title()<<endl; 571 m_client->transientFor()->fbwindow()->title()<<endl;
567 } 572 }
568#endif // DEBUG 573#endif // DEBUG
574
569 if (!place_window) 575 if (!place_window)
570 moveResize(frame().x(), frame().y(), frame().width(), frame().height()); 576 moveResize(frame().x(), frame().y(), frame().width(), frame().height());
571 577
572
573 screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); 578 screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window);
574 setWorkspace(m_workspace_number, true); 579 setWorkspace(m_workspace_number);
575 580
576 if (shaded) { // start shaded 581 if (shaded) { // start shaded
577 shaded = false; 582 shaded = false;
@@ -602,6 +607,7 @@ void FluxboxWindow::init() {
602 setupWindow(); 607 setupWindow();
603 608
604 FbTk::App::instance()->sync(false); 609 FbTk::App::instance()->sync(false);
610
605} 611}
606 612
607/// apply shape to this window 613/// apply shape to this window
@@ -1748,7 +1754,7 @@ void FluxboxWindow::maximizeFull() {
1748} 1754}
1749 1755
1750 1756
1751void FluxboxWindow::setWorkspace(int n, bool notify) { 1757void FluxboxWindow::setWorkspace(int n) {
1752 unsigned int old_wkspc = m_workspace_number; 1758 unsigned int old_wkspc = m_workspace_number;
1753 1759
1754 m_workspace_number = n; 1760 m_workspace_number = n;
@@ -1757,7 +1763,7 @@ void FluxboxWindow::setWorkspace(int n, bool notify) {
1757 m_blackbox_attrib.workspace = m_workspace_number; 1763 m_blackbox_attrib.workspace = m_workspace_number;
1758 1764
1759 // notify workspace change 1765 // notify workspace change
1760 if (notify && !stuck && old_wkspc != m_workspace_number) { 1766 if (isInitialized() && !stuck && old_wkspc != m_workspace_number) {
1761#ifdef DEBUG 1767#ifdef DEBUG
1762 cerr<<this<<" notify workspace signal"<<endl; 1768 cerr<<this<<" notify workspace signal"<<endl;
1763#endif // DEBUG 1769#endif // DEBUG
@@ -1770,13 +1776,16 @@ void FluxboxWindow::setLayerNum(int layernum) {
1770 1776
1771 m_blackbox_attrib.flags |= ATTRIB_STACK; 1777 m_blackbox_attrib.flags |= ATTRIB_STACK;
1772 m_blackbox_attrib.stack = layernum; 1778 m_blackbox_attrib.stack = layernum;
1773 saveBlackboxAttribs(); 1779
1780 if (isInitialized()) {
1781 saveBlackboxAttribs();
1774 1782
1775#ifdef DEBUG 1783#ifdef DEBUG
1776 cerr<<this<<" notify layer signal"<<endl; 1784 cerr<<this<<" notify layer signal"<<endl;
1777#endif // DEBUG 1785#endif // DEBUG
1778 1786
1779 m_layersig.notify(); 1787 m_layersig.notify();
1788 }
1780} 1789}
1781 1790
1782void FluxboxWindow::shade() { 1791void FluxboxWindow::shade() {
@@ -1791,13 +1800,15 @@ void FluxboxWindow::shade() {
1791 m_blackbox_attrib.flags ^= ATTRIB_SHADED; 1800 m_blackbox_attrib.flags ^= ATTRIB_SHADED;
1792 m_blackbox_attrib.attrib ^= ATTRIB_SHADED; 1801 m_blackbox_attrib.attrib ^= ATTRIB_SHADED;
1793 1802
1794 setState(NormalState, false); 1803 if (isInitialized())
1804 setState(NormalState, false);
1795 } else { 1805 } else {
1796 shaded = true; 1806 shaded = true;
1797 m_blackbox_attrib.flags |= ATTRIB_SHADED; 1807 m_blackbox_attrib.flags |= ATTRIB_SHADED;
1798 m_blackbox_attrib.attrib |= ATTRIB_SHADED; 1808 m_blackbox_attrib.attrib |= ATTRIB_SHADED;
1799 // shading is the same as iconic 1809 // shading is the same as iconic
1800 setState(IconicState, false); 1810 if (isInitialized())
1811 setState(IconicState, false);
1801 } 1812 }
1802 1813
1803} 1814}
@@ -1819,9 +1830,11 @@ void FluxboxWindow::stick() {
1819 1830
1820 } 1831 }
1821 1832
1822 setState(m_current_state, false); 1833 if (isInitialized()) {
1823 // notify since some things consider "stuck" to be a pseudo-workspace 1834 setState(m_current_state, false);
1824 m_workspacesig.notify(); 1835 // notify since some things consider "stuck" to be a pseudo-workspace
1836 m_workspacesig.notify();
1837 }
1825 1838
1826} 1839}
1827 1840
@@ -1882,6 +1895,11 @@ void FluxboxWindow::raiseLayer() {
1882 if (layerNum() == (Fluxbox::instance()->getMenuLayer()+1)) 1895 if (layerNum() == (Fluxbox::instance()->getMenuLayer()+1))
1883 return; 1896 return;
1884 1897
1898 if (!isInitialized()) {
1899 m_layernum++;
1900 return;
1901 }
1902
1885 // get root window 1903 // get root window
1886 WinClient *client = getRootTransientFor(m_client); 1904 WinClient *client = getRootTransientFor(m_client);
1887 1905
@@ -1914,6 +1932,12 @@ void FluxboxWindow::raiseLayer() {
1914} 1932}
1915 1933
1916void FluxboxWindow::lowerLayer() { 1934void FluxboxWindow::lowerLayer() {
1935 if (!isInitialized()) {
1936 if (m_layernum > 0)
1937 m_layernum--;
1938 return;
1939 }
1940
1917 // get root window 1941 // get root window
1918 WinClient *client = getRootTransientFor(m_client); 1942 WinClient *client = getRootTransientFor(m_client);
1919 1943
@@ -1957,6 +1981,11 @@ void FluxboxWindow::moveToLayer(int layernum) {
1957 layernum = fluxbox->getMenuLayer() + 1; 1981 layernum = fluxbox->getMenuLayer() + 1;
1958 } 1982 }
1959 1983
1984 if (!isInitialized()) {
1985 m_layernum = layernum;
1986 return;
1987 }
1988
1960 // get root window 1989 // get root window
1961 WinClient *client = getRootTransientFor(m_client); 1990 WinClient *client = getRootTransientFor(m_client);
1962 1991
@@ -1993,12 +2022,14 @@ void FluxboxWindow::setFocusHidden(bool value) {
1993 else 2022 else
1994 m_blackbox_attrib.flags ^= ATTRIB_HIDDEN; 2023 m_blackbox_attrib.flags ^= ATTRIB_HIDDEN;
1995 2024
1996 m_statesig.notify(); 2025 if (isInitialized())
2026 m_statesig.notify();
1997} 2027}
1998 2028
1999void FluxboxWindow::setIconHidden(bool value) { 2029void FluxboxWindow::setIconHidden(bool value) {
2000 m_icon_hidden= value; 2030 m_icon_hidden= value;
2001 m_statesig.notify(); 2031 if (isInitialized())
2032 m_statesig.notify();
2002} 2033}
2003 2034
2004 2035