mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 14:08:06 +01:00
New function save_app_icon
New function to save the icon "save_app_icon". This function is created in appicon.c, because is related to app_icons. The contents are from application.c. No important modifications are included in this function. Removed the includes not needed.
This commit is contained in:
committed by
Carlos R. Mafra
parent
423b78811a
commit
1c1697dc40
@@ -26,6 +26,8 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "WindowMaker.h"
|
||||
#include "window.h"
|
||||
@@ -759,3 +761,33 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void save_app_icon(WWindow *wwin, WApplication *wapp)
|
||||
{
|
||||
char *tmp, *path;
|
||||
struct stat dummy;
|
||||
WScreen *scr = NULL;
|
||||
|
||||
if (!wapp->app_icon)
|
||||
return;
|
||||
|
||||
scr = wwin->screen_ptr;
|
||||
tmp = wDefaultGetIconFile(scr, wapp->app_icon->wm_instance, wapp->app_icon->wm_class, True);
|
||||
|
||||
/* If the icon was saved by us from the client supplied icon, but is
|
||||
* missing, recreate it. */
|
||||
if (tmp && strstr(tmp, "Library/WindowMaker/CachedPixmaps") != NULL &&
|
||||
stat(tmp, &dummy) != 0 && errno == ENOENT) {
|
||||
wmessage(_("recreating missing icon '%s'"), tmp);
|
||||
path = wIconStore(wapp->app_icon->icon);
|
||||
if (path)
|
||||
wfree(path);
|
||||
|
||||
wIconUpdate(wapp->app_icon->icon);
|
||||
wAppIconPaint(wapp->app_icon);
|
||||
}
|
||||
|
||||
/* if the displayed icon was supplied by the client, save the icon */
|
||||
if (!tmp || strstr(tmp, "Library/WindowMaker/CachedPixmaps") != NULL)
|
||||
wAppIconSave(wapp->app_icon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user