From fde970a21d62756cdbca1fe5acd75386b251814c Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 14 Jul 2006 06:00:37 +0000 Subject: include iconic windows when cycling also, stop cycling on one screen when cycling begins on another --- ChangeLog | 6 ++++++ src/FocusControl.cc | 41 ++++++++++++++++++++--------------------- src/FocusControl.hh | 2 ++ src/WorkspaceCmd.cc | 4 ++-- src/fluxbox.cc | 2 ++ 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 @@ (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 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): 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_cycling_window = find(window_list->begin(),window_list->end(),s_focused_window); + m_cycling_creation_order = (opts & CYCLELINEAR); + 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(); + m_cycling_window = find(window_list->begin(),window_list->end(),*m_cycling_window); } } // 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 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: 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; 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() { 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); } 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) { cerr<<"WARNING: attempt to grab without modifiers!"<focusControl().stopCyclingFocus(); m_watching_screen = &screen; // just make sure we are saving the mods with any other flags (xkb) -- cgit v0.11.2