On Mon, 26 Nov 2012 at 19:12:26 +0100, Martin Frydl wrote:
> 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.
I'm not sure if I like this option, but a couple of trivial comments
are below. First, you should base your patches on the #next branch
as Christophe already pointed out.
> + WMSetButtonSelected(panel->swi[14],
> GetBoolForKey("CycleIgnoresMinimized"));
Use CycleIgnoreMinimized instead, since this is more like an imperative.
> -WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back)
> +WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int back, int
> ignoreMini)
ignoreMini is not a good name. Something like ignore_minimized is better.
> - if (back)
> - panel->current--;
> - else
> - panel->current++;
> + if (!wPreferences.cycle_ignores_minimized) ignoreMini = False;
Please do not use this coding style, wmaker-crm uses the linux kernel
coding style instead, see http://windowmaker.org/dev.php
Apart from that, is it really necessary to change the code to use
the "do while" loop in order to add your option? If that's not the
case, you should write another patch to use the do while loop.
>
> - 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].
--
To unsubscribe, send mail to [email protected].