Added CycleIgnoresMinimized 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.
---
WPrefs.app/Expert.c | 5 ++++-
src/WindowMaker.h | 1 +
src/cycling.c | 6 +++---
src/defaults.c | 4 +++-
src/switchpanel.c | 35 +++++++++++++++++------------------
src/switchpanel.h | 2 +-
6 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/WPrefs.app/Expert.c b/WPrefs.app/Expert.c
index b14f549..4445ba4 100644
--- a/WPrefs.app/Expert.c
+++ b/WPrefs.app/Expert.c
@@ -31,7 +31,7 @@ typedef struct _Panel {
WMWidget *parent;
- WMButton *swi[14];
+ WMButton *swi[15];
} _Panel;
@@ -55,6 +55,7 @@ static void showData(_Panel * panel)
WMSetButtonSelected(panel->swi[11],
GetBoolForKey("RaiseAppIconsWhenBouncing"));
WMSetButtonSelected(panel->swi[12],
GetBoolForKey("OpaqueMoveResizeKeyboard"));
WMSetButtonSelected(panel->swi[13],
GetBoolForKey("DoNotMakeAppIconsBounce"));
+ WMSetButtonSelected(panel->swi[14],
GetBoolForKey("CycleIgnoresMinimized"));
}
static void createPanel(Panel * p)
@@ -99,6 +100,7 @@ static void createPanel(Panel * p)
WMSetButtonText(panel->swi[11], _("Raise AppIcons when bouncing."));
WMSetButtonText(panel->swi[12], _("Opaque Move,Resize with keyboard."));
WMSetButtonText(panel->swi[13], _("Do not make AppIcons bounce."));
+ WMSetButtonText(panel->swi[14], _("Ignore minimized windows when
cycling."));
/* If the item is default true, enable the button here */
WMSetButtonEnabled(panel->swi[6], True);
@@ -132,6 +134,7 @@ static void storeDefaults(_Panel * panel)
SetBoolForKey(WMGetButtonSelected(panel->swi[11]),
"RaiseAppIconsWhenBouncing");
SetBoolForKey(WMGetButtonSelected(panel->swi[12]),
"OpaqueMoveResizeKeyboard");
SetBoolForKey(WMGetButtonSelected(panel->swi[13]),
"DoNotMakeAppIconsBounce");
+ SetBoolForKey(WMGetButtonSelected(panel->swi[14]),
"CycleIgnoresMinimized");
}
Panel *InitExpert(WMScreen * scr, WMWidget * parent)
diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 804695b..bf3dc09 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -427,6 +427,7 @@ typedef struct WPreferences {
char single_click; /* single click to lauch applications
*/
int history_lines; /* history of "Run..." dialog */
char cycle_active_head_only; /* Cycle only windows on the active
head */
+ char cycle_ignores_minimized; /* Ignore minimized windows when
cycling */
RImage *swtileImage;
RImage *swbackImage[9];
diff --git a/src/cycling.c b/src/cycling.c
index 0b0dc7c..b2c7726 100644
--- a/src/cycling.c
+++ b/src/cycling.c
@@ -123,7 +123,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool
next, Bool class_onl
if (swpanel) {
if (wwin->flags.mapped)
- newFocused = wSwitchPanelSelectNext(swpanel, !next);
+ newFocused = wSwitchPanelSelectNext(swpanel, !next,
True);
else
newFocused = wSwitchPanelSelectFirst(swpanel, False);
@@ -157,7 +157,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool
next, Bool class_onl
&& wKeyBindings[WKBD_GROUPNEXT].modifier ==
modifiers)
|| 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);
} 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)
|| 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);
} else if (ev.xkey.keycode == homeKey ||
ev.xkey.keycode == endKey) {
diff --git a/src/defaults.c b/src/defaults.c
index 4bf9aff..a4f4763 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -682,7 +682,9 @@ WDefaultEntry optionList[] = {
{"DialogHistoryLines", "500", NULL,
&wPreferences.history_lines, getInt, NULL, NULL, NULL},
{"CycleActiveHeadOnly", "NO", NULL,
- &wPreferences.cycle_active_head_only, getBool, NULL, NULL, NULL}
+ &wPreferences.cycle_active_head_only, getBool, NULL, NULL, NULL},
+ {"CycleIgnoresMinimized", "NO", NULL,
+ &wPreferences.cycle_ignores_minimized, getBool, NULL, NULL, NULL}
};
static void initDefaults()
diff --git a/src/switchpanel.c b/src/switchpanel.c
index 5006bce..1096b20 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -559,10 +559,11 @@ void wSwitchPanelDestroy(WSwitchPanel *panel)
wfree(panel);
}
-WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back)
+WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back, int ignoreMini)
{
WWindow *wwin;
int count = WMGetArrayItemCount(panel->windows);
+ int orig = panel->current;
if (count == 0)
return NULL;
@@ -570,26 +571,24 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int
back)
if (panel->win)
changeImage(panel, panel->current, 0);
- if (back)
- panel->current--;
- else
- panel->current++;
+ if (!wPreferences.cycle_ignores_minimized) ignoreMini = False;
- wwin = WMGetFromArray(panel->windows, (count + panel->current) % count);
+ if (ignoreMini && canReceiveFocus(WMGetFromArray(panel->windows, (count
+ panel->current) % count)) < 0) ignoreMini = False;
- 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);
- }
+ do {
+ if (back)
+ panel->current--;
+ else
+ panel->current++;
+
+ panel->current= (count + panel->current) % count;
+ wwin = WMGetFromArray(panel->windows, panel->current);
+ } while (ignoreMini && panel->current != orig && canReceiveFocus(wwin)
< 0);
- panel->current = (count + panel->current) % count;
+ 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) {
drawTitle(panel, panel->current, wwin->frame->title);
diff --git a/src/switchpanel.h b/src/switchpanel.h
index 73efa63..3367e12 100644
--- a/src/switchpanel.h
+++ b/src/switchpanel.h
@@ -27,7 +27,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin,
Bool class_only);
void wSwitchPanelDestroy(WSwitchPanel *panel);
-WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back);
+WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back, int ignoreMini);
WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back);
WWindow *wSwitchPanelHandleEvent(WSwitchPanel *panel, XEvent *event);
--
1.7.11.7
--
To unsubscribe, send mail to [email protected].