Adding background image reload patch ref. pull request #62
This commit is contained in:
parent
d8ec7a396c
commit
3e41e252b1
|
@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2022-04-11 - Added the background image reload patch
|
||||||
|
|
||||||
2022-03-10 - Added the background image patch
|
2022-03-10 - Added the background image patch
|
||||||
|
|
||||||
2022-02-24 - Upgraded to st 0.8.5 e823e23, 2022-02-17 - removing osc_10_11_12_2 patch as no longer relevant
|
2022-02-24 - Upgraded to st 0.8.5 e823e23, 2022-02-17 - removing osc_10_11_12_2 patch as no longer relevant
|
||||||
|
@ -101,6 +103,9 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
||||||
- draws a background image in farbfeld format in place of the defaultbg color allowing for
|
- draws a background image in farbfeld format in place of the defaultbg color allowing for
|
||||||
pseudo transparency
|
pseudo transparency
|
||||||
|
|
||||||
|
- background-image-reload
|
||||||
|
- allows the background image to be reloaded similar to xresources using USR1 signals
|
||||||
|
|
||||||
- [blinking-cursor](https://st.suckless.org/patches/blinking_cursor/)
|
- [blinking-cursor](https://st.suckless.org/patches/blinking_cursor/)
|
||||||
- allows the use of a blinking cursor
|
- allows the use of a blinking cursor
|
||||||
|
|
||||||
|
|
|
@ -94,3 +94,13 @@ bginit()
|
||||||
XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
|
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
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
|
|
||||||
static void updatexy(void);
|
static void updatexy(void);
|
||||||
static XImage *loadff(const char *);
|
static XImage *loadff(const char *);
|
||||||
static void bginit();
|
static void bginit();
|
||||||
|
static void reload_image();
|
||||||
|
|
|
@ -35,22 +35,14 @@ resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
#if XRESOURCES_RELOAD_PATCH
|
|
||||||
config_init(Display *dpy)
|
config_init(Display *dpy)
|
||||||
#else
|
|
||||||
config_init(void)
|
|
||||||
#endif // XRESOURCES_RELOAD_PATCH
|
|
||||||
{
|
{
|
||||||
char *resm;
|
char *resm;
|
||||||
XrmDatabase db;
|
XrmDatabase db;
|
||||||
ResourcePref *p;
|
ResourcePref *p;
|
||||||
|
|
||||||
XrmInitialize();
|
XrmInitialize();
|
||||||
#if XRESOURCES_RELOAD_PATCH
|
|
||||||
resm = XResourceManagerString(dpy);
|
resm = XResourceManagerString(dpy);
|
||||||
#else
|
|
||||||
resm = XResourceManagerString(xw.dpy);
|
|
||||||
#endif // XRESOURCES_RELOAD_PATCH
|
|
||||||
if (!resm)
|
if (!resm)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -69,11 +61,7 @@ reload_config(int sig)
|
||||||
die("Can't open display\n");
|
die("Can't open display\n");
|
||||||
|
|
||||||
config_init(dpy);
|
config_init(dpy);
|
||||||
if (sig != -1) {
|
xloadcols();
|
||||||
/* Called due to a SIGUSR1 */
|
redraw();
|
||||||
xloadcols();
|
|
||||||
redraw();
|
|
||||||
}
|
|
||||||
signal(SIGUSR1, reload_config);
|
|
||||||
}
|
}
|
||||||
#endif // XRESOURCES_RELOAD_PATCH
|
#endif // XRESOURCES_RELOAD_PATCH
|
||||||
|
|
|
@ -14,8 +14,4 @@ typedef struct {
|
||||||
} ResourcePref;
|
} ResourcePref;
|
||||||
|
|
||||||
int resource_load(XrmDatabase, char *, enum resource_type, void *);
|
int resource_load(XrmDatabase, char *, enum resource_type, void *);
|
||||||
#if XRESOURCES_RELOAD_PATCH
|
|
||||||
void config_init(Display *dpy);
|
void config_init(Display *dpy);
|
||||||
#else
|
|
||||||
void config_init(void);
|
|
||||||
#endif // XRESOURCES_RELOAD_PATCH
|
|
||||||
|
|
|
@ -54,6 +54,12 @@
|
||||||
*/
|
*/
|
||||||
#define BACKGROUND_IMAGE_PATCH 0
|
#define BACKGROUND_IMAGE_PATCH 0
|
||||||
|
|
||||||
|
/* This patch adds the ability to reload the background image config when a SIGUSR1 signal is
|
||||||
|
* received, e.g.: killall -USR1 st
|
||||||
|
* Depends on the BACKGROUND_IMAGE_PATCH.
|
||||||
|
*/
|
||||||
|
#define BACKGROUND_IMAGE_RELOAD_PATCH 0
|
||||||
|
|
||||||
/* This patch allows the use of a blinking cursor.
|
/* This patch allows the use of a blinking cursor.
|
||||||
* Only cursor styles 0, 1, 3, 5, and 7 blink. Set cursorstyle accordingly.
|
* Only cursor styles 0, 1, 3, 5, and 7 blink. Set cursorstyle accordingly.
|
||||||
* Cursor styles are defined here:
|
* Cursor styles are defined here:
|
||||||
|
|
30
x.c
30
x.c
|
@ -117,6 +117,9 @@ static void selnotify(XEvent *);
|
||||||
static void selclear_(XEvent *);
|
static void selclear_(XEvent *);
|
||||||
static void selrequest(XEvent *);
|
static void selrequest(XEvent *);
|
||||||
static void setsel(char *, Time);
|
static void setsel(char *, Time);
|
||||||
|
#if XRESOURCES_PATCH && XRESOURCES_RELOAD_PATCH || BACKGROUND_IMAGE_PATCH && BACKGROUND_IMAGE_RELOAD_PATCH
|
||||||
|
static void sigusr1_reload(int sig);
|
||||||
|
#endif // XRESOURCES_RELOAD_PATCH | BACKGROUND_IMAGE_RELOAD_PATCH
|
||||||
static int mouseaction(XEvent *, uint);
|
static int mouseaction(XEvent *, uint);
|
||||||
static void mousesel(XEvent *, int);
|
static void mousesel(XEvent *, int);
|
||||||
static void mousereport(XEvent *);
|
static void mousereport(XEvent *);
|
||||||
|
@ -744,6 +747,20 @@ setsel(char *str, Time t)
|
||||||
#endif // CLIPBOARD_PATCH
|
#endif // CLIPBOARD_PATCH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XRESOURCES_PATCH && XRESOURCES_RELOAD_PATCH || BACKGROUND_IMAGE_PATCH && BACKGROUND_IMAGE_RELOAD_PATCH
|
||||||
|
void
|
||||||
|
sigusr1_reload(int sig)
|
||||||
|
{
|
||||||
|
#if XRESOURCES_PATCH && XRESOURCES_RELOAD_PATCH
|
||||||
|
reload_config(sig);
|
||||||
|
#endif // XRESOURCES_RELOAD_PATCH
|
||||||
|
#if BACKGROUND_IMAGE_PATCH && BACKGROUND_IMAGE_RELOAD_PATCH
|
||||||
|
reload_image();
|
||||||
|
#endif // BACKGROUND_IMAGE_RELOAD_PATCH
|
||||||
|
signal(SIGUSR1, sigusr1_reload);
|
||||||
|
}
|
||||||
|
#endif // XRESOURCES_RELOAD_PATCH | BACKGROUND_IMAGE_RELOAD_PATCH
|
||||||
|
|
||||||
void
|
void
|
||||||
xsetsel(char *str)
|
xsetsel(char *str)
|
||||||
{
|
{
|
||||||
|
@ -1360,8 +1377,10 @@ xinit(int cols, int rows)
|
||||||
XVisualInfo vis;
|
XVisualInfo vis;
|
||||||
#endif // ALPHA_PATCH
|
#endif // ALPHA_PATCH
|
||||||
|
|
||||||
|
#if !XRESOURCES_PATCH
|
||||||
if (!(xw.dpy = XOpenDisplay(NULL)))
|
if (!(xw.dpy = XOpenDisplay(NULL)))
|
||||||
die("can't open display\n");
|
die("can't open display\n");
|
||||||
|
#endif // XRESOURCES_PATCH
|
||||||
xw.scr = XDefaultScreen(xw.dpy);
|
xw.scr = XDefaultScreen(xw.dpy);
|
||||||
|
|
||||||
#if ALPHA_PATCH
|
#if ALPHA_PATCH
|
||||||
|
@ -3400,14 +3419,15 @@ run:
|
||||||
|
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
XSetLocaleModifiers("");
|
XSetLocaleModifiers("");
|
||||||
#if XRESOURCES_RELOAD_PATCH && XRESOURCES_PATCH
|
#if XRESOURCES_PATCH && XRESOURCES_RELOAD_PATCH || BACKGROUND_IMAGE_PATCH && BACKGROUND_IMAGE_RELOAD_PATCH
|
||||||
reload_config(-1);
|
signal(SIGUSR1, sigusr1_reload);
|
||||||
#elif XRESOURCES_PATCH
|
#endif // XRESOURCES_RELOAD_PATCH | BACKGROUND_IMAGE_RELOAD_PATCH
|
||||||
|
#if XRESOURCES_PATCH
|
||||||
if (!(xw.dpy = XOpenDisplay(NULL)))
|
if (!(xw.dpy = XOpenDisplay(NULL)))
|
||||||
die("Can't open display\n");
|
die("Can't open display\n");
|
||||||
|
|
||||||
config_init();
|
config_init(xw.dpy);
|
||||||
#endif // XRESOURCES_RELOAD_PATCH
|
#endif // XRESOURCES_PATCH
|
||||||
cols = MAX(cols, 1);
|
cols = MAX(cols, 1);
|
||||||
rows = MAX(rows, 1);
|
rows = MAX(rows, 1);
|
||||||
#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH
|
#if ALPHA_PATCH && ALPHA_FOCUS_HIGHLIGHT_PATCH
|
||||||
|
|
Loading…
Reference in New Issue