From 0f0c49a630285af10c765e0b724896ff281e7b66 Mon Sep 17 00:00:00 2001 From: explosion-mental Date: Tue, 16 Aug 2022 10:54:31 +0200 Subject: 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 Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/358 Reviewed-by: NRK Co-authored-by: explosion-mental Co-committed-by: explosion-mental --- main.c | 87 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 43 insertions(+), 44 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 02128a7..a7b6fa9 100644 --- a/main.c +++ b/main.c @@ -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; } } } -- cgit v1.2.3-54-g00ecf