diff options
author | explosion-mental <explosion-mental@noreply.codeberg.org> | 2022-08-16 10:54:31 +0200 |
---|---|---|
committer | NRK <nrk@disroot.org> | 2022-08-16 10:54:31 +0200 |
commit | 0f0c49a630285af10c765e0b724896ff281e7b66 (patch) | |
tree | 96ba66a1ff64cd89c2fd75f8f0d736aa34fc3c56 /main.c | |
parent | 6578e6eb6533a6651bd88ecae7720aced88c8c2f (diff) | |
download | nsxiv-0f0c49a630285af10c765e0b724896ff281e7b66.tar.zst |
code-style: don't indent switch cases (#358)
The suckless coding style [^0] and the linux coding style [^1] both
recommends not indenting switch cases. And it helps out people with
lower resolution monitors.
[^0]: https://suckless.org/coding_style/
[^1]: https://www.kernel.org/doc/html/v5.10/process/coding-style.html#indentation
Co-authored-by: explosion-mental <explosion0mental@gmail.com>
Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/358
Reviewed-by: NRK <nrk@disroot.org>
Co-authored-by: explosion-mental <explosion-mental@noreply.codeberg.org>
Co-committed-by: explosion-mental <explosion-mental@noreply.codeberg.org>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 87 |
1 files changed, 43 insertions, 44 deletions
@@ -753,56 +753,55 @@ static void run(void) if (XEventsQueued(win.env.dpy, QueuedAlready) > 0) { XPeekEvent(win.env.dpy, &nextev); switch (ev.type) { - case ConfigureNotify: - case MotionNotify: - discard = ev.type == nextev.type; - break; - case KeyPress: - discard = (nextev.type == KeyPress || nextev.type == KeyRelease) - && ev.xkey.keycode == nextev.xkey.keycode; - break; + case ConfigureNotify: + case MotionNotify: + discard = ev.type == nextev.type; + break; + case KeyPress: + discard = (nextev.type == KeyPress || nextev.type == KeyRelease) + && ev.xkey.keycode == nextev.xkey.keycode; + break; } } } while (discard); - switch (ev.type) { - /* handle events */ - case ButtonPress: - on_buttonpress(&ev.xbutton); - break; - case ClientMessage: - if ((Atom) ev.xclient.data.l[0] == atoms[ATOM_WM_DELETE_WINDOW]) - cg_quit(EXIT_SUCCESS); - break; - case DestroyNotify: - cg_quit(EXIT_FAILURE); - break; - case ConfigureNotify: - if (win_configure(&win, &ev.xconfigure)) { - if (mode == MODE_IMAGE) { - img.dirty = true; - img.checkpan = true; - } else { - tns.dirty = true; - } - if (!resized) { - redraw(); - set_timeout(clear_resize, TO_REDRAW_RESIZE, false); - resized = true; - } else { - set_timeout(redraw, TO_REDRAW_RESIZE, false); - } - } - break; - case KeyPress: - on_keypress(&ev.xkey); - break; - case MotionNotify: + switch (ev.type) { /* handle events */ + case ButtonPress: + on_buttonpress(&ev.xbutton); + break; + case ClientMessage: + if ((Atom) ev.xclient.data.l[0] == atoms[ATOM_WM_DELETE_WINDOW]) + cg_quit(EXIT_SUCCESS); + break; + case DestroyNotify: + cg_quit(EXIT_FAILURE); + break; + case ConfigureNotify: + if (win_configure(&win, &ev.xconfigure)) { if (mode == MODE_IMAGE) { - set_timeout(reset_cursor, TO_CURSOR_HIDE, true); - reset_cursor(); + img.dirty = true; + img.checkpan = true; + } else { + tns.dirty = true; } - break; + if (!resized) { + redraw(); + set_timeout(clear_resize, TO_REDRAW_RESIZE, false); + resized = true; + } else { + set_timeout(redraw, TO_REDRAW_RESIZE, false); + } + } + break; + case KeyPress: + on_keypress(&ev.xkey); + break; + case MotionNotify: + if (mode == MODE_IMAGE) { + set_timeout(reset_cursor, TO_CURSOR_HIDE, true); + reset_cursor(); + } + break; } } } |