diff options
author | rathnor <rathnor> | 2003-02-09 14:11:14 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-02-09 14:11:14 (GMT) |
commit | e3b99d4e485591df52b2398fce9adbcece2b9917 (patch) | |
tree | 44c14c5160e07e1af0671e141ae99cc1f2e66609 /src/Window.cc | |
parent | 1a04cf1ce2649400d41c43024bd163a059cc426d (diff) | |
download | fluxbox_pavel-e3b99d4e485591df52b2398fce9adbcece2b9917.zip fluxbox_pavel-e3b99d4e485591df52b2398fce9adbcece2b9917.tar.bz2 |
fixing up of layer code
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 161 |
1 files changed, 147 insertions, 14 deletions
diff --git a/src/Window.cc b/src/Window.cc index f47f829..a8be66f 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.114 2003/02/03 13:55:08 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.115 2003/02/09 14:11:13 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -112,11 +112,12 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | |||
112 | display(0), | 112 | display(0), |
113 | lastButtonPressTime(0), | 113 | lastButtonPressTime(0), |
114 | m_windowmenu(menutheme, screen_num, imgctrl), | 114 | m_windowmenu(menutheme, screen_num, imgctrl), |
115 | m_layeritem(getFrameWindow(), layer), | ||
116 | m_layernum(4), | ||
117 | old_decoration(DECOR_NORMAL), | 115 | old_decoration(DECOR_NORMAL), |
118 | tab(0), | 116 | tab(0), |
119 | m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100) { | 117 | m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100), |
118 | m_layeritem(getFrameWindow(), layer), | ||
119 | m_layernum(layer.getLayerNum()) | ||
120 | { | ||
120 | 121 | ||
121 | 122 | ||
122 | 123 | ||
@@ -156,10 +157,6 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | |||
156 | client.transient_for = 0; | 157 | client.transient_for = 0; |
157 | client.mwm_hint = 0; | 158 | client.mwm_hint = 0; |
158 | client.blackbox_hint = 0; | 159 | client.blackbox_hint = 0; |
159 | Fluxbox *fluxbox = Fluxbox::instance(); | ||
160 | |||
161 | // default to normal layer | ||
162 | m_layernum = fluxbox->getNormalLayer(); | ||
163 | 160 | ||
164 | getBlackboxHints(); | 161 | getBlackboxHints(); |
165 | if (! client.blackbox_hint) { | 162 | if (! client.blackbox_hint) { |
@@ -190,6 +187,8 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | |||
190 | m_frame.move(wattrib.x, wattrib.y); | 187 | m_frame.move(wattrib.x, wattrib.y); |
191 | m_frame.resizeForClient(wattrib.width, wattrib.height); | 188 | m_frame.resizeForClient(wattrib.width, wattrib.height); |
192 | 189 | ||
190 | Fluxbox *fluxbox = Fluxbox::instance(); | ||
191 | |||
193 | timer.setTimeout(fluxbox->getAutoRaiseDelay()); | 192 | timer.setTimeout(fluxbox->getAutoRaiseDelay()); |
194 | timer.fireOnce(true); | 193 | timer.fireOnce(true); |
195 | 194 | ||
@@ -263,7 +262,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, | |||
263 | 262 | ||
264 | restoreAttributes(place_window); | 263 | restoreAttributes(place_window); |
265 | 264 | ||
266 | screen->moveWindowToLayer(this, m_layernum); | 265 | moveToLayer(m_layernum); |
267 | screen->getWorkspace(workspace_number)->addWindow(this, place_window); | 266 | screen->getWorkspace(workspace_number)->addWindow(this, place_window); |
268 | 267 | ||
269 | moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); | 268 | moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height()); |
@@ -1178,19 +1177,153 @@ void FluxboxWindow::stick() { | |||
1178 | setState(current_state); | 1177 | setState(current_state); |
1179 | } | 1178 | } |
1180 | 1179 | ||
1181 | void FluxboxWindow::lower() { | 1180 | void FluxboxWindow::raise() { |
1182 | if (isIconic()) | 1181 | if (isIconic()) |
1183 | deiconify(); | 1182 | deiconify(); |
1184 | 1183 | ||
1185 | screen->lowerWindow(this); | 1184 | FluxboxWindow *win = this; |
1185 | |||
1186 | while (win->getTransientFor()) { | ||
1187 | win = win->getTransientFor(); | ||
1188 | assert(win != win->getTransientFor()); | ||
1189 | } | ||
1190 | |||
1191 | if (win == 0) | ||
1192 | win = this; | ||
1193 | |||
1194 | if (!win->isIconic()) { | ||
1195 | screen->updateNetizenWindowRaise(win->getClientWindow()); | ||
1196 | win->getLayerItem().raise(); | ||
1197 | } | ||
1198 | |||
1199 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | ||
1200 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | ||
1201 | for (; it != it_end; ++it) { | ||
1202 | if (!(*it)->isIconic()) { | ||
1203 | screen->updateNetizenWindowRaise((*it)->getClientWindow()); | ||
1204 | (*it)->getLayerItem().raise(); | ||
1205 | } | ||
1206 | } | ||
1186 | } | 1207 | } |
1187 | 1208 | ||
1188 | void FluxboxWindow::raise() { | 1209 | void FluxboxWindow::lower() { |
1189 | if (isIconic()) | 1210 | if (isIconic()) |
1190 | deiconify(); | 1211 | deiconify(); |
1191 | screen->raiseWindow(this); | 1212 | |
1213 | FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = this; | ||
1214 | |||
1215 | while (bottom->getTransientFor()) { | ||
1216 | bottom = bottom->getTransientFor(); | ||
1217 | assert(bottom != bottom->getTransientFor()); | ||
1218 | } | ||
1219 | |||
1220 | win = bottom; | ||
1221 | |||
1222 | if (!win->isIconic()) { | ||
1223 | screen->updateNetizenWindowLower(win->getClientWindow()); | ||
1224 | win->getLayerItem().lower(); | ||
1225 | } | ||
1226 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | ||
1227 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | ||
1228 | for (; it != it_end; ++it) { | ||
1229 | if (!(*it)->isIconic()) { | ||
1230 | screen->updateNetizenWindowLower((*it)->getClientWindow()); | ||
1231 | (*it)->getLayerItem().lower(); | ||
1232 | } | ||
1233 | } | ||
1234 | |||
1192 | } | 1235 | } |
1193 | 1236 | ||
1237 | void FluxboxWindow::raiseLayer() { | ||
1238 | // don't let it up to menu layer | ||
1239 | if (getLayerNum() == (Fluxbox::instance()->getMenuLayer()+1)) | ||
1240 | return; | ||
1241 | |||
1242 | FluxboxWindow *win = this; | ||
1243 | |||
1244 | while (win->getTransientFor()) { | ||
1245 | win = win->getTransientFor(); | ||
1246 | assert(win != win->getTransientFor()); | ||
1247 | } | ||
1248 | |||
1249 | if (!win->isIconic()) { | ||
1250 | screen->updateNetizenWindowRaise(win->getClientWindow()); | ||
1251 | win->getLayerItem().raiseLayer(); | ||
1252 | win->setLayerNum(win->getLayerItem().getLayerNum()); | ||
1253 | } | ||
1254 | |||
1255 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | ||
1256 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | ||
1257 | for (; it != it_end; ++it) { | ||
1258 | if (!(*it)->isIconic()) { | ||
1259 | screen->updateNetizenWindowRaise((*it)->getClientWindow()); | ||
1260 | (*it)->getLayerItem().raiseLayer(); | ||
1261 | (*it)->setLayerNum((*it)->getLayerItem().getLayerNum()); | ||
1262 | } | ||
1263 | } | ||
1264 | } | ||
1265 | |||
1266 | void FluxboxWindow::lowerLayer() { | ||
1267 | FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = this; | ||
1268 | |||
1269 | while (bottom->getTransientFor()) { | ||
1270 | bottom = bottom->getTransientFor(); | ||
1271 | assert(bottom != bottom->getTransientFor()); | ||
1272 | } | ||
1273 | |||
1274 | win = bottom; | ||
1275 | |||
1276 | if (!win->isIconic()) { | ||
1277 | screen->updateNetizenWindowLower(win->getClientWindow()); | ||
1278 | win->getLayerItem().lowerLayer(); | ||
1279 | win->setLayerNum(win->getLayerItem().getLayerNum()); | ||
1280 | } | ||
1281 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | ||
1282 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | ||
1283 | for (; it != it_end; ++it) { | ||
1284 | if (!(*it)->isIconic()) { | ||
1285 | screen->updateNetizenWindowLower((*it)->getClientWindow()); | ||
1286 | (*it)->getLayerItem().lowerLayer(); | ||
1287 | (*it)->setLayerNum((*it)->getLayerItem().getLayerNum()); | ||
1288 | } | ||
1289 | } | ||
1290 | |||
1291 | } | ||
1292 | |||
1293 | void FluxboxWindow::moveToLayer(int layernum) { | ||
1294 | Fluxbox * fluxbox = Fluxbox::instance(); | ||
1295 | |||
1296 | FluxboxWindow *win = this; | ||
1297 | |||
1298 | // don't let it set its layer into menu area | ||
1299 | if (layernum <= fluxbox->getMenuLayer()) { | ||
1300 | layernum = fluxbox->getMenuLayer() + 1; | ||
1301 | } | ||
1302 | |||
1303 | while (win->getTransientFor()) { | ||
1304 | win = win->getTransientFor(); | ||
1305 | assert(win != win->getTransientFor()); | ||
1306 | } | ||
1307 | |||
1308 | if (!win->isIconic()) { | ||
1309 | screen->updateNetizenWindowRaise(win->getClientWindow()); | ||
1310 | win->getLayerItem().moveToLayer(layernum); | ||
1311 | win->setLayerNum(win->getLayerItem().getLayerNum()); | ||
1312 | } | ||
1313 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | ||
1314 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | ||
1315 | for (; it != it_end; ++it) { | ||
1316 | if (!(*it)->isIconic()) { | ||
1317 | screen->updateNetizenWindowRaise((*it)->getClientWindow()); | ||
1318 | (*it)->getLayerItem().moveToLayer(layernum); | ||
1319 | (*it)->setLayerNum((*it)->getLayerItem().getLayerNum()); | ||
1320 | |||
1321 | } | ||
1322 | } | ||
1323 | } | ||
1324 | |||
1325 | |||
1326 | |||
1194 | void FluxboxWindow::setFocusFlag(bool focus) { | 1327 | void FluxboxWindow::setFocusFlag(bool focus) { |
1195 | focused = focus; | 1328 | focused = focus; |
1196 | 1329 | ||
@@ -2325,7 +2458,7 @@ void FluxboxWindow::changeBlackboxHints(const BaseDisplay::BlackboxHints &net) { | |||
2325 | 2458 | ||
2326 | if (net.flags & BaseDisplay::ATTRIB_STACK) { | 2459 | if (net.flags & BaseDisplay::ATTRIB_STACK) { |
2327 | if ((unsigned int) m_layernum != net.stack) { | 2460 | if ((unsigned int) m_layernum != net.stack) { |
2328 | screen->moveWindowToLayer(this, net.stack); | 2461 | moveToLayer(net.stack); |
2329 | } | 2462 | } |
2330 | } | 2463 | } |
2331 | 2464 | ||