summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/FocusControl.cc41
-rw-r--r--src/FocusControl.hh2
-rw-r--r--src/WorkspaceCmd.cc4
-rw-r--r--src/fluxbox.cc2
5 files changed, 32 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ed16b6..dca3258 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0rc3: 2Changes for 1.0rc3:
3*06/07/14:
4 * Fix a possible bug with window cycling on multiple screens (Mark)
5 fluxbox.cc WorkspaceCmd.cc
6 * Include minimized windows when "alt-tabbing", added 16 to the
7 Next/PrevWindow bitmask to disable the behavior (Mark)
8 FocusControl.cc/hh
3*06/07/13: 9*06/07/13:
4 * Remove some redundant code for loading styles (Mark) 10 * Remove some redundant code for loading styles (Mark)
5 fluxbox.cc Screen.cc RootTheme.cc/hh 11 fluxbox.cc Screen.cc RootTheme.cc/hh
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index 6f919ef..6b4f64a 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -57,6 +57,7 @@ FocusControl::FocusControl(BScreen &screen):
57 screen.name()+".focusNewWindows", 57 screen.name()+".focusNewWindows",
58 screen.altName()+".FocusNewWindows"), 58 screen.altName()+".FocusNewWindows"),
59 m_cycling_focus(false), 59 m_cycling_focus(false),
60 m_was_iconic(false),
60 m_cycling_last(0) { 61 m_cycling_last(0) {
61 62
62 m_cycling_window = m_focused_list.end(); 63 m_cycling_window = m_focused_list.end();
@@ -73,38 +74,29 @@ bool doSkipWindow(const WinClient &winclient, int opts) {
73 (opts & FocusControl::CYCLEGROUPS) != 0 && win->winClient().window() != winclient.window() || 74 (opts & FocusControl::CYCLEGROUPS) != 0 && win->winClient().window() != winclient.window() ||
74 // skip if shaded 75 // skip if shaded
75 (opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() || 76 (opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() ||
77 // skip if iconic
78 (opts & FocusControl::CYCLESKIPICONIC) != 0 && win->isIconic() ||
76 // skip if hidden 79 // skip if hidden
77 win->isFocusHidden() 80 win->isFocusHidden()
78 ); 81 );
79} 82}
80 83
81void FocusControl::cycleFocus(int opts, bool cycle_reverse) { 84void FocusControl::cycleFocus(int opts, bool cycle_reverse) {
82 int num_windows = m_screen.currentWorkspace()->numberOfWindows();
83
84 if (num_windows < 1)
85 return;
86 85
87 FocusedWindows *window_list = (opts & CYCLELINEAR) ? &m_creation_order_list : &m_focused_list; 86 FocusedWindows *window_list = (opts & CYCLELINEAR) ? &m_creation_order_list : &m_focused_list;
88 if (!m_cycling_focus) { 87 if (!m_cycling_focus) {
89 if (Fluxbox::instance()->watchingScreen()) 88 if (&m_screen == Fluxbox::instance()->watchingScreen())
90 m_cycling_focus = true; 89 m_cycling_focus = true;
91 if (opts & CYCLELINEAR) { 90 m_cycling_window = find(window_list->begin(),window_list->end(),s_focused_window);
92 m_cycling_creation_order = true; 91 m_cycling_creation_order = (opts & CYCLELINEAR);
93 m_cycling_window = find(window_list->begin(),window_list->end(),s_focused_window); 92 m_was_iconic = false;
94 } else {
95 m_cycling_creation_order = (opts & CYCLELINEAR);
96 m_cycling_window = window_list->begin();
97 }
98 m_cycling_last = 0; 93 m_cycling_last = 0;
99 } else { 94 } else {
100 // already cycling, so restack to put windows back in their proper order 95 // already cycling, so restack to put windows back in their proper order
101 m_screen.layerManager().restack(); 96 m_screen.layerManager().restack();
102 if (m_cycling_creation_order ^ (bool)(opts & CYCLELINEAR)) { 97 if (m_cycling_creation_order ^ (bool)(opts & CYCLELINEAR)) {
103 m_cycling_creation_order ^= true; 98 m_cycling_creation_order ^= true;
104 if (m_cycling_window != m_focused_list.end() && m_cycling_window != m_creation_order_list.end()) 99 m_cycling_window = find(window_list->begin(),window_list->end(),*m_cycling_window);
105 m_cycling_window = find(window_list->begin(),window_list->end(),*m_cycling_window);
106 else
107 m_cycling_window = window_list->begin();
108 } 100 }
109 } 101 }
110 // if it is stacked, we want the highest window in the focused list 102 // if it is stacked, we want the highest window in the focused list
@@ -116,16 +108,18 @@ void FocusControl::cycleFocus(int opts, bool cycle_reverse) {
116 while (true) { 108 while (true) {
117 if (cycle_reverse && it == it_begin) 109 if (cycle_reverse && it == it_begin)
118 it = it_end; 110 it = it_end;
119 cycle_reverse ? --it : ++it; 111 else if (!cycle_reverse && it == it_end)
120 if (it == it_end)
121 it = it_begin; 112 it = it_begin;
113 else
114 cycle_reverse ? --it : ++it;
122 // give up [do nothing] if we reach the current focused again 115 // give up [do nothing] if we reach the current focused again
123 if ((*it) == (*m_cycling_window)) 116 if (it == m_cycling_window)
124 break; 117 break;
118 if (it == it_end)
119 continue;
125 120
126 FluxboxWindow *fbwin = (*it)->fbwindow(); 121 FluxboxWindow *fbwin = (*it)->fbwindow();
127 if (fbwin && !fbwin->isIconic() && 122 if (fbwin && (fbwin->isStuck()
128 (fbwin->isStuck()
129 || fbwin->workspaceNumber() == m_screen.currentWorkspaceID())) { 123 || fbwin->workspaceNumber() == m_screen.currentWorkspaceID())) {
130 // either on this workspace, or stuck 124 // either on this workspace, or stuck
131 125
@@ -140,6 +134,9 @@ void FocusControl::cycleFocus(int opts, bool cycle_reverse) {
140 m_cycling_last->fbwindow()->setCurrentClient(*m_cycling_last, false); 134 m_cycling_last->fbwindow()->setCurrentClient(*m_cycling_last, false);
141 } 135 }
142 m_cycling_last = &last_client; 136 m_cycling_last = &last_client;
137 if (m_was_iconic)
138 (*m_cycling_window)->fbwindow()->iconify();
139 m_was_iconic = fbwin->isIconic();
143 } 140 }
144 fbwin->tempRaise(); 141 fbwin->tempRaise();
145 break; 142 break;
@@ -362,6 +359,8 @@ void FocusControl::removeClient(WinClient &client) {
362 */ 359 */
363void FocusControl::revertFocus(BScreen &screen) { 360void FocusControl::revertFocus(BScreen &screen) {
364 361
362 if (screen.focusControl().isCycling())
363 return;
365 // Relevant resources: 364 // Relevant resources:
366 // resource.focus_last = whether we focus last focused when changing workspace 365 // resource.focus_last = whether we focus last focused when changing workspace
367 // BScreen::FocusModel = sloppy, click, whatever 366 // BScreen::FocusModel = sloppy, click, whatever
diff --git a/src/FocusControl.hh b/src/FocusControl.hh
index e13c645..666ab3c 100644
--- a/src/FocusControl.hh
+++ b/src/FocusControl.hh
@@ -62,6 +62,7 @@ public:
62 CYCLESKIPSTUCK = 0x02, 62 CYCLESKIPSTUCK = 0x02,
63 CYCLESKIPSHADED = 0x04, 63 CYCLESKIPSHADED = 0x04,
64 CYCLELINEAR = 0x08, 64 CYCLELINEAR = 0x08,
65 CYCLESKIPICONIC = 0x10,
65 CYCLEDEFAULT = 0x00 66 CYCLEDEFAULT = 0x00
66 }; 67 };
67 68
@@ -117,6 +118,7 @@ private:
117 FocusedWindows::iterator m_cycling_window; 118 FocusedWindows::iterator m_cycling_window;
118 bool m_cycling_focus; 119 bool m_cycling_focus;
119 bool m_cycling_creation_order; 120 bool m_cycling_creation_order;
121 bool m_was_iconic;
120 WinClient *m_cycling_last; 122 WinClient *m_cycling_last;
121 123
122 static WinClient *s_focused_window; 124 static WinClient *s_focused_window;
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index 5b5b607..800a672 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -55,7 +55,7 @@ void NextWindowCmd::execute() {
55 else { 55 else {
56 // if stacked cycling, then set a watch for 56 // if stacked cycling, then set a watch for
57 // the release of exactly these modifiers 57 // the release of exactly these modifiers
58 if (!fb->watchingScreen()) 58 if (screen != fb->watchingScreen())
59 Fluxbox::instance()->watchKeyRelease(*screen, mods); 59 Fluxbox::instance()->watchKeyRelease(*screen, mods);
60 screen->focusControl().nextFocus(m_option); 60 screen->focusControl().nextFocus(m_option);
61 } 61 }
@@ -77,7 +77,7 @@ void PrevWindowCmd::execute() {
77 else { 77 else {
78 // if stacked cycling, then set a watch for 78 // if stacked cycling, then set a watch for
79 // the release of exactly these modifiers 79 // the release of exactly these modifiers
80 if (!fb->watchingScreen()) 80 if (screen != fb->watchingScreen())
81 Fluxbox::instance()->watchKeyRelease(*screen, mods); 81 Fluxbox::instance()->watchKeyRelease(*screen, mods);
82 screen->focusControl().prevFocus(m_option); 82 screen->focusControl().prevFocus(m_option);
83 } 83 }
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index ccc7f8d..9625465 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1811,6 +1811,8 @@ void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) {
1811 cerr<<"WARNING: attempt to grab without modifiers!"<<endl; 1811 cerr<<"WARNING: attempt to grab without modifiers!"<<endl;
1812 return; 1812 return;
1813 } 1813 }
1814 if (m_watching_screen)
1815 m_watching_screen->focusControl().stopCyclingFocus();
1814 m_watching_screen = &screen; 1816 m_watching_screen = &screen;
1815 1817
1816 // just make sure we are saving the mods with any other flags (xkb) 1818 // just make sure we are saving the mods with any other flags (xkb)