aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonb <simonb>2005-01-05 05:37:06 (GMT)
committersimonb <simonb>2005-01-05 05:37:06 (GMT)
commit83224b7f55c9fd1febb89171d311da95f323eae4 (patch)
treee96bf13c28e04cb0a5086bcaf997995211125890
parenta6c1529a97585aea2392e6cc2ddcbd3b909aeff7 (diff)
downloadfluxbox-83224b7f55c9fd1febb89171d311da95f323eae4.zip
fluxbox-83224b7f55c9fd1febb89171d311da95f323eae4.tar.bz2
fix up window initialisation ordering
-rw-r--r--ChangeLog5
-rw-r--r--src/Ewmh.cc2
-rw-r--r--src/Window.cc65
-rw-r--r--src/Window.hh7
4 files changed, 58 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 887a3de..45c0a47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.12 2Changes for 0.9.12
3*05/01/05: 3*05/01/05:
4 * Tidy up initialisation a bit better. Handlers can still use "action"
5 functions (e.g. stick()), but those functions should now check if
6 isInitialised and only set the state variables (not send signals
7 etc) if not.
8 Window.hh/cc Ewmh.cc
4 * Fix for BScreen::reassociateWindow (Mathias) 9 * Fix for BScreen::reassociateWindow (Mathias)
5 Simon's last changes made fluxbox crash when "Sticky" or "Workspace" 10 Simon's last changes made fluxbox crash when "Sticky" or "Workspace"
6 options in the apps-file where used. This fix also solves <Current> and 11 options in the apps-file where used. This fix also solves <Current> and
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 2d744f7..548633c 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -238,7 +238,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
238 if (desktop == 0xFFFFFFFF && !win.isStuck()) 238 if (desktop == 0xFFFFFFFF && !win.isStuck())
239 win.stick(); 239 win.stick();
240 else 240 else
241 win.setWorkspace(desktop, false); 241 win.setWorkspace(desktop);
242 242
243 XFree(data); 243 XFree(data);
244 } 244 }
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
diff --git a/src/Window.hh b/src/Window.hh
index 020fd88..5f1468b 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -234,7 +234,7 @@ public:
234 /// move and resize frame to pox x,y and size width, height 234 /// move and resize frame to pox x,y and size width, height
235 void moveResize(int x, int y, unsigned int width, unsigned int height, int gravity = ForgetGravity); 235 void moveResize(int x, int y, unsigned int width, unsigned int height, int gravity = ForgetGravity);
236 236
237 void setWorkspace(int n, bool notify = true); 237 void setWorkspace(int n);
238 void changeBlackboxHints(const BlackboxHints &bh); 238 void changeBlackboxHints(const BlackboxHints &bh);
239 void updateFunctions(); 239 void updateFunctions();
240 void restoreAttributes(); 240 void restoreAttributes();
@@ -286,7 +286,8 @@ public:
286 286
287 inline bool isFocusHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); } 287 inline bool isFocusHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); }
288 inline bool isIconHidden() const { return m_icon_hidden; } 288 inline bool isIconHidden() const { return m_icon_hidden; }
289 inline bool isManaged() const { return m_managed; } 289 inline bool isManaged() const { return m_initialized; }
290 inline bool isInitialized() const { return m_initialized; }
290 inline bool isFocused() const { return focused; } 291 inline bool isFocused() const { return focused; }
291 bool isVisible() const; 292 bool isVisible() const;
292 inline bool isIconic() const { return iconic; } 293 inline bool isIconic() const { return iconic; }
@@ -459,7 +460,7 @@ private:
459 460
460 // Window states 461 // Window states
461 bool moving, resizing, shaded, iconic, 462 bool moving, resizing, shaded, iconic,
462 focused, stuck, m_managed, fullscreen; 463 focused, stuck, m_initialized, fullscreen;
463 464
464 int maximized; 465 int maximized;
465 466