On Wed, 2 Oct 2013 at 10:28:32 +0100, Iain Patterson wrote: > Quoth I, > > >I'll have a look this week. > > It turned out to be a simple bug. wSwitchPanelSelectFirst() was > inadvertently returning NULL, thus causing the switchpanel to fail > to raise the first selected window.
> From 853983fa9666c16361a63819f80d2f83b7ef9edd Mon Sep 17 00:00:00 2001 > From: Iain Patterson <[email protected]> > Date: Wed, 2 Oct 2013 10:20:58 +0100 > Subject: [PATCH] Fixed scoping error in wSwitchPanelSelectFirst(). > > We were using wwin as the temporary variable in WM_ITERATE_ARRAY() but > wwin was already set to the result of WMGetFromArray() and was due to be > returned from the function. As a result of this oversight, wwin was > always set to NULL. > > The bug could cause a problem in the - admittedly rare - case where all > windows were minimised at startup, causing the first invocation of the > switchpanel to highlight the first minimised window but then fail to > raise it. > > Reported by Yury Tarasievich. > --- > src/switchpanel.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/switchpanel.c b/src/switchpanel.c > index 424755d..0b5b037 100644 > --- a/src/switchpanel.c > +++ b/src/switchpanel.c > @@ -670,7 +670,7 @@ WWindow *wSwitchPanelSelectNext(WSwitchPanel *panel, int > back, int ignore_minimi > > WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int back) > { > - WWindow *wwin; > + WWindow *wwin, *tmpwin; > int count = WMGetArrayItemCount(panel->windows); > char *title; > int i; > @@ -690,7 +690,7 @@ WWindow *wSwitchPanelSelectFirst(WSwitchPanel *panel, int > back) > title = wwin->frame->title; > > if (panel->win) { > - WM_ITERATE_ARRAY(panel->windows, wwin, i) { > + WM_ITERATE_ARRAY(panel->windows, tmpwin, i) { > changeImage(panel, i, i == panel->current, False, > False); > } > drawTitle(panel, panel->current, title); > -- > 1.8.3.1 > Thanks Iain, But compiling it gives me this: Making all in src CC switchpanel.o switchpanel.c: In function 'wSwitchPanelSelectFirst': switchpanel.c:673:18: warning: variable 'tmpwin' set but not used [-Wunused-but-set-variable] CCLD wmaker Making all in util which looks bogus. Is there any compiler food for this case? -- To unsubscribe, send mail to [email protected].
