mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 05:48:01 +01:00
Make create_appicon_from_dock() do only what its name implies
Function names are important and should not do more than their names imply. In this case, create_appicon_from_dock() should only try to get an icon from the dock (or clip). If the icon is not there, do not try to make an icon from scratch. You were told to create it from the dock! Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This commit is contained in:
@@ -955,8 +955,6 @@ static WAppIcon *findDockIconFor(WDock *dock, Window main_window)
|
|||||||
void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_window)
|
void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_window)
|
||||||
{
|
{
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
|
|
||||||
/* Create the application icon */
|
|
||||||
wapp->app_icon = NULL;
|
wapp->app_icon = NULL;
|
||||||
|
|
||||||
if (scr->last_dock)
|
if (scr->last_dock)
|
||||||
@@ -990,7 +988,5 @@ void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_win
|
|||||||
|
|
||||||
wAppIconPaint(wapp->app_icon);
|
wAppIconPaint(wapp->app_icon);
|
||||||
wAppIconSave(wapp->app_icon);
|
wAppIconSave(wapp->app_icon);
|
||||||
} else {
|
|
||||||
makeAppIconFor(wapp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,22 +132,24 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
|||||||
#ifdef USER_MENU
|
#ifdef USER_MENU
|
||||||
if (!wapp->menu)
|
if (!wapp->menu)
|
||||||
wapp->menu = wUserMenuGet(scr, wapp->main_window_desc);
|
wapp->menu = wUserMenuGet(scr, wapp->main_window_desc);
|
||||||
#endif /* USER_MENU */
|
#endif
|
||||||
|
|
||||||
/*
|
/* Set application wide attributes from the leader */
|
||||||
* Set application wide attributes from the leader.
|
|
||||||
*/
|
|
||||||
wapp->flags.hidden = WFLAGP(wapp->main_window_desc, start_hidden);
|
wapp->flags.hidden = WFLAGP(wapp->main_window_desc, start_hidden);
|
||||||
wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon);
|
wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon);
|
||||||
|
|
||||||
/* application descriptor */
|
/* application descriptor */
|
||||||
XSaveContext(dpy, main_window, wAppWinContext, (XPointer) wapp);
|
XSaveContext(dpy, main_window, wAppWinContext, (XPointer) wapp);
|
||||||
|
|
||||||
/* Create the application icon using the icon from docks
|
/* First try to create an icon from the dock or clip */
|
||||||
* If not found in docks, create a new icon
|
|
||||||
* using the function wAppIconCreate() */
|
|
||||||
create_appicon_from_dock(wwin, wapp, main_window);
|
create_appicon_from_dock(wwin, wapp, main_window);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In case it was not found in the dock, make it from scratch.
|
||||||
|
* Note: makeAppIconFor() returns early if wapp->app_icon exists
|
||||||
|
*/
|
||||||
|
makeAppIconFor(wapp);
|
||||||
|
|
||||||
/* Save the app_icon in a file */
|
/* Save the app_icon in a file */
|
||||||
save_app_icon(wapp);
|
save_app_icon(wapp);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user