make some changes prepping for clang-format
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
This commit is contained in:
parent
8c876199b1
commit
2434e83807
|
@ -326,10 +326,10 @@ bool ci_drag(arg_t drag_mode)
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (drag_mode == DRAG_ABSOLUTE) {
|
if (drag_mode == DRAG_ABSOLUTE) {
|
||||||
px = MIN(MAX(0.0, x - win.w*0.1), win.w*0.8) / (win.w*0.8)
|
px = MIN(MAX(0.0, x - win.w*0.1), win.w*0.8) /
|
||||||
* (win.w - img.w * img.zoom);
|
(win.w*0.8) * (win.w - img.w * img.zoom);
|
||||||
py = MIN(MAX(0.0, y - win.h*0.1), win.h*0.8) / (win.h*0.8)
|
py = MIN(MAX(0.0, y - win.h*0.1), win.h*0.8) /
|
||||||
* (win.h - img.h * img.zoom);
|
(win.h*0.8) * (win.h - img.h * img.zoom);
|
||||||
} else {
|
} else {
|
||||||
px = img.x + x - ox;
|
px = img.x + x - ox;
|
||||||
py = img.y + y - oy;
|
py = img.y + y - oy;
|
||||||
|
|
9
image.c
9
image.c
|
@ -282,8 +282,9 @@ static bool img_load_gif(img_t *img, const fileinfo_t *file)
|
||||||
if (i < y || i >= y + h || j < x || j >= x + w ||
|
if (i < y || i >= y + h || j < x || j >= x + w ||
|
||||||
rows[i-y][j-x] == transp)
|
rows[i-y][j-x] == transp)
|
||||||
{
|
{
|
||||||
if (prev_frame != NULL && (prev_disposal != 2 ||
|
if (prev_frame != NULL &&
|
||||||
i < py || i >= py + ph || j < px || j >= px + pw))
|
(prev_disposal != 2 || i < py || i >= py + ph ||
|
||||||
|
j < px || j >= px + pw))
|
||||||
{
|
{
|
||||||
*ptr = prev_frame[i * sw + j];
|
*ptr = prev_frame[i * sw + j];
|
||||||
} else {
|
} else {
|
||||||
|
@ -412,8 +413,8 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
|
||||||
/* Load and decode frames (also works on images with only 1 frame) */
|
/* Load and decode frames (also works on images with only 1 frame) */
|
||||||
m->length = m->cnt = m->sel = 0;
|
m->length = m->cnt = m->sel = 0;
|
||||||
while (WebPAnimDecoderGetNext(dec, &buf, &ts)) {
|
while (WebPAnimDecoderGetNext(dec, &buf, &ts)) {
|
||||||
im = imlib_create_image_using_copied_data(
|
im = imlib_create_image_using_copied_data(info.canvas_width, info.canvas_height,
|
||||||
info.canvas_width, info.canvas_height, (uint32_t *)buf);
|
(uint32_t *)buf);
|
||||||
imlib_context_set_image(im);
|
imlib_context_set_image(im);
|
||||||
imlib_image_set_format("webp");
|
imlib_image_set_format("webp");
|
||||||
/* Get an iterator of this frame - used for frame info (duration, etc.) */
|
/* Get an iterator of this frame - used for frame info (duration, etc.) */
|
||||||
|
|
25
main.c
25
main.c
|
@ -40,15 +40,15 @@
|
||||||
#include <X11/XF86keysym.h>
|
#include <X11/XF86keysym.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
#define MODMASK(mask) ((mask) & USED_MODMASK)
|
#define MODMASK(mask) (USED_MODMASK & (mask))
|
||||||
#define BAR_SEP " "
|
#define BAR_SEP " "
|
||||||
|
|
||||||
#define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \
|
#define TV_DIFF(t1,t2) (((t1)->tv_sec - (t2)->tv_sec ) * 1000 + \
|
||||||
((t1)->tv_usec - (t2)->tv_usec) / 1000)
|
((t1)->tv_usec - (t2)->tv_usec) / 1000)
|
||||||
#define TV_ADD_MSEC(tv,t) { \
|
#define TV_ADD_MSEC(tv,t) do { \
|
||||||
(tv)->tv_sec += (t) / 1000; \
|
(tv)->tv_sec += (t) / 1000; \
|
||||||
(tv)->tv_usec += (t) % 1000 * 1000; \
|
(tv)->tv_usec += (t) % 1000 * 1000; \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int err;
|
int err;
|
||||||
|
@ -200,8 +200,8 @@ void remove_file(int n, bool manual)
|
||||||
|
|
||||||
if (n + 1 < filecnt) {
|
if (n + 1 < filecnt) {
|
||||||
if (tns.thumbs != NULL) {
|
if (tns.thumbs != NULL) {
|
||||||
memmove(tns.thumbs + n, tns.thumbs + n + 1, (filecnt - n - 1) *
|
memmove(tns.thumbs + n, tns.thumbs + n + 1,
|
||||||
sizeof(*tns.thumbs));
|
(filecnt - n - 1) * sizeof(*tns.thumbs));
|
||||||
memset(tns.thumbs + filecnt - 1, 0, sizeof(*tns.thumbs));
|
memset(tns.thumbs + filecnt - 1, 0, sizeof(*tns.thumbs));
|
||||||
}
|
}
|
||||||
memmove(files + n, files + n + 1, (filecnt - n - 1) * sizeof(*files));
|
memmove(files + n, files + n + 1, (filecnt - n - 1) * sizeof(*files));
|
||||||
|
@ -377,7 +377,7 @@ void load_image(int new)
|
||||||
if (new >= filecnt)
|
if (new >= filecnt)
|
||||||
new = filecnt - 1;
|
new = filecnt - 1;
|
||||||
else if (new > 0 && prev)
|
else if (new > 0 && prev)
|
||||||
new--;
|
new -= 1;
|
||||||
}
|
}
|
||||||
files[new].flags &= ~FF_WARN;
|
files[new].flags &= ~FF_WARN;
|
||||||
fileidx = current = new;
|
fileidx = current = new;
|
||||||
|
@ -562,8 +562,9 @@ void handle_key_handler(bool init)
|
||||||
return;
|
return;
|
||||||
if (init) {
|
if (init) {
|
||||||
close_info();
|
close_info();
|
||||||
snprintf(win.bar.l.buf, win.bar.l.size, "Getting key handler input "
|
snprintf(win.bar.l.buf, win.bar.l.size,
|
||||||
"(%s to abort)...", XKeysymToString(KEYHANDLER_ABORT));
|
"Getting key handler input (%s to abort)...",
|
||||||
|
XKeysymToString(KEYHANDLER_ABORT));
|
||||||
} else { /* abort */
|
} else { /* abort */
|
||||||
open_info();
|
open_info();
|
||||||
update_info();
|
update_info();
|
||||||
|
@ -739,8 +740,8 @@ static void run(void)
|
||||||
init_thumb = mode == MODE_THUMB && tns.initnext < filecnt;
|
init_thumb = mode == MODE_THUMB && tns.initnext < filecnt;
|
||||||
load_thumb = mode == MODE_THUMB && tns.loadnext < tns.end;
|
load_thumb = mode == MODE_THUMB && tns.loadnext < tns.end;
|
||||||
|
|
||||||
if ((init_thumb || load_thumb || to_set || info.fd != -1 ||
|
if ((init_thumb || load_thumb || to_set || info.fd != -1 || arl.fd != -1) &&
|
||||||
arl.fd != -1) && XPending(win.env.dpy) == 0)
|
XPending(win.env.dpy) == 0)
|
||||||
{
|
{
|
||||||
if (load_thumb) {
|
if (load_thumb) {
|
||||||
set_timeout(redraw, TO_REDRAW_THUMBS, false);
|
set_timeout(redraw, TO_REDRAW_THUMBS, false);
|
||||||
|
@ -793,8 +794,8 @@ static void run(void)
|
||||||
discard = ev.type == nextev.type;
|
discard = ev.type == nextev.type;
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
discard = (nextev.type == KeyPress || nextev.type == KeyRelease)
|
discard = (nextev.type == KeyPress || nextev.type == KeyRelease) &&
|
||||||
&& ev.xkey.keycode == nextev.xkey.keycode;
|
ev.xkey.keycode == nextev.xkey.keycode;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
window.c
4
window.c
|
@ -226,8 +226,8 @@ void win_open(win_t *win)
|
||||||
if (gmask & YValue) {
|
if (gmask & YValue) {
|
||||||
if (gmask & YNegative) {
|
if (gmask & YNegative) {
|
||||||
win->y += e->scrh - win->h;
|
win->y += e->scrh - win->h;
|
||||||
sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity
|
sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity ?
|
||||||
? SouthEastGravity : SouthWestGravity;
|
SouthEastGravity : SouthWestGravity;
|
||||||
}
|
}
|
||||||
sizehints.flags |= USPosition;
|
sizehints.flags |= USPosition;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue