diff options
author | markt <markt> | 2007-03-04 17:47:37 (GMT) |
---|---|---|
committer | markt <markt> | 2007-03-04 17:47:37 (GMT) |
commit | 4c1a242968dff12e504f281224819b7cd3850a04 (patch) | |
tree | 42a6e3de02153bc8f35cae43f89238d73e9b821a /src/fluxbox.cc | |
parent | 9477af82a5835b7336fec8879967abb67f3bd848 (diff) | |
download | fluxbox-4c1a242968dff12e504f281224819b7cd3850a04.zip fluxbox-4c1a242968dff12e504f281224819b7cd3850a04.tar.bz2 |
moved some code around (regarding event handling) in preparation for upcoming features
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r-- | src/fluxbox.cc | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index c71e2f5..e4c68bf 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -228,7 +228,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
228 | m_masked_window(0), | 228 | m_masked_window(0), |
229 | m_mousescreen(0), | 229 | m_mousescreen(0), |
230 | m_keyscreen(0), | 230 | m_keyscreen(0), |
231 | m_watching_screen(0), m_watch_keyrelease(0), | ||
232 | m_last_time(0), | 231 | m_last_time(0), |
233 | m_masked(0), | 232 | m_masked(0), |
234 | m_rc_file(rcfilename ? rcfilename : ""), | 233 | m_rc_file(rcfilename ? rcfilename : ""), |
@@ -746,7 +745,6 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
746 | switch (e->type) { | 745 | switch (e->type) { |
747 | case ButtonRelease: | 746 | case ButtonRelease: |
748 | case ButtonPress: | 747 | case ButtonPress: |
749 | handleButtonEvent(e->xbutton); | ||
750 | break; | 748 | break; |
751 | case ConfigureRequest: { | 749 | case ConfigureRequest: { |
752 | 750 | ||
@@ -894,7 +892,6 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
894 | break; | 892 | break; |
895 | case KeyRelease: | 893 | case KeyRelease: |
896 | case KeyPress: | 894 | case KeyPress: |
897 | handleKeyEvent(e->xkey); | ||
898 | break; | 895 | break; |
899 | case ColormapNotify: { | 896 | case ColormapNotify: { |
900 | BScreen *screen = searchScreen(e->xcolormap.window); | 897 | BScreen *screen = searchScreen(e->xcolormap.window); |
@@ -958,20 +955,6 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
958 | } | 955 | } |
959 | } | 956 | } |
960 | 957 | ||
961 | void Fluxbox::handleButtonEvent(XButtonEvent &be) { | ||
962 | m_last_time = be.time; | ||
963 | |||
964 | BScreen *screen = searchScreen(be.window); | ||
965 | if (be.type == ButtonRelease || !screen) | ||
966 | // no bindings for this type yet | ||
967 | return; | ||
968 | |||
969 | if (be.button == 1 && !screen->isRootColormapInstalled()) | ||
970 | screen->imageControl().installRootColormap(); | ||
971 | |||
972 | m_key->doAction(be.type, be.state, be.button); | ||
973 | } | ||
974 | |||
975 | void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) { | 958 | void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) { |
976 | 959 | ||
977 | BScreen *screen = searchScreen(ue.event); | 960 | BScreen *screen = searchScreen(ue.event); |
@@ -1092,47 +1075,6 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) { | |||
1092 | } | 1075 | } |
1093 | } | 1076 | } |
1094 | 1077 | ||
1095 | /** | ||
1096 | Handles KeyRelease and KeyPress events | ||
1097 | */ | ||
1098 | void Fluxbox::handleKeyEvent(XKeyEvent &ke) { | ||
1099 | |||
1100 | if (keyScreen() == 0 || mouseScreen() == 0) | ||
1101 | return; | ||
1102 | |||
1103 | switch (ke.type) { | ||
1104 | case KeyPress: | ||
1105 | m_key->doAction(ke.type, ke.state, ke.keycode); | ||
1106 | break; | ||
1107 | case KeyRelease: { | ||
1108 | // we ignore most key releases unless we need to use | ||
1109 | // a release to stop something (e.g. window cycling). | ||
1110 | |||
1111 | // we notify if _all_ of the watched modifiers are released | ||
1112 | if (m_watching_screen && m_watch_keyrelease) { | ||
1113 | // mask the mod of the released key out | ||
1114 | // won't mask anything if it isn't a mod | ||
1115 | unsigned int state = FbTk::KeyUtil::instance().isolateModifierMask(ke.state); | ||
1116 | state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode); | ||
1117 | |||
1118 | if ((m_watch_keyrelease & state) == 0) { | ||
1119 | |||
1120 | m_watching_screen->notifyReleasedKeys(); | ||
1121 | XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime); | ||
1122 | |||
1123 | // once they are released, we drop the watch | ||
1124 | m_watching_screen = 0; | ||
1125 | m_watch_keyrelease = 0; | ||
1126 | } | ||
1127 | } | ||
1128 | |||
1129 | break; | ||
1130 | } | ||
1131 | default: | ||
1132 | break; | ||
1133 | } | ||
1134 | } | ||
1135 | |||
1136 | /// handle system signals | 1078 | /// handle system signals |
1137 | void Fluxbox::handleSignal(int signum) { | 1079 | void Fluxbox::handleSignal(int signum) { |
1138 | _FB_USES_NLS; | 1080 | _FB_USES_NLS; |
@@ -1810,28 +1752,6 @@ void Fluxbox::updateFocusedWindow(BScreen *screen, BScreen *old_screen) { | |||
1810 | } | 1752 | } |
1811 | } | 1753 | } |
1812 | 1754 | ||
1813 | void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) { | ||
1814 | |||
1815 | if (mods == 0) { | ||
1816 | cerr<<"WARNING: attempt to grab without modifiers!"<<endl; | ||
1817 | return; | ||
1818 | } | ||
1819 | // just make sure we are saving the mods with any other flags (xkb) | ||
1820 | m_watch_keyrelease = FbTk::KeyUtil::instance().isolateModifierMask(mods); | ||
1821 | |||
1822 | if (m_watching_screen == &screen) | ||
1823 | return; | ||
1824 | if (m_watching_screen) | ||
1825 | m_watching_screen->focusControl().stopCyclingFocus(); | ||
1826 | m_watching_screen = &screen; | ||
1827 | |||
1828 | // TODO: it's possible (and happens to me sometimes) for the mods to be | ||
1829 | // released before we grab the keyboard -- not sure of a good way to fix it | ||
1830 | XGrabKeyboard(FbTk::App::instance()->display(), | ||
1831 | screen.rootWindow().window(), True, | ||
1832 | GrabModeAsync, GrabModeAsync, CurrentTime); | ||
1833 | } | ||
1834 | |||
1835 | void Fluxbox::updateFrameExtents(FluxboxWindow &win) { | 1755 | void Fluxbox::updateFrameExtents(FluxboxWindow &win) { |
1836 | AtomHandlerContainerIt it = m_atomhandler.begin(); | 1756 | AtomHandlerContainerIt it = m_atomhandler.begin(); |
1837 | AtomHandlerContainerIt it_end = m_atomhandler.end(); | 1757 | AtomHandlerContainerIt it_end = m_atomhandler.end(); |