aboutsummaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authorN-R-K <79544946+N-R-K@users.noreply.github.com>2021-10-28 22:00:53 +0200
committerGitHub <noreply@github.com>2021-10-28 22:00:53 +0200
commit850bc788c3fd4bb96f425ceedfe4237754cabe46 (patch)
tree8007a27013fe67601640e257310161a2c254f3ba /window.c
parent03eb664e89d01cb9a28a9a2dcbad6aac208fa03b (diff)
downloadnsxiv-850bc788c3fd4bb96f425ceedfe4237754cabe46.tar.zst
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 <uidops@protonmail.com> Co-authored-by: Arthur Williams <taaparthur@gmail.com>
Diffstat (limited to 'window.c')
-rw-r--r--window.c20
1 files changed, 10 insertions, 10 deletions
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,