diff options
author | markt <markt> | 2007-10-24 17:09:26 (GMT) |
---|---|---|
committer | markt <markt> | 2007-10-24 17:09:26 (GMT) |
commit | f3afe787c1209cf1357493924a4f7eb7864def54 (patch) | |
tree | d0c0c3eca154ab538fbc1fb3c62081e9250c05bd /src/Screen.cc | |
parent | 74eb584a312aba21b21eccb6c49ade1571aa3740 (diff) | |
download | fluxbox_pavel-f3afe787c1209cf1357493924a4f7eb7864def54.zip fluxbox_pavel-f3afe787c1209cf1357493924a4f7eb7864def54.tar.bz2 |
introduced workspacename for ClientPattern, and some miscellaneous cleanup
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 61 |
1 files changed, 6 insertions, 55 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 55517d8..541b30a 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -373,7 +373,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
373 | m_altname(altscreenname), | 373 | m_altname(altscreenname), |
374 | m_focus_control(new FocusControl(*this)), | 374 | m_focus_control(new FocusControl(*this)), |
375 | m_placement_strategy(new ScreenPlacement(*this)), | 375 | m_placement_strategy(new ScreenPlacement(*this)), |
376 | m_cycling(false), m_typing_ahead(false), m_cycle_opts(0), | 376 | m_cycling(false), m_cycle_opts(0), |
377 | m_xinerama_headinfo(0), | 377 | m_xinerama_headinfo(0), |
378 | m_restart(false), | 378 | m_restart(false), |
379 | m_shutdown(false) { | 379 | m_shutdown(false) { |
@@ -826,45 +826,9 @@ void BScreen::propertyNotify(Atom atom) { | |||
826 | } | 826 | } |
827 | 827 | ||
828 | void BScreen::keyPressEvent(XKeyEvent &ke) { | 828 | void BScreen::keyPressEvent(XKeyEvent &ke) { |
829 | if (!m_typing_ahead) { | 829 | WindowCmd<void>::setWindow(FocusControl::focusedFbWindow()); |
830 | WindowCmd<void>::setWindow(FocusControl::focusedFbWindow()); | 830 | Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, |
831 | Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode, | 831 | Keys::GLOBAL|Keys::ON_DESKTOP); |
832 | Keys::GLOBAL|Keys::ON_DESKTOP); | ||
833 | return; | ||
834 | } | ||
835 | |||
836 | KeySym ks; | ||
837 | char keychar[1]; | ||
838 | XLookupString(&ke, keychar, 1, &ks, 0); | ||
839 | // a modifier key by itself doesn't do anything | ||
840 | if (IsModifierKey(ks)) | ||
841 | return; | ||
842 | |||
843 | switch (ks) { | ||
844 | case XK_Escape: | ||
845 | case XK_KP_Enter: | ||
846 | case XK_Return: | ||
847 | m_type_ahead.reset(); | ||
848 | FbTk::EventManager::instance()->ungrabKeyboard(); | ||
849 | break; | ||
850 | case XK_BackSpace: | ||
851 | m_type_ahead.putBackSpace(); | ||
852 | m_matches = m_type_ahead.matched(); | ||
853 | break; | ||
854 | case XK_Tab: | ||
855 | case XK_ISO_Left_Tab: | ||
856 | m_type_ahead.seek(); | ||
857 | focusControl().cycleFocus(m_matches, m_cycle_opts, (bool)(ke.state & ShiftMask)); | ||
858 | break; | ||
859 | default: | ||
860 | m_matches = m_type_ahead.putCharacter(keychar[0]); | ||
861 | // if focused win doesn't match new search string, find the next one | ||
862 | if (!m_matches.empty() && | ||
863 | std::find(m_matches.begin(), m_matches.end(), | ||
864 | FocusControl::focusedWindow()) == m_matches.end()) | ||
865 | focusControl().cycleFocus(m_matches, m_cycle_opts); | ||
866 | break; | ||
867 | } | ||
868 | } | 832 | } |
869 | 833 | ||
870 | void BScreen::keyReleaseEvent(XKeyEvent &ke) { | 834 | void BScreen::keyReleaseEvent(XKeyEvent &ke) { |
@@ -889,22 +853,9 @@ void BScreen::buttonPressEvent(XButtonEvent &be) { | |||
889 | 853 | ||
890 | void BScreen::notifyUngrabKeyboard() { | 854 | void BScreen::notifyUngrabKeyboard() { |
891 | m_cycling = false; | 855 | m_cycling = false; |
892 | m_typing_ahead = false; | ||
893 | m_type_ahead.reset(); | ||
894 | focusControl().stopCyclingFocus(); | 856 | focusControl().stopCyclingFocus(); |
895 | } | 857 | } |
896 | 858 | ||
897 | void BScreen::startTypeAheadFocus(std::list<Focusable *> &winlist, | ||
898 | const ClientPattern *pat) { | ||
899 | m_type_ahead.init(winlist); | ||
900 | m_matches = winlist; | ||
901 | FbTk::EventManager *evm = FbTk::EventManager::instance(); | ||
902 | if (!m_typing_ahead && !m_cycling) | ||
903 | evm->grabKeyboard(*this, rootWindow().window()); | ||
904 | m_cycle_opts = pat; | ||
905 | m_typing_ahead = true; | ||
906 | } | ||
907 | |||
908 | void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) { | 859 | void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) { |
909 | // get modifiers from event that causes this for focus order cycling | 860 | // get modifiers from event that causes this for focus order cycling |
910 | XEvent ev = Fluxbox::instance()->lastEvent(); | 861 | XEvent ev = Fluxbox::instance()->lastEvent(); |
@@ -914,7 +865,7 @@ void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) { | |||
914 | else if (ev.type == ButtonPress) | 865 | else if (ev.type == ButtonPress) |
915 | mods = FbTk::KeyUtil::instance().cleanMods(ev.xbutton.state); | 866 | mods = FbTk::KeyUtil::instance().cleanMods(ev.xbutton.state); |
916 | 867 | ||
917 | if (!m_cycling && !m_typing_ahead && mods) { | 868 | if (!m_cycling && mods) { |
918 | m_cycling = true; | 869 | m_cycling = true; |
919 | FbTk::EventManager::instance()->grabKeyboard(*this, rootWindow().window()); | 870 | FbTk::EventManager::instance()->grabKeyboard(*this, rootWindow().window()); |
920 | } | 871 | } |
@@ -922,7 +873,7 @@ void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) { | |||
922 | if (mods == 0) // can't stacked cycle unless there is a mod to grab | 873 | if (mods == 0) // can't stacked cycle unless there is a mod to grab |
923 | options |= FocusControl::CYCLELINEAR; | 874 | options |= FocusControl::CYCLELINEAR; |
924 | 875 | ||
925 | FocusControl::Focusables *win_list = 0; | 876 | const FocusControl::Focusables *win_list = 0; |
926 | if (options & FocusControl::CYCLEGROUPS) { | 877 | if (options & FocusControl::CYCLEGROUPS) { |
927 | win_list = (options & FocusControl::CYCLELINEAR) ? | 878 | win_list = (options & FocusControl::CYCLELINEAR) ? |
928 | &focusControl().creationOrderWinList() : | 879 | &focusControl().creationOrderWinList() : |