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
This commit is contained in:
parent
d9db7d76b4
commit
bdd9521bf3
@ -14,10 +14,10 @@ static const char *DEFAULT_MARK_COLOR = NULL; /* NULL means it will default to
|
|||||||
static const char *DEFAULT_BAR_BG = NULL; /* NULL means it will default to window background */
|
static const char *DEFAULT_BAR_BG = NULL; /* NULL means it will default to window background */
|
||||||
static const char *DEFAULT_BAR_FG = NULL; /* NULL means it will default to window foreground */
|
static const char *DEFAULT_BAR_FG = NULL; /* NULL means it will default to window foreground */
|
||||||
static const char *DEFAULT_FONT = "monospace-8";
|
static const char *DEFAULT_FONT = "monospace-8";
|
||||||
#endif
|
|
||||||
|
|
||||||
/* if true, statusbar appears on top of the window */
|
/* if true, statusbar appears on top of the window */
|
||||||
static const bool TOP_STATUSBAR = false;
|
static const bool TOP_STATUSBAR = false;
|
||||||
|
#endif /* HAVE_LIBFONTS */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef _IMAGE_CONFIG
|
#ifdef _IMAGE_CONFIG
|
||||||
|
2
main.c
2
main.c
@ -233,7 +233,7 @@ static bool check_timeouts(struct timeval *t)
|
|||||||
return tmin > 0;
|
return tmin > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t get_win_title(char *buf, int len)
|
size_t get_win_title(unsigned char *buf, int len)
|
||||||
{
|
{
|
||||||
char *argv[8];
|
char *argv[8];
|
||||||
spawn_t pfd;
|
spawn_t pfd;
|
||||||
|
1
nsxiv.h
1
nsxiv.h
@ -380,6 +380,7 @@ enum {
|
|||||||
ATOM__NET_WM_STATE,
|
ATOM__NET_WM_STATE,
|
||||||
ATOM__NET_WM_PID,
|
ATOM__NET_WM_PID,
|
||||||
ATOM__NET_WM_STATE_FULLSCREEN,
|
ATOM__NET_WM_STATE_FULLSCREEN,
|
||||||
|
ATOM_UTF8_STRING,
|
||||||
ATOM_COUNT
|
ATOM_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
11
window.c
11
window.c
@ -30,7 +30,7 @@
|
|||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xresource.h>
|
#include <X11/Xresource.h>
|
||||||
|
|
||||||
extern size_t get_win_title(char *, int);
|
extern size_t get_win_title(unsigned char *, int);
|
||||||
|
|
||||||
#if HAVE_LIBFONTS
|
#if HAVE_LIBFONTS
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
@ -170,6 +170,7 @@ void win_init(win_t *win)
|
|||||||
INIT_ATOM_(_NET_WM_STATE);
|
INIT_ATOM_(_NET_WM_STATE);
|
||||||
INIT_ATOM_(_NET_WM_PID);
|
INIT_ATOM_(_NET_WM_PID);
|
||||||
INIT_ATOM_(_NET_WM_STATE_FULLSCREEN);
|
INIT_ATOM_(_NET_WM_STATE_FULLSCREEN);
|
||||||
|
INIT_ATOM_(UTF8_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_open(win_t *win)
|
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)
|
void win_set_title(win_t *win)
|
||||||
{
|
{
|
||||||
char title[512];
|
unsigned char title[512];
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if ((len = get_win_title(title, ARRLEN(title))) <= 0)
|
if ((len = get_win_title(title, ARRLEN(title))) <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XChangeProperty(win->env.dpy, win->xwin, atoms[ATOM__NET_WM_NAME],
|
XChangeProperty(win->env.dpy, win->xwin, atoms[ATOM__NET_WM_NAME],
|
||||||
XInternAtom(win->env.dpy, "UTF8_STRING", False), 8,
|
atoms[ATOM_UTF8_STRING], 8, PropModeReplace, title, len);
|
||||||
PropModeReplace, (unsigned char *) title, len);
|
|
||||||
XChangeProperty(win->env.dpy, win->xwin, atoms[ATOM__NET_WM_ICON_NAME],
|
XChangeProperty(win->env.dpy, win->xwin, atoms[ATOM__NET_WM_ICON_NAME],
|
||||||
XInternAtom(win->env.dpy, "UTF8_STRING", False), 8,
|
atoms[ATOM_UTF8_STRING], 8, PropModeReplace, title, len);
|
||||||
PropModeReplace, (unsigned char *) title, len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_set_cursor(win_t *win, cursor_t cursor)
|
void win_set_cursor(win_t *win, cursor_t cursor)
|
||||||
|
Loading…
Reference in New Issue
Block a user