Adding background image reload patch ref. pull request #62

This commit is contained in:
bakkeby 2022-04-11 15:56:12 +02:00
parent d8ec7a396c
commit 3e41e252b1
7 changed files with 50 additions and 24 deletions

View file

@ -94,3 +94,13 @@ bginit()
XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
}
}
#if BACKGROUND_IMAGE_RELOAD_PATCH
void
reload_image()
{
XFreeGC(xw.dpy, xw.bggc);
bginit();
redraw();
}
#endif // XRESOURCES_RELOAD_PATCH

View file

@ -2,4 +2,5 @@
static void updatexy(void);
static XImage *loadff(const char *);
static void bginit();
static void bginit();
static void reload_image();

View file

@ -35,22 +35,14 @@ resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
}
void
#if XRESOURCES_RELOAD_PATCH
config_init(Display *dpy)
#else
config_init(void)
#endif // XRESOURCES_RELOAD_PATCH
{
char *resm;
XrmDatabase db;
ResourcePref *p;
XrmInitialize();
#if XRESOURCES_RELOAD_PATCH
resm = XResourceManagerString(dpy);
#else
resm = XResourceManagerString(xw.dpy);
#endif // XRESOURCES_RELOAD_PATCH
if (!resm)
return;
@ -69,11 +61,7 @@ reload_config(int sig)
die("Can't open display\n");
config_init(dpy);
if (sig != -1) {
/* Called due to a SIGUSR1 */
xloadcols();
redraw();
}
signal(SIGUSR1, reload_config);
xloadcols();
redraw();
}
#endif // XRESOURCES_RELOAD_PATCH

View file

@ -14,8 +14,4 @@ typedef struct {
} ResourcePref;
int resource_load(XrmDatabase, char *, enum resource_type, void *);
#if XRESOURCES_RELOAD_PATCH
void config_init(Display *dpy);
#else
void config_init(void);
#endif // XRESOURCES_RELOAD_PATCH