summaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index a6e5e84..3d6d479 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -856,19 +856,26 @@ void BScreen::propertyNotify(Atom atom) {
856} 856}
857 857
858void BScreen::keyPressEvent(XKeyEvent &ke) { 858void BScreen::keyPressEvent(XKeyEvent &ke) {
859 Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, 859 if (Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode,
860 Keys::GLOBAL|Keys::ON_DESKTOP); 860 Keys::GLOBAL|Keys::ON_DESKTOP))
861 // re-grab keyboard, so we don't pass KeyRelease to clients
862 FbTk::EventManager::instance()->grabKeyboard(rootWindow().window());
863
861} 864}
862 865
863void BScreen::keyReleaseEvent(XKeyEvent &ke) { 866void BScreen::keyReleaseEvent(XKeyEvent &ke) {
864 if (!m_cycling) 867 if (m_cycling) {
865 return; 868 unsigned int state = FbTk::KeyUtil::instance().cleanMods(ke.state);
869 state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode);
870
871 if (state) // still cycling
872 return;
866 873
867 unsigned int state = FbTk::KeyUtil::instance().cleanMods(ke.state); 874 m_cycling = false;
868 state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode); 875 focusControl().stopCyclingFocus();
876 }
869 877
870 if (!state) // all modifiers were released 878 FbTk::EventManager::instance()->ungrabKeyboard();
871 FbTk::EventManager::instance()->ungrabKeyboard();
872} 879}
873 880
874void BScreen::buttonPressEvent(XButtonEvent &be) { 881void BScreen::buttonPressEvent(XButtonEvent &be) {
@@ -880,11 +887,6 @@ void BScreen::buttonPressEvent(XButtonEvent &be) {
880 0, be.time); 887 0, be.time);
881} 888}
882 889
883void BScreen::notifyUngrabKeyboard() {
884 m_cycling = false;
885 focusControl().stopCyclingFocus();
886}
887
888void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) { 890void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) {
889 // get modifiers from event that causes this for focus order cycling 891 // get modifiers from event that causes this for focus order cycling
890 XEvent ev = Fluxbox::instance()->lastEvent(); 892 XEvent ev = Fluxbox::instance()->lastEvent();
@@ -896,7 +898,7 @@ void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) {
896 898
897 if (!m_cycling && mods) { 899 if (!m_cycling && mods) {
898 m_cycling = true; 900 m_cycling = true;
899 FbTk::EventManager::instance()->grabKeyboard(*this, rootWindow().window()); 901 FbTk::EventManager::instance()->grabKeyboard(rootWindow().window());
900 } 902 }
901 903
902 if (mods == 0) // can't stacked cycle unless there is a mod to grab 904 if (mods == 0) // can't stacked cycle unless there is a mod to grab