From 850bc788c3fd4bb96f425ceedfe4237754cabe46 Mon Sep 17 00:00:00 2001 From: N-R-K <79544946+N-R-K@users.noreply.github.com> Date: Fri, 29 Oct 2021 02:00:53 +0600 Subject: code-style: general cleanups (#137) * tns_clean_cache: remove unused function arg * remove malloc casting * improve consistency use sizeof(T) at the end * avoid comparing integers of different signedness * use Window type for embed and parent * remove unnecessary comparisons * remove cpp style comments * improve consistency: remove comma from the end of enumerator list * Removed useless _IMAGE_CONFIG defines * consistency: use the same order as snprintf * Resolve c89 warnings Co-authored-by: uidops Co-authored-by: Arthur Williams --- window.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index 77eb9a0..97e424f 100644 --- a/window.c +++ b/window.c @@ -172,7 +172,7 @@ void win_init(win_t *win) void win_open(win_t *win) { int c, i, j, n; - long parent; + Window parent; win_env_t *e; XClassHint classhint; unsigned long *icon_data; @@ -188,7 +188,7 @@ void win_open(win_t *win) XSetWindowAttributes attrs; e = &win->env; - parent = options->embed != 0 ? options->embed : RootWindow(e->dpy, e->scr); + parent = options->embed ? options->embed : RootWindow(e->dpy, e->scr); sizehints.flags = PWinGravity; sizehints.win_gravity = NorthWestGravity; @@ -199,16 +199,16 @@ void win_open(win_t *win) else gmask = XParseGeometry(options->geometry, &win->x, &win->y, &win->w, &win->h); - if ((gmask & WidthValue) != 0) + if (gmask & WidthValue) sizehints.flags |= USSize; else win->w = WIN_WIDTH; - if ((gmask & HeightValue) != 0) + if (gmask & HeightValue) sizehints.flags |= USSize; else win->h = WIN_HEIGHT; - if ((gmask & XValue) != 0) { - if ((gmask & XNegative) != 0) { + if (gmask & XValue) { + if (gmask & XNegative) { win->x += e->scrw - win->w; sizehints.win_gravity = NorthEastGravity; } @@ -216,8 +216,8 @@ void win_open(win_t *win) } else { win->x = 0; } - if ((gmask & YValue) != 0) { - if ((gmask & YNegative) != 0) { + if (gmask & YValue) { + if (gmask & YNegative) { win->y += e->scrh - win->h; sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity ? SouthEastGravity : SouthWestGravity; @@ -322,7 +322,7 @@ void win_open(win_t *win) CLEANUP void win_close(win_t *win) { - int i; + unsigned int i; for (i = 0; i < ARRLEN(cursors); i++) XFreeCursor(win->env.dpy, cursors[i].icon); @@ -360,7 +360,7 @@ void win_toggle_fullscreen(win_t *win) cm->window = win->xwin; cm->message_type = atoms[ATOM__NET_WM_STATE]; cm->format = 32; - cm->data.l[0] = 2; // toggle + cm->data.l[0] = 2; /* toggle */ cm->data.l[1] = atoms[ATOM__NET_WM_STATE_FULLSCREEN]; XSendEvent(win->env.dpy, DefaultRootWindow(win->env.dpy), False, -- cgit v1.2.3-54-g00ecf