diff options
author | fluxgen <fluxgen> | 2003-02-19 14:53:38 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-02-19 14:53:38 (GMT) |
commit | e0ac7575cc8bf6fc5599713652c53ea2c737c1a1 (patch) | |
tree | 6952dcf4dcf835bd5c44b4abad2876811c3dc261 /src | |
parent | 7368b7dc764ecb8b6b4def84d4e5a2d197692256 (diff) | |
download | fluxbox_paul-e0ac7575cc8bf6fc5599713652c53ea2c737c1a1.zip fluxbox_paul-e0ac7575cc8bf6fc5599713652c53ea2c737c1a1.tar.bz2 |
fixed transient raise and lower
Diffstat (limited to 'src')
-rw-r--r-- | src/Window.cc | 115 |
1 files changed, 66 insertions, 49 deletions
diff --git a/src/Window.cc b/src/Window.cc index b7a28fa..55fe23c 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.120 2003/02/18 15:11:10 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.121 2003/02/19 14:53:38 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -55,7 +55,7 @@ using namespace std; | |||
55 | namespace { | 55 | namespace { |
56 | 56 | ||
57 | void grabButton(Display *display, unsigned int button, | 57 | void grabButton(Display *display, unsigned int button, |
58 | Window window, Cursor cursor) { | 58 | Window window, Cursor cursor) { |
59 | 59 | ||
60 | //numlock | 60 | //numlock |
61 | XGrabButton(display, button, Mod1Mask|Mod2Mask, window, True, | 61 | XGrabButton(display, button, Mod1Mask|Mod2Mask, window, True, |
@@ -93,6 +93,40 @@ void grabButton(Display *display, unsigned int button, | |||
93 | 93 | ||
94 | } | 94 | } |
95 | 95 | ||
96 | /// raise window and do the same for each transient it holds | ||
97 | void raiseFluxboxWindow(FluxboxWindow &win) { | ||
98 | |||
99 | if (!win.isIconic()) { | ||
100 | win.getScreen()->updateNetizenWindowRaise(win.getClientWindow()); | ||
101 | win.getLayerItem().raise(); | ||
102 | } | ||
103 | |||
104 | // for each transient do raise | ||
105 | std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin(); | ||
106 | std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end(); | ||
107 | for (; it != it_end; ++it) { | ||
108 | if (!(*it)->isIconic()) | ||
109 | raiseFluxboxWindow(*(*it)); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | /// lower window and do the same for each transient it holds | ||
114 | void lowerFluxboxWindow(FluxboxWindow &win) { | ||
115 | |||
116 | if (!win.isIconic()) { | ||
117 | win.getScreen()->updateNetizenWindowLower(win.getClientWindow()); | ||
118 | win.getLayerItem().lower(); | ||
119 | } | ||
120 | |||
121 | // for each transient do lower | ||
122 | std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin(); | ||
123 | std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end(); | ||
124 | for (; it != it_end; ++it) { | ||
125 | if (!(*it)->isIconic()) | ||
126 | lowerFluxboxWindow(*(*it)); | ||
127 | } | ||
128 | } | ||
129 | |||
96 | }; | 130 | }; |
97 | 131 | ||
98 | FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | 132 | FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, |
@@ -121,11 +155,11 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | |||
121 | { | 155 | { |
122 | 156 | ||
123 | m_layermenu = new LayerMenu<FluxboxWindow>( | 157 | m_layermenu = new LayerMenu<FluxboxWindow>( |
124 | menutheme, | 158 | menutheme, |
125 | screen_num, | 159 | screen_num, |
126 | imgctrl, | 160 | imgctrl, |
127 | *s->layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 161 | *s->layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
128 | this); | 162 | this); |
129 | 163 | ||
130 | 164 | ||
131 | // redirect events from frame to us | 165 | // redirect events from frame to us |
@@ -153,8 +187,8 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | |||
153 | decorations.menu = true; //override menu option | 187 | decorations.menu = true; //override menu option |
154 | // all decorations on by default | 188 | // all decorations on by default |
155 | decorations.titlebar = decorations.border = decorations.handle = true; | 189 | decorations.titlebar = decorations.border = decorations.handle = true; |
156 | decorations.maximize = decorations.close = decorations.sticky = decorations.shade = | 190 | decorations.maximize = decorations.close = |
157 | decorations.tab = true; | 191 | decorations.sticky = decorations.shade = decorations.tab = true; |
158 | 192 | ||
159 | 193 | ||
160 | functions.resize = functions.move = functions.iconify = functions.maximize = true; | 194 | functions.resize = functions.move = functions.iconify = functions.maximize = true; |
@@ -269,7 +303,12 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | |||
269 | 303 | ||
270 | restoreAttributes(); | 304 | restoreAttributes(); |
271 | 305 | ||
272 | moveToLayer(m_layernum); | 306 | // if we're a transient then we should be on the same layer as our parent |
307 | if (isTransient()) { | ||
308 | getLayerItem().setLayer(getTransientFor()->getLayerItem().getLayer()); | ||
309 | } else // if no parent then set default layer | ||
310 | moveToLayer(m_layernum); | ||
311 | |||
273 | screen->getWorkspace(workspace_number)->addWindow(this, place_window); | 312 | screen->getWorkspace(workspace_number)->addWindow(this, place_window); |
274 | 313 | ||
275 | moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); | 314 | moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); |
@@ -1194,61 +1233,40 @@ void FluxboxWindow::stick() { | |||
1194 | setState(current_state); | 1233 | setState(current_state); |
1195 | } | 1234 | } |
1196 | 1235 | ||
1236 | |||
1197 | void FluxboxWindow::raise() { | 1237 | void FluxboxWindow::raise() { |
1198 | if (isIconic()) | 1238 | if (isIconic()) |
1199 | deiconify(); | 1239 | deiconify(); |
1200 | 1240 | ||
1241 | // get root window | ||
1201 | FluxboxWindow *win = this; | 1242 | FluxboxWindow *win = this; |
1202 | |||
1203 | while (win->getTransientFor()) { | 1243 | while (win->getTransientFor()) { |
1204 | win = win->getTransientFor(); | 1244 | win = win->getTransientFor(); |
1205 | assert(win != win->getTransientFor()); | 1245 | assert(win != win->getTransientFor()); |
1206 | } | 1246 | } |
1207 | 1247 | // if we don't have any root window use this as root | |
1208 | if (win == 0) | 1248 | if (win == 0) |
1209 | win = this; | 1249 | win = this; |
1210 | 1250 | ||
1211 | if (!win->isIconic()) { | 1251 | // raise this window and every transient in it |
1212 | screen->updateNetizenWindowRaise(win->getClientWindow()); | 1252 | raiseFluxboxWindow(*win); |
1213 | win->getLayerItem().raise(); | ||
1214 | } | ||
1215 | |||
1216 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | ||
1217 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | ||
1218 | for (; it != it_end; ++it) { | ||
1219 | if (!(*it)->isIconic()) { | ||
1220 | screen->updateNetizenWindowRaise((*it)->getClientWindow()); | ||
1221 | (*it)->getLayerItem().raise(); | ||
1222 | } | ||
1223 | } | ||
1224 | } | 1253 | } |
1225 | 1254 | ||
1226 | void FluxboxWindow::lower() { | 1255 | void FluxboxWindow::lower() { |
1227 | if (isIconic()) | 1256 | if (isIconic()) |
1228 | deiconify(); | 1257 | deiconify(); |
1229 | 1258 | ||
1230 | FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = this; | 1259 | // get root window (i.e the bottom window) |
1231 | 1260 | FluxboxWindow *bottom = this; | |
1232 | while (bottom->getTransientFor()) { | 1261 | while (bottom->getTransientFor()) { |
1233 | bottom = bottom->getTransientFor(); | 1262 | bottom = bottom->getTransientFor(); |
1234 | assert(bottom != bottom->getTransientFor()); | 1263 | assert(bottom != bottom->getTransientFor()); |
1235 | } | 1264 | } |
1265 | |||
1266 | if (bottom == 0) | ||
1267 | bottom = this; | ||
1236 | 1268 | ||
1237 | win = bottom; | 1269 | lowerFluxboxWindow(*bottom); |
1238 | |||
1239 | if (!win->isIconic()) { | ||
1240 | screen->updateNetizenWindowLower(win->getClientWindow()); | ||
1241 | win->getLayerItem().lower(); | ||
1242 | } | ||
1243 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | ||
1244 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | ||
1245 | for (; it != it_end; ++it) { | ||
1246 | if (!(*it)->isIconic()) { | ||
1247 | screen->updateNetizenWindowLower((*it)->getClientWindow()); | ||
1248 | (*it)->getLayerItem().lower(); | ||
1249 | } | ||
1250 | } | ||
1251 | |||
1252 | } | 1270 | } |
1253 | 1271 | ||
1254 | void FluxboxWindow::raiseLayer() { | 1272 | void FluxboxWindow::raiseLayer() { |
@@ -1619,7 +1637,9 @@ void FluxboxWindow::popupMenu() { | |||
1619 | return; | 1637 | return; |
1620 | } | 1638 | } |
1621 | 1639 | ||
1622 | m_windowmenu.move(m_last_button_x, m_frame.y() + m_frame.titlebar().height() + m_frame.titlebar().borderWidth()*2); | 1640 | m_windowmenu.move(m_last_button_x, |
1641 | m_frame.y() + m_frame.titlebar().height() + | ||
1642 | m_frame.titlebar().borderWidth()*2); | ||
1623 | m_windowmenu.show(); | 1643 | m_windowmenu.show(); |
1624 | m_windowmenu.raise(); | 1644 | m_windowmenu.raise(); |
1625 | } | 1645 | } |
@@ -1850,8 +1870,6 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) { | |||
1850 | 1870 | ||
1851 | case XA_WM_ICON_NAME: | 1871 | case XA_WM_ICON_NAME: |
1852 | updateIconNameFromClient(); | 1872 | updateIconNameFromClient(); |
1853 | if (iconic) | ||
1854 | screen->iconUpdate(); | ||
1855 | updateIcon(); | 1873 | updateIcon(); |
1856 | break; | 1874 | break; |
1857 | 1875 | ||
@@ -1938,13 +1956,13 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
1938 | client.old_bw = cr.border_width; | 1956 | client.old_bw = cr.border_width; |
1939 | 1957 | ||
1940 | if (cr.value_mask & CWX) | 1958 | if (cr.value_mask & CWX) |
1941 | cx = cr.x;// - frame_mwm_border_w - screen->getBorderWidth(); | 1959 | cx = cr.x; |
1942 | 1960 | ||
1943 | if (cr.value_mask & CWY) | 1961 | if (cr.value_mask & CWY) |
1944 | cy = cr.y - m_frame.titlebar().height(); // - frame_mwm_border_w - screen->getBorderWidth(); | 1962 | cy = cr.y - m_frame.titlebar().height(); |
1945 | 1963 | ||
1946 | if (cr.value_mask & CWWidth) | 1964 | if (cr.value_mask & CWWidth) |
1947 | cw = cr.width;// + (frame_mwm_border_w * 2); | 1965 | cw = cr.width; |
1948 | 1966 | ||
1949 | if (cr.value_mask & CWHeight) | 1967 | if (cr.value_mask & CWHeight) |
1950 | ch = cr.height; | 1968 | ch = cr.height; |
@@ -2015,7 +2033,6 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { | |||
2015 | XUngrabPointer(display, CurrentTime); | 2033 | XUngrabPointer(display, CurrentTime); |
2016 | } | 2034 | } |
2017 | 2035 | ||
2018 | |||
2019 | } | 2036 | } |
2020 | 2037 | ||
2021 | 2038 | ||