mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Added option to ignore minimized windows during cycling.
Added CycleIgnoreMinimized configuration option settable on Expert page in WPrefs. When option is set, switch panel cycling ignores minimized (grayed) windows. They are still visible and can be selected using left/right arrows or mouse click.
This commit is contained in:
committed by
Carlos R. Mafra
parent
eae7ef6c59
commit
914d4e06ef
@@ -62,6 +62,9 @@ static const struct {
|
|||||||
{ N_("Cycle windows only on the active head."),
|
{ N_("Cycle windows only on the active head."),
|
||||||
/* default: */ False, OPTION_WMAKER, "CycleActiveHeadOnly" },
|
/* default: */ False, OPTION_WMAKER, "CycleActiveHeadOnly" },
|
||||||
|
|
||||||
|
{ N_("Ignore minimized windows when cycling."),
|
||||||
|
/* default: */ False, OPTION_WMAKER, "CycleIgnoreMinimized" },
|
||||||
|
|
||||||
{ N_("Show workspace title on Clip."),
|
{ N_("Show workspace title on Clip."),
|
||||||
/* default: */ True, OPTION_WMAKER, "ShowClipTitle" },
|
/* default: */ True, OPTION_WMAKER, "ShowClipTitle" },
|
||||||
|
|
||||||
|
|||||||
@@ -427,6 +427,7 @@ typedef struct WPreferences {
|
|||||||
char single_click; /* single click to lauch applications */
|
char single_click; /* single click to lauch applications */
|
||||||
int history_lines; /* history of "Run..." dialog */
|
int history_lines; /* history of "Run..." dialog */
|
||||||
char cycle_active_head_only; /* Cycle only windows on the active head */
|
char cycle_active_head_only; /* Cycle only windows on the active head */
|
||||||
|
char cycle_ignore_minimized; /* Ignore minimized windows when cycling */
|
||||||
|
|
||||||
RImage *swtileImage;
|
RImage *swtileImage;
|
||||||
RImage *swbackImage[9];
|
RImage *swbackImage[9];
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl
|
|||||||
if (swpanel) {
|
if (swpanel) {
|
||||||
|
|
||||||
if (wwin->flags.mapped)
|
if (wwin->flags.mapped)
|
||||||
newFocused = wSwitchPanelSelectNext(swpanel, !next);
|
newFocused = wSwitchPanelSelectNext(swpanel, !next, True);
|
||||||
else
|
else
|
||||||
newFocused = wSwitchPanelSelectFirst(swpanel, False);
|
newFocused = wSwitchPanelSelectFirst(swpanel, False);
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl
|
|||||||
&& wKeyBindings[WKBD_GROUPNEXT].modifier == modifiers)
|
&& wKeyBindings[WKBD_GROUPNEXT].modifier == modifiers)
|
||||||
|| ev.xkey.keycode == rightKey) {
|
|| ev.xkey.keycode == rightKey) {
|
||||||
|
|
||||||
newFocused = wSwitchPanelSelectNext(swpanel, False);
|
newFocused = wSwitchPanelSelectNext(swpanel, False, ev.xkey.keycode != rightKey);
|
||||||
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
|
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
|
||||||
|
|
||||||
} else if ((wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode
|
} else if ((wKeyBindings[WKBD_FOCUSPREV].keycode == ev.xkey.keycode
|
||||||
@@ -166,7 +166,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next, Bool class_onl
|
|||||||
&& wKeyBindings[WKBD_GROUPPREV].modifier == modifiers)
|
&& wKeyBindings[WKBD_GROUPPREV].modifier == modifiers)
|
||||||
|| ev.xkey.keycode == leftKey) {
|
|| ev.xkey.keycode == leftKey) {
|
||||||
|
|
||||||
newFocused = wSwitchPanelSelectNext(swpanel, True);
|
newFocused = wSwitchPanelSelectNext(swpanel, True, ev.xkey.keycode != leftKey);
|
||||||
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
|
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
|
||||||
|
|
||||||
} else if (ev.xkey.keycode == homeKey || ev.xkey.keycode == endKey) {
|
} else if (ev.xkey.keycode == homeKey || ev.xkey.keycode == endKey) {
|
||||||
|
|||||||
@@ -684,7 +684,9 @@ WDefaultEntry optionList[] = {
|
|||||||
{"DialogHistoryLines", "500", NULL,
|
{"DialogHistoryLines", "500", NULL,
|
||||||
&wPreferences.history_lines, getInt, NULL, NULL, NULL},
|
&wPreferences.history_lines, getInt, NULL, NULL, NULL},
|
||||||
{"CycleActiveHeadOnly", "NO", NULL,
|
{"CycleActiveHeadOnly", "NO", NULL,
|
||||||
&wPreferences.cycle_active_head_only, getBool, NULL, NULL, NULL}
|
&wPreferences.cycle_active_head_only, getBool, NULL, NULL, NULL},
|
||||||
|
{"CycleIgnoreMinimized", "NO", NULL,
|
||||||
|
&wPreferences.cycle_ignore_minimized, getBool, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void initDefaults()
|
static void initDefaults()
|
||||||
|
|||||||
@@ -559,10 +559,11 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
|
|||||||
wfree(panel);
|
wfree(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back)
|
WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back, int ignore_minimized)
|
||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
int count = WMGetArrayItemCount(panel->windows);
|
int count = WMGetArrayItemCount(panel->windows);
|
||||||
|
int orig = panel->current;
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -570,26 +571,26 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back)
|
|||||||
if (panel->win)
|
if (panel->win)
|
||||||
changeImage(panel, panel->current, 0);
|
changeImage(panel, panel->current, 0);
|
||||||
|
|
||||||
|
if (!wPreferences.cycle_ignore_minimized)
|
||||||
|
ignore_minimized = False;
|
||||||
|
|
||||||
|
if (ignore_minimized && canReceiveFocus(WMGetFromArray(panel->windows, (count + panel->current) % count)) < 0)
|
||||||
|
ignore_minimized = False;
|
||||||
|
|
||||||
|
do {
|
||||||
if (back)
|
if (back)
|
||||||
panel->current--;
|
panel->current--;
|
||||||
else
|
else
|
||||||
panel->current++;
|
panel->current++;
|
||||||
|
|
||||||
wwin = WMGetFromArray(panel->windows, (count + panel->current) % count);
|
|
||||||
|
|
||||||
if (back) {
|
|
||||||
if (panel->current < 0)
|
|
||||||
scrollIcons(panel, count);
|
|
||||||
else if (panel->current < panel->firstVisible)
|
|
||||||
scrollIcons(panel, -1);
|
|
||||||
} else {
|
|
||||||
if (panel->current >= count)
|
|
||||||
scrollIcons(panel, -count);
|
|
||||||
else if (panel->current - panel->firstVisible >= panel->visibleCount)
|
|
||||||
scrollIcons(panel, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
panel->current= (count + panel->current) % count;
|
panel->current= (count + panel->current) % count;
|
||||||
|
wwin = WMGetFromArray(panel->windows, panel->current);
|
||||||
|
} while (ignore_minimized && panel->current != orig && canReceiveFocus(wwin) < 0);
|
||||||
|
|
||||||
|
if (panel->current < panel->firstVisible)
|
||||||
|
scrollIcons(panel, panel->current - panel->firstVisible);
|
||||||
|
else if (panel->current - panel->firstVisible >= panel->visibleCount)
|
||||||
|
scrollIcons(panel, panel->current - panel->firstVisible - panel->visibleCount + 1);
|
||||||
|
|
||||||
if (panel->win) {
|
if (panel->win) {
|
||||||
drawTitle(panel, panel->current, wwin->frame->title);
|
drawTitle(panel, panel->current, wwin->frame->title);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, Bool class_only);
|
|||||||
|
|
||||||
void wSwitchPanelDestroy(WSwitchPanel *panel);
|
void wSwitchPanelDestroy(WSwitchPanel *panel);
|
||||||
|
|
||||||
WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back);
|
WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back, int ignore_minimized);
|
||||||
WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back);
|
WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back);
|
||||||
|
|
||||||
WWindow *wSwitchPanelHandleEvent(WSwitchPanel *panel, XEvent *event);
|
WWindow *wSwitchPanelHandleEvent(WSwitchPanel *panel, XEvent *event);
|
||||||
|
|||||||
Reference in New Issue
Block a user