The appicon list is moved out of WScreen. The reason is because the appicon list is used to create and remove icons (appicons, dock, clip,...) on the screen, but these icons are not associated with the WScreen. These icons are associated with the Workspace.
If we check the WWorkspace struct we can see that the Clip is inside this struct. The dock, the background, the workspace name are other items related to the Workspace, not with the screen. So, we should take out the appicon from the WScreen. But, what is the better place to hold it? The workspace? NO!, because the icon list is common to the all workspaces. Probably the better place is hold as independent list, in main.c, so this is my option. In the next patches we can see that this is the better option, because we can create the icons, without think where we should paint them. Signed-off-by: Rodolfo García Peñas (kix) <k...@kix.es> --- src/actions.c | 3 ++- src/appicon.c | 33 ++++++++++++++++----------------- src/defaults.c | 3 ++- src/dock.c | 3 ++- src/main.c | 4 ++++ src/screen.h | 2 -- 6 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/actions.c b/src/actions.c index 39fbd39..d7dc498 100644 --- a/src/actions.c +++ b/src/actions.c @@ -54,6 +54,7 @@ int ignore_wks_change = 0; extern WWorkspace_info wks_info; +extern WAppIcon *app_icon_list; static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, int *new_y, unsigned int *new_width, unsigned int *new_height); @@ -1767,7 +1768,7 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll) : vars[head].yo + vars[head].ys*(vars[head].si*isize)) /* arrange application icons */ - aicon = scr->app_icon_list; + aicon = app_icon_list; /* reverse them to avoid unnecessarily sliding of icons */ while (aicon && aicon->next) aicon = aicon->next; diff --git a/src/appicon.c b/src/appicon.c index 0ee66b9..c197c6b 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -63,6 +63,7 @@ /**** Global variables ****/ extern WDDomain *WDWindowAttributes; extern WWorkspace_info wks_info; +extern WAppIcon *app_icon_list; #define MOD_MASK wPreferences.modifier_mask #define ICON_SIZE wPreferences.icon_size @@ -71,8 +72,8 @@ static void iconDblClick(WObjDescriptor * desc, XEvent * event); static void iconExpose(WObjDescriptor * desc, XEvent * event); static void wApplicationSaveIconPathFor(const char *iconPath, const char *wm_instance, const char *wm_class); static WAppIcon *wAppIconCreate(WWindow * leader_win); -static void add_to_appicon_list(WScreen *scr, WAppIcon *appicon); -static void remove_from_appicon_list(WScreen *scr, WAppIcon *appicon); +static void add_to_appicon_list(WAppIcon *appicon); +static void remove_from_appicon_list(WAppIcon *appicon); static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_window); /* This function is used if the application is a .app. It checks if it has an icon in it @@ -119,7 +120,7 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, const char *command, const char *w aicon->yindex = -1; aicon->xindex = -1; - add_to_appicon_list(scr, aicon); + add_to_appicon_list(aicon); if (command) aicon->command = wstrdup(command); @@ -192,7 +193,7 @@ void unpaint_app_icon(WApplication *wapp) /* 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); + remove_from_appicon_list(aicon); if (wPreferences.auto_arrange_icons && !aicon->attracted) wArrangeIcons(scr, True); @@ -243,7 +244,7 @@ void paint_app_icon(WApplication *wapp) * having it on the list */ if (!WFLAGP(wapp->main_window_desc, no_appicon) && wapp->app_icon->next == NULL && wapp->app_icon->prev == NULL) - add_to_appicon_list(scr, wapp->app_icon); + add_to_appicon_list(wapp->app_icon); if (!attracting_dock || !wapp->app_icon->attracted || !attracting_dock->collapsed) XMapWindow(dpy, icon->core->window); @@ -327,10 +328,8 @@ static WAppIcon *wAppIconCreate(WWindow *leader_win) return aicon; } -void wAppIconDestroy(WAppIcon * aicon) +void wAppIconDestroy(WAppIcon *aicon) { - WScreen *scr = aicon->icon->core->screen_ptr; - RemoveFromStackList(aicon->icon->core); wIconDestroy(aicon->icon); if (aicon->command) @@ -345,7 +344,7 @@ void wAppIconDestroy(WAppIcon * aicon) if (aicon->wm_class) wfree(aicon->wm_class); - remove_from_appicon_list(scr, aicon); + remove_from_appicon_list(aicon); aicon->destroyed = 1; wrelease(aicon); @@ -1191,23 +1190,23 @@ static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window m } /* Add the appicon to the appiconlist */ -static void add_to_appicon_list(WScreen *scr, WAppIcon *appicon) +static void add_to_appicon_list(WAppIcon *appicon) { appicon->prev = NULL; - appicon->next = scr->app_icon_list; - if (scr->app_icon_list) - scr->app_icon_list->prev = appicon; + appicon->next = app_icon_list; + if (app_icon_list) + app_icon_list->prev = appicon; - scr->app_icon_list = appicon; + app_icon_list = appicon; } /* Remove the appicon from the appiconlist */ -static void remove_from_appicon_list(WScreen *scr, WAppIcon *appicon) +static void remove_from_appicon_list(WAppIcon *appicon) { - if (appicon == scr->app_icon_list) { + if (appicon == app_icon_list) { if (appicon->next) appicon->next->prev = NULL; - scr->app_icon_list = appicon->next; + app_icon_list = appicon->next; } else { if (appicon->next) appicon->next->prev = appicon->prev; diff --git a/src/defaults.c b/src/defaults.c index a94a90b..11cf23c 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -77,6 +77,7 @@ extern WDDomain *WDWindowAttributes; extern WDDomain *WDRootMenu; extern int wScreenCount; extern WWorkspace_info wks_info; +extern WAppIcon *app_icon_list; extern WShortKey wKeyBindings[WKBD_LAST]; typedef struct _WDefaultEntry WDefaultEntry; @@ -1217,7 +1218,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict) void wDefaultUpdateIcons(WScreen *scr) { - WAppIcon *aicon = scr->app_icon_list; + WAppIcon *aicon = app_icon_list; WDrawerChain *dc; WWindow *wwin = scr->focused_window; diff --git a/src/dock.c b/src/dock.c index d5d395e..874e786 100644 --- a/src/dock.c +++ b/src/dock.c @@ -67,6 +67,7 @@ /**** Global variables ****/ extern WWorkspace_info wks_info; +extern WAppIcon *app_icon_list; #define MOD_MASK wPreferences.modifier_mask #define ICON_SIZE wPreferences.icon_size @@ -664,7 +665,7 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry *entry) assert(entry->clientdata != NULL); clip = clickedIcon->dock; - aicon = clip->screen_ptr->app_icon_list; + aicon = app_icon_list; while (aicon) { if (!aicon->docked && wDockFindFreeSlot(clip, &x, &y)) { diff --git a/src/main.c b/src/main.c index b28eec1..b15d661 100644 --- a/src/main.c +++ b/src/main.c @@ -57,6 +57,7 @@ #include "main.h" #include "monitor.h" #include "workspace.h" +#include "appicon.h" #include <WINGs/WUtil.h> @@ -94,6 +95,9 @@ WDDomain *WDRootMenu = NULL; /* Workspace information */ WWorkspace_info wks_info; +/* Appicons information - App Icon List */ +struct WAppIcon *app_icon_list; + #ifdef SHAPE Bool wShapeSupported; int wShapeEventBase; diff --git a/src/screen.h b/src/screen.h index a854002..0d667a5 100644 --- a/src/screen.h +++ b/src/screen.h @@ -107,8 +107,6 @@ typedef struct _WScreen { WMArray *fakeGroupLeaders; /* list of fake window group ids */ - struct WAppIcon *app_icon_list; /* list of all app-icons on screen */ - struct WApplication *wapp_list; /* list of all aplications */ WMBag *stacking_list; /* bag of lists of windows -- 1.8.4.rc3 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.