From: "Rodolfo García Peñas (kix)" <k...@kix.es> 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. --- 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 d261b69..ee80bd6 100644 --- a/src/actions.c +++ b/src/actions.c @@ -57,6 +57,7 @@ extern Time LastTimestamp; extern Time LastFocusChange; extern Atom _XA_WM_TAKE_FOCUS; extern wks_info wks_nfo; +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); @@ -1770,7 +1771,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 3459612..397bed1 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -65,6 +65,7 @@ extern Cursor wCursor[WCUR_LAST]; extern WDDomain *WDWindowAttributes; extern XContext wWinContext; extern wks_info wks_nfo; +extern WAppIcon *app_icon_list; #define MOD_MASK wPreferences.modifier_mask #define ICON_SIZE wPreferences.icon_size @@ -73,8 +74,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 @@ -121,7 +122,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); @@ -194,7 +195,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); @@ -245,7 +246,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); @@ -334,10 +335,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) @@ -352,7 +351,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); @@ -1192,23 +1191,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 b92a1dc..3604147 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -77,6 +77,7 @@ extern WDDomain *WDWindowAttributes; extern WDDomain *WDRootMenu; extern int wScreenCount; extern wks_info wks_nfo; +extern WAppIcon *app_icon_list; extern WShortKey wKeyBindings[WKBD_LAST]; typedef struct _WDefaultEntry WDefaultEntry; @@ -1218,7 +1219,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 24dd886..c0a2482 100644 --- a/src/dock.c +++ b/src/dock.c @@ -69,6 +69,7 @@ extern Cursor wCursor[WCUR_LAST]; extern XContext wWinContext; extern wks_info wks_nfo; +extern WAppIcon *app_icon_list; #define MOD_MASK wPreferences.modifier_mask #define ICON_SIZE wPreferences.icon_size @@ -666,7 +667,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 18f6002..8ad2185 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> @@ -133,6 +134,9 @@ Cursor wCursor[WCUR_LAST]; /* Workspace information */ wks_info wks_nfo; +/* Appicons information - App Icon List */ +struct WAppIcon *app_icon_list; + /* last event timestamp for XSetInputFocus */ Time LastTimestamp = CurrentTime; /* timestamp on the last time we did XSetInputFocus() */ 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.7.10.4 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.