Appropriate title for thumbnail mode
This commit is contained in:
parent
1c072cc0d0
commit
e09a6b5e3f
17
main.c
17
main.c
|
@ -158,6 +158,11 @@ void update_title() {
|
||||||
float size;
|
float size;
|
||||||
const char *unit;
|
const char *unit;
|
||||||
|
|
||||||
|
if (mode == MODE_THUMBS) {
|
||||||
|
n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] %s",
|
||||||
|
tns.cnt ? tns.sel + 1 : 0, tns.cnt,
|
||||||
|
tns.cnt ? tns.thumbs[tns.sel].filename : "");
|
||||||
|
} else {
|
||||||
if (img.valid) {
|
if (img.valid) {
|
||||||
size = filesize;
|
size = filesize;
|
||||||
size_readable(&size, &unit);
|
size_readable(&size, &unit);
|
||||||
|
@ -168,6 +173,7 @@ void update_title() {
|
||||||
n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] broken: %s",
|
n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] broken: %s",
|
||||||
fileidx + 1, filecnt, filenames[fileidx]);
|
fileidx + 1, filecnt, filenames[fileidx]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (n >= TITLE_LEN) {
|
if (n >= TITLE_LEN) {
|
||||||
win_title[TITLE_LEN - 2] = '.';
|
win_title[TITLE_LEN - 2] = '.';
|
||||||
|
@ -491,7 +497,7 @@ void run() {
|
||||||
if (tns_loaded == filecnt)
|
if (tns_loaded == filecnt)
|
||||||
win_set_cursor(&win, CURSOR_ARROW);
|
win_set_cursor(&win, CURSOR_ARROW);
|
||||||
if (!XPending(win.env.dpy)) {
|
if (!XPending(win.env.dpy)) {
|
||||||
tns_render(&tns, &win);
|
redraw();
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
timeout = 1;
|
timeout = 1;
|
||||||
|
@ -503,13 +509,8 @@ void run() {
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(xfd, &fds);
|
FD_SET(xfd, &fds);
|
||||||
|
|
||||||
if (!XPending(win.env.dpy) && !select(xfd + 1, &fds, 0, 0, &t)) {
|
if (!XPending(win.env.dpy) && !select(xfd + 1, &fds, 0, 0, &t))
|
||||||
timeout = 0;
|
redraw();
|
||||||
if (mode == MODE_NORMAL)
|
|
||||||
img_render(&img, &win);
|
|
||||||
else
|
|
||||||
tns_render(&tns, &win);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!XNextEvent(win.env.dpy, &ev)) {
|
if (!XNextEvent(win.env.dpy, &ev)) {
|
||||||
|
|
1
thumbs.c
1
thumbs.c
|
@ -69,6 +69,7 @@ void tns_load(tns_t *tns, win_t *win, const char *filename) {
|
||||||
z = MIN(zw, zh);
|
z = MIN(zw, zh);
|
||||||
|
|
||||||
t = &tns->thumbs[tns->cnt++];
|
t = &tns->thumbs[tns->cnt++];
|
||||||
|
t->filename = filename;
|
||||||
t->w = z * w;
|
t->w = z * w;
|
||||||
t->h = z * h;
|
t->h = z * h;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue