aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-06-26 10:09:28 (GMT)
committerMathias Gumz <akira@fluxbox.org>2016-06-26 14:35:26 (GMT)
commit07d8fbfba806e10d8e57629b0ade029989c0b9d6 (patch)
tree001c34d0fea1f8e51b0515fc5c76db02f5c671f0 /src/Window.cc
parent1a61881ec34a5f3691df1159f63a4b5afb1f53c4 (diff)
downloadfluxbox-07d8fbfba806e10d8e57629b0ade029989c0b9d6.zip
fluxbox-07d8fbfba806e10d8e57629b0ade029989c0b9d6.tar.bz2
merge remember focusnew into focusprotection
The FocusNewWindow key is still read, but not written and OVERRIDDEN in case of conflict with the FocusProtection key
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 929cec8..37fb6c4 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -290,7 +290,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
290 m_old_decoration_mask(0), 290 m_old_decoration_mask(0),
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)),
294 m_focus_protection(Focus::NoProtection), 293 m_focus_protection(Focus::NoProtection),
295 m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)), 294 m_mouse_focus(BoolAcc(screen().focusControl(), &FocusControl::isMouseFocus)),
296 m_click_focus(true), 295 m_click_focus(true),
@@ -563,7 +562,7 @@ void FluxboxWindow::init() {
563 deiconify(false); 562 deiconify(false);
564 // check if we should prevent this window from gaining focus 563 // check if we should prevent this window from gaining focus
565 m_focused = false; // deiconify sets this 564 m_focused = false; // deiconify sets this
566 if (!Fluxbox::instance()->isStartup() && m_focus_new) { 565 if (!Fluxbox::instance()->isStartup() && isFocusNew()) {
567 Focus::Protection fp = m_focus_protection; 566 Focus::Protection fp = m_focus_protection;
568 m_focus_protection &= ~Focus::Deny; // new windows run as "Refuse" 567 m_focus_protection &= ~Focus::Deny; // new windows run as "Refuse"
569 m_focused = focusRequestFromClient(*m_client); 568 m_focused = focusRequestFromClient(*m_client);
@@ -658,9 +657,9 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
658 bool is_startup = Fluxbox::instance()->isStartup(); 657 bool is_startup = Fluxbox::instance()->isStartup();
659 658
660 // we use m_focused as a signal to focus the window when mapped 659 // we use m_focused as a signal to focus the window when mapped
661 if (m_focus_new && !is_startup) 660 if (isFocusNew() && !is_startup)
662 m_focused = focusRequestFromClient(client); 661 m_focused = focusRequestFromClient(client);
663 focused_win = (m_focus_new || is_startup) ? &client : m_client; 662 focused_win = (isFocusNew() || is_startup) ? &client : m_client;
664 663
665 m_clientlist.push_back(&client); 664 m_clientlist.push_back(&client);
666 } 665 }
@@ -1025,6 +1024,14 @@ bool FluxboxWindow::isGroupable() const {
1025 return false; 1024 return false;
1026} 1025}
1027 1026
1027bool FluxboxWindow::isFocusNew() const {
1028 if (m_focus_protection & Focus::Gain)
1029 return true;
1030 if (m_focus_protection & Focus::Refuse)
1031 return false;
1032 return screen().focusControl().focusNew();
1033}
1034
1028void FluxboxWindow::associateClientWindow() { 1035void FluxboxWindow::associateClientWindow() {
1029 frame().setShapingClient(m_client, false); 1036 frame().setShapingClient(m_client, false);
1030 1037
@@ -1432,7 +1439,7 @@ void FluxboxWindow::deiconify(bool do_raise) {
1432 // but not on startup: focus will be handled after creating everything 1439 // but not on startup: focus will be handled after creating everything
1433 // we use m_focused as a signal to focus the window when mapped 1440 // we use m_focused as a signal to focus the window when mapped
1434 if (screen().currentWorkspace()->numberOfWindows() == 1 || 1441 if (screen().currentWorkspace()->numberOfWindows() == 1 ||
1435 m_focus_new || m_client->isTransient()) 1442 isFocusNew() || m_client->isTransient())
1436 m_focused = true; 1443 m_focused = true;
1437 1444
1438 oplock = false; 1445 oplock = false;
@@ -2027,7 +2034,7 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
2027 setCurrentClient(*client, false); // focus handled on MapNotify 2034 setCurrentClient(*client, false); // focus handled on MapNotify
2028 deiconify(); 2035 deiconify();
2029 2036
2030 if (m_focus_new) { 2037 if (isFocusNew()) {
2031 m_focused = false; // deiconify sets this 2038 m_focused = false; // deiconify sets this
2032 Focus::Protection fp = m_focus_protection; 2039 Focus::Protection fp = m_focus_protection;
2033 m_focus_protection &= ~Focus::Deny; // goes by "Refuse" 2040 m_focus_protection &= ~Focus::Deny; // goes by "Refuse"