Krolyxon
Commit bdd9521

Branches

Refs →

nsxivbdd9521

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
Author
NRK
Date
2022-02-27 15:37 +0600
Committer
N-R-K · 2022-03-02 09:32 +0000
Parent
d9db7d7
Commit
bdd9521bf3ea86b3cd83b070728b58227d821ff8

+8 −8

4 files changed

  1. M config.def.h +1 −1
  2. M main.c +1 −1
  3. M nsxiv.h +1 −0
  4. M window.c +5 −6
M config.def.h View
@@ -14,10 +14,10 @@ static const char *DEFAULT_MARK_COLOR = NULL; /* NULL means it will default to
1414 static const char *DEFAULT_BAR_BG = NULL; /* NULL means it will default to window background */
1515 static const char *DEFAULT_BAR_FG = NULL; /* NULL means it will default to window foreground */
1616 static const char *DEFAULT_FONT = "monospace-8";
17−#endif
1817
1918 /* if true, statusbar appears on top of the window */
2019 static const bool TOP_STATUSBAR = false;
20+#endif /* HAVE_LIBFONTS */
2121
2222 #endif
2323 #ifdef _IMAGE_CONFIG
M main.c View
@@ -233,7 +233,7 @@ static bool check_timeouts(struct timeval *t)
233233 return tmin > 0;
234234 }
235235
236−size_t get_win_title(char *buf, int len)
236+size_t get_win_title(unsigned char *buf, int len)
237237 {
238238 char *argv[8];
239239 spawn_t pfd;
M nsxiv.h View
@@ -380,6 +380,7 @@ enum {
380380 ATOM__NET_WM_STATE,
381381 ATOM__NET_WM_PID,
382382 ATOM__NET_WM_STATE_FULLSCREEN,
383+ ATOM_UTF8_STRING,
383384 ATOM_COUNT
384385 };
385386
M window.c View
@@ -30,7 +30,7 @@
3030 #include <X11/Xatom.h>
3131 #include <X11/Xresource.h>
3232
33−extern size_t get_win_title(char *, int);
33+extern size_t get_win_title(unsigned char *, int);
3434
3535 #if HAVE_LIBFONTS
3636 #include "utf8.h"
@@ -170,6 +170,7 @@ void win_init(win_t *win)
170170 INIT_ATOM_(_NET_WM_STATE);
171171 INIT_ATOM_(_NET_WM_PID);
172172 INIT_ATOM_(_NET_WM_STATE_FULLSCREEN);
173+ INIT_ATOM_(UTF8_STRING);
173174 }
174175
175176 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,
504505
505506 void win_set_title(win_t *win)
506507 {
507− char title[512];
508+ unsigned char title[512];
508509 size_t len;
509510
510511 if ((len = get_win_title(title, ARRLEN(title))) <= 0)
511512 return;
512513
513514 XChangeProperty(win->env.dpy, win->xwin, atoms[ATOM__NET_WM_NAME],
514− XInternAtom(win->env.dpy, "UTF8_STRING", False), 8,
515− PropModeReplace, (unsigned char *) title, len);
515+ atoms[ATOM_UTF8_STRING], 8, PropModeReplace, title, len);
516516 XChangeProperty(win->env.dpy, win->xwin, atoms[ATOM__NET_WM_ICON_NAME],
517− XInternAtom(win->env.dpy, "UTF8_STRING", False), 8,
518− PropModeReplace, (unsigned char *) title, len);
517+ atoms[ATOM_UTF8_STRING], 8, PropModeReplace, title, len);
519518 }
520519
521520 void win_set_cursor(win_t *win, cursor_t cursor)