mirror of
https://github.com/gryf/wmaker.git
synced 2026-06-18 16:35:24 +02:00
wmaker: add directional window focus
This patch is adding directional window focus (like in openbox), where the focus can be passed to the current window neighboors with a shortcut key. Comparisons are performed using window centres. New options are FocusWindowLeftKey, FocusWindowRightKey, FocusWindowUpKey, FocusWindowDownKey. Other WM are setting those to SUPER+LEFT/RIGHT/UP/DOWN keys but currently those are not set by default. CirculateRaise option which is described in WPrefs as 'Raise window when switching focus with keyboard' is also used to raise/not raise windows that are fully covered by other windows.
This commit is contained in:
committed by
Carlos R. Mafra
parent
a3c02a22bd
commit
33fba87ed1
@@ -470,6 +470,35 @@ void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
||||
wwin->client_flags.no_focusable = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns True if every pixel of 'wwin' is covered by at least one other
|
||||
* mapped window on the same workspace, making it invisible to the user
|
||||
*/
|
||||
Bool wWindowIsFullyCovered(WWindow *wwin)
|
||||
{
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
int cx = wwin->frame_x;
|
||||
int cy = wwin->frame_y;
|
||||
int cright = cx + (int)wwin->frame->core->width;
|
||||
int cbottom = cy + (int)wwin->frame->core->height;
|
||||
WWindow *w;
|
||||
|
||||
for (w = scr->focused_window; w != NULL; w = w->prev) {
|
||||
if (w == wwin)
|
||||
continue;
|
||||
if (!w->flags.mapped)
|
||||
continue;
|
||||
if (!w->frame || w->frame->workspace != scr->current_workspace)
|
||||
continue;
|
||||
if (w->frame_x <= cx &&
|
||||
w->frame_y <= cy &&
|
||||
w->frame_x + (int)w->frame->core->width >= cright &&
|
||||
w->frame_y + (int)w->frame->core->height >= cbottom)
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool wWindowObscuresWindow(WWindow *wwin, WWindow *obscured)
|
||||
{
|
||||
int w1, h1, w2, h2;
|
||||
|
||||
Reference in New Issue
Block a user