aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc71
1 files changed, 60 insertions, 11 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index b676a8b..3dfe324 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -28,6 +28,7 @@
28#include "Screen.hh" 28#include "Screen.hh"
29 29
30#include "fluxbox.hh" 30#include "fluxbox.hh"
31#include "Keys.hh"
31#include "Window.hh" 32#include "Window.hh"
32#include "Workspace.hh" 33#include "Workspace.hh"
33#include "Netizen.hh" 34#include "Netizen.hh"
@@ -364,6 +365,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
364 m_altname(altscreenname), 365 m_altname(altscreenname),
365 m_focus_control(new FocusControl(*this)), 366 m_focus_control(new FocusControl(*this)),
366 m_placement_strategy(new ScreenPlacement(*this)), 367 m_placement_strategy(new ScreenPlacement(*this)),
368 m_cycling(false),
367 m_xinerama_headinfo(0), 369 m_xinerama_headinfo(0),
368 m_restart(false), 370 m_restart(false),
369 m_shutdown(false) { 371 m_shutdown(false) {
@@ -416,7 +418,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
416 screenNumber(), XVisualIDFromVisual(rootWindow().visual()), 418 screenNumber(), XVisualIDFromVisual(rootWindow().visual()),
417 rootWindow().depth()); 419 rootWindow().depth());
418 420
419 421 FbTk::EventManager *evm = FbTk::EventManager::instance();
422 evm->add(*this, rootWindow());
420 rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr)); 423 rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
421 424
422 // load this screens resources 425 // load this screens resources
@@ -538,6 +541,9 @@ BScreen::~BScreen() {
538 if (! managed) 541 if (! managed)
539 return; 542 return;
540 543
544 FbTk::EventManager *evm = FbTk::EventManager::instance();
545 evm->remove(rootWindow());
546
541 if (m_rootmenu.get() != 0) 547 if (m_rootmenu.get() != 0)
542 m_rootmenu->removeAll(); 548 m_rootmenu->removeAll();
543 549
@@ -780,6 +786,59 @@ void BScreen::update(FbTk::Subject *subj) {
780 786
781} 787}
782 788
789void BScreen::keyPressEvent(XKeyEvent &ke) {
790 Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode);
791}
792
793void BScreen::keyReleaseEvent(XKeyEvent &ke) {
794 if (!m_cycling)
795 return;
796
797 unsigned int state = FbTk::KeyUtil::instance().cleanMods(ke.state);
798 state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode);
799
800 if (!state) // all modifiers were released
801 FbTk::EventManager::instance()->ungrabKeyboard();
802}
803
804void BScreen::buttonPressEvent(XButtonEvent &be) {
805 if (be.button == 1 && !isRootColormapInstalled())
806 imageControl().installRootColormap();
807
808 Keys *keys = Fluxbox::instance()->keys();
809 keys->doAction(be.type, be.state, be.button);
810}
811
812void BScreen::notifyUngrabKeyboard() {
813 m_cycling = false;
814 focusControl().stopCyclingFocus();
815}
816
817void BScreen::cycleFocus(int options, bool reverse) {
818 // get modifiers from event that causes this for focus order cycling
819 XEvent ev = Fluxbox::instance()->lastEvent();
820 unsigned int mods = 0;
821 if (ev.type == KeyPress)
822 mods = FbTk::KeyUtil::instance().cleanMods(ev.xkey.state);
823 else if (ev.type == ButtonPress)
824 mods = FbTk::KeyUtil::instance().cleanMods(ev.xbutton.state);
825
826 if (!m_cycling && mods) {
827 m_cycling = true;
828 FbTk::EventManager::instance()->grabKeyboard(*this, rootWindow().window());
829 }
830
831 if (mods == 0) // can't stacked cycle unless there is a mod to grab
832 options |= FocusControl::CYCLELINEAR;
833
834 FocusControl::FocusedWindows *win_list =
835 (options & FocusControl::CYCLELINEAR) ?
836 &focusControl().creationOrderList() :
837 &focusControl().focusedOrderList();
838
839 focusControl().cycleFocus(win_list, options, reverse);
840}
841
783FbTk::Menu *BScreen::createMenu(const string &label) { 842FbTk::Menu *BScreen::createMenu(const string &label) {
784 FbTk::Menu *menu = new FbMenu(menuTheme(), 843 FbTk::Menu *menu = new FbMenu(menuTheme(),
785 imageControl(), 844 imageControl(),
@@ -2054,16 +2113,6 @@ void BScreen::renderPosWindow() {
2054 2113
2055} 2114}
2056 2115
2057
2058
2059
2060/**
2061 Called when a set of watched modifiers has been released
2062*/
2063void BScreen::notifyReleasedKeys() {
2064 focusControl().stopCyclingFocus();
2065}
2066
2067void BScreen::updateSize() { 2116void BScreen::updateSize() {
2068 // force update geometry 2117 // force update geometry
2069 rootWindow().updateGeometry(); 2118 rootWindow().updateGeometry();