mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 05:48:01 +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 <X11/Xutil.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include "window.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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ WAppIcon * wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
|
|||||||
void wAppIconDestroy(WAppIcon *aicon);
|
void wAppIconDestroy(WAppIcon *aicon);
|
||||||
void wAppIconPaint(WAppIcon *aicon);
|
void wAppIconPaint(WAppIcon *aicon);
|
||||||
void wAppIconMove(WAppIcon *aicon, int x, int y);
|
void wAppIconMove(WAppIcon *aicon, int x, int y);
|
||||||
|
void save_app_icon(WWindow *wwin, WApplication *wapp);
|
||||||
Bool wAppIconChangeImage(WAppIcon *icon, char *file);
|
Bool wAppIconChangeImage(WAppIcon *icon, char *file);
|
||||||
Bool wAppIconSave(WAppIcon *aicon);
|
Bool wAppIconSave(WAppIcon *aicon);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,13 +22,8 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@@ -36,15 +31,12 @@
|
|||||||
#ifdef USER_MENU
|
#ifdef USER_MENU
|
||||||
#include "usermenu.h"
|
#include "usermenu.h"
|
||||||
#endif /* USER_MENU */
|
#endif /* USER_MENU */
|
||||||
#include "icon.h"
|
|
||||||
#include "appicon.h"
|
#include "appicon.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "appmenu.h"
|
#include "appmenu.h"
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
#include "funcs.h"
|
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
#include "defaults.h"
|
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "dock.h"
|
#include "dock.h"
|
||||||
|
|
||||||
@@ -349,29 +341,9 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
|||||||
if (wPreferences.auto_arrange_icons && wapp->app_icon && !wapp->app_icon->attracted)
|
if (wPreferences.auto_arrange_icons && wapp->app_icon && !wapp->app_icon->attracted)
|
||||||
wArrangeIcons(scr, True);
|
wArrangeIcons(scr, True);
|
||||||
|
|
||||||
if (wapp->app_icon) {
|
/* Save the app_icon in a file */
|
||||||
char *tmp, *path;
|
save_app_icon(wwin, wapp);
|
||||||
struct stat dummy;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
return wapp;
|
return wapp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user