aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-10-22 17:45:39 (GMT)
committermarkt <markt>2007-10-22 17:45:39 (GMT)
commitc6a2605d76927eed881e4ff9df58a9ec600bf4a2 (patch)
tree468c356ffdad6893d4f4b312f847122b66c997ed /src/Window.cc
parentf72633a0e0df146c4860b5b3940e9c3a2f7260b1 (diff)
downloadfluxbox-c6a2605d76927eed881e4ff9df58a9ec600bf4a2.zip
fluxbox-c6a2605d76927eed881e4ff9df58a9ec600bf4a2.tar.bz2
replaced ModKey with new key commands StartMoving and StartResizing
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc77
1 files changed, 31 insertions, 46 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 9a3d367..dbd945f 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1039,20 +1039,6 @@ void FluxboxWindow::grabButtons() {
1039 XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, 1039 XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask,
1040 frame().window().window()); 1040 frame().window().window());
1041 1041
1042 unsigned int modkey = Fluxbox::instance()->getModKey();
1043
1044 if (modkey) {
1045 //----grab with "all" modifiers
1046 FbTk::KeyUtil::grabButton(Button1, modkey, frame().window().window(),
1047 ButtonReleaseMask | ButtonMotionMask, frame().theme().moveCursor());
1048
1049 XGrabButton(display, Button2, modkey, frame().window().window(), True,
1050 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
1051
1052 //---grab with "all" modifiers
1053 FbTk::KeyUtil::grabButton(Button3, modkey, frame().window().window(),
1054 ButtonReleaseMask | ButtonMotionMask);
1055 }
1056} 1042}
1057 1043
1058 1044
@@ -2592,8 +2578,7 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2592 // check frame events first 2578 // check frame events first
2593 frame().buttonPressEvent(be); 2579 frame().buttonPressEvent(be);
2594 2580
2595 if (be.button == 1 || (be.button == 3 && 2581 if (be.button == 1) {
2596 be.state == Fluxbox::instance()->getModKey())) {
2597 if (!m_focused) //check focus 2582 if (!m_focused) //check focus
2598 focus(); 2583 focus();
2599 2584
@@ -2618,28 +2603,14 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2618 2603
2619void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { 2604void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
2620 2605
2621 if ((re.button == 1) && (re.state & Fluxbox::instance()->getModKey())
2622 && !screen().clickRaises()) {
2623
2624 if (!isMoving())
2625 raise();
2626
2627 }
2628
2629 if (isMoving()) 2606 if (isMoving())
2630 stopMoving(); 2607 stopMoving();
2631 else if (isResizing()) 2608 else if (isResizing())
2632 stopResizing(); 2609 stopResizing();
2633 else if (m_attaching_tab) 2610 else if (m_attaching_tab)
2634 attachTo(re.x_root, re.y_root); 2611 attachTo(re.x_root, re.y_root);
2635 else if (re.window == frame().window()) { 2612 else
2636 if (re.button == 2 && re.state == Fluxbox::instance()->getModKey())
2637 ungrabPointer(CurrentTime);
2638 else
2639 frame().buttonReleaseEvent(re);
2640 } else {
2641 frame().buttonReleaseEvent(re); 2613 frame().buttonReleaseEvent(re);
2642 }
2643} 2614}
2644 2615
2645 2616
@@ -2654,9 +2625,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2654 || frame().handle() == me.window 2625 || frame().handle() == me.window
2655 || frame().window() == me.window); 2626 || frame().window() == me.window);
2656 2627
2657 if (Fluxbox::instance()->getIgnoreBorder() 2628 if (Fluxbox::instance()->getIgnoreBorder() && m_attaching_tab == 0
2658 && !(me.state & Fluxbox::instance()->getModKey()) // really should check for exact matches 2629 && !(isMoving() || isResizing())) {
2659 && !(isMoving() || isResizing() || m_attaching_tab != 0)) {
2660 int borderw = frame().window().borderWidth(); 2630 int borderw = frame().window().borderWidth();
2661 //!! TODO(tabs): the below test ought to be in FbWinFrame 2631 //!! TODO(tabs): the below test ought to be in FbWinFrame
2662 // if mouse is currently on the window border, ignore it 2632 // if mouse is currently on the window border, ignore it
@@ -2787,23 +2757,13 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2787 2757
2788 if (! resizing) { 2758 if (! resizing) {
2789 2759
2790 int cx = frame().width() / 2;
2791 int cy = frame().height() / 2;
2792 ResizeDirection resize_corner = RIGHTBOTTOM; 2760 ResizeDirection resize_corner = RIGHTBOTTOM;
2793 if (me.window == frame().gripRight()) 2761 if (me.window == frame().gripRight())
2794 resize_corner = RIGHTBOTTOM; 2762 resize_corner = RIGHTBOTTOM;
2795 else if (me.window == frame().gripLeft()) 2763 else if (me.window == frame().gripLeft())
2796 resize_corner = LEFTBOTTOM; 2764 resize_corner = LEFTBOTTOM;
2797 else if (screen().getResizeModel() != BScreen::QUADRANTRESIZE) { 2765 else // dragging border of window, so choose nearest corner
2798 if (screen().getResizeModel() == BScreen::CENTERRESIZE) 2766 resize_corner = getResizeDirection(me.x, me.y, QUADRANTRESIZE);
2799 resize_corner = ALLCORNERS;
2800 else
2801 resize_corner = RIGHTBOTTOM;
2802 } else if (me.x < cx)
2803 resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM;
2804 else
2805 resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM;
2806
2807 2767
2808 // We are grabbing frame window in startResizing 2768 // We are grabbing frame window in startResizing
2809 // we need to translate coordinates to it. 2769 // we need to translate coordinates to it.
@@ -3404,6 +3364,31 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
3404 3364
3405} 3365}
3406 3366
3367FluxboxWindow::ResizeDirection FluxboxWindow::getResizeDirection(int x, int y,
3368 ResizeModel model) {
3369 int cx = frame().width() / 2;
3370 int cy = frame().height() / 2;
3371 if (model == CENTERRESIZE)
3372 return ALLCORNERS;
3373 if (model == NEARESTEDGERESIZE) {
3374 if (abs(cy - abs(y - cy)) > abs(cx - abs(x - cx))) // y is nearest
3375 return (y > cy) ? BOTTOM : TOP;
3376 return (x > cx) ? RIGHT : LEFT;
3377 }
3378 if (model == QUADRANTRESIZE) {
3379 if (x < cx)
3380 return (y < cy) ? LEFTTOP : LEFTBOTTOM;
3381 return (y < cy) ? RIGHTTOP : RIGHTBOTTOM;
3382 }
3383 if (model == TOPLEFTRESIZE) return LEFTTOP;
3384 if (model == TOPRESIZE) return TOP;
3385 if (model == TOPRIGHTRESIZE) return RIGHTTOP;
3386 if (model == LEFTRESIZE) return LEFT;
3387 if (model == RIGHTRESIZE) return RIGHT;
3388 if (model == BOTTOMLEFTRESIZE) return LEFTBOTTOM;
3389 if (model == BOTTOMRESIZE) return BOTTOM;
3390 return RIGHTBOTTOM;
3391}
3407 3392
3408void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) { 3393void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) {
3409 3394