diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/Window.cc b/src/Window.cc index 32f4dd2..1ad789d 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -98,41 +98,43 @@ void grabButton(unsigned int button, | |||
98 | const int capslock = KeyUtil::instance().capslock(); | 98 | const int capslock = KeyUtil::instance().capslock(); |
99 | const int scrolllock = KeyUtil::instance().scrolllock(); | 99 | const int scrolllock = KeyUtil::instance().scrolllock(); |
100 | 100 | ||
101 | // Grab with Mod1 and with all lock modifiers | 101 | // Grab with modkey and with all lock modifiers |
102 | // (num, scroll and caps) | 102 | // (num, scroll and caps) |
103 | 103 | ||
104 | unsigned int modkey = Fluxbox::instance()->getModKey(); | ||
105 | |||
104 | //numlock | 106 | //numlock |
105 | XGrabButton(display, button, Mod1Mask|numlock, window, True, | 107 | XGrabButton(display, button, modkey|numlock, window, True, |
106 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 108 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
107 | GrabModeAsync, None, cursor); | 109 | GrabModeAsync, None, cursor); |
108 | //scrolllock | 110 | //scrolllock |
109 | XGrabButton(display, button, Mod1Mask|scrolllock, window, True, | 111 | XGrabButton(display, button, modkey|scrolllock, window, True, |
110 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 112 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
111 | GrabModeAsync, None, cursor); | 113 | GrabModeAsync, None, cursor); |
112 | 114 | ||
113 | //capslock | 115 | //capslock |
114 | XGrabButton(display, button, Mod1Mask|capslock, window, True, | 116 | XGrabButton(display, button, modkey|capslock, window, True, |
115 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 117 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
116 | GrabModeAsync, None, cursor); | 118 | GrabModeAsync, None, cursor); |
117 | 119 | ||
118 | //capslock+numlock | 120 | //capslock+numlock |
119 | XGrabButton(display, Button1, Mod1Mask|capslock|numlock, window, True, | 121 | XGrabButton(display, Button1, modkey|capslock|numlock, window, True, |
120 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 122 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
121 | GrabModeAsync, None, cursor); | 123 | GrabModeAsync, None, cursor); |
122 | 124 | ||
123 | //capslock+scrolllock | 125 | //capslock+scrolllock |
124 | XGrabButton(display, button, Mod1Mask|capslock|scrolllock, window, True, | 126 | XGrabButton(display, button, modkey|capslock|scrolllock, window, True, |
125 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 127 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
126 | GrabModeAsync, None, cursor); | 128 | GrabModeAsync, None, cursor); |
127 | 129 | ||
128 | //capslock+numlock+scrolllock | 130 | //capslock+numlock+scrolllock |
129 | XGrabButton(display, button, Mod1Mask|capslock|numlock|scrolllock, window, | 131 | XGrabButton(display, button, modkey|capslock|numlock|scrolllock, window, |
130 | True, | 132 | True, |
131 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 133 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
132 | GrabModeAsync, None, cursor); | 134 | GrabModeAsync, None, cursor); |
133 | 135 | ||
134 | //numlock+scrollLock | 136 | //numlock+scrollLock |
135 | XGrabButton(display, button, Mod1Mask|numlock|scrolllock, window, True, | 137 | XGrabButton(display, button, modkey|numlock|scrolllock, window, True, |
136 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 138 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
137 | GrabModeAsync, None, cursor); | 139 | GrabModeAsync, None, cursor); |
138 | 140 | ||
@@ -1108,20 +1110,23 @@ void FluxboxWindow::grabButtons() { | |||
1108 | XGrabButton(display, Button1, AnyModifier, | 1110 | XGrabButton(display, Button1, AnyModifier, |
1109 | frame().window().window(), True, ButtonPressMask, | 1111 | frame().window().window(), True, ButtonPressMask, |
1110 | GrabModeSync, GrabModeSync, None, None); | 1112 | GrabModeSync, GrabModeSync, None, None); |
1111 | XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window()); | 1113 | XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, |
1114 | frame().window().window()); | ||
1115 | |||
1116 | unsigned int modkey = Fluxbox::instance()->getModKey(); | ||
1112 | 1117 | ||
1113 | if (Fluxbox::instance()->useMod1()) { | 1118 | if (modkey) { |
1114 | XGrabButton(display, Button1, Mod1Mask, frame().window().window(), True, | 1119 | XGrabButton(display, Button1, modkey, frame().window().window(), True, |
1115 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 1120 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
1116 | GrabModeAsync, None, frame().theme().moveCursor()); | 1121 | GrabModeAsync, None, frame().theme().moveCursor()); |
1117 | 1122 | ||
1118 | //----grab with "all" modifiers | 1123 | //----grab with "all" modifiers |
1119 | grabButton(Button1, frame().window().window(), frame().theme().moveCursor()); | 1124 | grabButton(Button1, frame().window().window(), frame().theme().moveCursor()); |
1120 | 1125 | ||
1121 | XGrabButton(display, Button2, Mod1Mask, frame().window().window(), True, | 1126 | XGrabButton(display, Button2, modkey, frame().window().window(), True, |
1122 | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); | 1127 | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); |
1123 | 1128 | ||
1124 | XGrabButton(display, Button3, Mod1Mask, frame().window().window(), True, | 1129 | XGrabButton(display, Button3, modkey, frame().window().window(), True, |
1125 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, | 1130 | ButtonReleaseMask | ButtonMotionMask, GrabModeAsync, |
1126 | GrabModeAsync, None, None); | 1131 | GrabModeAsync, None, None); |
1127 | 1132 | ||
@@ -1738,7 +1743,7 @@ void FluxboxWindow::maximize(int type) { | |||
1738 | m_last_resize_y = new_y; | 1743 | m_last_resize_y = new_y; |
1739 | m_last_resize_w = new_w; | 1744 | m_last_resize_w = new_w; |
1740 | m_last_resize_h = new_h; | 1745 | m_last_resize_h = new_h; |
1741 | 1746 | ||
1742 | ResizeDirection old_resize_corner = m_resize_corner; | 1747 | ResizeDirection old_resize_corner = m_resize_corner; |
1743 | m_resize_corner = NOCORNER; | 1748 | m_resize_corner = NOCORNER; |
1744 | fixsize(); | 1749 | fixsize(); |
@@ -2684,7 +2689,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { | |||
2684 | // check frame events first | 2689 | // check frame events first |
2685 | frame().buttonPressEvent(be); | 2690 | frame().buttonPressEvent(be); |
2686 | 2691 | ||
2687 | if (be.button == 1 || (be.button == 3 && be.state == Mod1Mask)) { | 2692 | if (be.button == 1 || (be.button == 3 && |
2693 | be.state == Fluxbox::instance()->getModKey())) { | ||
2688 | if ( (! focused) ) { //check focus | 2694 | if ( (! focused) ) { //check focus |
2689 | setInputFocus(); | 2695 | setInputFocus(); |
2690 | } | 2696 | } |
@@ -2721,7 +2727,7 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { | |||
2721 | else if (m_attaching_tab) | 2727 | else if (m_attaching_tab) |
2722 | attachTo(re.x_root, re.y_root); | 2728 | attachTo(re.x_root, re.y_root); |
2723 | else if (re.window == frame().window()) { | 2729 | else if (re.window == frame().window()) { |
2724 | if (re.button == 2 && re.state == Mod1Mask) | 2730 | if (re.button == 2 && re.state == Fluxbox::instance()->getModKey()) |
2725 | ungrabPointer(CurrentTime); | 2731 | ungrabPointer(CurrentTime); |
2726 | else | 2732 | else |
2727 | frame().buttonReleaseEvent(re); | 2733 | frame().buttonReleaseEvent(re); |
@@ -2743,7 +2749,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2743 | || frame().window() == me.window); | 2749 | || frame().window() == me.window); |
2744 | 2750 | ||
2745 | if (Fluxbox::instance()->getIgnoreBorder() | 2751 | if (Fluxbox::instance()->getIgnoreBorder() |
2746 | && !(me.state & Mod1Mask) // really should check for exact matches | 2752 | && !(me.state & Fluxbox::instance()->getModKey()) // really should check for exact matches |
2747 | && !(isMoving() || isResizing() || m_attaching_tab != 0)) { | 2753 | && !(isMoving() || isResizing() || m_attaching_tab != 0)) { |
2748 | int borderw = frame().window().borderWidth(); | 2754 | int borderw = frame().window().borderWidth(); |
2749 | //!! TODO(tabs): the below test ought to be in FbWinFrame | 2755 | //!! TODO(tabs): the below test ought to be in FbWinFrame |
@@ -2871,7 +2877,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2871 | resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM; | 2877 | resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM; |
2872 | 2878 | ||
2873 | 2879 | ||
2874 | // We are grabbing frame window in startResizing | 2880 | // We are grabbing frame window in startResizing |
2875 | // we need to translate coordinates to it. | 2881 | // we need to translate coordinates to it. |
2876 | int start_x = me.x, start_y = me.y; | 2882 | int start_x = me.x, start_y = me.y; |
2877 | Window child; | 2883 | Window child; |