diff options
author | rathnor <rathnor> | 2003-09-24 14:02:25 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-09-24 14:02:25 (GMT) |
commit | feb7462e381b4015bc736e90da87dc7cc5711b1a (patch) | |
tree | e028335ecbc02b1e79128247293003b2ce5afc29 /src/Window.cc | |
parent | bec4f7c894677a92d9210a1b1e511afd4cee5e5e (diff) | |
download | fluxbox_pavel-feb7462e381b4015bc736e90da87dc7cc5711b1a.zip fluxbox_pavel-feb7462e381b4015bc736e90da87dc7cc5711b1a.tar.bz2 |
Fix updates to mwm_hints, and make configure request move and resize atomic
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/src/Window.cc b/src/Window.cc index 5d2f600..f35c21e 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.233 2003/09/24 11:33:40 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.234 2003/09/24 14:02:25 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -415,9 +415,9 @@ void FluxboxWindow::init() { | |||
415 | decorations.close = false; | 415 | decorations.close = false; |
416 | 416 | ||
417 | if (m_client->getBlackboxHint() != 0) | 417 | if (m_client->getBlackboxHint() != 0) |
418 | getBlackboxHints(); | 418 | updateBlackboxHintsFromClient(*m_client); |
419 | else | 419 | else |
420 | getMWMHints(); | 420 | updateMWMHintsFromClient(*m_client); |
421 | 421 | ||
422 | //!! | 422 | //!! |
423 | // fetch client size and placement | 423 | // fetch client size and placement |
@@ -498,8 +498,7 @@ void FluxboxWindow::init() { | |||
498 | 498 | ||
499 | } | 499 | } |
500 | 500 | ||
501 | frame().move(wattrib.x, wattrib.y); | 501 | frame().moveResizeForClient(wattrib.x, wattrib.y, wattrib.width, wattrib.height); |
502 | frame().resizeForClient(wattrib.width, wattrib.height); | ||
503 | 502 | ||
504 | // if we're a transient then we should be on the same layer as our parent | 503 | // if we're a transient then we should be on the same layer as our parent |
505 | if (m_client->isTransient() && | 504 | if (m_client->isTransient() && |
@@ -907,8 +906,8 @@ bool FluxboxWindow::isGroupable() const { | |||
907 | 906 | ||
908 | void FluxboxWindow::associateClientWindow() { | 907 | void FluxboxWindow::associateClientWindow() { |
909 | m_client->setBorderWidth(0); | 908 | m_client->setBorderWidth(0); |
910 | updateTitleFromClient(); | 909 | updateTitleFromClient(*m_client); |
911 | updateIconNameFromClient(); | 910 | updateIconNameFromClient(*m_client); |
912 | 911 | ||
913 | frame().setClientWindow(*m_client); | 912 | frame().setClientWindow(*m_client); |
914 | frame().resizeForClient(m_client->width(), m_client->height()); | 913 | frame().resizeForClient(m_client->width(), m_client->height()); |
@@ -964,25 +963,24 @@ void FluxboxWindow::reconfigure() { | |||
964 | } | 963 | } |
965 | 964 | ||
966 | /// update current client title and title in our frame | 965 | /// update current client title and title in our frame |
967 | void FluxboxWindow::updateTitleFromClient() { | 966 | void FluxboxWindow::updateTitleFromClient(WinClient &client) { |
968 | m_client->updateTitle(); | 967 | client.updateTitle(); |
969 | // compare old title with new and see if we need to update | 968 | // compare old title with new and see if we need to update |
970 | // graphics | 969 | // graphics |
971 | if (m_labelbuttons[m_client]->text() != m_client->title()) { | 970 | if (m_labelbuttons[&client]->text() != client.title()) { |
972 | m_labelbuttons[m_client]->setText(m_client->title()); | 971 | m_labelbuttons[&client]->setText(client.title()); |
973 | m_labelbuttons[m_client]->clear(); // redraw text | 972 | m_labelbuttons[&client]->clear(); // redraw text |
974 | m_labelbuttons[m_client]->updateTransparent(); | 973 | m_labelbuttons[&client]->updateTransparent(); |
975 | } | 974 | } |
976 | } | 975 | } |
977 | 976 | ||
978 | /// update icon title from client | 977 | /// update icon title from client |
979 | void FluxboxWindow::updateIconNameFromClient() { | 978 | void FluxboxWindow::updateIconNameFromClient(WinClient &client) { |
980 | m_client->updateIconTitle(); | 979 | client.updateIconTitle(); |
981 | } | 980 | } |
982 | 981 | ||
983 | 982 | void FluxboxWindow::updateMWMHintsFromClient(WinClient &client) { | |
984 | void FluxboxWindow::getMWMHints() { | 983 | const WinClient::MwmHints *hint = client.getMwmHint(); |
985 | const WinClient::MwmHints *hint = m_client->getMwmHint(); | ||
986 | 984 | ||
987 | if (!hint) return; | 985 | if (!hint) return; |
988 | 986 | ||
@@ -1049,8 +1047,8 @@ void FluxboxWindow::updateFunctions() { | |||
1049 | setupWindow(); | 1047 | setupWindow(); |
1050 | } | 1048 | } |
1051 | 1049 | ||
1052 | void FluxboxWindow::getBlackboxHints() { | 1050 | void FluxboxWindow::updateBlackboxHintsFromClient(WinClient &client) { |
1053 | const FluxboxWindow::BlackboxHints *hint = m_client->getBlackboxHint(); | 1051 | const FluxboxWindow::BlackboxHints *hint = client.getBlackboxHint(); |
1054 | if (!hint) return; | 1052 | if (!hint) return; |
1055 | 1053 | ||
1056 | if (hint->flags & ATTRIB_SHADED) | 1054 | if (hint->flags & ATTRIB_SHADED) |
@@ -1912,10 +1910,12 @@ void FluxboxWindow::handleEvent(XEvent &event) { | |||
1912 | // case MapRequest: | 1910 | // case MapRequest: |
1913 | // mapRequestEvent(event.xmaprequest); | 1911 | // mapRequestEvent(event.xmaprequest); |
1914 | //break; | 1912 | //break; |
1915 | case PropertyNotify: | 1913 | case PropertyNotify: { |
1916 | if (event.xproperty.state != PropertyDelete) { | 1914 | WinClient *client = findClient(event.xproperty.window); |
1917 | propertyNotifyEvent(event.xproperty.atom); | 1915 | if (client) { |
1916 | propertyNotifyEvent(*client, event.xproperty.atom); | ||
1918 | } | 1917 | } |
1918 | } | ||
1919 | break; | 1919 | break; |
1920 | 1920 | ||
1921 | default: | 1921 | default: |
@@ -2076,8 +2076,7 @@ void FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent &de) { | |||
2076 | } | 2076 | } |
2077 | 2077 | ||
2078 | 2078 | ||
2079 | void FluxboxWindow::propertyNotifyEvent(Atom atom) { | 2079 | void FluxboxWindow::propertyNotifyEvent(WinClient &client, Atom atom) { |
2080 | |||
2081 | switch(atom) { | 2080 | switch(atom) { |
2082 | case XA_WM_CLASS: | 2081 | case XA_WM_CLASS: |
2083 | case XA_WM_CLIENT_MACHINE: | 2082 | case XA_WM_CLIENT_MACHINE: |
@@ -2085,31 +2084,28 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) { | |||
2085 | break; | 2084 | break; |
2086 | 2085 | ||
2087 | case XA_WM_TRANSIENT_FOR: { | 2086 | case XA_WM_TRANSIENT_FOR: { |
2088 | // TODO: this property notify should be handled by winclient | 2087 | bool was_transient = client.isTransient(); |
2089 | // but for now we'll justhave to update all transient info | 2088 | client.updateTransientInfo(); |
2090 | //bool was_transient = isTransient(); | ||
2091 | for_each(clientList().begin(), clientList().end(), | ||
2092 | mem_fun(&WinClient::updateTransientInfo)); | ||
2093 | reconfigure(); | ||
2094 | // TODO: this is broken whilst we don't know which client | ||
2095 | // update our layer to be the same layer as our transient for | 2089 | // update our layer to be the same layer as our transient for |
2096 | //if (isTransient() && isTransient() != was_transient) | 2090 | if (client.isTransient() && !was_transient |
2097 | // layerItem().setLayer(getTransientFor()->layerItem().getLayer()); | 2091 | && client.transientFor()->fbwindow()) |
2092 | layerItem().setLayer(client.transientFor()->fbwindow()->layerItem().getLayer()); | ||
2098 | 2093 | ||
2099 | } break; | 2094 | } break; |
2100 | 2095 | ||
2101 | case XA_WM_HINTS: | 2096 | case XA_WM_HINTS: |
2102 | m_client->updateWMHints(); | 2097 | client.updateWMHints(); |
2103 | hintSig().notify(); // notify listeners | 2098 | hintSig().notify(); // notify listeners |
2104 | break; | 2099 | break; |
2105 | 2100 | ||
2106 | case XA_WM_ICON_NAME: | 2101 | case XA_WM_ICON_NAME: |
2107 | updateIconNameFromClient(); | 2102 | client.updateIconTitle(); |
2103 | updateIconNameFromClient(client); | ||
2108 | updateIcon(); | 2104 | updateIcon(); |
2109 | break; | 2105 | break; |
2110 | 2106 | ||
2111 | case XA_WM_NAME: | 2107 | case XA_WM_NAME: |
2112 | updateTitleFromClient(); | 2108 | updateTitleFromClient(client); |
2113 | 2109 | ||
2114 | if (! iconic) | 2110 | if (! iconic) |
2115 | screen().getWorkspace(m_workspace_number)->update(); | 2111 | screen().getWorkspace(m_workspace_number)->update(); |
@@ -2120,27 +2116,27 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) { | |||
2120 | break; | 2116 | break; |
2121 | 2117 | ||
2122 | case XA_WM_NORMAL_HINTS: { | 2118 | case XA_WM_NORMAL_HINTS: { |
2123 | m_client->updateWMNormalHints(); | 2119 | client.updateWMNormalHints(); |
2124 | 2120 | ||
2125 | if ((m_client->normal_hint_flags & PMinSize) && | 2121 | if ((client.normal_hint_flags & PMinSize) && |
2126 | (m_client->normal_hint_flags & PMaxSize)) { | 2122 | (client.normal_hint_flags & PMaxSize)) { |
2127 | 2123 | ||
2128 | if (m_client->max_width != 0 && m_client->max_width <= m_client->min_width && | 2124 | if (client.max_width != 0 && client.max_width <= client.min_width && |
2129 | m_client->max_height != 0 && m_client->max_height <= m_client->min_height) { | 2125 | client.max_height != 0 && client.max_height <= client.min_height) { |
2130 | decorations.maximize = false; | 2126 | decorations.maximize = false; |
2131 | decorations.handle = false; | 2127 | decorations.handle = false; |
2132 | functions.resize=false; | 2128 | functions.resize=false; |
2133 | functions.maximize=false; | 2129 | functions.maximize=false; |
2134 | } else { | 2130 | } else { |
2135 | // TODO: is broken while handled by FbW, needs to be in WinClient | 2131 | // TODO: is broken while handled by FbW, needs to be in WinClient |
2136 | if (! winClient().isTransient()) { | 2132 | if (! client.isTransient()) { |
2137 | decorations.maximize = true; | 2133 | decorations.maximize = true; |
2138 | decorations.handle = true; | 2134 | decorations.handle = true; |
2139 | functions.maximize = true; | 2135 | functions.maximize = true; |
2140 | } | 2136 | } |
2141 | functions.resize = true; | 2137 | functions.resize = true; |
2142 | } | 2138 | } |
2143 | 2139 | setupWindow(); | |
2144 | } | 2140 | } |
2145 | 2141 | ||
2146 | // save old values | 2142 | // save old values |
@@ -2159,13 +2155,16 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) { | |||
2159 | } | 2155 | } |
2160 | 2156 | ||
2161 | default: | 2157 | default: |
2162 | if (atom == FbAtoms::instance()->getWMProtocolsAtom()) { | 2158 | FbAtoms *fbatoms = FbAtoms::instance(); |
2163 | m_client->updateWMProtocols(); | 2159 | if (atom == fbatoms->getWMProtocolsAtom()) { |
2164 | //!!TODO check this area | 2160 | client.updateWMProtocols(); |
2165 | // reset window actions | 2161 | } else if (atom == fbatoms->getMWMHintsAtom()) { |
2166 | setupWindow(); | 2162 | client.updateMWMHints(); |
2167 | 2163 | updateMWMHintsFromClient(client); | |
2168 | } | 2164 | } else if (atom == fbatoms->getFluxboxHintsAtom()) { |
2165 | client.updateBlackboxHints(); | ||
2166 | updateBlackboxHintsFromClient(client); | ||
2167 | } | ||
2169 | break; | 2168 | break; |
2170 | } | 2169 | } |
2171 | 2170 | ||
@@ -2208,11 +2207,12 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2208 | 2207 | ||
2209 | // the request is for client window so we resize the frame to it first | 2208 | // the request is for client window so we resize the frame to it first |
2210 | if (frame().width() != cw || frame().height() != ch) { | 2209 | if (frame().width() != cw || frame().height() != ch) { |
2211 | frame().resizeForClient(cw, ch); | 2210 | if (frame().x() != cx || frame().y() != cy) |
2211 | frame().moveResizeForClient(cx, cy, cw, ch); | ||
2212 | else | ||
2213 | frame().resizeForClient(cw, ch); | ||
2212 | send_notify = true; | 2214 | send_notify = true; |
2213 | } | 2215 | } else if (frame().x() != cx || frame().y() != cy) { |
2214 | |||
2215 | if (frame().x() != cx || frame().y() != cy) { | ||
2216 | move(cx, cy); | 2216 | move(cx, cy); |
2217 | // since we already send a notify in move we don't need to do that again | 2217 | // since we already send a notify in move we don't need to do that again |
2218 | send_notify = false; | 2218 | send_notify = false; |
@@ -2627,7 +2627,7 @@ void FluxboxWindow::applyDecorations(bool initial) { | |||
2627 | 2627 | ||
2628 | // if the location changes, shift it | 2628 | // if the location changes, shift it |
2629 | if (grav_x != 0 || grav_y != 0) | 2629 | if (grav_x != 0 || grav_y != 0) |
2630 | frame().move(grav_x + frame().x(), grav_y + frame().y()); | 2630 | move(grav_x + frame().x(), grav_y + frame().y()); |
2631 | 2631 | ||
2632 | frame().reconfigure(); | 2632 | frame().reconfigure(); |
2633 | } | 2633 | } |