aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Window.cc b/src/Window.cc
index ac76aee..929cec8 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -291,6 +291,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
291 m_client(&client), 291 m_client(&client),
292 m_toggled_decos(false), 292 m_toggled_decos(false),
293 m_focus_new(BoolAcc(screen().focusControl(), &FocusControl::focusNew)), 293 m_focus_new(BoolAcc(screen().focusControl(), &FocusControl::focusNew)),
294 m_focus_protection(Focus::NoProtection),
294 m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)), 295 m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)),
295 m_click_focus(true), 296 m_click_focus(true),
296 m_last_button_x(0), m_last_button_y(0), 297 m_last_button_x(0), m_last_button_y(0),
@@ -563,7 +564,10 @@ void FluxboxWindow::init() {
563 // check if we should prevent this window from gaining focus 564 // check if we should prevent this window from gaining focus
564 m_focused = false; // deiconify sets this 565 m_focused = false; // deiconify sets this
565 if (!Fluxbox::instance()->isStartup() && m_focus_new) { 566 if (!Fluxbox::instance()->isStartup() && m_focus_new) {
567 Focus::Protection fp = m_focus_protection;
568 m_focus_protection &= ~Focus::Deny; // new windows run as "Refuse"
566 m_focused = focusRequestFromClient(*m_client); 569 m_focused = focusRequestFromClient(*m_client);
570 m_focus_protection = fp;
567 if (!m_focused) 571 if (!m_focused)
568 lower(); 572 lower();
569 } 573 }
@@ -2025,7 +2029,10 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
2025 2029
2026 if (m_focus_new) { 2030 if (m_focus_new) {
2027 m_focused = false; // deiconify sets this 2031 m_focused = false; // deiconify sets this
2032 Focus::Protection fp = m_focus_protection;
2033 m_focus_protection &= ~Focus::Deny; // goes by "Refuse"
2028 m_focused = focusRequestFromClient(*client); 2034 m_focused = focusRequestFromClient(*client);
2035 m_focus_protection = fp;
2029 if (!m_focused) 2036 if (!m_focused)
2030 lower(); 2037 lower();
2031 } 2038 }
@@ -2041,9 +2048,13 @@ bool FluxboxWindow::focusRequestFromClient(WinClient &from) {
2041 2048
2042 FluxboxWindow *cur = FocusControl::focusedFbWindow(); 2049 FluxboxWindow *cur = FocusControl::focusedFbWindow();
2043 WinClient *client = FocusControl::focusedWindow(); 2050 WinClient *client = FocusControl::focusedWindow();
2044 if (cur && getRootTransientFor(&from) != getRootTransientFor(client)) 2051 if ((from.fbwindow() && (from.fbwindow()->focusProtection() & Focus::Deny)) ||
2052 (cur && (cur->focusProtection() & Focus::Lock))) {
2053 ret = false;
2054 } else if (cur && getRootTransientFor(&from) != getRootTransientFor(client)) {
2045 ret = !(cur->isFullscreen() && getOnHead() == cur->getOnHead()) && 2055 ret = !(cur->isFullscreen() && getOnHead() == cur->getOnHead()) &&
2046 !cur->isTyping(); 2056 !cur->isTyping();
2057 }
2047 2058
2048 if (!ret) 2059 if (!ret)
2049 Fluxbox::instance()->attentionHandler().addAttention(from); 2060 Fluxbox::instance()->attentionHandler().addAttention(from);