Krolyxon
Commit 2434e83

Branches

Refs →

nsxiv2434e83

make some changes prepping for clang-format

Author
NRK
Date
2022-07-02 21:06 +0600
Committer
NRK · 2023-03-11 18:36 +0600
Parent
8c87619
Commit
2434e83807360bfe43e3c404be12438f00a894ab

+24 −22

4 files changed

  1. M commands.c +4 −4
  2. M image.c +5 −4
  3. M main.c +13 −12
  4. M window.c +2 −2
M commands.c View
@@ -326,10 +326,10 @@ bool ci_drag(arg_t drag_mode)
326326
327327 while (true) {
328328 if (drag_mode == DRAG_ABSOLUTE) {
329− px = MIN(MAX(0.0, x - win.w*0.1), win.w*0.8) / (win.w*0.8)
330− * (win.w - img.w * img.zoom);
331− py = MIN(MAX(0.0, y - win.h*0.1), win.h*0.8) / (win.h*0.8)
332− * (win.h - img.h * img.zoom);
329+ px = MIN(MAX(0.0, x - win.w*0.1), win.w*0.8) /
330+ (win.w*0.8) * (win.w - img.w * img.zoom);
331+ py = MIN(MAX(0.0, y - win.h*0.1), win.h*0.8) /
332+ (win.h*0.8) * (win.h - img.h * img.zoom);
333333 } else {
334334 px = img.x + x - ox;
335335 py = img.y + y - oy;
M image.c View
@@ -282,8 +282,9 @@ static bool img_load_gif(img_t *img, const fileinfo_t *file)
282282 if (i < y || i >= y + h || j < x || j >= x + w ||
283283 rows[i-y][j-x] == transp)
284284 {
285− if (prev_frame != NULL && (prev_disposal != 2 ||
286− i < py || i >= py + ph || j < px || j >= px + pw))
285+ if (prev_frame != NULL &&
286+ (prev_disposal != 2 || i < py || i >= py + ph ||
287+ j < px || j >= px + pw))
287288 {
288289 *ptr = prev_frame[i * sw + j];
289290 } else {
@@ -412,8 +413,8 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
412413 /* Load and decode frames (also works on images with only 1 frame) */
413414 m->length = m->cnt = m->sel = 0;
414415 while (WebPAnimDecoderGetNext(dec, &buf, &ts)) {
415− im = imlib_create_image_using_copied_data(
416− info.canvas_width, info.canvas_height, (uint32_t *)buf);
416+ im = imlib_create_image_using_copied_data(info.canvas_width, info.canvas_height,
417+ (uint32_t *)buf);
417418 imlib_context_set_image(im);
418419 imlib_image_set_format("webp");
419420 /* Get an iterator of this frame - used for frame info (duration, etc.) */
M main.c View
@@ -40,15 +40,15 @@
4040 #include <X11/XF86keysym.h>
4141 #include <X11/keysym.h>
4242
43−#define MODMASK(mask) ((mask) & USED_MODMASK)
43+#define MODMASK(mask) (USED_MODMASK & (mask))
4444 #define BAR_SEP " "
4545
4646 #define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \
4747 ((t1)->tv_usec - (t2)->tv_usec) / 1000)
48−#define TV_ADD_MSEC(tv,t) { \
48+#define TV_ADD_MSEC(tv,t) do { \
4949 (tv)->tv_sec += (t) / 1000; \
5050 (tv)->tv_usec += (t) % 1000 * 1000; \
51−}
51+} while (0)
5252
5353 typedef struct {
5454 int err;
@@ -200,8 +200,8 @@ void remove_file(int n, bool manual)
200200
201201 if (n + 1 < filecnt) {
202202 if (tns.thumbs != NULL) {
203− memmove(tns.thumbs + n, tns.thumbs + n + 1, (filecnt - n - 1) *
204− sizeof(*tns.thumbs));
203+ memmove(tns.thumbs + n, tns.thumbs + n + 1,
204+ (filecnt - n - 1) * sizeof(*tns.thumbs));
205205 memset(tns.thumbs + filecnt - 1, 0, sizeof(*tns.thumbs));
206206 }
207207 memmove(files + n, files + n + 1, (filecnt - n - 1) * sizeof(*files));
@@ -377,7 +377,7 @@ void load_image(int new)
377377 if (new >= filecnt)
378378 new = filecnt - 1;
379379 else if (new > 0 && prev)
380− new--;
380+ new -= 1;
381381 }
382382 files[new].flags &= ~FF_WARN;
383383 fileidx = current = new;
@@ -562,8 +562,9 @@ void handle_key_handler(bool init)
562562 return;
563563 if (init) {
564564 close_info();
565− snprintf(win.bar.l.buf, win.bar.l.size, "Getting key handler input "
566− "(%s to abort)...", XKeysymToString(KEYHANDLER_ABORT));
565+ snprintf(win.bar.l.buf, win.bar.l.size,
566+ "Getting key handler input (%s to abort)...",
567+ XKeysymToString(KEYHANDLER_ABORT));
567568 } else { /* abort */
568569 open_info();
569570 update_info();
@@ -739,8 +740,8 @@ static void run(void)
739740 init_thumb = mode == MODE_THUMB && tns.initnext < filecnt;
740741 load_thumb = mode == MODE_THUMB && tns.loadnext < tns.end;
741742
742− if ((init_thumb || load_thumb || to_set || info.fd != -1 ||
743− arl.fd != -1) && XPending(win.env.dpy) == 0)
743+ if ((init_thumb || load_thumb || to_set || info.fd != -1 || arl.fd != -1) &&
744+ XPending(win.env.dpy) == 0)
744745 {
745746 if (load_thumb) {
746747 set_timeout(redraw, TO_REDRAW_THUMBS, false);
@@ -793,8 +794,8 @@ static void run(void)
793794 discard = ev.type == nextev.type;
794795 break;
795796 case KeyPress:
796− discard = (nextev.type == KeyPress || nextev.type == KeyRelease)
797− && ev.xkey.keycode == nextev.xkey.keycode;
797+ discard = (nextev.type == KeyPress || nextev.type == KeyRelease) &&
798+ ev.xkey.keycode == nextev.xkey.keycode;
798799 break;
799800 }
800801 }
M window.c View
@@ -226,8 +226,8 @@ void win_open(win_t *win)
226226 if (gmask & YValue) {
227227 if (gmask & YNegative) {
228228 win->y += e->scrh - win->h;
229− sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity
230− ? SouthEastGravity : SouthWestGravity;
229+ sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity ?
230+ SouthEastGravity : SouthWestGravity;
231231 }
232232 sizehints.flags |= USPosition;
233233 } else {