----- Rodolfo García Peñas <[email protected]> a écrit : > > From ccd0feecb5accf0876748cbaca1ef15280d97bd7 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]> > Date: Mon, 8 Oct 2012 05:43:22 +0200 > Subject: [PATCH 3/3] Icon creation in only one function > > This patch avoid the icon creation in winspector.c and adds the > ability of creating + paiting and unpainting instead icon destroy. > > Now the icon is always created by wApplicationCreate and the icon > exists while the application is runnning. If the user wants to > remove the appicon, winspector.c don't removes the icon, only > don't paint it on the screen, but the icon still is created. > > Probably the most difficult part in this code is how to handle the > icons in the iconlist. We must include the icon in the iconlist when > is painted, not when is created. And must be removed when is unpainted. > We can check if the icon is in the iconlist if icon->next AND icon->prev > are null, else is included in the applist. If is included, we must not > paint it again, because the function PlaceIcon() will calculate a new > icon place in the screen including the icon!, then a hole is painted. > --- > src/appicon.c | 57 > ++++++++++++++++++++++++++++++++++++++++++++---------- > src/appicon.h | 1 + > src/winspector.c | 6 ++---- > 3 files changed, 50 insertions(+), 14 deletions(-) > > diff --git a/src/appicon.c b/src/appicon.c > index a90e35b..f2dc957 100644 > --- a/src/appicon.c > +++ b/src/appicon.c > @@ -157,6 +157,33 @@ void makeAppIconFor(WApplication *wapp) > paint_app_icon(wapp); > } > > +void unpaint_app_icon(WApplication *wapp) > +{ > + WAppIcon *aicon; > + WScreen *scr = wapp->main_window_desc->screen_ptr; > + WDock *clip = scr->workspaces[scr->current_workspace]->clip; > + > + if (!wapp || !wapp->app_icon) > + return;
Hi, While having a quick look at this patch, I noticed that the pointer that is checked for null value was actually dereferenced beforehand, so if the case arises there will be a crash before the protection check could be reached. I have entered a bug in the BTS (id=3) about it. > + > + aicon = wapp->app_icon; > + > + /* If the icon is docked, don't continue */ > + if (aicon->docked) > + return; > + > + if (!clip || !aicon->attracted || !clip->collapsed) > + XUnmapWindow(dpy, aicon->icon->core->window); > + > + /* We want to avoid having it on the list because otherwise > + * there will be a hole when the icons are arranged with > + * wArrangeIcons() */ > + remove_from_appicon_list(scr, aicon); > + > + if (wPreferences.auto_arrange_icons && !aicon->attracted) > + wArrangeIcons(scr, True); > +} > + -- To unsubscribe, send mail to [email protected].
