aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc35
1 files changed, 7 insertions, 28 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 468e723..89bd0d5 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -970,19 +970,7 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
970 if (be.button == 1 && !screen->isRootColormapInstalled()) 970 if (be.button == 1 && !screen->isRootColormapInstalled())
971 screen->imageControl().installRootColormap(); 971 screen->imageControl().installRootColormap();
972 972
973 // see if we need to keep watching for key releases 973 m_key->doAction(be.type, be.state, be.button);
974 BScreen *old_watching_screen = m_watching_screen;
975 m_watching_screen = 0;
976 if (!m_key->doAction(be.type, be.state, be.button))
977 // no command run, so could still be cycling
978 m_watching_screen = old_watching_screen;
979 else if (old_watching_screen &&
980 m_watching_screen != old_watching_screen) {
981 // no longer need to watch old screen, so stop cycling
982 old_watching_screen->notifyReleasedKeys();
983 if (!m_watching_screen)
984 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime);
985 }
986} 974}
987 975
988void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) { 976void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) {
@@ -1113,21 +1101,9 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1113 if (keyScreen() == 0 || mouseScreen() == 0) 1101 if (keyScreen() == 0 || mouseScreen() == 0)
1114 return; 1102 return;
1115 1103
1116 BScreen *old_watching_screen = m_watching_screen;
1117
1118 switch (ke.type) { 1104 switch (ke.type) {
1119 case KeyPress: 1105 case KeyPress:
1120 // see if we need to keep watching for key releases 1106 m_key->doAction(ke.type, ke.state, ke.keycode);
1121 m_watching_screen = 0;
1122 if (!m_key->doAction(ke.type, ke.state, ke.keycode))
1123 // no command run, so could still be cycling
1124 m_watching_screen = old_watching_screen;
1125 else if (old_watching_screen &&
1126 m_watching_screen != old_watching_screen) {
1127 old_watching_screen->notifyReleasedKeys();
1128 if (!m_watching_screen)
1129 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime);
1130 }
1131 break; 1107 break;
1132 case KeyRelease: { 1108 case KeyRelease: {
1133 // we ignore most key releases unless we need to use 1109 // we ignore most key releases unless we need to use
@@ -1841,12 +1817,15 @@ void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) {
1841 cerr<<"WARNING: attempt to grab without modifiers!"<<endl; 1817 cerr<<"WARNING: attempt to grab without modifiers!"<<endl;
1842 return; 1818 return;
1843 } 1819 }
1820 // just make sure we are saving the mods with any other flags (xkb)
1821 m_watch_keyrelease = FbTk::KeyUtil::instance().isolateModifierMask(mods);
1822
1823 if (m_watching_screen == &screen)
1824 return;
1844 if (m_watching_screen) 1825 if (m_watching_screen)
1845 m_watching_screen->focusControl().stopCyclingFocus(); 1826 m_watching_screen->focusControl().stopCyclingFocus();
1846 m_watching_screen = &screen; 1827 m_watching_screen = &screen;
1847 1828
1848 // just make sure we are saving the mods with any other flags (xkb)
1849 m_watch_keyrelease = FbTk::KeyUtil::instance().isolateModifierMask(mods);
1850 // TODO: it's possible (and happens to me sometimes) for the mods to be 1829 // TODO: it's possible (and happens to me sometimes) for the mods to be
1851 // released before we grab the keyboard -- not sure of a good way to fix it 1830 // released before we grab the keyboard -- not sure of a good way to fix it
1852 XGrabKeyboard(FbTk::App::instance()->display(), 1831 XGrabKeyboard(FbTk::App::instance()->display(),