diff options
author | rathnor <rathnor> | 2004-06-19 15:04:28 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2004-06-19 15:04:28 (GMT) |
commit | 4589ecdbbc719cc49f10cef4a9460d89b6a8fba7 (patch) | |
tree | c5c12affeb3f6de45439f14478c931a78d549b44 | |
parent | e68a7a4e72f0a0b3303d89e3b6a7d345997bf987 (diff) | |
download | fluxbox_lack-4589ecdbbc719cc49f10cef4a9460d89b6a8fba7.zip fluxbox_lack-4589ecdbbc719cc49f10cef4a9460d89b6a8fba7.tar.bz2 |
fix initialisation of state when a window is first mapped
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/Screen.cc | 9 | ||||
-rw-r--r-- | src/Window.cc | 77 | ||||
-rw-r--r-- | src/Window.hh | 4 |
4 files changed, 38 insertions, 55 deletions
@@ -1,5 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 0.9.10: | 2 | Changes for 0.9.10: |
3 | *04/06/20: | ||
4 | * Fix honouring of initial state on window open (Simon) | ||
5 | Window.hh/cc Screen.cc | ||
3 | *04/06/18: | 6 | *04/06/18: |
4 | * background xmessage in fbsetbg so it doesn't block anything | 7 | * background xmessage in fbsetbg so it doesn't block anything |
5 | also set the "okay" button to default so you can just press enter | 8 | also set the "okay" button to default so you can just press enter |
diff --git a/src/Screen.cc b/src/Screen.cc index b76f174..f90b3dc 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.281 2004/06/14 12:25:31 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.282 2004/06/19 15:04:27 rathnor Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -1186,10 +1186,6 @@ FluxboxWindow *BScreen::createWindow(Window client) { | |||
1186 | win->attachClient(otherwin->winClient()); | 1186 | win->attachClient(otherwin->winClient()); |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | if (!win->isIconic() && (win->workspaceNumber() == currentWorkspaceID() || win->isStuck())) { | ||
1190 | win->show(); | ||
1191 | } | ||
1192 | |||
1193 | m_clientlist_sig.notify(); | 1189 | m_clientlist_sig.notify(); |
1194 | 1190 | ||
1195 | FbTk::App::instance()->sync(false); | 1191 | FbTk::App::instance()->sync(false); |
@@ -1229,9 +1225,6 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) { | |||
1229 | // WinClient already exists). | 1225 | // WinClient already exists). |
1230 | 1226 | ||
1231 | Fluxbox::instance()->attachSignals(*win); | 1227 | Fluxbox::instance()->attachSignals(*win); |
1232 | // winclient actions should have been setup when the WinClient was created | ||
1233 | if (win->workspaceNumber() == currentWorkspaceID() || win->isStuck()) | ||
1234 | win->show(); | ||
1235 | 1228 | ||
1236 | m_clientlist_sig.notify(); | 1229 | m_clientlist_sig.notify(); |
1237 | 1230 | ||
diff --git a/src/Window.cc b/src/Window.cc index 3b45e2e..553c863 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.289 2004/06/07 21:48:14 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.290 2004/06/19 15:04:27 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -558,8 +558,6 @@ void FluxboxWindow::init() { | |||
558 | deiconify(); //we're omnipresent and visible | 558 | deiconify(); //we're omnipresent and visible |
559 | } | 559 | } |
560 | 560 | ||
561 | setState(m_current_state); | ||
562 | |||
563 | sendConfigureNotify(); | 561 | sendConfigureNotify(); |
564 | // no focus default | 562 | // no focus default |
565 | setFocusFlag(false); | 563 | setFocusFlag(false); |
@@ -1285,7 +1283,7 @@ void FluxboxWindow::iconify() { | |||
1285 | 1283 | ||
1286 | iconic = true; | 1284 | iconic = true; |
1287 | 1285 | ||
1288 | setState(IconicState); | 1286 | setState(IconicState, false); |
1289 | 1287 | ||
1290 | hide(true); | 1288 | hide(true); |
1291 | 1289 | ||
@@ -1332,7 +1330,7 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { | |||
1332 | bool was_iconic = iconic; | 1330 | bool was_iconic = iconic; |
1333 | 1331 | ||
1334 | iconic = false; | 1332 | iconic = false; |
1335 | setState(NormalState); | 1333 | setState(NormalState, false); |
1336 | 1334 | ||
1337 | ClientList::iterator client_it = clientList().begin(); | 1335 | ClientList::iterator client_it = clientList().begin(); |
1338 | ClientList::iterator client_it_end = clientList().end(); | 1336 | ClientList::iterator client_it_end = clientList().end(); |
@@ -1522,13 +1520,13 @@ void FluxboxWindow::shade() { | |||
1522 | m_blackbox_attrib.flags ^= ATTRIB_SHADED; | 1520 | m_blackbox_attrib.flags ^= ATTRIB_SHADED; |
1523 | m_blackbox_attrib.attrib ^= ATTRIB_SHADED; | 1521 | m_blackbox_attrib.attrib ^= ATTRIB_SHADED; |
1524 | 1522 | ||
1525 | setState(NormalState); | 1523 | setState(NormalState, false); |
1526 | } else { | 1524 | } else { |
1527 | shaded = true; | 1525 | shaded = true; |
1528 | m_blackbox_attrib.flags |= ATTRIB_SHADED; | 1526 | m_blackbox_attrib.flags |= ATTRIB_SHADED; |
1529 | m_blackbox_attrib.attrib |= ATTRIB_SHADED; | 1527 | m_blackbox_attrib.attrib |= ATTRIB_SHADED; |
1530 | // shading is the same as iconic | 1528 | // shading is the same as iconic |
1531 | setState(IconicState); | 1529 | setState(IconicState, false); |
1532 | } | 1530 | } |
1533 | 1531 | ||
1534 | } | 1532 | } |
@@ -1550,7 +1548,7 @@ void FluxboxWindow::stick() { | |||
1550 | 1548 | ||
1551 | } | 1549 | } |
1552 | 1550 | ||
1553 | setState(m_current_state); | 1551 | setState(m_current_state, false); |
1554 | // notify since some things consider "stuck" to be a pseudo-workspace | 1552 | // notify since some things consider "stuck" to be a pseudo-workspace |
1555 | m_workspacesig.notify(); | 1553 | m_workspacesig.notify(); |
1556 | 1554 | ||
@@ -1811,28 +1809,31 @@ void FluxboxWindow::saveBlackboxAttribs() { | |||
1811 | 1809 | ||
1812 | /** | 1810 | /** |
1813 | Sets state on each client in our list | 1811 | Sets state on each client in our list |
1812 | Use setting_up for setting startup state - it may not be committed yet | ||
1813 | That'll happen when its mapped | ||
1814 | */ | 1814 | */ |
1815 | void FluxboxWindow::setState(unsigned long new_state) { | 1815 | void FluxboxWindow::setState(unsigned long new_state, bool setting_up) { |
1816 | if (numClients() == 0) | 1816 | if (numClients() == 0) |
1817 | return; | 1817 | return; |
1818 | 1818 | ||
1819 | m_current_state = new_state; | 1819 | m_current_state = new_state; |
1820 | unsigned long state[2]; | 1820 | if (!setting_up) { |
1821 | state[0] = (unsigned long) m_current_state; | 1821 | unsigned long state[2]; |
1822 | state[1] = (unsigned long) None; | 1822 | state[0] = (unsigned long) m_current_state; |
1823 | state[1] = (unsigned long) None; | ||
1823 | 1824 | ||
1824 | for_each(m_clientlist.begin(), m_clientlist.end(), | 1825 | for_each(m_clientlist.begin(), m_clientlist.end(), |
1825 | FbTk::ChangeProperty(display, FbAtoms::instance()->getWMStateAtom(), | 1826 | FbTk::ChangeProperty(display, FbAtoms::instance()->getWMStateAtom(), |
1826 | PropModeReplace, | 1827 | PropModeReplace, |
1827 | (unsigned char *)state, 2)); | 1828 | (unsigned char *)state, 2)); |
1828 | 1829 | ||
1829 | saveBlackboxAttribs(); | 1830 | saveBlackboxAttribs(); |
1830 | //notify state changed | 1831 | //notify state changed |
1831 | m_statesig.notify(); | 1832 | m_statesig.notify(); |
1833 | } | ||
1832 | } | 1834 | } |
1833 | 1835 | ||
1834 | bool FluxboxWindow::getState() { | 1836 | bool FluxboxWindow::getState() { |
1835 | m_current_state = 0; | ||
1836 | 1837 | ||
1837 | Atom atom_return; | 1838 | Atom atom_return; |
1838 | bool ret = false; | 1839 | bool ret = false; |
@@ -1863,7 +1864,7 @@ bool FluxboxWindow::getState() { | |||
1863 | */ | 1864 | */ |
1864 | void FluxboxWindow::restoreAttributes() { | 1865 | void FluxboxWindow::restoreAttributes() { |
1865 | if (!getState()) | 1866 | if (!getState()) |
1866 | m_current_state = NormalState; | 1867 | m_current_state = m_client->initial_state; |
1867 | 1868 | ||
1868 | Atom atom_return; | 1869 | Atom atom_return; |
1869 | int foo; | 1870 | int foo; |
@@ -1894,30 +1895,17 @@ void FluxboxWindow::restoreAttributes() { | |||
1894 | return; | 1895 | return; |
1895 | 1896 | ||
1896 | if (m_blackbox_attrib.flags & ATTRIB_SHADED && | 1897 | if (m_blackbox_attrib.flags & ATTRIB_SHADED && |
1897 | m_blackbox_attrib.attrib & ATTRIB_SHADED) { | 1898 | m_blackbox_attrib.attrib & ATTRIB_SHADED) |
1898 | int save_state = | ||
1899 | ((m_current_state == IconicState) ? NormalState : m_current_state); | ||
1900 | |||
1901 | shaded = true; | 1899 | shaded = true; |
1902 | |||
1903 | m_current_state = save_state; | ||
1904 | } | ||
1905 | 1900 | ||
1906 | if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) && | 1901 | if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) && |
1907 | ( m_blackbox_attrib.workspace < screen().getCount())) { | 1902 | ( m_blackbox_attrib.workspace < screen().getCount())) |
1908 | m_workspace_number = m_blackbox_attrib.workspace; | 1903 | m_workspace_number = m_blackbox_attrib.workspace; |
1909 | 1904 | ||
1910 | if (m_current_state == NormalState) m_current_state = WithdrawnState; | ||
1911 | } else if (m_current_state == WithdrawnState) | ||
1912 | m_current_state = NormalState; | ||
1913 | |||
1914 | if (m_blackbox_attrib.flags & ATTRIB_OMNIPRESENT && | 1905 | if (m_blackbox_attrib.flags & ATTRIB_OMNIPRESENT && |
1915 | m_blackbox_attrib.attrib & ATTRIB_OMNIPRESENT) { | 1906 | m_blackbox_attrib.attrib & ATTRIB_OMNIPRESENT) |
1916 | stuck = true; | 1907 | stuck = true; |
1917 | 1908 | ||
1918 | m_current_state = NormalState; | ||
1919 | } | ||
1920 | |||
1921 | if (m_blackbox_attrib.flags & ATTRIB_STACK) { | 1909 | if (m_blackbox_attrib.flags & ATTRIB_STACK) { |
1922 | //!! TODO check value? | 1910 | //!! TODO check value? |
1923 | m_layernum = m_blackbox_attrib.stack; | 1911 | m_layernum = m_blackbox_attrib.stack; |
@@ -1942,7 +1930,6 @@ void FluxboxWindow::restoreAttributes() { | |||
1942 | m_blackbox_attrib.premax_h = h; | 1930 | m_blackbox_attrib.premax_h = h; |
1943 | } | 1931 | } |
1944 | 1932 | ||
1945 | setState(m_current_state); | ||
1946 | } | 1933 | } |
1947 | 1934 | ||
1948 | /** | 1935 | /** |
@@ -2062,14 +2049,14 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) { | |||
2062 | 2049 | ||
2063 | bool get_state_ret = getState(); | 2050 | bool get_state_ret = getState(); |
2064 | if (! (get_state_ret && fluxbox->isStartup())) { | 2051 | if (! (get_state_ret && fluxbox->isStartup())) { |
2065 | if ((m_client->wm_hint_flags & StateHint) && | 2052 | if ((m_client->wm_hint_flags & StateHint) && m_current_state == 0) {// && |
2066 | (! (m_current_state == NormalState || m_current_state == IconicState))) { | ||
2067 | m_current_state = m_client->initial_state; | 2053 | m_current_state = m_client->initial_state; |
2068 | } else | 2054 | } |
2069 | m_current_state = NormalState; | ||
2070 | } else if (iconic) | 2055 | } else if (iconic) |
2071 | m_current_state = NormalState; | 2056 | m_current_state = NormalState; |
2072 | 2057 | ||
2058 | setState(m_current_state, false); | ||
2059 | |||
2073 | switch (m_current_state) { | 2060 | switch (m_current_state) { |
2074 | case IconicState: | 2061 | case IconicState: |
2075 | iconify(); | 2062 | iconify(); |
@@ -2091,7 +2078,7 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) { | |||
2091 | if (wsp != 0 && isGroupable()) | 2078 | if (wsp != 0 && isGroupable()) |
2092 | destroyed = wsp->checkGrouping(*this); | 2079 | destroyed = wsp->checkGrouping(*this); |
2093 | 2080 | ||
2094 | // if we wasn't grouped with another window we deiconify ourself | 2081 | // if we weren't grouped with another window we deiconify ourself |
2095 | if (!destroyed) | 2082 | if (!destroyed) |
2096 | deiconify(false); | 2083 | deiconify(false); |
2097 | 2084 | ||
@@ -2118,7 +2105,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) { | |||
2118 | if (! client->validateClient()) | 2105 | if (! client->validateClient()) |
2119 | return; | 2106 | return; |
2120 | 2107 | ||
2121 | setState(NormalState); | 2108 | setState(NormalState, false); |
2122 | 2109 | ||
2123 | if (client->isTransient() || screen().doFocusNew()) | 2110 | if (client->isTransient() || screen().doFocusNew()) |
2124 | setCurrentClient(*client, true); | 2111 | setCurrentClient(*client, true); |
diff --git a/src/Window.hh b/src/Window.hh index c67ce63..44c1f4d 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.hh,v 1.114 2004/05/13 01:48:18 rathnor Exp $ | 25 | // $Id: Window.hh,v 1.115 2004/06/19 15:04:28 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -404,7 +404,7 @@ private: | |||
404 | 404 | ||
405 | void restoreGravity(); | 405 | void restoreGravity(); |
406 | void setGravityOffsets(); | 406 | void setGravityOffsets(); |
407 | void setState(unsigned long stateval); | 407 | void setState(unsigned long stateval, bool setting_up); |
408 | void upsize(); | 408 | void upsize(); |
409 | void downsize(); | 409 | void downsize(); |
410 | 410 | ||