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)
|
||||
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:
|
||||
* Remove some redundant code for loading styles (Mark)
|
||||
fluxbox.cc Screen.cc RootTheme.cc/hh
|
||||
|
|
|
@ -57,6 +57,7 @@ FocusControl::FocusControl(BScreen &screen):
|
|||
screen.name()+".focusNewWindows",
|
||||
screen.altName()+".FocusNewWindows"),
|
||||
m_cycling_focus(false),
|
||||
m_was_iconic(false),
|
||||
m_cycling_last(0) {
|
||||
|
||||
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() ||
|
||||
// skip if shaded
|
||||
(opts & FocusControl::CYCLESKIPSHADED) != 0 && win->isShaded() ||
|
||||
// skip if iconic
|
||||
(opts & FocusControl::CYCLESKIPICONIC) != 0 && win->isIconic() ||
|
||||
// skip if hidden
|
||||
win->isFocusHidden()
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
if (!m_cycling_focus) {
|
||||
if (Fluxbox::instance()->watchingScreen())
|
||||
if (&m_screen == Fluxbox::instance()->watchingScreen())
|
||||
m_cycling_focus = true;
|
||||
if (opts & CYCLELINEAR) {
|
||||
m_cycling_creation_order = true;
|
||||
m_cycling_window = find(window_list->begin(),window_list->end(),s_focused_window);
|
||||
} else {
|
||||
m_cycling_creation_order = (opts & CYCLELINEAR);
|
||||
m_cycling_window = window_list->begin();
|
||||
}
|
||||
m_was_iconic = false;
|
||||
m_cycling_last = 0;
|
||||
} else {
|
||||
// already cycling, so restack to put windows back in their proper order
|
||||
m_screen.layerManager().restack();
|
||||
if (m_cycling_creation_order ^ (bool)(opts & CYCLELINEAR)) {
|
||||
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);
|
||||
else
|
||||
m_cycling_window = window_list->begin();
|
||||
}
|
||||
}
|
||||
// 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) {
|
||||
if (cycle_reverse && it == it_begin)
|
||||
it = it_end;
|
||||
cycle_reverse ? --it : ++it;
|
||||
if (it == it_end)
|
||||
else if (!cycle_reverse && it == it_end)
|
||||
it = it_begin;
|
||||
else
|
||||
cycle_reverse ? --it : ++it;
|
||||
// give up [do nothing] if we reach the current focused again
|
||||
if ((*it) == (*m_cycling_window))
|
||||
if (it == m_cycling_window)
|
||||
break;
|
||||
if (it == it_end)
|
||||
continue;
|
||||
|
||||
FluxboxWindow *fbwin = (*it)->fbwindow();
|
||||
if (fbwin && !fbwin->isIconic() &&
|
||||
(fbwin->isStuck()
|
||||
if (fbwin && (fbwin->isStuck()
|
||||
|| fbwin->workspaceNumber() == m_screen.currentWorkspaceID())) {
|
||||
// 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 = &last_client;
|
||||
if (m_was_iconic)
|
||||
(*m_cycling_window)->fbwindow()->iconify();
|
||||
m_was_iconic = fbwin->isIconic();
|
||||
}
|
||||
fbwin->tempRaise();
|
||||
break;
|
||||
|
@ -362,6 +359,8 @@ void FocusControl::removeClient(WinClient &client) {
|
|||
*/
|
||||
void FocusControl::revertFocus(BScreen &screen) {
|
||||
|
||||
if (screen.focusControl().isCycling())
|
||||
return;
|
||||
// Relevant resources:
|
||||
// resource.focus_last = whether we focus last focused when changing workspace
|
||||
// BScreen::FocusModel = sloppy, click, whatever
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
CYCLESKIPSTUCK = 0x02,
|
||||
CYCLESKIPSHADED = 0x04,
|
||||
CYCLELINEAR = 0x08,
|
||||
CYCLESKIPICONIC = 0x10,
|
||||
CYCLEDEFAULT = 0x00
|
||||
};
|
||||
|
||||
|
@ -117,6 +118,7 @@ private:
|
|||
FocusedWindows::iterator m_cycling_window;
|
||||
bool m_cycling_focus;
|
||||
bool m_cycling_creation_order;
|
||||
bool m_was_iconic;
|
||||
WinClient *m_cycling_last;
|
||||
|
||||
static WinClient *s_focused_window;
|
||||
|
|
|
@ -55,7 +55,7 @@ void NextWindowCmd::execute() {
|
|||
else {
|
||||
// if stacked cycling, then set a watch for
|
||||
// the release of exactly these modifiers
|
||||
if (!fb->watchingScreen())
|
||||
if (screen != fb->watchingScreen())
|
||||
Fluxbox::instance()->watchKeyRelease(*screen, mods);
|
||||
screen->focusControl().nextFocus(m_option);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ void PrevWindowCmd::execute() {
|
|||
else {
|
||||
// if stacked cycling, then set a watch for
|
||||
// the release of exactly these modifiers
|
||||
if (!fb->watchingScreen())
|
||||
if (screen != fb->watchingScreen())
|
||||
Fluxbox::instance()->watchKeyRelease(*screen, mods);
|
||||
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;
|
||||
return;
|
||||
}
|
||||
if (m_watching_screen)
|
||||
m_watching_screen->focusControl().stopCyclingFocus();
|
||||
m_watching_screen = &screen;
|
||||
|
||||
// just make sure we are saving the mods with any other flags (xkb)
|
||||
|
|
Loading…
Reference in a new issue