diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 96 |
1 files changed, 31 insertions, 65 deletions
diff --git a/src/Window.cc b/src/Window.cc index 6a12664..82bdc5e 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -905,29 +905,27 @@ void FluxboxWindow::moveClientTo(WinClient &win, int x, int y) { | |||
905 | 905 | ||
906 | void FluxboxWindow::moveClientLeftOf(WinClient &win, WinClient &dest) { | 906 | void FluxboxWindow::moveClientLeftOf(WinClient &win, WinClient &dest) { |
907 | 907 | ||
908 | frame().moveLabelButtonLeftOf(*m_labelbuttons[&win], *m_labelbuttons[&dest]); | 908 | frame().moveLabelButtonLeftOf(*m_labelbuttons[&win], *m_labelbuttons[&dest]); |
909 | 909 | ||
910 | ClientList::iterator it = find(m_clientlist.begin(), | 910 | ClientList::iterator it = find(m_clientlist.begin(), |
911 | m_clientlist.end(), | 911 | m_clientlist.end(), |
912 | &win); | 912 | &win); |
913 | ClientList::iterator new_pos = find(m_clientlist.begin(), | 913 | ClientList::iterator new_pos = find(m_clientlist.begin(), |
914 | m_clientlist.end(), | 914 | m_clientlist.end(), |
915 | &dest); | 915 | &dest); |
916 | 916 | ||
917 | // make sure we found them | 917 | // make sure we found them |
918 | if (it == m_clientlist.end() || new_pos==m_clientlist.end()) { | 918 | if (it == m_clientlist.end() || new_pos==m_clientlist.end()) |
919 | return; | 919 | return; |
920 | } | 920 | //moving a button to the left of itself results in no change |
921 | //moving a button to the left of itself results in no change | 921 | if (new_pos == it) |
922 | if( new_pos == it) { | 922 | return; |
923 | return; | 923 | //remove from list |
924 | } | 924 | m_clientlist.erase(it); |
925 | //remove from list | 925 | //insert on the new place |
926 | m_clientlist.erase(it); | 926 | m_clientlist.insert(new_pos, &win); |
927 | //insert on the new place | ||
928 | m_clientlist.insert(new_pos, &win); | ||
929 | 927 | ||
930 | updateClientLeftWindow(); | 928 | updateClientLeftWindow(); |
931 | } | 929 | } |
932 | 930 | ||
933 | 931 | ||
@@ -2560,10 +2558,20 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { | |||
2560 | m_last_button_x = be.x_root; | 2558 | m_last_button_x = be.x_root; |
2561 | m_last_button_y = be.y_root; | 2559 | m_last_button_y = be.y_root; |
2562 | 2560 | ||
2561 | bool onTitlebar = frame().gripLeft().window() != be.window && | ||
2562 | frame().gripRight().window() != be.window && | ||
2563 | frame().clientArea().window() != be.window && | ||
2564 | frame().window() != be.window; | ||
2565 | |||
2566 | if (onTitlebar && be.button == 1) | ||
2567 | raise(); | ||
2568 | |||
2563 | // check keys file first | 2569 | // check keys file first |
2564 | WindowCmd<void>::setWindow(this); | 2570 | WindowCmd<void>::setWindow(this); |
2565 | if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button, | 2571 | Keys *k = Fluxbox::instance()->keys(); |
2566 | Keys::ON_WINDOW)) { | 2572 | if (onTitlebar && k->doAction(be.type, be.state, be.button, |
2573 | Keys::ON_TITLEBAR, be.time) || | ||
2574 | k->doAction(be.type, be.state, be.button, Keys::ON_WINDOW, be.time)) { | ||
2567 | return; | 2575 | return; |
2568 | } | 2576 | } |
2569 | 2577 | ||
@@ -2572,13 +2580,6 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { | |||
2572 | if (!m_focused && acceptsFocus()) //check focus | 2580 | if (!m_focused && acceptsFocus()) //check focus |
2573 | focus(); | 2581 | focus(); |
2574 | 2582 | ||
2575 | // click on titlebar | ||
2576 | if (frame().gripLeft().window() != be.window && | ||
2577 | frame().gripRight().window() != be.window && | ||
2578 | frame().clientArea().window() != be.window && | ||
2579 | frame().window() != be.window) | ||
2580 | raise(); | ||
2581 | |||
2582 | if (frame().window().window() == be.window || | 2583 | if (frame().window().window() == be.window || |
2583 | frame().tabcontainer().window() == be.window) { | 2584 | frame().tabcontainer().window() == be.window) { |
2584 | if (screen().clickRaises()) | 2585 | if (screen().clickRaises()) |
@@ -2607,43 +2608,8 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { | |||
2607 | stopResizing(); | 2608 | stopResizing(); |
2608 | else if (m_attaching_tab) | 2609 | else if (m_attaching_tab) |
2609 | attachTo(re.x_root, re.y_root); | 2610 | attachTo(re.x_root, re.y_root); |
2610 | else { | 2611 | else |
2611 | frame().tabcontainer().tryButtonReleaseEvent(re); | 2612 | frame().tabcontainer().tryButtonReleaseEvent(re); |
2612 | if (frame().gripLeft().window() == re.window || | ||
2613 | frame().gripRight().window() == re.window || | ||
2614 | frame().clientArea().window() == re.window || | ||
2615 | frame().handle().window() == re.window || | ||
2616 | frame().window() == re.window) | ||
2617 | return; | ||
2618 | |||
2619 | static Time last_release_time = 0; | ||
2620 | bool double_click = (re.time - last_release_time <= | ||
2621 | Fluxbox::instance()->getDoubleClickInterval()); | ||
2622 | last_release_time = re.time; | ||
2623 | |||
2624 | if (re.button == 1 && double_click) | ||
2625 | shade(); | ||
2626 | if (re.button == 3) | ||
2627 | popupMenu(); | ||
2628 | if (re.button == 2) | ||
2629 | lower(); | ||
2630 | |||
2631 | unsigned int reverse = (screen().getScrollReverse() ? 1 : 0); | ||
2632 | if (re.button == 4 || re.button == 5) { | ||
2633 | if (StringUtil::toLower(screen().getScrollAction()) == "shade") { | ||
2634 | if (re.button == 5 - reverse) | ||
2635 | shadeOn(); | ||
2636 | else | ||
2637 | shadeOff(); | ||
2638 | } | ||
2639 | if (StringUtil::toLower(screen().getScrollAction()) == "nexttab") { | ||
2640 | if (re.button == 5 - reverse) | ||
2641 | nextClient(); | ||
2642 | else | ||
2643 | prevClient(); | ||
2644 | } | ||
2645 | } | ||
2646 | } | ||
2647 | 2613 | ||
2648 | } | 2614 | } |
2649 | 2615 | ||