aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
authormathias <mathias>2005-05-06 09:22:53 (GMT)
committermathias <mathias>2005-05-06 09:22:53 (GMT)
commit6c057c6903151aab92309310087d5af455ecefce (patch)
tree1d4c98ad1637df09b89593b3e6a4a70245db4602 /src/fluxbox.cc
parent7d4f711204ab0b51d45eaff332708f529c11c9f5 (diff)
downloadfluxbox-6c057c6903151aab92309310087d5af455ecefce.zip
fluxbox-6c057c6903151aab92309310087d5af455ecefce.tar.bz2
Fix for #1160244, #1099704, #1094107:
if the xkb-extension is enabled and the user switches between his/her keyboardlayouts fluxbox's keybhandling doesn't work well anymore because xkeyevent.state contains also xkb-related flags and thus we have to handle that with caution. KeyUtils now contain 'isolateModifierMask()' to really work only on the modifiers. why not as part of cleanMods() ? because the XLookupString return false results, eg TextBox's would only print chars from the first keyboardlayout.
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index cd289ed..271d93f 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -777,11 +777,13 @@ void Fluxbox::handleEvent(XEvent * const e) {
777#ifdef DEBUG 777#ifdef DEBUG
778 cerr<<__FILE__<<"("<<__FUNCTION__<<"): MappingNotify"<<endl; 778 cerr<<__FILE__<<"("<<__FUNCTION__<<"): MappingNotify"<<endl;
779#endif // DEBUG 779#endif // DEBUG
780 780 if (e->xmapping.request == MappingKeyboard
781 FbTk::KeyUtil::instance().init(); // reinitialise the key utils 781 || e->xmapping.request == MappingModifier) {
782 // reconfigure keys (if the mapping changes, they don't otherwise update 782 XRefreshKeyboardMapping(&e->xmapping);
783 m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str()); 783 FbTk::KeyUtil::instance().init(); // reinitialise the key utils
784 784 // reconfigure keys (if the mapping changes, they don't otherwise update
785 m_key->reconfigure(StringUtil::expandFilename(*m_rc_keyfile).c_str());
786 }
785 break; 787 break;
786 case CreateNotify: 788 case CreateNotify:
787 break; 789 break;
@@ -1076,7 +1078,6 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1076 if (keyScreen() == 0 || mouseScreen() == 0) 1078 if (keyScreen() == 0 || mouseScreen() == 0)
1077 return; 1079 return;
1078 1080
1079
1080 switch (ke.type) { 1081 switch (ke.type) {
1081 case KeyPress: 1082 case KeyPress:
1082 m_key->doAction(ke); 1083 m_key->doAction(ke);
@@ -1089,9 +1090,10 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1089 if (m_watching_screen && m_watch_keyrelease) { 1090 if (m_watching_screen && m_watch_keyrelease) {
1090 // mask the mod of the released key out 1091 // mask the mod of the released key out
1091 // won't mask anything if it isn't a mod 1092 // won't mask anything if it isn't a mod
1092 ke.state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode); 1093 unsigned int state = FbTk::KeyUtil::instance().isolateModifierMask(ke.state);
1093 1094 state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode);
1094 if ((m_watch_keyrelease & ke.state) == 0) { 1095
1096 if ((m_watch_keyrelease & state) == 0) {
1095 1097
1096 m_watching_screen->notifyReleasedKeys(ke); 1098 m_watching_screen->notifyReleasedKeys(ke);
1097 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime); 1099 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime);
@@ -1107,8 +1109,6 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1107 default: 1109 default:
1108 break; 1110 break;
1109 } 1111 }
1110
1111
1112} 1112}
1113 1113
1114/// handle system signals 1114/// handle system signals
@@ -1951,12 +1951,15 @@ void Fluxbox::unfocusWindow(WinClient &client, bool full_revert, bool unfocus_fr
1951 1951
1952 1952
1953void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) { 1953void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) {
1954
1954 if (mods == 0) { 1955 if (mods == 0) {
1955 cerr<<"WARNING: attempt to grab without modifiers!"<<endl; 1956 cerr<<"WARNING: attempt to grab without modifiers!"<<endl;
1956 return; 1957 return;
1957 } 1958 }
1958 m_watching_screen = &screen; 1959 m_watching_screen = &screen;
1959 m_watch_keyrelease = mods; 1960
1961 // just make sure we are saving the mods with any other flags (xkb)
1962 m_watch_keyrelease = FbTk::KeyUtil::instance().isolateModifierMask(mods);
1960 XGrabKeyboard(FbTk::App::instance()->display(), 1963 XGrabKeyboard(FbTk::App::instance()->display(),
1961 screen.rootWindow().window(), True, 1964 screen.rootWindow().window(), True,
1962 GrabModeAsync, GrabModeAsync, CurrentTime); 1965 GrabModeAsync, GrabModeAsync, CurrentTime);