aboutsummaryrefslogtreecommitdiff
path: root/src/Window.hh
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-06-19 15:45:41 (GMT)
committerMathias Gumz <akira@fluxbox.org>2016-06-26 14:35:16 (GMT)
commit1a61881ec34a5f3691df1159f63a4b5afb1f53c4 (patch)
tree8ab844e8790c75a0e9dcc2ea44143dea47649758 /src/Window.hh
parent69b0f0fa97f53f601a250dc1b5a6876f64796a91 (diff)
downloadfluxbox-1a61881ec34a5f3691df1159f63a4b5afb1f53c4.zip
fluxbox-1a61881ec34a5f3691df1159f63a4b5afb1f53c4.tar.bz2
Add FocusProtection features
The apps file gets a new key FocusProtection supporting a comma separated list. * None : regular behavior * Lock : If this window has the focus, no other may claim it * Deny : This window is not allowed to focus itself I addition there's preparation for a follow-up patch to incorporate and substitute the present FocusNewWindow feature: * Gain : Pass focus to new window * Refuse : Do not pass focus to new window rationale: clients stealing the focus sucks badly and while there's an input driven timeout, that only protects actual typing flow, but if eg. vlc proceeds on the playlist, you'll suddenly control vlc instead of your browser (ie. typing ctrl+w doesn't close the tab, but the playlist ...)
Diffstat (limited to 'src/Window.hh')
-rw-r--r--src/Window.hh17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Window.hh b/src/Window.hh
index c04676a..706f8ed 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -56,6 +56,18 @@ class ImageControl;
56class Layer; 56class Layer;
57} 57}
58 58
59namespace Focus {
60 enum {
61 NoProtection = 0,
62 Gain = 1,
63 Refuse = 2,
64 Lock = 4,
65 Deny = 8
66 };
67 typedef unsigned int Protection;
68}
69
70
59/// Creates the window frame and handles any window event for it 71/// Creates the window frame and handles any window event for it
60class FluxboxWindow: public Focusable, 72class FluxboxWindow: public Focusable,
61 public FbTk::EventHandler, 73 public FbTk::EventHandler,
@@ -256,6 +268,8 @@ public:
256 void setIconHidden(bool value); 268 void setIconHidden(bool value);
257 /// sets whether or not the window normally gets focus when mapped 269 /// sets whether or not the window normally gets focus when mapped
258 void setFocusNew(bool value) { m_focus_new = value; } 270 void setFocusNew(bool value) { m_focus_new = value; }
271 /// sets how to protect the focus on or against this window
272 void setFocusProtection(Focus::Protection value) { m_focus_protection = value; }
259 /// sets whether or not the window gets focused with mouse 273 /// sets whether or not the window gets focused with mouse
260 void setMouseFocus(bool value) { m_mouse_focus = value; } 274 void setMouseFocus(bool value) { m_mouse_focus = value; }
261 /// sets whether or not the window gets focused with click 275 /// sets whether or not the window gets focused with click
@@ -384,6 +398,7 @@ public:
384 bool isMoveable() const { return functions.move; } 398 bool isMoveable() const { return functions.move; }
385 bool isStuck() const { return m_state.stuck; } 399 bool isStuck() const { return m_state.stuck; }
386 bool isFocusNew() const { return m_focus_new; } 400 bool isFocusNew() const { return m_focus_new; }
401 Focus::Protection focusProtection() const { return m_focus_protection; }
387 bool hasTitlebar() const { return decorations.titlebar; } 402 bool hasTitlebar() const { return decorations.titlebar; }
388 bool isMoving() const { return moving; } 403 bool isMoving() const { return moving; }
389 bool isResizing() const { return resizing; } 404 bool isResizing() const { return resizing; }
@@ -572,6 +587,8 @@ private:
572 typedef FbTk::ConstObjectAccessor<bool, FocusControl> BoolAcc; 587 typedef FbTk::ConstObjectAccessor<bool, FocusControl> BoolAcc;
573 /// if the window is normally focused when mapped 588 /// if the window is normally focused when mapped
574 FbTk::DefaultValue<bool, BoolAcc> m_focus_new; 589 FbTk::DefaultValue<bool, BoolAcc> m_focus_new;
590 /// special focus permissions
591 Focus::Protection m_focus_protection;
575 /// if the window is focused with EnterNotify 592 /// if the window is focused with EnterNotify
576 FbTk::DefaultValue<bool, BoolAcc> m_mouse_focus; 593 FbTk::DefaultValue<bool, BoolAcc> m_mouse_focus;
577 bool m_click_focus; ///< if the window is focused by clicking 594 bool m_click_focus; ///< if the window is focused by clicking