mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
changed behavior when focusing new windows with autofocus enabled
New windows will only get focused if the mouse is on the same screen. The code doesn't handle multiple heads but since it's just one screen the function works as usual. Checking the head and assign the focus only if the window is on the same head might be a good idea. Making the whole stuff optional might be even better.
This commit is contained in:
committed by
Carlos R. Mafra
parent
fe8ab024af
commit
d74a90d1bf
22
src/window.c
22
src/window.c
@@ -1366,9 +1366,29 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
||||
|
||||
if (!wwin->flags.miniaturized && workspace == scr->current_workspace && !wwin->flags.hidden) {
|
||||
if (((transientOwner && transientOwner->flags.focused)
|
||||
|| wPreferences.auto_focus) && !WFLAGP(wwin, no_focusable))
|
||||
|| wPreferences.auto_focus) && !WFLAGP(wwin, no_focusable)) {
|
||||
|
||||
/* only auto_focus if on same screen as mouse
|
||||
* (and same head for xinerama mode)
|
||||
* TODO: make it an option */
|
||||
|
||||
/*TODO add checking the head of the window, is it available? */
|
||||
short same_screen = 0, same_head = 1;
|
||||
|
||||
int foo;
|
||||
unsigned int bar;
|
||||
Window dummy;
|
||||
|
||||
if (XQueryPointer(dpy, scr->root_win, &dummy, &dummy,
|
||||
&foo, &foo, &foo, &foo, &bar) != False) {
|
||||
same_screen = 1;
|
||||
}
|
||||
|
||||
if (same_screen == 1 && same_head == 1) {
|
||||
wSetFocusTo(scr, wwin);
|
||||
}
|
||||
}
|
||||
}
|
||||
wWindowResetMouseGrabs(wwin);
|
||||
|
||||
if (!WFLAGP(wwin, no_bind_keys))
|
||||
|
||||
Reference in New Issue
Block a user