Added option for focus revert to stay on current head
This commit is contained in:
parent
b4534e0f28
commit
e65a966d80
5 changed files with 33 additions and 0 deletions
|
@ -78,6 +78,8 @@ $set 4 #Configmenu
|
|||
27 Resize-Increment nicht beachten
|
||||
28 Position fixieren
|
||||
29 Größe fixieren
|
||||
30 Fokus folgt Maus (strikt)
|
||||
31 Gleicher Head
|
||||
|
||||
$set 5 #Ewmh
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ enum {
|
|||
ConfigmenuMaxDisableMove = 28,
|
||||
ConfigmenuMaxDisableResize = 29,
|
||||
ConfigmenuStrictMouseFocus = 30,
|
||||
ConfigmenuFocusSameHead = 31,
|
||||
|
||||
EwmhSet = 5,
|
||||
EwmhOutOfMemoryClientList = 1,
|
||||
|
|
|
@ -76,6 +76,11 @@ FocusControl::FocusControl(BScreen &screen):
|
|||
m_focus_new(screen.resourceManager(), true,
|
||||
screen.name()+".focusNewWindows",
|
||||
screen.altName()+".FocusNewWindows"),
|
||||
#ifdef XINERAMA
|
||||
m_focus_same_head(screen.resourceManager(), false,
|
||||
screen.name()+".focusSameHead",
|
||||
screen.altName()+".FocusSameHead"),
|
||||
#endif // XINERAMA
|
||||
m_focused_list(screen), m_creation_order_list(screen),
|
||||
m_focused_win_list(screen), m_creation_order_win_list(screen),
|
||||
m_cycling_list(0),
|
||||
|
@ -251,11 +256,18 @@ Focusable *FocusControl::lastFocusedWindow(int workspace) {
|
|||
if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces())
|
||||
return m_focused_list.clientList().front();
|
||||
|
||||
#ifdef XINERAMA
|
||||
int cur_head = focusSameHead() ? m_screen.getCurrHead() : (-1);
|
||||
#endif // XINERAMA
|
||||
|
||||
Focusables::iterator it = m_focused_list.clientList().begin();
|
||||
Focusables::iterator it_end = m_focused_list.clientList().end();
|
||||
for (; it != it_end; ++it) {
|
||||
if ((*it)->fbwindow() && (*it)->acceptsFocus() &&
|
||||
(*it)->fbwindow()->winClient().validateClient() &&
|
||||
#ifdef XINERAMA
|
||||
( (cur_head == -1) || ((*it)->fbwindow()->getOnHead() == cur_head) ) &&
|
||||
#endif // XINERAMA
|
||||
((((int)(*it)->fbwindow()->workspaceNumber()) == workspace ||
|
||||
(*it)->fbwindow()->isStuck()) && !(*it)->fbwindow()->isIconic()))
|
||||
return *it;
|
||||
|
|
|
@ -124,6 +124,10 @@ public:
|
|||
TabFocusModel tabFocusModel() const { return *m_tab_focus_model; }
|
||||
/// @return true if newly created windows are focused
|
||||
bool focusNew() const { return *m_focus_new; }
|
||||
#ifdef XINERAMA
|
||||
/// @return true if focus reverts to same head only
|
||||
bool focusSameHead() const { return *m_focus_same_head; }
|
||||
#endif // XINERAMA
|
||||
|
||||
/// @return last focused client in a specific workspace, or NULL.
|
||||
Focusable *lastFocusedWindow(int workspace);
|
||||
|
@ -161,6 +165,9 @@ private:
|
|||
FbTk::Resource<FocusModel> m_focus_model;
|
||||
FbTk::Resource<TabFocusModel> m_tab_focus_model;
|
||||
FbTk::Resource<bool> m_focus_new;
|
||||
#ifdef XINERAMA
|
||||
FbTk::Resource<bool> m_focus_same_head;
|
||||
#endif // XINERAMA
|
||||
|
||||
// This list keeps the order of window focusing for this screen
|
||||
// Screen global so it works for sticky windows too.
|
||||
|
|
|
@ -1600,6 +1600,17 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
|||
} catch (FbTk::ResourceException & e) {
|
||||
cerr<<e.what()<<endl;
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
try {
|
||||
focus_menu->insert(new FbTk::BoolMenuItem(_FB_XTEXT(Configmenu, FocusSameHead,
|
||||
"Keep Head", "Only revert focus on same head"),
|
||||
m_resource_manager.getResource<bool>(name() + ".focusSameHead"),
|
||||
saverc_cmd));
|
||||
} catch (FbTk::ResourceException e) {
|
||||
cerr<<e.what()<<endl;
|
||||
}
|
||||
#endif // XINERAMA
|
||||
|
||||
_BOOLITEM(*focus_menu, Configmenu, AutoRaise,
|
||||
"Auto Raise", "Auto Raise windows on sloppy",
|
||||
|
|
Loading…
Reference in a new issue