diff --git a/src/WindowMaker.h b/src/WindowMaker.h index 24a3806e..dd5f4805 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -558,6 +558,9 @@ extern struct wmaker_global_variables { XContext stack; } context; + /* Application related */ + struct WAppIcon *app_icon_list; /* list of all aplication icons */ + } w_global; extern unsigned int ValidModMask; diff --git a/src/actions.c b/src/actions.c index 47461a9d..1b351f41 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1766,7 +1766,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 = w_global.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 17ac8e35..0a5d6e6d 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -70,8 +70,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 @@ -118,7 +118,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); @@ -191,7 +191,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); @@ -242,7 +242,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); @@ -326,10 +326,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) @@ -344,7 +342,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); @@ -1190,23 +1188,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 = w_global.app_icon_list; + if (w_global.app_icon_list) + w_global.app_icon_list->prev = appicon; - scr->app_icon_list = appicon; + w_global.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 == w_global.app_icon_list) { if (appicon->next) appicon->next->prev = NULL; - scr->app_icon_list = appicon->next; + w_global.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 2b2a1edf..7d20908d 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -1216,7 +1216,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict) void wDefaultUpdateIcons(WScreen *scr) { - WAppIcon *aicon = scr->app_icon_list; + WAppIcon *aicon = w_global.app_icon_list; WDrawerChain *dc; WWindow *wwin = scr->focused_window; diff --git a/src/dock.c b/src/dock.c index 3606e82b..48b240c9 100644 --- a/src/dock.c +++ b/src/dock.c @@ -661,7 +661,7 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry *entry) assert(entry->clientdata != NULL); clip = clickedIcon->dock; - aicon = clip->screen_ptr->app_icon_list; + aicon = w_global.app_icon_list; while (aicon) { if (!aicon->docked && wDockFindFreeSlot(clip, &x, &y)) { diff --git a/src/screen.h b/src/screen.h index a8540026..0d667a5c 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