-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Latest round of fixes from upstream:
* fix --draw-filename "x of y" being cut off by short filenames * respect --zoom 100 in --fullscreen mode
- Loading branch information
David Coppa
committed
Jun 28, 2011
1 parent
b0092fc
commit 753bb80
Showing
4 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
$OpenBSD: patch-src_imlib_c,v 1.7 2011/06/28 07:40:08 dcoppa Exp $ | ||
--- src/imlib.c.orig Thu May 19 22:36:13 2011 | ||
+++ src/imlib.c Tue Jun 28 09:30:29 2011 | ||
@@ -434,7 +434,7 @@ void feh_draw_errstr(winwidget w) | ||
void feh_draw_filename(winwidget w) | ||
{ | ||
static Imlib_Font fn = NULL; | ||
- int tw = 0, th = 0; | ||
+ int tw = 0, th = 0, nw = 0; | ||
Imlib_Image im = NULL; | ||
static DATA8 atab[256]; | ||
char *s = NULL; | ||
@@ -462,10 +462,22 @@ void feh_draw_filename(winwidget w) | ||
memset(atab, 0, sizeof(atab)); | ||
|
||
/* Work out how high the font is */ | ||
- gib_imlib_get_text_size(fn, FEH_FILE(w->file->data)->filename, NULL, &tw, &th, IMLIB_TEXT_TO_RIGHT); | ||
+ gib_imlib_get_text_size(fn, FEH_FILE(w->file->data)->filename, NULL, &tw, | ||
+ &th, IMLIB_TEXT_TO_RIGHT); | ||
|
||
- /* tw is no longer correct, if the filename is shorter than | ||
- * the string "%d of %d" used below in fullscreen mode */ | ||
+ if (gib_list_length(filelist) > 1) { | ||
+ len = snprintf(NULL, 0, "%d of %d", gib_list_length(filelist), | ||
+ gib_list_length(filelist)) + 1; | ||
+ s = emalloc(len); | ||
+ snprintf(s, len, "%d of %d", gib_list_num(filelist, current_file) + | ||
+ 1, gib_list_length(filelist)); | ||
+ | ||
+ gib_imlib_get_text_size(fn, s, NULL, &nw, NULL, IMLIB_TEXT_TO_RIGHT); | ||
+ | ||
+ if (nw > tw) | ||
+ tw = nw; | ||
+ } | ||
+ | ||
tw += 3; | ||
th += 3; | ||
im = imlib_create_image(tw, 2 * th); | ||
@@ -473,20 +485,16 @@ void feh_draw_filename(winwidget w) | ||
eprintf("Couldn't create image. Out of memory?"); | ||
|
||
gib_imlib_image_set_has_alpha(im, 1); | ||
- gib_imlib_apply_color_modifier_to_rectangle(im, 0, 0, tw, 2 * th, NULL, NULL, NULL, atab); | ||
+ gib_imlib_apply_color_modifier_to_rectangle(im, 0, 0, tw, 2 * th, NULL, | ||
+ NULL, NULL, atab); | ||
gib_imlib_image_fill_rectangle(im, 0, 0, tw, 2 * th, 0, 0, 0, 0); | ||
|
||
gib_imlib_text_draw(im, fn, NULL, 2, 2, FEH_FILE(w->file->data)->filename, | ||
IMLIB_TEXT_TO_RIGHT, 0, 0, 0, 255); | ||
gib_imlib_text_draw(im, fn, NULL, 1, 1, FEH_FILE(w->file->data)->filename, | ||
IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); | ||
- /* Print the position in the filelist, if we have >=2 files */ | ||
- if (gib_list_length(filelist) > 1) { | ||
- /* sic! */ | ||
- len = snprintf(NULL, 0, "%d of %d", gib_list_length(filelist), gib_list_length(filelist)) + 1; | ||
- s = emalloc(len); | ||
- snprintf(s, len, "%d of %d", gib_list_num(filelist, current_file) + 1, gib_list_length(filelist)); | ||
- /* This should somehow be right-aligned */ | ||
+ | ||
+ if (s) { | ||
gib_imlib_text_draw(im, fn, NULL, 2, th + 1, s, IMLIB_TEXT_TO_RIGHT, 0, 0, 0, 255); | ||
gib_imlib_text_draw(im, fn, NULL, 1, th, s, IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); | ||
free(s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$OpenBSD: patch-src_winwidget_c,v 1.5 2011/06/28 07:40:08 dcoppa Exp $ | ||
--- src/winwidget.c.orig Thu May 19 22:36:13 2011 | ||
+++ src/winwidget.c Tue Jun 28 09:33:26 2011 | ||
@@ -464,10 +464,12 @@ void winwidget_render_image(winwidget winwid, int resi | ||
double old_zoom = winwid->zoom; | ||
|
||
winwid->zoom = 0.01 * opt.default_zoom; | ||
- if ((winwid->im_h * winwid->zoom) > max_h) | ||
- winwid->zoom = old_zoom; | ||
- if ((winwid->im_w * winwid->zoom) > max_w) | ||
- winwid->zoom = old_zoom; | ||
+ if (winwid->zoom != 1.0) { | ||
+ if ((winwid->im_h * winwid->zoom) > max_h) | ||
+ winwid->zoom = old_zoom; | ||
+ else if ((winwid->im_w * winwid->zoom) > max_w) | ||
+ winwid->zoom = old_zoom; | ||
+ } | ||
|
||
winwid->im_x = ((int) | ||
(max_w - (winwid->im_w * winwid->zoom))) >> 1; |