diff options
author | fluxgen <fluxgen> | 2003-05-15 12:00:46 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-05-15 12:00:46 (GMT) |
commit | 988392b1eb89deaddfddfcb37a15e8f55d58bb70 (patch) | |
tree | 493d69abd418722498d1b53982653eae1d4a37e6 /src/Window.cc | |
parent | cbce8634dde14fd7000fde92e86f4bd4bf3525c2 (diff) | |
download | fluxbox_pavel-988392b1eb89deaddfddfcb37a15e8f55d58bb70.zip fluxbox_pavel-988392b1eb89deaddfddfcb37a15e8f55d58bb70.tar.bz2 |
minor cleaning in BScreen interface
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 105 |
1 files changed, 43 insertions, 62 deletions
diff --git a/src/Window.cc b/src/Window.cc index 1216d63..5c681ea 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.176 2003/05/15 11:17:27 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.177 2003/05/15 12:00:46 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -236,16 +236,16 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t | |||
236 | m_screen(scr), | 236 | m_screen(scr), |
237 | m_timer(this), | 237 | m_timer(this), |
238 | display(0), | 238 | display(0), |
239 | m_windowmenu(menutheme, scr.getScreenNumber(), *scr.getImageControl()), | 239 | m_windowmenu(menutheme, scr.screenNumber(), *scr.getImageControl()), |
240 | m_layermenu(new LayerMenu<FluxboxWindow>(menutheme, | 240 | m_layermenu(new LayerMenu<FluxboxWindow>(menutheme, |
241 | scr.getScreenNumber(), | 241 | scr.screenNumber(), |
242 | *scr.getImageControl(), | 242 | *scr.getImageControl(), |
243 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 243 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
244 | this, | 244 | this, |
245 | false)), | 245 | false)), |
246 | m_old_decoration(DECOR_NORMAL), | 246 | m_old_decoration(DECOR_NORMAL), |
247 | m_client(&client), | 247 | m_client(&client), |
248 | m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100)), | 248 | m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.screenNumber(), 0, 0, 100, 100)), |
249 | m_layeritem(m_frame->window(), layer), | 249 | m_layeritem(m_frame->window(), layer), |
250 | m_layernum(layer.getLayerNum()), | 250 | m_layernum(layer.getLayerNum()), |
251 | m_parent(scr.rootWindow()) { | 251 | m_parent(scr.rootWindow()) { |
@@ -269,16 +269,16 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm, | |||
269 | m_screen(scr), | 269 | m_screen(scr), |
270 | m_timer(this), | 270 | m_timer(this), |
271 | display(0), | 271 | display(0), |
272 | m_windowmenu(menutheme, scr.getScreenNumber(), *scr.getImageControl()), | 272 | m_windowmenu(menutheme, scr.screenNumber(), *scr.getImageControl()), |
273 | m_layermenu(new LayerMenu<FluxboxWindow>(menutheme, | 273 | m_layermenu(new LayerMenu<FluxboxWindow>(menutheme, |
274 | scr.getScreenNumber(), | 274 | scr.screenNumber(), |
275 | *scr.getImageControl(), | 275 | *scr.getImageControl(), |
276 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 276 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
277 | this, | 277 | this, |
278 | false)), | 278 | false)), |
279 | m_old_decoration(DECOR_NORMAL), | 279 | m_old_decoration(DECOR_NORMAL), |
280 | m_client(new WinClient(w, *this)), | 280 | m_client(new WinClient(w, *this)), |
281 | m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.getScreenNumber(), 0, 0, 100, 100)), | 281 | m_frame(new FbWinFrame(tm, *scr.getImageControl(), scr.screenNumber(), 0, 0, 100, 100)), |
282 | m_layeritem(m_frame->window(), layer), | 282 | m_layeritem(m_frame->window(), layer), |
283 | m_layernum(layer.getLayerNum()), | 283 | m_layernum(layer.getLayerNum()), |
284 | m_parent(scr.rootWindow()) { | 284 | m_parent(scr.rootWindow()) { |
@@ -484,8 +484,8 @@ void FluxboxWindow::init() { | |||
484 | 484 | ||
485 | if (real_x >= 0 && | 485 | if (real_x >= 0 && |
486 | real_y + frame().y() >= 0 && | 486 | real_y + frame().y() >= 0 && |
487 | real_x <= (signed) screen().getWidth() && | 487 | real_x <= (signed) screen().width() && |
488 | real_y <= (signed) screen().getHeight()) | 488 | real_y <= (signed) screen().height()) |
489 | place_window = false; | 489 | place_window = false; |
490 | 490 | ||
491 | } else | 491 | } else |
@@ -500,7 +500,7 @@ void FluxboxWindow::init() { | |||
500 | positionWindows(); | 500 | positionWindows(); |
501 | 501 | ||
502 | if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) | 502 | if (m_workspace_number < 0 || m_workspace_number >= screen().getCount()) |
503 | m_workspace_number = screen().getCurrentWorkspaceID(); | 503 | m_workspace_number = screen().currentWorkspaceID(); |
504 | 504 | ||
505 | restoreAttributes(); | 505 | restoreAttributes(); |
506 | 506 | ||
@@ -1180,23 +1180,23 @@ bool FluxboxWindow::setInputFocus() { | |||
1180 | if (((signed) (frame().y() + frame().height())) < 0) { | 1180 | if (((signed) (frame().y() + frame().height())) < 0) { |
1181 | moveResize(screen().rootTheme().borderWidth(), screen().rootTheme().borderWidth(), | 1181 | moveResize(screen().rootTheme().borderWidth(), screen().rootTheme().borderWidth(), |
1182 | frame().width(), frame().height()); | 1182 | frame().width(), frame().height()); |
1183 | } else if (frame().y() > (signed) screen().getHeight()) { | 1183 | } else if (frame().y() > (signed) screen().height()) { |
1184 | moveResize(screen().rootTheme().borderWidth(), screen().getHeight() - frame().height(), | 1184 | moveResize(screen().rootTheme().borderWidth(), screen().height() - frame().height(), |
1185 | frame().width(), frame().height()); | 1185 | frame().width(), frame().height()); |
1186 | } else { | 1186 | } else { |
1187 | moveResize(screen().rootTheme().borderWidth(), frame().y() + screen().rootTheme().borderWidth(), | 1187 | moveResize(screen().rootTheme().borderWidth(), frame().y() + screen().rootTheme().borderWidth(), |
1188 | frame().width(), frame().height()); | 1188 | frame().width(), frame().height()); |
1189 | } | 1189 | } |
1190 | } else if (frame().x() > (signed) screen().getWidth()) { | 1190 | } else if (frame().x() > (signed) screen().width()) { |
1191 | if (((signed) (frame().y() + frame().height())) < 0) { | 1191 | if (((signed) (frame().y() + frame().height())) < 0) { |
1192 | moveResize(screen().getWidth() - frame().width(), screen().rootTheme().borderWidth(), | 1192 | moveResize(screen().width() - frame().width(), screen().rootTheme().borderWidth(), |
1193 | frame().width(), frame().height()); | 1193 | frame().width(), frame().height()); |
1194 | } else if (frame().y() > (signed) screen().getHeight()) { | 1194 | } else if (frame().y() > (signed) screen().height()) { |
1195 | moveResize(screen().getWidth() - frame().width(), | 1195 | moveResize(screen().width() - frame().width(), |
1196 | screen().getHeight() - frame().height(), | 1196 | screen().height() - frame().height(), |
1197 | frame().width(), frame().height()); | 1197 | frame().width(), frame().height()); |
1198 | } else { | 1198 | } else { |
1199 | moveResize(screen().getWidth() - frame().width(), | 1199 | moveResize(screen().width() - frame().width(), |
1200 | frame().y() + screen().rootTheme().borderWidth(), | 1200 | frame().y() + screen().rootTheme().borderWidth(), |
1201 | frame().width(), frame().height()); | 1201 | frame().width(), frame().height()); |
1202 | } | 1202 | } |
@@ -1299,8 +1299,8 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { | |||
1299 | oplock = true; | 1299 | oplock = true; |
1300 | 1300 | ||
1301 | if (iconic || reassoc) { | 1301 | if (iconic || reassoc) { |
1302 | screen().reassociateWindow(this, screen().getCurrentWorkspace()->workspaceID(), false); | 1302 | screen().reassociateWindow(this, screen().currentWorkspace()->workspaceID(), false); |
1303 | } else if (moving || m_workspace_number != screen().getCurrentWorkspace()->workspaceID()) { | 1303 | } else if (moving || m_workspace_number != screen().currentWorkspace()->workspaceID()) { |
1304 | oplock = false; | 1304 | oplock = false; |
1305 | return; | 1305 | return; |
1306 | } | 1306 | } |
@@ -1384,12 +1384,12 @@ void FluxboxWindow::maximize() { | |||
1384 | m_old_height = frame().height(); | 1384 | m_old_height = frame().height(); |
1385 | m_old_pos_x = frame().x(); | 1385 | m_old_pos_x = frame().x(); |
1386 | m_old_pos_y = frame().y(); | 1386 | m_old_pos_y = frame().y(); |
1387 | unsigned int left_x = screen().getMaxLeft(); | 1387 | unsigned int left_x = screen().maxLeft(); |
1388 | unsigned int max_width = screen().getMaxRight(); | 1388 | unsigned int max_width = screen().maxRight(); |
1389 | unsigned int max_top = screen().getMaxTop(); | 1389 | unsigned int max_top = screen().maxTop(); |
1390 | moveResize(left_x, max_top, | 1390 | moveResize(left_x, max_top, |
1391 | max_width - left_x, | 1391 | max_width - left_x, |
1392 | screen().getMaxBottom() - max_top - frame().window().borderWidth()); | 1392 | screen().maxBottom() - max_top - frame().window().borderWidth()); |
1393 | } else { // demaximize, restore to old values | 1393 | } else { // demaximize, restore to old values |
1394 | moveResize(m_old_pos_x, m_old_pos_y, | 1394 | moveResize(m_old_pos_x, m_old_pos_y, |
1395 | m_old_width, m_old_height); | 1395 | m_old_width, m_old_height); |
@@ -1399,8 +1399,8 @@ void FluxboxWindow::maximize() { | |||
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | void FluxboxWindow::maximizeHorizontal() { | 1401 | void FluxboxWindow::maximizeHorizontal() { |
1402 | unsigned int left_x = screen().getMaxLeft(); | 1402 | unsigned int left_x = screen().maxLeft(); |
1403 | unsigned int max_width = screen().getMaxRight(); | 1403 | unsigned int max_width = screen().maxRight(); |
1404 | moveResize(left_x, frame().y(), | 1404 | moveResize(left_x, frame().y(), |
1405 | max_width - left_x, frame().height() - frame().window().borderWidth()); | 1405 | max_width - left_x, frame().height() - frame().window().borderWidth()); |
1406 | 1406 | ||
@@ -1410,10 +1410,10 @@ void FluxboxWindow::maximizeHorizontal() { | |||
1410 | Maximize window horizontal | 1410 | Maximize window horizontal |
1411 | */ | 1411 | */ |
1412 | void FluxboxWindow::maximizeVertical() { | 1412 | void FluxboxWindow::maximizeVertical() { |
1413 | unsigned int max_top = screen().getMaxTop(); | 1413 | unsigned int max_top = screen().maxTop(); |
1414 | moveResize(frame().x(), max_top, | 1414 | moveResize(frame().x(), max_top, |
1415 | frame().width() - frame().window().borderWidth(), | 1415 | frame().width() - frame().window().borderWidth(), |
1416 | screen().getMaxBottom() - max_top); | 1416 | screen().maxBottom() - max_top); |
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | 1419 | ||
@@ -1862,7 +1862,7 @@ void FluxboxWindow::restoreAttributes() { | |||
1862 | m_current_state = save_state; | 1862 | m_current_state = save_state; |
1863 | } | 1863 | } |
1864 | 1864 | ||
1865 | if (( m_blackbox_attrib.workspace != screen().getCurrentWorkspaceID()) && | 1865 | if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) && |
1866 | ( m_blackbox_attrib.workspace < screen().getCount())) { | 1866 | ( m_blackbox_attrib.workspace < screen().getCount())) { |
1867 | m_workspace_number = m_blackbox_attrib.workspace; | 1867 | m_workspace_number = m_blackbox_attrib.workspace; |
1868 | 1868 | ||
@@ -2434,12 +2434,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2434 | m_last_resize_y = me.y_root; | 2434 | m_last_resize_y = me.y_root; |
2435 | 2435 | ||
2436 | if (moved_x && screen().isWorkspaceWarping()) { | 2436 | if (moved_x && screen().isWorkspaceWarping()) { |
2437 | unsigned int cur_id = screen().getCurrentWorkspaceID(); | 2437 | unsigned int cur_id = screen().currentWorkspaceID(); |
2438 | unsigned int new_id = cur_id; | 2438 | unsigned int new_id = cur_id; |
2439 | const int warpPad = screen().getEdgeSnapThreshold(); | 2439 | const int warpPad = screen().getEdgeSnapThreshold(); |
2440 | // 1) if we're inside the border threshold | 2440 | // 1) if we're inside the border threshold |
2441 | // 2) if we moved in the right direction | 2441 | // 2) if we moved in the right direction |
2442 | if (me.x_root >= int(screen().getWidth()) - warpPad - 1 && | 2442 | if (me.x_root >= int(screen().width()) - warpPad - 1 && |
2443 | moved_x > 0) { | 2443 | moved_x > 0) { |
2444 | //warp right | 2444 | //warp right |
2445 | new_id = (cur_id + 1) % screen().getCount(); | 2445 | new_id = (cur_id + 1) % screen().getCount(); |
@@ -2448,7 +2448,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2448 | moved_x < 0) { | 2448 | moved_x < 0) { |
2449 | //warp left | 2449 | //warp left |
2450 | new_id = (cur_id + screen().getCount() - 1) % screen().getCount(); | 2450 | new_id = (cur_id + screen().getCount() - 1) % screen().getCount(); |
2451 | dx = screen().getWidth() - me.x_root-1; // move mouse to screen width - 1 | 2451 | dx = screen().width() - me.x_root-1; // move mouse to screen width - 1 |
2452 | } | 2452 | } |
2453 | if (new_id != cur_id) { | 2453 | if (new_id != cur_id) { |
2454 | XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0); | 2454 | XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0); |
@@ -2559,12 +2559,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2559 | dy -= screen().rootTheme().borderWidth(); | 2559 | dy -= screen().rootTheme().borderWidth(); |
2560 | 2560 | ||
2561 | if (screen().getEdgeSnapThreshold()) { | 2561 | if (screen().getEdgeSnapThreshold()) { |
2562 | int drx = screen().getWidth() - (dx + 1); | 2562 | int drx = screen().width() - (dx + 1); |
2563 | 2563 | ||
2564 | if (dx > 0 && dx < drx && dx < screen().getEdgeSnapThreshold()) | 2564 | if (dx > 0 && dx < drx && dx < screen().getEdgeSnapThreshold()) |
2565 | dx = 0; | 2565 | dx = 0; |
2566 | else if (drx > 0 && drx < screen().getEdgeSnapThreshold()) | 2566 | else if (drx > 0 && drx < screen().getEdgeSnapThreshold()) |
2567 | dx = screen().getWidth() - 1; | 2567 | dx = screen().width() - 1; |
2568 | 2568 | ||
2569 | int dty, dby; | 2569 | int dty, dby; |
2570 | 2570 | ||
@@ -2821,8 +2821,8 @@ void FluxboxWindow::stopMoving() { | |||
2821 | frame().width() + 2*frame().window().borderWidth()-1, | 2821 | frame().width() + 2*frame().window().borderWidth()-1, |
2822 | frame().height() + 2*frame().window().borderWidth()-1); | 2822 | frame().height() + 2*frame().window().borderWidth()-1); |
2823 | moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height()); | 2823 | moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height()); |
2824 | if (m_workspace_number != screen().getCurrentWorkspaceID()) { | 2824 | if (m_workspace_number != screen().currentWorkspaceID()) { |
2825 | screen().reassociateWindow(this, screen().getCurrentWorkspaceID(), true); | 2825 | screen().reassociateWindow(this, screen().currentWorkspaceID(), true); |
2826 | frame().show(); | 2826 | frame().show(); |
2827 | } | 2827 | } |
2828 | fluxbox->ungrab(); | 2828 | fluxbox->ungrab(); |
@@ -2853,7 +2853,7 @@ void FluxboxWindow::resumeMoving() { | |||
2853 | return; | 2853 | return; |
2854 | } | 2854 | } |
2855 | 2855 | ||
2856 | if (m_workspace_number == screen().getCurrentWorkspaceID()) { | 2856 | if (m_workspace_number == screen().currentWorkspaceID()) { |
2857 | frame().show(); | 2857 | frame().show(); |
2858 | } | 2858 | } |
2859 | XSync(display,false); | 2859 | XSync(display,false); |
@@ -2930,13 +2930,13 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { | |||
2930 | ///////////////////////////////////// | 2930 | ///////////////////////////////////// |
2931 | // begin by checking the screen edges | 2931 | // begin by checking the screen edges |
2932 | 2932 | ||
2933 | snapToWindow(dx, dy, left, right, top, bottom, 0, screen().getWidth(), 0, screen().getHeight()); | 2933 | snapToWindow(dx, dy, left, right, top, bottom, 0, screen().width(), 0, screen().height()); |
2934 | 2934 | ||
2935 | ///////////////////////////////////// | 2935 | ///////////////////////////////////// |
2936 | // now check window edges | 2936 | // now check window edges |
2937 | 2937 | ||
2938 | Workspace::Windows &wins = | 2938 | Workspace::Windows &wins = |
2939 | screen().getCurrentWorkspace()->windowList(); | 2939 | screen().currentWorkspace()->windowList(); |
2940 | 2940 | ||
2941 | Workspace::Windows::iterator it = wins.begin(); | 2941 | Workspace::Windows::iterator it = wins.begin(); |
2942 | Workspace::Windows::iterator it_end = wins.end(); | 2942 | Workspace::Windows::iterator it_end = wins.end(); |
@@ -2951,26 +2951,6 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { | |||
2951 | (*it)->y() + (*it)->height() + 2*borderW); | 2951 | (*it)->y() + (*it)->height() + 2*borderW); |
2952 | } | 2952 | } |
2953 | 2953 | ||
2954 | ///////////////////////////////////// | ||
2955 | // now the toolbar | ||
2956 | |||
2957 | Toolbar *tbar = screen().getToolbar(); | ||
2958 | if (tbar) | ||
2959 | snapToWindow(dx, dy, left, right, top, bottom, | ||
2960 | tbar->x(), tbar->x() + tbar->width() + 2*borderW, | ||
2961 | tbar->y(), tbar->y() + tbar->height() + 2*borderW); | ||
2962 | |||
2963 | ///////////////////////////////////// | ||
2964 | // and the slit | ||
2965 | |||
2966 | #ifdef SLIT | ||
2967 | Slit *slit = screen().getSlit(); | ||
2968 | if (slit) | ||
2969 | snapToWindow(dx, dy, left, right, top, bottom, | ||
2970 | slit->x(), slit->x() + slit->width() + 2*borderW, | ||
2971 | slit->y(), slit->y() + slit->height() + 2*borderW); | ||
2972 | #endif // SLIT | ||
2973 | |||
2974 | // commit | 2954 | // commit |
2975 | if (dx <= screen().getEdgeSnapThreshold()) | 2955 | if (dx <= screen().getEdgeSnapThreshold()) |
2976 | orig_left += dx; | 2956 | orig_left += dx; |
@@ -3066,10 +3046,11 @@ void FluxboxWindow::attachTo(int x, int y) { | |||
3066 | 3046 | ||
3067 | //finds and redraw the icon label | 3047 | //finds and redraw the icon label |
3068 | void FluxboxWindow::updateIcon() { | 3048 | void FluxboxWindow::updateIcon() { |
3069 | if (screen().getToolbar()) { | 3049 | //!! TODO we shouldn't know about the toolbar in fluxboxwindow! |
3050 | if (screen().toolbar()) { | ||
3070 | const IconBar *iconbar = 0; | 3051 | const IconBar *iconbar = 0; |
3071 | const IconBarObj *icon = 0; | 3052 | const IconBarObj *icon = 0; |
3072 | if ((iconbar = screen().getToolbar()->iconBar()) != 0) { | 3053 | if ((iconbar = screen().toolbar()->iconBar()) != 0) { |
3073 | if ((icon = iconbar->findIcon(this)) != 0) | 3054 | if ((icon = iconbar->findIcon(this)) != 0) |
3074 | iconbar->draw(icon, icon->width()); | 3055 | iconbar->draw(icon, icon->width()); |
3075 | } | 3056 | } |
@@ -3216,7 +3197,7 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) { | |||
3216 | 3197 | ||
3217 | screen().reassociateWindow(this, net.workspace, true); | 3198 | screen().reassociateWindow(this, net.workspace, true); |
3218 | 3199 | ||
3219 | if (screen().getCurrentWorkspaceID() != net.workspace) | 3200 | if (screen().currentWorkspaceID() != net.workspace) |
3220 | withdraw(); | 3201 | withdraw(); |
3221 | else | 3202 | else |
3222 | deiconify(); | 3203 | deiconify(); |