From bdd9521bf3ea86b3cd83b070728b58227d821ff8 Mon Sep 17 00:00:00 2001 From: NRK Date: Sun, 27 Feb 2022 15:37:15 +0600 Subject: code-style: slight cleanups * put TOP_STATUSBAR under the HAVE_LIBFONTS guard * change get_win_title param to take unsigned char ptr * init UTF8_STRING like other atoms --- window.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index 7d82975..9bfc2ec 100644 --- a/window.c +++ b/window.c @@ -30,7 +30,7 @@ #include #include -extern size_t get_win_title(char *, int); +extern size_t get_win_title(unsigned char *, int); #if HAVE_LIBFONTS #include "utf8.h" @@ -170,6 +170,7 @@ void win_init(win_t *win) INIT_ATOM_(_NET_WM_STATE); INIT_ATOM_(_NET_WM_PID); INIT_ATOM_(_NET_WM_STATE_FULLSCREEN); + INIT_ATOM_(UTF8_STRING); } void win_open(win_t *win) @@ -504,18 +505,16 @@ void win_draw_rect(win_t *win, int x, int y, int w, int h, bool fill, int lw, void win_set_title(win_t *win) { - char title[512]; + unsigned char title[512]; size_t len; if ((len = get_win_title(title, ARRLEN(title))) <= 0) return; XChangeProperty(win->env.dpy, win->xwin, atoms[ATOM__NET_WM_NAME], - XInternAtom(win->env.dpy, "UTF8_STRING", False), 8, - PropModeReplace, (unsigned char *) title, len); + atoms[ATOM_UTF8_STRING], 8, PropModeReplace, title, len); XChangeProperty(win->env.dpy, win->xwin, atoms[ATOM__NET_WM_ICON_NAME], - XInternAtom(win->env.dpy, "UTF8_STRING", False), 8, - PropModeReplace, (unsigned char *) title, len); + atoms[ATOM_UTF8_STRING], 8, PropModeReplace, title, len); } void win_set_cursor(win_t *win, cursor_t cursor) -- cgit v1.2.3-54-g00ecf