From b11384a6942cdf3c6b6f55e0dcc0a438eff7158a Mon Sep 17 00:00:00 2001 From: NRK Date: Wed, 19 Oct 2022 14:46:22 +0200 Subject: code-style: misc changes (#374) * ensure static variables comes after non-static ones * remove depreciated DATA32 type * prefer `sizeof(expression)` over `sizeof(Type)`. * silence a -Wsign warning * {gif,webp} loader: use a pointer to reduce code-noise * gif loader: allocate in one place Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/374 Reviewed-by: TAAPArthur --- window.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index e385be7..136b452 100644 --- a/window.c +++ b/window.c @@ -34,14 +34,11 @@ #if HAVE_LIBFONTS #include "utf8.h" #define UTF8_PADDING 4 /* utf8_decode requires 4 bytes of zero padding */ -static XftFont *font; -static double fontsize; #define TEXTWIDTH(win, text, len) \ win_draw_text(win, NULL, NULL, 0, 0, text, len, 0) #endif #define RES_CLASS "Nsxiv" - #define INIT_ATOM_(atom) \ atoms[ATOM_##atom] = XInternAtom(e->dpy, #atom, False); @@ -50,6 +47,10 @@ enum { V_TEXT_PAD = 1 }; +Atom atoms[ATOM_COUNT]; + +static GC gc; +static int barheight; static struct { int name; Cursor icon; @@ -58,11 +59,10 @@ static struct { { XC_sb_left_arrow }, { XC_sb_right_arrow } }; -static GC gc; - -static int barheight; - -Atom atoms[ATOM_COUNT]; +#if HAVE_LIBFONTS +static XftFont *font; +static double fontsize; +#endif #if HAVE_LIBFONTS static void win_init_font(const win_env_t *e, const char *fontstr) @@ -116,7 +116,7 @@ void win_init(win_t *win) static char lbuf[512 + UTF8_PADDING], rbuf[64 + UTF8_PADDING]; #endif - memset(win, 0, sizeof(win_t)); + memset(win, 0, sizeof(*win)); e = &win->env; if ((e->dpy = XOpenDisplay(NULL)) == NULL) -- cgit v1.2.3-54-g00ecf