include iconic windows when cycling
also, stop cycling on one screen when cycling begins on another
This commit is contained in:
parent
d32a7af7e6
commit
fde970a21d
5 changed files with 32 additions and 23 deletions
|
@ -1,5 +1,11 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 1.0rc3:
|
Changes for 1.0rc3:
|
||||||
|
*06/07/14:
|
||||||
|
* Fix a possible bug with window cycling on multiple screens (Mark)
|
||||||
|
fluxbox.cc WorkspaceCmd.cc
|
||||||
|
* Include minimized windows when "alt-tabbing", added 16 to the
|
||||||
|
Next/PrevWindow bitmask to disable the behavior (Mark)
|
||||||
|
FocusControl.cc/hh
|
||||||
*06/07/13:
|
*06/07/13:
|
||||||
* Remove some redundant code for loading styles (Mark)
|
* Remove some redundant code for loading styles (Mark)
|
||||||
fluxbox.cc Screen.cc RootTheme.cc/hh
|
fluxbox.cc Screen.cc RootTheme.cc/hh
|
||||||
|
|
|
@ -57,6 +57,7 @@ FocusControl::FocusControl(BScreen &screen):
|
||||||
screen.name()+".focusNewWindows",
|
screen.name()+".focusNewWindows",
|
||||||
screen.altName()+".FocusNewWindows"),
|
screen.altName()+".FocusNewWindows"),
|
||||||
m_cycling_focus(false),
|
m_cycling_focus(false),
|
||||||
|
m_was_iconic(false),
|
||||||
m_cycling_last(0) {
|
m_cycling_last(0) {
|
||||||
|
|
||||||
m_cycling_window = m_focused_list.end();
|
m_cycling_window = m_focused_list.end();
|
||||||
|
@ -73,38 +74,29 @@ bool doSkipWindow(const WinClient &winclient, int opts) {
|
||||||
(opts & FocusControl::CYCLEGROUPS) != 0 && win->winClient().window() != winclient.window() ||
|
(opts & FocusControl::CYCLEGROUPS) != 0 && win->winClient().window() != winclient.window() ||
|
||||||
// skip if shaded
|
// skip if shaded
|
||||||
(opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() ||
|
(opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() ||
|
||||||
|
// skip if iconic
|
||||||
|
(opts & FocusControl::CYCLESKIPICONIC) != 0 && win->isIconic() ||
|
||||||
// skip if hidden
|
// skip if hidden
|
||||||
win->isFocusHidden()
|
win->isFocusHidden()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusControl::cycleFocus(int opts, bool cycle_reverse) {
|
void FocusControl::cycleFocus(int opts, bool cycle_reverse) {
|
||||||
int num_windows = m_screen.currentWorkspace()->numberOfWindows();
|
|
||||||
|
|
||||||
if (num_windows < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
FocusedWindows *window_list = (opts & CYCLELINEAR) ? &m_creation_order_list : &m_focused_list;
|
FocusedWindows *window_list = (opts & CYCLELINEAR) ? &m_creation_order_list : &m_focused_list;
|
||||||
if (!m_cycling_focus) {
|
if (!m_cycling_focus) {
|
||||||
if (Fluxbox::instance()->watchingScreen())
|
if (&m_screen == Fluxbox::instance()->watchingScreen())
|
||||||
m_cycling_focus = true;
|
m_cycling_focus = true;
|
||||||
if (opts & CYCLELINEAR) {
|
m_cycling_window = find(window_list->begin(),window_list->end(),s_focused_window);
|
||||||
m_cycling_creation_order = true;
|
m_cycling_creation_order = (opts & CYCLELINEAR);
|
||||||
m_cycling_window = find(window_list->begin(),window_list->end(),s_focused_window);
|
m_was_iconic = false;
|
||||||
} else {
|
|
||||||
m_cycling_creation_order = (opts & CYCLELINEAR);
|
|
||||||
m_cycling_window = window_list->begin();
|
|
||||||
}
|
|
||||||
m_cycling_last = 0;
|
m_cycling_last = 0;
|
||||||
} else {
|
} else {
|
||||||
// already cycling, so restack to put windows back in their proper order
|
// already cycling, so restack to put windows back in their proper order
|
||||||
m_screen.layerManager().restack();
|
m_screen.layerManager().restack();
|
||||||
if (m_cycling_creation_order ^ (bool)(opts & CYCLELINEAR)) {
|
if (m_cycling_creation_order ^ (bool)(opts & CYCLELINEAR)) {
|
||||||
m_cycling_creation_order ^= true;
|
m_cycling_creation_order ^= true;
|
||||||
if (m_cycling_window != m_focused_list.end() && m_cycling_window != m_creation_order_list.end())
|
m_cycling_window = find(window_list->begin(),window_list->end(),*m_cycling_window);
|
||||||
m_cycling_window = find(window_list->begin(),window_list->end(),*m_cycling_window);
|
|
||||||
else
|
|
||||||
m_cycling_window = window_list->begin();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if it is stacked, we want the highest window in the focused list
|
// 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) {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (cycle_reverse && it == it_begin)
|
if (cycle_reverse && it == it_begin)
|
||||||
it = it_end;
|
it = it_end;
|
||||||
cycle_reverse ? --it : ++it;
|
else if (!cycle_reverse && it == it_end)
|
||||||
if (it == it_end)
|
|
||||||
it = it_begin;
|
it = it_begin;
|
||||||
|
else
|
||||||
|
cycle_reverse ? --it : ++it;
|
||||||
// give up [do nothing] if we reach the current focused again
|
// give up [do nothing] if we reach the current focused again
|
||||||
if ((*it) == (*m_cycling_window))
|
if (it == m_cycling_window)
|
||||||
break;
|
break;
|
||||||
|
if (it == it_end)
|
||||||
|
continue;
|
||||||
|
|
||||||
FluxboxWindow *fbwin = (*it)->fbwindow();
|
FluxboxWindow *fbwin = (*it)->fbwindow();
|
||||||
if (fbwin && !fbwin->isIconic() &&
|
if (fbwin && (fbwin->isStuck()
|
||||||
(fbwin->isStuck()
|
|
||||||
|| fbwin->workspaceNumber() == m_screen.currentWorkspaceID())) {
|
|| fbwin->workspaceNumber() == m_screen.currentWorkspaceID())) {
|
||||||
// either on this workspace, or stuck
|
// either on this workspace, or stuck
|
||||||
|
|
||||||
|
@ -140,6 +134,9 @@ void FocusControl::cycleFocus(int opts, bool cycle_reverse) {
|
||||||
m_cycling_last->fbwindow()->setCurrentClient(*m_cycling_last, false);
|
m_cycling_last->fbwindow()->setCurrentClient(*m_cycling_last, false);
|
||||||
}
|
}
|
||||||
m_cycling_last = &last_client;
|
m_cycling_last = &last_client;
|
||||||
|
if (m_was_iconic)
|
||||||
|
(*m_cycling_window)->fbwindow()->iconify();
|
||||||
|
m_was_iconic = fbwin->isIconic();
|
||||||
}
|
}
|
||||||
fbwin->tempRaise();
|
fbwin->tempRaise();
|
||||||
break;
|
break;
|
||||||
|
@ -362,6 +359,8 @@ void FocusControl::removeClient(WinClient &client) {
|
||||||
*/
|
*/
|
||||||
void FocusControl::revertFocus(BScreen &screen) {
|
void FocusControl::revertFocus(BScreen &screen) {
|
||||||
|
|
||||||
|
if (screen.focusControl().isCycling())
|
||||||
|
return;
|
||||||
// Relevant resources:
|
// Relevant resources:
|
||||||
// resource.focus_last = whether we focus last focused when changing workspace
|
// resource.focus_last = whether we focus last focused when changing workspace
|
||||||
// BScreen::FocusModel = sloppy, click, whatever
|
// BScreen::FocusModel = sloppy, click, whatever
|
||||||
|
|
|
@ -62,6 +62,7 @@ public:
|
||||||
CYCLESKIPSTUCK = 0x02,
|
CYCLESKIPSTUCK = 0x02,
|
||||||
CYCLESKIPSHADED = 0x04,
|
CYCLESKIPSHADED = 0x04,
|
||||||
CYCLELINEAR = 0x08,
|
CYCLELINEAR = 0x08,
|
||||||
|
CYCLESKIPICONIC = 0x10,
|
||||||
CYCLEDEFAULT = 0x00
|
CYCLEDEFAULT = 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -117,6 +118,7 @@ private:
|
||||||
FocusedWindows::iterator m_cycling_window;
|
FocusedWindows::iterator m_cycling_window;
|
||||||
bool m_cycling_focus;
|
bool m_cycling_focus;
|
||||||
bool m_cycling_creation_order;
|
bool m_cycling_creation_order;
|
||||||
|
bool m_was_iconic;
|
||||||
WinClient *m_cycling_last;
|
WinClient *m_cycling_last;
|
||||||
|
|
||||||
static WinClient *s_focused_window;
|
static WinClient *s_focused_window;
|
||||||
|
|
|
@ -55,7 +55,7 @@ void NextWindowCmd::execute() {
|
||||||
else {
|
else {
|
||||||
// if stacked cycling, then set a watch for
|
// if stacked cycling, then set a watch for
|
||||||
// the release of exactly these modifiers
|
// the release of exactly these modifiers
|
||||||
if (!fb->watchingScreen())
|
if (screen != fb->watchingScreen())
|
||||||
Fluxbox::instance()->watchKeyRelease(*screen, mods);
|
Fluxbox::instance()->watchKeyRelease(*screen, mods);
|
||||||
screen->focusControl().nextFocus(m_option);
|
screen->focusControl().nextFocus(m_option);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ void PrevWindowCmd::execute() {
|
||||||
else {
|
else {
|
||||||
// if stacked cycling, then set a watch for
|
// if stacked cycling, then set a watch for
|
||||||
// the release of exactly these modifiers
|
// the release of exactly these modifiers
|
||||||
if (!fb->watchingScreen())
|
if (screen != fb->watchingScreen())
|
||||||
Fluxbox::instance()->watchKeyRelease(*screen, mods);
|
Fluxbox::instance()->watchKeyRelease(*screen, mods);
|
||||||
screen->focusControl().prevFocus(m_option);
|
screen->focusControl().prevFocus(m_option);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1811,6 +1811,8 @@ void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) {
|
||||||
cerr<<"WARNING: attempt to grab without modifiers!"<<endl;
|
cerr<<"WARNING: attempt to grab without modifiers!"<<endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (m_watching_screen)
|
||||||
|
m_watching_screen->focusControl().stopCyclingFocus();
|
||||||
m_watching_screen = &screen;
|
m_watching_screen = &screen;
|
||||||
|
|
||||||
// just make sure we are saving the mods with any other flags (xkb)
|
// just make sure we are saving the mods with any other flags (xkb)
|
||||||
|
|
Loading…
Reference in a new issue