summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog33
-rw-r--r--Makefile3
-rw-r--r--config.mk2
-rw-r--r--man/feh.pre274
-rw-r--r--src/events.c20
-rw-r--r--src/feh.h3
-rw-r--r--src/feh_png.c4
-rw-r--r--src/filelist.c33
-rw-r--r--src/filelist.h1
-rw-r--r--src/help.raw2
-rw-r--r--src/imlib.c38
-rw-r--r--src/keyevents.c36
-rw-r--r--src/menu.c10
-rw-r--r--src/multiwindow.c4
-rw-r--r--src/options.c26
-rw-r--r--src/options.h2
-rw-r--r--src/signals.c5
-rw-r--r--src/slideshow.c41
-rw-r--r--src/support.c173
-rw-r--r--src/thumbnail.c4
-rw-r--r--src/winwidget.c31
-rw-r--r--src/winwidget.h5
-rwxr-xr-xtest/feh.i8
-rw-r--r--test/feh.t27
-rw-r--r--test/scr/caption_donebin9669 -> 9603 bytes
-rw-r--r--test/scr/caption_newbin19333 -> 19221 bytes
-rw-r--r--test/scr/caption_whilebin21458 -> 21269 bytes
-rw-r--r--test/scr/draw_actionbin8315 -> 8287 bytes
-rw-r--r--test/scr/draw_all_multibin11416 -> 11334 bytes
-rw-r--r--test/scr/draw_all_onebin11113 -> 11045 bytes
-rw-r--r--test/scr/draw_filenamebin7796 -> 7804 bytes
-rw-r--r--test/scr/draw_filename_actionbin9549 -> 9525 bytes
-rw-r--r--test/scr/thumbnail_defaultbin1712 -> 1712 bytes
33 files changed, 576 insertions, 209 deletions
diff --git a/ChangeLog b/ChangeLog
index 41742ae..572e51f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,41 @@
git HEAD
+ * Only create caption directory when actually writing out a caption.
+ <http://github.com/derf/feh/issues/42>
+ * The --menu-bg option has been deprecated. It will be removed along with
+ --menu-style by the end of 2012.
+ <http://github.com/derf/feh/issues/27>
+ * read directory contents sorted by filename instead of 'randomly'
+ (as returned by readdir) by default. Thanks talisein!
+ <https://github.com/derf/feh/pull/20>
+
+Sat, 23 Apr 2011 22:00:27 +0200 Daniel Friesel <derf@finalrewind.org>
+
+* Release v1.13
+ * Fix segfault upon unloadable images when image-related format specifiers
+ (e.g. %h) are used in --title
+ * Show images in current directory when invoked without file arguments
+ * Option to disable antialiasing, either global (--force-aliasing) or per
+ image (press 'A' to toggle, keybinding toggle_aliasing)
+ * Use SIGUSR1/SIGUSR2 to reload all images in multiwindow mode
+ * Fix Imlib2 caching bug in reload (only worked after the second try)
+ * The --bg options are now Xinerama-aware. That is, they set the image in
+ the respective mode (scale/fill/max/center) on each Xinerama screen. Use
+ --no-xinerama to disable this.
+
+Sat, 12 Mar 2011 22:49:53 +0100 Daniel Friesel <derf@finalrewind.org>
+
+* Release v1.12
* Add --zoom fill as equivalent for --auto-zoom
* Add --zoom max (zooming like in --bg-max)
* --menu-style is now deprecated
+ * http images are now viewed using libcurl, not wget (thanks to talisein)
+ This adds libcurl as dependency, and removes the wget recommendation
+ * Slight build system change: make now has flags, e.g.
+ "make xinerama=0 debug=1". By default feh is compiled with xinerama and
+ libcurl support enabled, see README.
+ * Remove builtin http client (--builtin)
+ * Fix compilation issues with libpng 1.5.1
Wed, 09 Feb 2011 20:11:26 +0100 Daniel Friesel <derf@finalrewind.org>
diff --git a/Makefile b/Makefile
index 7de7229..a5d5ddd 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ build-man:
@${MAKE} -C man
test: all
- @PACKAGE=${PACKAGE} VERSION=${VERSION} prove test
+ @PACKAGE=${PACKAGE} prove test
test-x11: all
test/run-interactive
@@ -68,6 +68,7 @@ uninstall:
dist:
mkdir /tmp/feh-${VERSION}
git --work-tree=/tmp/feh-${VERSION} checkout -f
+ cp src/deps.mk /tmp/feh-${VERSION}/src/deps.mk
sed -i 's/^VERSION ?= .*$$/VERSION ?= ${VERSION}/' \
/tmp/feh-${VERSION}/config.mk
tar -C /tmp -cjf ../feh-${VERSION}.tar.bz2 feh-${VERSION}
diff --git a/config.mk b/config.mk
index a563c24..b19a6df 100644
--- a/config.mk
+++ b/config.mk
@@ -31,7 +31,7 @@ endif
ifeq (${debug},1)
CFLAGS += -DDEBUG
- MAN_DEBUG = This is a debug build.
+ MAN_DEBUG = . This is a debug build.
else
MAN_DEBUG =
endif
diff --git a/man/feh.pre b/man/feh.pre
index e3609a0..e2fda9f 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -19,9 +19,11 @@
.Sh VERSION
.
This manual documents feh $VERSION$
+.
.Pp
+.
Compile-time switches: libcurl support $MAN_CURL$, Xinerama support
-$MAN_XINERAMA$. $MAN_DEBUG$
+$MAN_XINERAMA$$MAN_DEBUG$
.
.
.Sh DESCRIPTION
@@ -32,7 +34,9 @@ need a fast image viewer without huge GUI dependencies, though it can also be
started by
.Pq graphical
file managers to view an image.
+.
.Pp
+.
.Nm
supports filelists, various image sorting modes, image captions and more.
Configurable keyboard shortcuts are used to control it; the mouse is also
@@ -44,37 +48,53 @@ supported, but only required for very few actions.
.Nm
is based on various modes, which are selected at startup by comandline
options.
+.
.Pp
+.
Slideshow mode is the default. It opens one window and displays the first
image in it, the keyboard and mouse can be used to change slides
.Pq images .
In slideshow mode, images can be deleted either from the filelist or from the
disk, the new filelist can then be saved to the disk and reopened at a later
time.
+.
.Pp
+.
Montage mode forms a montage from the filelist. The resulting image can be
viewed or saved, and its size can be limited by height, width or both.
+.
.Pp
+.
Collage mode is very similar to montage mode, except the images are distributed
randomly and may overlap each other.
+.
.Pp
+.
Index mode forms an index print from the filelist. Image thumbnails are shown
along with the filename, filesize and pixel size, printed using a truetype
font of your choice. The resulting image can be viewed or saved, and its size
can be limited by height, width or both.
+.
.Pp
+.
Thumbnail mode is like index mode, but the mini-images are clickable and open
the selected image in a new window.
+.
.Pp
+.
Multiwindow mode shows images in multiple windows, instead of as a slideshow
in one window. Don't use with a large filelist ;)
+.
.Pp
+.
List mode doesn't display images. Outputs an
.Cm ls - No style
listing of the files in the filelist, including image info such as size,
pixels, type, etc. Customlist mode will display whatever image info you want,
in the format you choose.
+.
.Pp
+.
.Nm
can also list either all the loadable files in a filelist or all the
unloadable files. Useful for preening a directory.
@@ -85,19 +105,24 @@ unloadable files. Useful for preening a directory.
.Bl -tag -width indent
.
.It Cm -A , --action Oo Ar flag Oc Ns Ar action
+.
Specify a string as an action to perform on the image. In slideshow or
multiwindow modes, the action will be run when the enter key is pressed, in
list mode, the action will be run for each file listed. In
loadables/unloadables mode, the action will be run for each
loadable/unloadable file, respectively.
+.
.Pp
+.
If
.Ar flag
is
.Qq \&; ,
.Nm
will not switch to the next image after executing the action.
+.
.Pp
+.
The action will be executed by /bin/sh. Use format specifiers to refer to
image info. See
.Sx FORMAT SPECIFIERS
@@ -107,21 +132,26 @@ In slideshow mode, the next image will be shown after running the action, in
multiwindow mode, the window will be closed.
.
.It Cm --action1 No .. Cm --action9
+.
Extra actions which can be set and triggered using the appropiate number key.
.
.It Cm -Z , --auto-zoom
+.
Zoom pictures to screen size in fullscreen
.Pq affected by Cm --stretch No and Cm --ignore-aspect .
.
.It Cm -x , --borderless
+.
Create borderless windows.
.
.It Cm -P , --cache-thumbnails
+.
Enable (experimental) thumbnail caching in
.Pa ~/.thumbnails .
Only works with thumbnails <= 256x256 pixels.
.
.It Cm -K , --caption-path Ar path
+.
Path to directory containing image captions. This turns on caption viewing,
and if captions are found in
.Ar path ,
@@ -134,6 +164,7 @@ the caption will be looked for in
.Qq images/captions/foo.jpg.txt .
.
.It Cm -c , --collage
+.
Enable collage mode. Collage mode is very similar to montage mode, except
the images are distributed randomly.
When using collage mode, you should also specify
@@ -142,6 +173,7 @@ and
.Cm --limit-height .
.
.It Cm -L , --customlist Ar format
+.
Use
.Ar format
.Pq printf-like string containing image info specifiers
@@ -149,15 +181,19 @@ for list output. See
.Sx FORMAT SPECIFIERS .
.
.It Cm --cycle-once
+.
Exit feh after one loop through the slideshow.
.
.It Cm -G , --draw-actions
+.
Draw the defined actions and what they do at the top-left of the image.
.
.It Cm -d , --draw-filename
+.
Draw the filename at the top-left of the image.
.
.It Cm -f , --filelist Ar file
+.
This option is similar to the playlists used by music software. If
.Ar file
exists, it will be read for a list of files to load, in the order they appear.
@@ -177,24 +213,33 @@ exits. You can add files to filelists by specifying them on the commandline
when also specifying the list.
.
.It Cm -e , --font Ar font
+.
Set global font. Should be a truetype font, resident in the current directory
or the font directory, and should be defined in the form fontname/points, like
.Qq myfont/12 .
.
.It Cm -C , --fontpath Ar path
+.
Specify
.Ar path
as extra directory in which to search for fonts; can be used multiple times to
add multiple paths.
.
+.It Cm --force-aliasing
+.
+Disable antialiasing for zooming, background setting etc.
+.
.It Cm -I , --fullindex
+.
Same as Index mode, but you also get image size and dimensions printed
below each thumbnail.
.
.It Cm -F , --fullscreen
+.
Make the window fullscreen.
.
.It Cm -g , --geometry Ar width No x Ar height
+.
Limit (and don't change) the window size. Takes an X-style geometry
.Ar string
like 640x480.
@@ -202,32 +247,40 @@ Note that larger images will be zoomed out to fit but you can see them at 1:1
by clicking the zoom button.
.
.It Cm -h , --help
+.
display help output and exit.
.
.It Cm -Y , --hide-pointer
+.
Hide the pointer
.Pq useful for slideshows etc .
.
.It Cm -B , --image-bg Ar style
+.
Use style as background for transparent image parts and the like.
Accepted values: white, black, default.
.
.It Cm -i , --index
+.
Enable Index mode. Index mode is similar to montage mode, and accepts the
same options. It creates an index print of thumbails, printing the image
name beneath each thumbnail. Index mode enables certain other options, see
.Sx INDEX MODE OPTIONS .
.
.It Cm --index-dim Ar bool
+.
Toggle showing image dimensions in thumbnail/index mode.
.
.It Cm --index-name Ar bool
+.
Toggle showing the filename in thumbnail/index mode.
.
.It Cm --index-size Ar bool
+.
Toggle showing the filesize in thumbnail/index mode.
.
.It Cm --info Ar commandline
+.
Execute
.Ar commandline
and display its output in the bottom left corner of the image. Can be used to
@@ -235,6 +288,7 @@ display e.g. image dimensions or EXIF information. Supports
.Sx FORMAT SPECIFIERS .
.
.It Cm -k , --keep-http
+.
When viewing files using HTTP,
.Nm
normally deletes the local copies after viewing, or, if caching, on exit.
@@ -246,58 +300,64 @@ with
in the name.
.
.It Cm -l , --list
+.
Don't display images. Analyse them and display an
.Xr ls 1 - No style
listing. Useful in scripts to hunt out images of a certain
size/resolution/type etc.
.
.It Cm -U , --loadable
+.
Don't display images. Just print out their names if imlib2 can successfully
load them.
.
-.It Cm -) , --menu-bg Ar file
-Use
-.Ar file
-as background image in menus.
-.
.It Cm -M , --menu-font Ar font
+.
Use
.Ar font
.Pq truetype, with size, like Qq yudit/12
as menu font.
.
.It Cm -m , --montage
+.
Enable montage mode. Montage mode creates a new image consisting of a grid of
thumbnails of the images in the filelist. When montage mode is selected,
certain other options become available. See
.Sx MONTAGE MODE OPTIONS .
.
.It Cm -w , --multiwindow
+.
Disable slideshow mode. With this setting, instead of opening multiple files
in slideshow mode, multiple windows will be opened; one per file.
.
.It Cm --no-jump-on-resort
+.
Don't jump to the first image after resorting the filelist.
.
.It Cm -N , --no-menus
+.
Don't load or show any menus.
.
.It Cm --no-screen-clip
+.
By default, window sizes are limited to the screen size. With this option,
windows will have the size of the image inside them. Note that they may
become very large this way, making them unmanageable in certain window
managers.
.
.It Cm --no-xinerama
+.
Disable Xinerama support. Only makes sense when you have Xinerama support
compiled in.
.
.It Cm -j , --output-dir Ar directory
+.
Save files to
.Ar directory
.Pq only useful with -k
.
.It Cm -p , --preload
+.
Preload images. This doesn't mean hold them in RAM, it means run through
them and eliminate unloadable images first. Otherwise they will be removed
as you flick through. This also analyses the images to get data for use in
@@ -305,32 +365,39 @@ sorting, such as pixel size, type etc. A preload run will be automatically
performed if you specify one of these sort modes.
.
.It Cm -q , --quiet
+.
Don't report non-fatal errors for failed loads. Verbose and quiet modes are
not mutually exclusive, the first controls informational messages, the second
only errors.
.
.It Cm -z , --randomize
+.
When viewing multiple files in a slideshow, randomize the file list before
displaying.
.
.It Cm -r , --recursive
+.
Recursively expand any directories in the commandline arguments
to the content of those directories, all the way down to the bottom level.
.
.It Cm -R , --reload Ar int
+.
Reload images after
.Ar int
seconds. Mainly useful when viewing webcams via http.
.
.It Cm -n , --reverse
+.
Reverse the sort order. Use this to invert the order of the filelist.
E.g. to sort in reverse width order, use
.Cm -nSwidth .
.
.It Cm -. , --scale-down
+.
When not in fullscreen: Scale images to screen size if they are too big.
.
.It Cm -D , --slideshow-delay Ar float
+.
For slideshow mode, wait
.Ar float
seconds between automatically changing slides. Useful for presentations.
@@ -339,18 +406,21 @@ Specify a negative number to set the delay
but start feh in paused mode.
.
.It Cm -S , --sort Ar sort_type
+.
The file list may be sorted according to image parameters. Allowed sort
types are: name, filename, width, height, pixels, size, format. For sort
modes other than name or filename, a preload run will be necessary,
causing a delay proportional to the number of images in the list.
.
.It Cm -| , --start-at Ar filename
+.
Start the filelist at
.Ar filename .
See
.Sx USAGE EXAMPLES .
.
.It Cm -T , --theme Ar theme
+.
Load options from config file with name
.Ar theme
- see
@@ -365,6 +435,7 @@ will look for a
theme.
.
.It Cm -t , --thumbnails
+.
Same as Index mode, but the thumbnails are clickable image launchers.
Note that
.Cm --fullscreen
@@ -372,27 +443,33 @@ does not affect the thumbnail window. It does, however, work for the image
windows launched from thumbnail mode.
.
.It Cm -~ , --thumb-title Ar string
+.
Set
.Ar title
for windows opened from thumbnail mode. See also
.Sx FORMAT SPECIFIERS .
.
.It Cm -^ , --title Ar title
+.
Set window title. Applies to all windows except those opened from thumbnail
mode. See
.Sx FORMAT SPECIFIERS
.
.It Cm -u , --unloadable
+.
Don't display images. Just print out their names if imlib2 can NOT
successfully load them.
.
.It Cm -V , --verbose
+.
output useful information, progress bars, etc.
.
.It Cm -v , --version
+.
output version information and exit.
.
.It Cm --zoom Ar percent No | Cm max No | Cm fill
+.
Zoom images by
.Ar percent
when in full screen mode or when window geometry is fixed. When combined with
@@ -417,46 +494,57 @@ mode.
.Bl -tag -width indent
.
.It Cm -0 , --reload-button Ar int
+.
Set button to reload the image
.Pq default: 0 .
.
.It Cm -1 , --pan-button Ar int
+.
Set button to pan the image
.Pq hold button down and move mouse to move the image .
When the mouse is not moved, advances to the next image in slideshow mode.
.Pq default: 1 , usually the left button .
.
.It Cm -2 , --zoom-button Ar int
+.
Set button to enable zoom mode
.Pq default: 2 , usually the middle button .
.
.It Cm -3 , --menu-button Ar int
+.
Set button to activate the menu.
.Pq default: 3 , usually the right button .
.
.It Cm --menu-ctrl-mask
+.
Require CTRL+Button for menu activation.
.
.It Cm -4 , --prev-button Ar int
+.
Set button to switch to the previous image in slideshow mode
.Pq default: 4 , usually Aq mousewheel up .
.
.It Cm -5 , --next-button Ar int
+.
Set button to switch to the next image in slideshow mode
.Pq default: 5 , usually Aq mousewheel down .
.
.It Cm -8 , --rotate-button Ar int
+.
Use CTRL+Button to rotate the current image
.Pq default : 2 .
.
.It Cm --no-rotate-ctrl-mask
+.
Don't require CTRL+Button for rotation - just use the button.
.
.It Cm -9 , --blur-button Ar int
+.
Use CTRL+Button for blurring
.Pq default : 1 .
.
.It Cm --no-blur-ctrl-mask
+.
Don't require CTRL+Button for blurring - just use the button.
.El
.
@@ -469,11 +557,13 @@ thumbnail modes.
.Bl -tag -width indent
.
.It Cm -a , --alpha Ar int
+.
When drawing thumbnails onto the background, set their transparency level to
.Ar int
.Pq 0 - 255 .
.
.It Cm -b , --bg Ar file No | Cm trans
+.
Use
.Ar file
as background for your montage. With this option specified, the montage size
@@ -486,6 +576,7 @@ is
the background will be made transparent.
.
.It Cm -X , --ignore-aspect
+.
By default, the montage thumbnails will retain their aspect ratios, while
fitting into thumb-width/-height. This options forces them to be the size set
by
@@ -493,6 +584,7 @@ by
This will prevent any empty space in the final montage.
.
.It Cm -H , --limit-height Ar pixels
+.
Limit the height of the montage. These options can be used together to define
the image size exactly, or separately. If only one is specified, the other is
calculated from the number of files specified and the size of the thumbnails.
@@ -500,18 +592,22 @@ The default is to limit width to 800 pixels and calculate the height as
necessary.
.
.It Cm -W , --limit-width Ar pixels
+.
Limit the width of the montage.
.
.It Cm -o , --output Ar file
+.
Save the created montage to
.Ar file .
.
.It Cm -O , --output-only Ar file
+.
Just save the created montage to
.Ar file
without displaying it.
.
.It Cm -s , --stretch
+.
Normally, if an image is smaller than the specified thumbnail size, it will
not be enlarged. If this option is set, the image will be scaled up to fit
the thumnail size. Aspect ratio will be maintained unles
@@ -519,12 +615,15 @@ the thumnail size. Aspect ratio will be maintained unles
is specified.
.
.It Cm -E , --thumb-height Ar pixels
+.
Set thumbnail height.
.
.It Cm -y , --thumb-width Ar pixels
+.
Set thumbnail width.
.
.It Cm -J , --thumb-redraw Ar n
+.
Only relevant for
.Cm --thumbnails :
Redraw thumbnail window every
@@ -542,6 +641,7 @@ default. Set
to get the old behaviour,
.Ar n No = 0
will only redraw once all thumbnails are loaded.
+.
.El
.
.
@@ -550,6 +650,7 @@ will only redraw once all thumbnails are loaded.
.Bl -tag -width indent
.
.It Cm -@ , --title-font Ar font
+.
Set font to print a title on the index, if no font is specified, no title will
be printed.
.El
@@ -565,31 +666,50 @@ so to have your background restored everytime you start X, you can add
.Qq `cat ~/.fehbg`
to your X startup script
.Pq like Pa ~/.xinitrc .
+.
+.Pp
+.
+Note that all options except
+.Cm --bg-tile
+support Xinerama. So, if you have multiple screens connected and use e.g.
+.Cm --bg-center ,
+.Nm
+will center the image on each screen. You can use
+.Cm --no-xinerama
+to treat the whole X display as one screen.
+.
.Pp
+.
The following options control how exactly the background is set. Each of them
takes exactly one file as argument.
+.
.Bl -tag -width indent
.
.It Cm --bg-center
+.
Center the file on the background. If it is too small, it will be surrounded
by a black border
.
.It Cm --bg-fill
+.
Like
.Cm --bg-scale ,
but preserves aspect ratio by zooming the image until it fits. Either a
horizontal or a vertical part of the image will be cut off
.
.It Cm --bg-max
+.
Like
.Cm --bg-fill ,
but scale the image to the maximum size that fits the screen with black borders on one side.
.
.It Cm --bg-scale
+.
Fit the file into the background without repeating it, cutting off stuff or
using borders. But the aspect ratio is not preserved either
.
.It Cm --bg-tile
+.
Tile
.Pq repeat
the image in case it is too small for the screen
@@ -600,31 +720,56 @@ the image in case it is too small for the screen
.Sh FORMAT SPECIFIERS
.
.Bl -tag -width indent
+.
.It %f
+.
Image path/filename
+.
.It %h
+.
Image height
+.
.It %l
+.
Total number of files in filelist
+.
.It %m
+.
Current mode
+.
.It %n
+.
Image name
+.
.It %p
+.
Number of image pixels
+.
.It \&%P
+.
.Nm
+.
.It %s
+.
Image size in bytes
+.
.It %t
+.
Image format
+.
.It %u
+.
Number of current file
+.
.It %w
+.
Image width
+.
.It %v
+.
.Nm
version
+.
.El
.
.
@@ -654,7 +799,9 @@ Note that mid-line comments are not supported.
.Sh THEMES CONFIG SYNTAX
.
This file allows the naming of option groups, called themes.
+.
.Pp
+.
It takes entries of the form
.Qq Ar theme options ... ,
where
@@ -662,10 +809,14 @@ where
is the name of the entry and
.Ar options
are the options which will be applied when the theme is used.
+.
.Pp
+.
An example entry would be
.Qq imagemap -rVq --thumb-width 40 --thumb-height 30 .
+.
.Pp
+.
You cane use this theme in two ways. Either call
.Qo
.Nm
@@ -682,10 +833,14 @@ ln -s `which
Now just run
.Qq imagemap *.jpg
to use these options.
+.
.Pp
+.
Note that you can split a theme over several lines by placing a backslash at
the end of a line, like in the shell.
+.
.Pp
+.
You can combine these themes with commandline options. An example fehrc is
provided with a couple of cool example themes.
.
@@ -694,7 +849,9 @@ provided with a couple of cool example themes.
.
This file defines the key bindings. It has entries of the form
.Qq Ar action Op Ar key1 Op Ar key2 Op Ar key3 .
+.
.Pp
+.
Each
.Ar key
is an X11 keysym name as shown by
@@ -706,15 +863,21 @@ It may optionally start with a modifier for things like Control, in which case
looks like
.Ar mod Ns No - Ns Ar keysym
.Pq for example Qo C-Delete Qc for Ctrl+Delete .
+.
.Pp
+.
Available modifiers are
.Ar C No for Control and
.Ar 1 , 4 No for Mod1 and Mod4 .
+.
.Pp
+.
Specifying an
.Ar action
without any keys unbinds it (i.e. the default bindings are removed).
+.
.Pp
+.
For a list of the
.Ar action
names, see
@@ -729,10 +892,16 @@ In an image window, the following keys may be used
.Bl -tag -width indent
.
.It a Bq toggle_actions
+.
Toggle actions display
.Pq see Cm --draw-actions
.
+.It A Bq toggle_aliasing
+.
+Enable/Disable anti-aliasing
+.
.It c Bq toggle_caption
+.
Caption entry mode. If
.Cm --caption-path
has been specified, then this enables caption editing. The caption at the
@@ -742,53 +911,68 @@ an actual newline into the caption using
.Aq CTRL+return .
.
.It d Bq toggle_filenames
+.
Toggle filename display
.Pq see Cm --draw-filename
.
.It f Bq save_filelist
+.
Save the current filelist to a unique filename
.
.It h Bq toggle_pause
+.
Pause/Continue the slideshow. When it is paused, it will not automatically
change slides based on
.Cm --slideshow-delay .
.
.It m Bq toggle_menu
+.
Show menu. Use the arrow keys and return to select items,
.Aq escape
to close the menu.
.
.It n , Ao Space Ac , Ao Right Ac Bq next_img
+.
Show next image
.
.It o Bq toggle_pointer
+.
Toggle pointer visibility
.
.It p , Ao Backspace Ac , Ao Left Ac Bq prev_img
+.
Show previous image
.
.It q , Ao Escape Ac Bq quit
+.
Quit feh
.
.It r Bq reload_image
+.
Reload current image. Useful for webcams
.
.It s Bq save_image
+.
Save the current image to a unique filename
.
.It v Bq toggle_fullscreen
+.
Toggle fullscreen
.
.It w Bq size_to_image
+.
Change window size to fit current image size
.
.It x Bq close
+.
Close current window
.
.It z Bq jump_random
+.
Jump to a random position in the current filelist
.
.It < , > Bq orient_3 , orient_1
+.
In place editing - rotate the images 90 degrees (counter)clockwise.
The rotation is lossless, but may create artifacts in some image corners when
used with JPEG images. Rotating in the reverse direction will make them go
@@ -797,62 +981,81 @@ away. See
for more about lossless JPEG rotation.
.
.It 0 .. 9 Bq action_0 .. action_9
+.
Execute the corresponding action
.Pq 0 = Cm --action , No 1 = Cm --action1 No etc.
.
.It Ao Return Ac Bq action_0
+.
Run the command defined by
.Cm --action
.
.It Ao home Ac Bq jump_first
+.
Show first image
.
.It Ao end Ac Bq jump_last
+.
Show last image
.
.It Ao page up Ac Bq jump_fwd
+.
Go forward ~5% of the filelist
.
.It Ao page down Ac Bq jump_back
+.
Go backward ~5% of the filelist
.
.It + Bq reload_plus
+.
Increase reload delay
.
.It - Bq reload_minus
+.
Decrease reload delay
.
.It Ao delete Ac Bq remove
+.
Remove current file from filelist
.
.It Ao CTRL+delete Ac Bq delete
+.
Remove current file from filelist and delete it
.
.It Ao keypad left Ac , Ao Ctrl+Left Ac Bq scroll_left
+.
Scroll to the left
.
.It Ao keypad right Ac , Ao Ctrl+Right Ac Bq scroll_right
+.
Scroll to the right
.
.It Ao keypad up Ac , Ao Ctrl+Up Ac Bq scroll_up
+.
Scroll up
.
.It Ao keypad down Ac , Ao Ctrl+Down Ac Bq scroll_down
+.
Scroll down
.
.It Ao keypad begin Ac Bq render
+.
Antialias the image
.
.It Ao keypad + Ac , Ao Up Ac Bq zoom_in
+.
Zoom in
.
.It Ao keypad - Ac , Ao Down Ac Bq zoom_out
+.
Zoom out
.
.It Ao keypad * Ac Bq zoom_default
+.
Zoom to 100%
.
.It Ao keypad / Ac Bq zoom_fit
+.
Zoom to fit the window size
.
.El
@@ -864,25 +1067,32 @@ The following keys bindings are used for the feh menu:
.Bl -tag -width indent
.
.It Ao Escape Ac Bq menu_close
+.
Close the menu
.
.It Ao Up Ac Bq menu_up
+.
Highlight previous menu item
.
.It Ao Down Ac Bq menu_down
+.
Highlight next menu item
.
.It Ao Left Ac Bq menu_parent
+.
Highlight parent menu item
.
.It Ao Right Ac Bq menu_child
+.
Highlight child menu item
.
.It Ao Return Ac , Ao Space Ac Bq menu_select
+.
Select highlighted menu item
.
.El
.
+.
.Sh MOUSE ACTIONS
.
When viewing an image, by default mouse button 1 pans
@@ -894,17 +1104,23 @@ button 2 zooms
to restore zoom to 100%
.Pc ;
and mouse button 3 opens the menu.
+.
.Pp
+.
CTRL+Button 1 blurs or sharpens the image
.Pq drag left to blur, right to sharpen ;
CTRL+Button 2 rotates the image around the center point.
+.
.Pp
+.
A note about pan and zoom modes:
In pan mode, if you reach a window border but haven't yet panned to the end of
the image,
.Nm
will warp your cursor to the opposite border so you can continue panning.
+.
.Pp
+.
When clicking the zoom button and immediately releasing it, the image will be
back at 100% zoom. When clicking it and moving the mouse while holding the
button down, the zoom will be continued at the previous zoom level. The zoom
@@ -918,65 +1134,86 @@ zoom button on that part.
In slideshow mode,
.Nm
handles the following signals:
+.
.Bl -tag -width indent
+.
.It Dv SIGUSR1
+.
Switch to next image
+.
.It Dv SIGUSR2
+.
Switch to previous image
+.
.El
.
.
.Sh USAGE EXAMPLES
.
Here are some examples of useful option combinations
+.
.Bl -tag -width indent
.
.It feh /opt/images
+.
Show all images in /opt/images
.
.It feh -r /opt/images
+.
Recursively show all images found in /opt/images and subdirectories
.
.It feh -rSfilename /opt/images
+.
Same as above, but sort by filename. By default, feh will show files in the
order it finds them on the hard disk, which is usually somewhat random.
.
.It feh -t -Sfilename -E 128 -y 128 -W 1024 /opt/images
+.
Show 128x128 pixel thumbnails, limit window width to 1024 pixels.
.
.It feh -t -Sfilename -E 128 -y 128 -W 1024 -P -C /usr/share/fonts/truetype/ttf-dejavu/ -e DejaVuSans/8 /opt/images
+.
Same as above, but enable thumbnail caching in ~/.thumbnails and use a smaller
font.
.
.It feh -irFarial/14 -O index.jpg /opt/images
+.
Make an index print of /opt/images and all directories below it, using 14 point
Arial to write the image info under each thumbnail. Save the image as
index.jpg and don't display it, just exit. Note that this even works without
a running X server
.
.It feh --unloadable -r /opt/images
+.
Print all unloadable images in /opt/images, recursively
.
.It feh -w /opt/images/holidays
+.
Open each image in /opt/images/holidays in its own window
.
.It feh -FD5 -Sname /opt/images/presentation
+.
Show the images in .../presentation, sorted by name, in fullscreen,
automatically change to the next image after 5 seconds
.
.It feh -rSwidth -A Qo mv '%f' ~/images/'%n' Qc /opt/images
+.
View all images in /opt/images and below, sorted by width, move an image to
~/image/image_name when enter is pressed
.
.It feh --start-at ./foo.jpg \&.
+.
View all images in the current directory, starting with foo.jpg. All other
images are still in the slideshow and can be viewed normally
.
.It feh --start-at foo.jpg *
+.
Same as above
.
.It feh --info \&"exifgrep '\&(Model\&|DateTimeOriginal\&|FNumber\&|ISO\&|Flash\&)' '%f' \&| cut -d \&. -f 4-\&" \&.
+.
Show some EXIF information, extracted by exifprobe/exifgrep
+.
.El
.
.
@@ -988,7 +1225,9 @@ requires the
binary
.Pq usually distributed in Qo libjpeg-progs Qc or similar
for lossless rotation.
+.
.Pp
+.
To view images from URLs such as http://, you need
.Nm
compiled with libcurl support (enabled by default). See the
@@ -1001,18 +1240,28 @@ section.
Xinerama support does not really work on Xinerama screens != 0. Set
.Ev XINERAMA_SCREEN
to the correct number as a workaround.
+.
.Pp
+.
Thumbnail mode is somewhat inefficient, and because of that not nearly as fast
as it could be.
.
+.Pp
+.
+There are still some zooming issues when using
+.Cm --scale-down .
+.
.Ss REPORTING BUGS
+.
If you find a bug, please report it to
.Aq derf@finalrewind.org
or via
.Aq http://github.com/derf/feh/issues .
You are also welcome to direct any feh-related comments/questions/... to #feh
on irc.oftc.net.
+.
.Pp
+.
Please include the feh version
.Aq the output of Qq feh --version ,
steps to reproduce the bug and (if necessary), images to reproduce it.
@@ -1021,6 +1270,7 @@ steps to reproduce the bug and (if necessary), images to reproduce it.
.Sh FUTURE PLANS
.
Plans for the following releases:
+.
.Bl -bullet -compact
.
.It
@@ -1033,33 +1283,45 @@ Make zoom options more intuitive
.
Copyright (C) 1999, 2000 by Tom Gilbert (and various contributors).
Copyright (C) 2010 by Daniel Friesel (and even more contributors).
+.
.Pp
+.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
+.
.Pp
+.
The above copyright notice and this permission notice shall be included in
all copies of the Software and its documentation and acknowledgment shall be
given in the documentation and software packages that this Software was
used.
+.
.Pp
+.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+.
.Pp
+.
Current developer: Daniel Friesel
.Aq derf@finalrewind.org
+.
.Pp
+.
Original author
.Pq no longer developing :
Tom Gilbert
.Aq feh_sucks@linuxbrit.co.uk
+.
.Pp
+.
See also:
http://feh.finalrewind.org
diff --git a/src/events.c b/src/events.c
index f2a1b3e..a850137 100644
--- a/src/events.c
+++ b/src/events.c
@@ -183,7 +183,7 @@ static void feh_event_handle_ButtonRelease(XEvent * ev)
opt.mode = MODE_NORMAL;
winwid->mode = MODE_NORMAL;
winwidget_sanitise_offsets(winwid);
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
}
} else if (opt.mode == MODE_NEXT) {
opt.mode = MODE_NORMAL;
@@ -248,7 +248,7 @@ static void feh_event_handle_ButtonRelease(XEvent * ev)
} else
winwidget_sanitise_offsets(winwid);
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
}
} else if ((ev->xbutton.button == opt.blur_button)
&& ((opt.no_blur_ctrl_mask)
@@ -281,7 +281,7 @@ static void feh_event_handle_ConfigureNotify(XEvent * ev)
opt.geom_w = w->w;
opt.geom_h = w->h;
}
- winwidget_render_image(w, 0, 1);
+ winwidget_render_image(w, 0, 0);
}
}
}
@@ -404,7 +404,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
winwid->im_y = winwid->click_offset_y
- (winwid->im_click_offset_y * winwid->zoom);
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
}
} else if ((opt.mode == MODE_PAN) || (opt.mode == MODE_NEXT)) {
int orig_x, orig_y;
@@ -463,7 +463,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
if ((winwid->im_x != orig_x)
|| (winwid->im_y != orig_y))
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
}
} else if (opt.mode == MODE_ROTATE) {
while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev));
@@ -483,7 +483,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
}
winwid->im_angle = (ev->xmotion.x - winwid->w / 2) / ((double) winwid->w / 2) * 3.1415926535;
D(("angle: %f\n", winwid->im_angle));
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
}
} else if (opt.mode == MODE_BLUR) {
while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev));
@@ -503,7 +503,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
gib_imlib_image_blur(temp, 0 - blur_radius);
ptr = winwid->im;
winwid->im = temp;
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
gib_imlib_free_image_and_decache(winwid->im);
winwid->im = ptr;
}
@@ -522,7 +522,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
imlib_context_set_image(winwid->im);
imlib_apply_filter("bump_map_point(x=[],y=[],map="
PREFIX "/share/feh/images/about.png);", &x, &y);
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
gib_imlib_free_image_and_decache(winwid->im);
winwid->im = orig_im;
} else if (winwid->type == WIN_TYPE_THUMBNAIL) {
@@ -553,11 +553,11 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
thumbnail->x + 2, thumbnail->y + 2,
thumbnail->w - 4, thumbnail->h - 4,
255, 255, 255, 255);
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
gib_imlib_free_image_and_decache(winwid->im);
winwid->im = origwin;
} else
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
}
last_thumb = thumbnail;
}
diff --git a/src/feh.h b/src/feh.h
index 09a19a6..01006b2 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -139,12 +139,11 @@ void feh_display_status(char stat);
void real_loadables_mode(int loadable);
void feh_reload_image(winwidget w, int resize, int force_new);
void feh_filelist_image_remove(winwidget winwid, char do_delete);
-char *feh_strip_hostname(char *url);
void slideshow_save_image(winwidget win);
void feh_edit_inplace_orient(winwidget w, int orientation);
void feh_edit_inplace_lossless_rotate(winwidget w, int orientation);
gib_list *feh_wrap_string(char *text, int wrap_width, Imlib_Font fn, gib_style * style);
-char *build_caption_filename(feh_file * file);
+char *build_caption_filename(feh_file * file, short create_dir);
gib_list *feh_list_jump(gib_list * root, gib_list * l, int direction, int num);
/* Imlib stuff */
diff --git a/src/feh_png.c b/src/feh_png.c
index cefd4c8..f02aecb 100644
--- a/src/feh_png.c
+++ b/src/feh_png.c
@@ -66,7 +66,7 @@ gib_hash *feh_png_read_comments(char *file)
return hash;
}
- if (setjmp(png_ptr->jmpbuf)) {
+ if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fclose(fp);
return hash;
@@ -124,7 +124,7 @@ int feh_png_write_png(Imlib_Image image, char *file, ...)
return 0;
}
- if (setjmp(png_ptr->jmpbuf)) {
+ if (setjmp(png_jmpbuf(png_ptr))) {
fclose(fp);
png_destroy_write_struct(&png_ptr, &info_ptr);
png_destroy_info_struct(png_ptr, &info_ptr);
diff --git a/src/filelist.c b/src/filelist.c
index b4b481a..fa1735d 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -112,6 +112,11 @@ gib_list *feh_file_remove_from_list(gib_list * list, gib_list * l)
return(gib_list_remove(list, l));
}
+int file_selector_all(const struct dirent *unused __attribute__((unused)))
+{
+ return 1;
+}
+
/* Recursive */
void add_file_to_filelist_recursively(char *origpath, unsigned char level)
{
@@ -176,8 +181,9 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level)
}
if ((S_ISDIR(st.st_mode)) && (level != FILELIST_LAST)) {
- struct dirent *de;
+ struct dirent **de;
DIR *dir;
+ int cnt, n;
D(("It is a directory\n"));
@@ -187,13 +193,25 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level)
free(path);
return;
}
- de = readdir(dir);
- while (de != NULL) {
- if (strcmp(de->d_name, ".")
- && strcmp(de->d_name, "..")) {
+ n = scandir(path, &de, file_selector_all, alphasort);
+ if (n < 0) {
+ switch (errno) {
+ case ENOMEM:
+ if (!opt.quiet)
+ weprintf("Insufficient memory to scan directory %s:", path);
+ break;
+ default:
+ if (!opt.quiet)
+ weprintf("Failed to scan directory %s:", path);
+ }
+ }
+
+ for (cnt = 0; cnt < n; cnt++) {
+ if (strcmp(de[cnt]->d_name, ".")
+ && strcmp(de[cnt]->d_name, "..")) {
char *newfile;
- newfile = estrjoin("", path, "/", de->d_name, NULL);
+ newfile = estrjoin("", path, "/", de[cnt]->d_name, NULL);
/* This ensures we go down one level even if not fully recursive
- this way "feh some_dir" expands to some_dir's contents */
@@ -203,9 +221,10 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level)
add_file_to_filelist_recursively(newfile, FILELIST_LAST);
free(newfile);
+ free(de[cnt]);
}
- de = readdir(dir);
}
+ free(de);
closedir(dir);
} else if (S_ISREG(st.st_mode)) {
D(("Adding regular file %s to filelist\n", path));
diff --git a/src/filelist.h b/src/filelist.h
index 842e3af..617236f 100644
--- a/src/filelist.h
+++ b/src/filelist.h
@@ -60,6 +60,7 @@ void feh_file_free(feh_file * file);
feh_file_info *feh_file_info_new(void);
void feh_file_info_free(feh_file_info * info);
gib_list *feh_file_rm_and_free(gib_list * list, gib_list * file);
+int file_selector_all(const struct dirent *unused);
void add_file_to_filelist_recursively(char *origpath, unsigned char level);
void add_file_to_rm_filelist(char *file);
void delete_rm_files(void);
diff --git a/src/help.raw b/src/help.raw
index eb57248..bbe5e37 100644
--- a/src/help.raw
+++ b/src/help.raw
@@ -49,6 +49,7 @@ OPTIONS
Executed by /bin/sh, may contain FORMAT SPECIFIERS
--action[1-9] Extra actions triggered by pressing keys <1>to <9>
-G, --draw-actions Show the defined actions in the image window
+ --force-aliasing Disable antialiasing
-m, --montage Enable montage mode
-c, --collage Montage mode with randomly distributed thumbnails
-i, --index Create an index print of all images
@@ -76,7 +77,6 @@ OPTIONS
-C, --fontpath PATH Specify an extra directory to look in for fonts,
can be used multiple times to add multiple paths.
-M, --menu-font FONT Use FONT for the font in menus.
- -), --menu-bg BG Use BG for the background image in menus.
-B, --image-bg STYLE Set background for transparent images and the like.
Accepted values: white, black, default
-N, --no-menus Don't load or show any menus.
diff --git a/src/imlib.c b/src/imlib.c
index 2460924..3f73a24 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -316,31 +316,6 @@ char *feh_http_load_image(char *url)
#endif /* HAVE_LIBCURL */
-char *feh_strip_hostname(char *url)
-{
- char *ret;
- char *start;
- char *finish;
- int len;
-
- start = strchr(url, '/');
- if (!start)
- return(NULL);
-
- start += 2;
-
- finish = strchr(start, '/');
- if (!finish)
- return(NULL);
-
- len = finish - start;
-
- ret = emalloc(len + 1);
- strncpy(ret, start, len);
- ret[len] = '\0';
- return(ret);
-}
-
void feh_draw_zoom(winwidget w)
{
static Imlib_Font fn = NULL;
@@ -530,7 +505,7 @@ void feh_draw_info(winwidget w)
return;
}
-char *build_caption_filename(feh_file * file)
+char *build_caption_filename(feh_file * file, short create_dir)
{
char *caption_filename;
char *s, *dir, *caption_dir;
@@ -549,6 +524,8 @@ char *build_caption_filename(feh_file * file)
D(("dir %s, cp %s, cdir %s\n", dir, opt.caption_path, caption_dir))
if (stat(caption_dir, &cdir_stat) == -1) {
+ if (!create_dir)
+ return NULL;
if (mkdir(caption_dir, 0755) == -1)
eprintf("Failed to create caption directory %s:", caption_dir);
} else if (!S_ISDIR(cdir_stat.st_mode))
@@ -584,9 +561,12 @@ void feh_draw_caption(winwidget w)
if (!file->caption) {
char *caption_filename;
- caption_filename = build_caption_filename(file);
- /* read caption from file */
- file->caption = ereadfile(caption_filename);
+ caption_filename = build_caption_filename(file, 0);
+ if (caption_filename)
+ /* read caption from file */
+ file->caption = ereadfile(caption_filename);
+ else
+ file->caption = estrdup("");
free(caption_filename);
}
diff --git a/src/keyevents.c b/src/keyevents.c
index 8e2b181..e43ae33 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -125,6 +125,7 @@ void init_keyevents(void) {
feh_set_kb(&keys.size_to_image, 0, XK_w , 0, 0 , 0, 0);
feh_set_kb(&keys.render , 0, XK_KP_Begin , 0, 0 , 0, 0);
feh_set_kb(&keys.toggle_actions, 0, XK_a, 0, 0, 0, 0);
+ feh_set_kb(&keys.toggle_aliasing, 0, XK_A, 0, 0, 0, 0);
feh_set_kb(&keys.toggle_filenames, 0, XK_d, 0, 0, 0, 0);
feh_set_kb(&keys.toggle_pointer, 0, XK_o, 0, 0, 0, 0);
feh_set_kb(&keys.toggle_caption, 0, XK_c, 0, 0, 0, 0);
@@ -245,6 +246,8 @@ void init_keyevents(void) {
cur_kb = &keys.render;
else if (!strcmp(action, "toggle_actions"))
cur_kb = &keys.toggle_actions;
+ else if (!strcmp(action, "toggle_aliasing"))
+ cur_kb = &keys.toggle_aliasing;
else if (!strcmp(action, "toggle_filenames"))
cur_kb = &keys.toggle_filenames;
else if (!strcmp(action, "toggle_pointer"))
@@ -374,14 +377,15 @@ void feh_event_handle_keypress(XEvent * ev)
/* finish caption entry, write to captions file */
FILE *fp;
char *caption_filename;
- caption_filename = build_caption_filename(FEH_FILE(winwid->file->data));
+ caption_filename =
+ build_caption_filename(FEH_FILE(winwid->file->data), 1);
winwid->caption_entry = 0;
winwidget_render_image_cached(winwid);
XFreePixmap(disp, winwid->bg_pmap_cache);
winwid->bg_pmap_cache = 0;
fp = fopen(caption_filename, "w");
if (!fp) {
- weprintf("couldn't write to captions file %s:", caption_filename);
+ eprintf("couldn't write to captions file %s:", caption_filename);
return;
}
fprintf(fp, "%s", FEH_FILE(winwid->file->data)->caption);
@@ -424,19 +428,19 @@ void feh_event_handle_keypress(XEvent * ev)
}
else if (feh_is_kp(&keys.scroll_right, keysym, state)) {
winwid->im_x -= 20;
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
}
else if (feh_is_kp(&keys.scroll_left, keysym, state)) {
winwid->im_x += 20;
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
}
else if (feh_is_kp(&keys.scroll_down, keysym, state)) {
winwid->im_y -= 20;
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
}
else if (feh_is_kp(&keys.scroll_up, keysym, state)) {
winwid->im_y += 20;
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
}
else if (feh_is_kp(&keys.jump_back, keysym, state)) {
if (opt.slideshow)
@@ -505,7 +509,7 @@ void feh_event_handle_keypress(XEvent * ev)
winwid->im_y = (winwid->h / 2) - (((winwid->h / 2) - winwid->im_y) /
winwid->old_zoom * winwid->zoom);
winwidget_sanitise_offsets(winwid);
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.zoom_out, keysym, state)) {
winwid->old_zoom = winwid->zoom;
@@ -515,7 +519,7 @@ void feh_event_handle_keypress(XEvent * ev)
winwid->im_y = (winwid->h / 2) - (((winwid->h / 2) - winwid->im_y) /
winwid->old_zoom * winwid->zoom);
winwidget_sanitise_offsets(winwid);
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.zoom_default, keysym, state)) {
winwid->zoom = 1;
@@ -526,18 +530,22 @@ void feh_event_handle_keypress(XEvent * ev)
else if (feh_is_kp(&keys.zoom_fit, keysym, state)) {
feh_calc_needed_zoom(&winwid->zoom, winwid->im_w, winwid->im_h, winwid->w, winwid->h);
winwidget_center_image(winwid);
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.render, keysym, state)) {
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.toggle_actions, keysym, state)) {
opt.draw_actions = !opt.draw_actions;
- winwidget_rerender_all(0, 1);
+ winwidget_rerender_all(0);
+ }
+ else if (feh_is_kp(&keys.toggle_aliasing, keysym, state)) {
+ opt.force_aliasing = !opt.force_aliasing;
+ winwidget_rerender_all(0);
}
else if (feh_is_kp(&keys.toggle_filenames, keysym, state)) {
opt.draw_filename = !opt.draw_filename;
- winwidget_rerender_all(0, 1);
+ winwidget_rerender_all(0);
}
else if (feh_is_kp(&keys.toggle_pointer, keysym, state)) {
winwidget_set_pointer(winwid, opt.hide_pointer);
@@ -549,7 +557,7 @@ void feh_event_handle_keypress(XEvent * ev)
else if (feh_is_kp(&keys.toggle_caption, keysym, state)) {
if (opt.caption_path)
winwid->caption_entry = 1;
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
}
else if (feh_is_kp(&keys.reload_image, keysym, state)) {
feh_reload_image(winwid, 0, 0);
@@ -614,7 +622,7 @@ void feh_event_handle_keypress(XEvent * ev)
winwid->full_screen = !winwid->full_screen;
winwidget_destroy_xwin(winwid);
winwidget_create_window(winwid, winwid->im_w, winwid->im_h);
- winwidget_render_image(winwid, 1, 1);
+ winwidget_render_image(winwid, 1, 0);
winwidget_show(winwid);
#ifdef HAVE_LIBXINERAMA
/* if we have xinerama and we're using it, then full screen the window
diff --git a/src/menu.c b/src/menu.c
index 1e81cd6..f12f4ed 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1268,7 +1268,7 @@ void feh_menu_cb_opt_fullscreen(feh_menu * m, feh_menu_item * i)
winwidget_destroy_xwin(m->fehwin);
winwidget_create_window(m->fehwin, m->fehwin->im_w, m->fehwin->im_h);
- winwidget_render_image(m->fehwin, 1, 1);
+ winwidget_render_image(m->fehwin, 1, 0);
winwidget_show(m->fehwin);
#ifdef HAVE_LIBXINERAMA
@@ -1343,7 +1343,7 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data)
winwidget_resize(m->fehwin, m->fehwin->im_w, m->fehwin->im_h);
}
winwidget_reset_image(m->fehwin);
- winwidget_render_image(m->fehwin, 1, 1);
+ winwidget_render_image(m->fehwin, 1, 0);
break;
case CB_RELOAD:
feh_reload_image(m->fehwin, 0, 0);
@@ -1404,7 +1404,7 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data)
opt.draw_filename = TRUE;
else
opt.draw_filename = FALSE;
- winwidget_rerender_all(0, 1);
+ winwidget_rerender_all(0);
break;
case CB_OPT_DRAW_ACTIONS:
MENU_ITEM_TOGGLE(i);
@@ -1412,7 +1412,7 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data)
opt.draw_actions = TRUE;
else
opt.draw_actions = FALSE;
- winwidget_rerender_all(0, 1);
+ winwidget_rerender_all(0);
break;
case CB_OPT_KEEP_HTTP:
MENU_ITEM_TOGGLE(i);
@@ -1440,7 +1440,7 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data)
opt.zoom_mode = ZOOM_MODE_FILL;
else
opt.zoom_mode = 0;
- winwidget_rerender_all(1, 1);
+ winwidget_rerender_all(1);
break;
}
return;
diff --git a/src/multiwindow.c b/src/multiwindow.c
index c46e453..1bd8a8a 100644
--- a/src/multiwindow.c
+++ b/src/multiwindow.c
@@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "timers.h"
#include "filelist.h"
#include "options.h"
+#include "signals.h"
void init_multiwindow_mode(void)
{
@@ -63,5 +64,8 @@ void init_multiwindow_mode(void)
}
free(s);
}
+
+ setup_signal_handlers();
+
return;
}
diff --git a/src/options.c b/src/options.c
index 3ba0512..de72429 100644
--- a/src/options.c
+++ b/src/options.c
@@ -30,8 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static void check_options(void);
static void feh_getopt_theme(int argc, char **argv);
-static void feh_parse_option_array(int argc, char **argv);
-static void feh_parse_environment_options(void);
+static void feh_parse_option_array(int argc, char **argv, int finalrun);
static void feh_check_theme_options(int arg, char **argv);
static void feh_parse_options_from_string(char *opts);
static void feh_load_options_for_theme(char *theme);
@@ -95,7 +94,7 @@ void init_parse_options(int argc, char **argv)
D(("About to parse commandline options\n"));
/* Parse the cmdline args */
- feh_parse_option_array(argc, argv);
+ feh_parse_option_array(argc, argv, 1);
/* If we have a filelist to read, do it now */
if (opt.filelistfile) {
@@ -167,8 +166,10 @@ static void feh_load_options_for_theme(char *theme)
free(rcpath);
if (!fp && ((fp = fopen(oldrcpath, "r")) != NULL))
- weprintf("the config is now read from .config/feh/themes, "
- "please update your path!");
+ weprintf("The theme config file was moved from ~/.fehrc to "
+ "~/.config/feh/themes. Run\n"
+ " mkdir -p ~/.config/feh; mv ~/.fehrc ~/.config/feh/themes\n"
+ "to fix this.");
free(oldrcpath);
@@ -257,7 +258,7 @@ static void feh_parse_options_from_string(char *opts)
last = *t;
}
- feh_parse_option_array(num, list);
+ feh_parse_option_array(num, list, 0);
for (i = 0; i < num; i++)
if (list[i])
@@ -319,7 +320,7 @@ static void feh_getopt_theme(int argc, char **argv)
optind = 0;
}
-static void feh_parse_option_array(int argc, char **argv)
+static void feh_parse_option_array(int argc, char **argv, int finalrun)
{
static char stropts[] =
"a:A:b:B:cC:dD:e:E:f:Fg:GhH:iIj:J:kK:lL:mM:nNo:O:pPqrR:sS:tT:uUvVwW:xXy:YzZ"
@@ -422,6 +423,7 @@ static void feh_parse_option_array(int argc, char **argv)
{"index-dim" , 1, 0, 232},
{"thumb-redraw" , 1, 0, 'J'},
{"info" , 1, 0, 234},
+ {"force-aliasing", 0, 0, 235},
{0, 0, 0, 0}
};
@@ -518,7 +520,7 @@ static void feh_parse_option_array(int argc, char **argv)
opt.full_screen = 1;
break;
case 'Z':
- opt.zoom_mode = ZOOM_MODE_FILL;
+ opt.zoom_mode = ZOOM_MODE_MAX;
break;
case 'U':
opt.loadables = 1;
@@ -605,6 +607,7 @@ static void feh_parse_option_array(int argc, char **argv)
case ')':
free(opt.menu_bg);
opt.menu_bg = estrdup(optarg);
+ weprintf("The --menu-bg option is deprecated and will be removed by 2012");
break;
case 'B':
free(opt.image_bg);
@@ -686,7 +689,7 @@ static void feh_parse_option_array(int argc, char **argv)
case 204:
free(opt.menu_style);
opt.menu_style = estrdup(optarg);
- weprintf("--menu-style is deprecated and will be removed soon");
+ weprintf("The --menu-style option is deprecated and will be removed by 2012");
break;
case 205:
if (!strcmp("fill", optarg))
@@ -771,6 +774,9 @@ static void feh_parse_option_array(int argc, char **argv)
case 234:
opt.info_cmd = estrdup(optarg);
break;
+ case 235:
+ opt.force_aliasing = 1;
+ break;
default:
break;
}
@@ -784,6 +790,8 @@ static void feh_parse_option_array(int argc, char **argv)
add_file_to_filelist_recursively(argv[optind++], FILELIST_FIRST);
}
}
+ else if (finalrun && !opt.filelistfile && !opt.bgmode)
+ add_file_to_filelist_recursively(".", FILELIST_FIRST);
/* So that we can safely be called again */
optind = 1;
diff --git a/src/options.h b/src/options.h
index 38b1526..431fdfc 100644
--- a/src/options.h
+++ b/src/options.h
@@ -107,6 +107,7 @@ struct __fehoptions {
unsigned char no_blur_ctrl_mask;
unsigned char no_pan_ctrl_mask;
+ int force_aliasing;
int thumb_w;
int thumb_h;
int limit_w;
@@ -175,6 +176,7 @@ struct __fehkb {
struct __fehkey toggle_actions;
struct __fehkey toggle_filenames;
struct __fehkey toggle_pointer;
+ struct __fehkey toggle_aliasing;
struct __fehkey jump_random;
struct __fehkey toggle_caption;
struct __fehkey toggle_pause;
diff --git a/src/signals.c b/src/signals.c
index b3e118a..956c861 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "feh.h"
#include "winwidget.h"
+#include "options.h"
void feh_handle_signal(int);
@@ -60,12 +61,16 @@ void feh_handle_signal(int signo)
{
winwidget winwid
= winwidget_get_first_window_of_type(WIN_TYPE_SLIDESHOW);
+ int i;
if (winwid) {
if (signo == SIGUSR1)
slideshow_change_image(winwid, SLIDE_NEXT);
else if (signo == SIGUSR2)
slideshow_change_image(winwid, SLIDE_PREV);
+ } else if (opt.multiwindow) {
+ for (i = window_num - 1; i >= 0; i--)
+ feh_reload_image(windows[i], 0, 0);
}
return;
diff --git a/src/slideshow.c b/src/slideshow.c
index 5ceee39..79b931f 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -101,12 +101,15 @@ void feh_reload_image(winwidget w, int resize, int force_new)
char *title, *new_title;
int len;
Imlib_Image tmp;
+ int old_w, old_h;
if (!w->file) {
weprintf("couldn't reload, this image has no file associated with it.");
return;
}
+ D(("resize %d, force_new %d\n", resize, force_new));
+
free(FEH_FILE(w->file->data)->caption);
FEH_FILE(w->file->data)->caption = NULL;
@@ -116,10 +119,11 @@ void feh_reload_image(winwidget w, int resize, int force_new)
title = estrdup(w->name);
winwidget_rename(w, new_title);
+ old_w = gib_imlib_image_get_width(w->im);
+ old_h = gib_imlib_image_get_height(w->im);
+
/* force imlib2 not to cache */
- if (force_new) {
- winwidget_free_image(w);
- }
+ winwidget_free_image(w);
/* if the image has changed in dimensions - we gotta resize */
if ((feh_load_image(&tmp, FEH_FILE(w->file->data))) == 0) {
@@ -134,19 +138,13 @@ void feh_reload_image(winwidget w, int resize, int force_new)
filelist = feh_file_remove_from_list(filelist, w->file);
return;
}
- if (force_new) {
- w->im = tmp;
+
+ if (!resize && ((old_w != gib_imlib_image_get_width(tmp)) ||
+ (old_h != gib_imlib_image_get_height(tmp))))
resize = 1;
- winwidget_reset_image(w);
- } else {
- if ((gib_imlib_image_get_width(w->im) != gib_imlib_image_get_width(tmp))
- || (gib_imlib_image_get_height(w->im) != gib_imlib_image_get_height(tmp))) {
- resize = 1;
- winwidget_reset_image(w);
- }
- winwidget_free_image(w);
- w->im = tmp;
- }
+
+ w->im = tmp;
+ winwidget_reset_image(w);
w->mode = MODE_NORMAL;
if ((w->im_w != gib_imlib_image_get_width(w->im))
@@ -163,7 +161,7 @@ void feh_reload_image(winwidget w, int resize, int force_new)
w->im_w = gib_imlib_image_get_width(w->im);
w->im_h = gib_imlib_image_get_height(w->im);
}
- winwidget_render_image(w, resize, 1);
+ winwidget_render_image(w, resize, 0);
winwidget_rename(w, title);
free(title);
@@ -252,10 +250,6 @@ void slideshow_change_image(winwidget winwid, int change)
filelist = feh_file_remove_from_list(filelist, last);
last = NULL;
}
- s = slideshow_create_name(FEH_FILE(current_file->data));
-
- winwidget_rename(winwid, s);
- free(s);
if ((winwidget_loadimage(winwid, FEH_FILE(current_file->data)))
!= 0) {
@@ -268,7 +262,12 @@ void slideshow_change_image(winwidget winwid, int change)
winwidget_reset_image(winwid);
winwid->im_w = gib_imlib_image_get_width(winwid->im);
winwid->im_h = gib_imlib_image_get_height(winwid->im);
- winwidget_render_image(winwid, 1, 1);
+ winwidget_render_image(winwid, 1, 0);
+
+ s = slideshow_create_name(FEH_FILE(current_file->data));
+ winwidget_rename(winwid, s);
+ free(s);
+
break;
} else
last = current_file;
diff --git a/src/support.c b/src/support.c
index d404047..e257271 100644
--- a/src/support.c
+++ b/src/support.c
@@ -131,7 +131,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
enl_ipc_sync();
} else {
Atom prop_root, prop_esetroot, type;
- int format;
+ int format, i;
unsigned long length, after;
unsigned char *data_root, *data_esetroot;
Pixmap pmap_d1, pmap_d2;
@@ -139,6 +139,10 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
char *fehbg = NULL;
char *home;
char filbuf[PATH_MAX];
+ char fehbg_xinerama[] = "--no-xinerama";
+
+ if (opt.xinerama)
+ fehbg_xinerama[0] = '\0';
/* local display to set closedownmode on */
Display *disp2;
@@ -163,21 +167,20 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
filbuf[out++] = 0;
if (scaled) {
- w = scr->width;
- h = scr->height;
-
-/* disable xinerama check for setting background */
-#if 0
-/* #ifdef HAVE_LIBXINERAMA */
- if (opt.xinerama && xinerama_screens) {
- w = xinerama_screens[xinerama_screen].width;
- h = xinerama_screens[xinerama_screen].height;
- }
-#endif /* HAVE_LIBXINERAMA */
-
- pmap_d1 = XCreatePixmap(disp, root, w, h, depth);
- gib_imlib_render_image_on_drawable_at_size(pmap_d1, im, 0, 0, w, h, 1, 0, 1);
- fehbg = estrjoin(" ", "feh --bg-scale", filbuf, NULL);
+ pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth);
+
+#ifdef HAVE_LIBXINERAMA
+ if (opt.xinerama && xinerama_screens)
+ for (i = 0; i < num_xinerama_screens; i++)
+ gib_imlib_render_image_on_drawable_at_size(pmap_d1, im,
+ xinerama_screens[i].x_org, xinerama_screens[i].y_org,
+ xinerama_screens[i].width, xinerama_screens[i].height,
+ 1, 0, !opt.force_aliasing);
+ else
+#endif /* HAVE_LIBXINERAMA */
+ gib_imlib_render_image_on_drawable_at_size(pmap_d1, im, 0, 0,
+ scr->width, scr->height, 1, 0, !opt.force_aliasing);
+ fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-scale", filbuf, NULL);
} else if (centered) {
XGCValues gcval;
GC gc;
@@ -186,25 +189,33 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
D(("centering\n"));
w = scr->width;
h = scr->height;
-
-/* disable xinerama check for setting background */
-#if 0
-/* #ifdef HAVE_LIBXINERAMA */
- if (opt.xinerama && xinerama_screens) {
- w = xinerama_screens[xinerama_screen].width;
- h = xinerama_screens[xinerama_screen].height;
- }
-#endif /* HAVE_LIBXINERAMA */
+ x = (w - gib_imlib_image_get_width(im)) >> 1;
+ y = (h - gib_imlib_image_get_height(im)) >> 1;
pmap_d1 = XCreatePixmap(disp, root, w, h, depth);
gcval.foreground = BlackPixel(disp, DefaultScreen(disp));
gc = XCreateGC(disp, root, GCForeground, &gcval);
XFillRectangle(disp, pmap_d1, gc, 0, 0, w, h);
- x = (w - gib_imlib_image_get_width(im)) >> 1;
- y = (h - gib_imlib_image_get_height(im)) >> 1;
- gib_imlib_render_image_on_drawable(pmap_d1, im, x, y, 1, 0, 0);
+
+#ifdef HAVE_LIBXINERAMA
+ if (opt.xinerama && xinerama_screens)
+ for (i = 0; i < num_xinerama_screens; i++) {
+ w = xinerama_screens[i].width;
+ h = xinerama_screens[i].height;
+ x = (w - gib_imlib_image_get_width(im)) >> 1;
+ y = (h - gib_imlib_image_get_height(im)) >> 1;
+ gib_imlib_render_image_part_on_drawable_at_size(
+ pmap_d1, im,
+ ((x < 0) ? -x : 0) , ((y < 0) ? -y : 0), w, h,
+ xinerama_screens[i].x_org + ((x > 0) ? x : 0),
+ xinerama_screens[i].y_org + ((y > 0) ? y : 0),
+ w, h, 1, 0, 0);
+ }
+ else
+#endif /* HAVE_LIBXINERAMA */
+ gib_imlib_render_image_on_drawable(pmap_d1, im, x, y, 1, 0, 0);
XFreeGC(disp, gc);
- fehbg = estrjoin(" ", "feh --bg-center", filbuf, NULL);
+ fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-center", filbuf, NULL);
} else if (filled == 1) {
int scr_w = scr->width;
int scr_h = scr->height;
@@ -212,20 +223,44 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
int img_h = gib_imlib_image_get_height(im);
int render_x = 0;
int render_y = 0;
+ int cut_x = (((img_w * scr_h) > (img_h * scr_w)) ? 1 : 0);
+ w = (cut_x ? ((scr_h * img_w) / img_h) : scr_w);
+ h = (cut_x ? scr_h : ((scr_w * img_h) / img_w));
+
+ if (cut_x)
+ render_x = (scr_w - w) >> 1;
+ else
+ render_y = (scr_h - h) >> 1;
- if ((img_w * scr_h) > (scr_w * img_h)) {
- h = scr_h;
- w = (scr_h * img_w) / img_h;
- render_x = (scr_w - w) / 2;
- } else {
- h = (scr_w * img_h) / img_w;
- w = scr_w;
- render_y = (scr_h - h) / 2;
- }
pmap_d1 = XCreatePixmap(disp, root, w, h, depth);
- gib_imlib_render_image_on_drawable_at_size(pmap_d1, im,
- render_x, render_y, w, h, 1, 0, 1);
- fehbg = estrjoin(" ", "feh --bg-fill", filbuf, NULL);
+
+#ifdef HAVE_LIBXINERAMA
+ if (opt.xinerama && xinerama_screens)
+ for (i = 0; i < num_xinerama_screens; i++) {
+ scr_w = xinerama_screens[i].width;
+ scr_h = xinerama_screens[i].height;
+ cut_x = (((img_w * scr_h) > (img_h * scr_w)) ? 1 : 0);
+ w = (cut_x ? ((img_h * scr_w) / scr_h) : img_w);
+ h = (cut_x ? img_h : ((img_w * scr_h) / scr_w));
+ render_x = (cut_x ? ((img_w - w) >> 1) : 0);
+ render_y = (cut_x ? 0 : ((img_h - h) >> 1));
+
+ D(("cut_x %d w %5d h %5d x %5d y %5d\n",
+ cut_x, w, h, render_x, render_y));
+
+ gib_imlib_render_image_part_on_drawable_at_size(
+ pmap_d1, im,
+ render_x, render_y,
+ w, h,
+ xinerama_screens[i].x_org,
+ xinerama_screens[i].y_org,
+ scr_w, scr_h, 1, 0, !opt.force_aliasing);
+ }
+ else
+#endif /* HAVE_LIBXINERAMA */
+ gib_imlib_render_image_on_drawable_at_size(pmap_d1, im,
+ render_x, render_y, w, h, 1, 0, !opt.force_aliasing);
+ fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-fill", filbuf, NULL);
} else if (filled == 2) {
int scr_w = scr->width;
int scr_h = scr->height;
@@ -233,38 +268,48 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
int img_h = gib_imlib_image_get_height(im);
int render_x = 0;
int render_y = 0;
+ int border_x = (((img_w * scr_h) > (img_h * scr_w)) ? 0 : 1);
+ w = (border_x ? ((scr_h * img_w) / img_h) : scr_w);
+ h = (border_x ? scr_h : ((scr_w * img_h) / img_w));
XGCValues gcval;
- if (img_w > img_h) {
- w = scr_w;
- h = (((scr_w * 100) / img_w) * img_h) / 100;
- render_y = (scr_h - h) / 2;
- if (h > scr_h) {
- w = (((scr_h * 100) / h) * w) / 100;
- h = scr_h;
- render_x = (scr_w - w) / 2;
- render_y = 0;
- }
- } else {
- h = scr_h;
- w = (((scr_h * 100) / img_h) * img_w) / 100;
- render_x = (scr_w - w) / 2;
- if (w > scr_w) {
- h = (((scr_w * 100) / w) * h) / 100;
- w = scr_w;
- render_x = 0;
- render_y = (scr_h - h) / 2;
- }
- }
+ if (border_x)
+ render_x = (scr_w - w) >> 1;
+ else
+ render_y = (scr_h - h) >> 1;
pmap_d1 = XCreatePixmap(disp, root, scr_w, scr_h, depth);
gcval.foreground = BlackPixel(disp, DefaultScreen(disp));
gc = XCreateGC(disp, root, GCForeground, &gcval);
XFillRectangle(disp, pmap_d1, gc, 0, 0, scr_w, scr_h);
+
+#ifdef HAVE_LIBXINERAMA
+ if (opt.xinerama && xinerama_screens)
+ for (i = 0; i < num_xinerama_screens; i++) {
+ scr_w = xinerama_screens[i].width;
+ scr_h = xinerama_screens[i].height;
+ border_x = (((img_w * scr_h) > (img_h * scr_w)) ? 0 : 1);
+ w = (border_x ? ((scr_h * img_w) / img_h) : scr_w);
+ h = (border_x ? scr_h : ((scr_w * img_h) / img_w));
+ render_x = (border_x ? ((scr_w - w) >> 1) : 0);
+ render_y = (border_x ? 0 : ((scr_h - h) >> 1));
+
+ D(("border_x %d w %5d h %5d x %5d y %5d\n",
+ border_x, w, h, render_x, render_y));
+
+ gib_imlib_render_image_on_drawable_at_size(
+ pmap_d1, im,
+ xinerama_screens[i].x_org + render_x,
+ xinerama_screens[i].y_org + render_y,
+ w, h,
+ 1, 0, !opt.force_aliasing);
+ }
+ else
+#endif /* HAVE_LIBXINERAMA */
gib_imlib_render_image_on_drawable_at_size(pmap_d1, im,
- render_x, render_y, w, h, 1, 0, 1);
+ render_x, render_y, w, h, 1, 0, !opt.force_aliasing);
XFreeGC(disp, gc);
- fehbg = estrjoin(" ", "feh --bg-max", filbuf, NULL);
+ fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-max", filbuf, NULL);
} else {
w = gib_imlib_image_get_width(im);
h = gib_imlib_image_get_height(im);
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 17605a9..ca5c387 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -364,7 +364,7 @@ void init_thumbnail_mode(void)
if (opt.display) {
/* thumb_counter is unsigned, so no need to catch overflows */
if (++thumb_counter == opt.thumb_redraw) {
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
thumb_counter = 0;
}
if (!feh_main_iteration(0))
@@ -373,7 +373,7 @@ void init_thumbnail_mode(void)
}
if (thumb_counter != 0)
- winwidget_render_image(winwid, 0, 0);
+ winwidget_render_image(winwid, 0, 1);
if (opt.verbose)
fprintf(stdout, "\n");
diff --git a/src/winwidget.c b/src/winwidget.c
index e918cd3..a39e8ef 100644
--- a/src/winwidget.c
+++ b/src/winwidget.c
@@ -58,6 +58,7 @@ static winwidget winwidget_allocate(void)
ret->type = WIN_TYPE_UNSET;
ret->visible = 0;
ret->caption_entry = 0;
+ ret->force_aliasing = opt.force_aliasing;
/* Zoom stuff */
ret->mode = MODE_NORMAL;
@@ -99,7 +100,7 @@ winwidget winwidget_create_from_image(Imlib_Image im, char *name, char type)
if (opt.full_screen && (type != WIN_TYPE_THUMBNAIL))
ret->full_screen = True;
winwidget_create_window(ret, ret->w, ret->h);
- winwidget_render_image(ret, 1, 1);
+ winwidget_render_image(ret, 1, 0);
return(ret);
}
@@ -132,7 +133,7 @@ winwidget winwidget_create_from_file(gib_list * list, char *name, char type)
if (opt.full_screen)
ret->full_screen = True;
winwidget_create_window(ret, ret->w, ret->h);
- winwidget_render_image(ret, 1, 1);
+ winwidget_render_image(ret, 1, 0);
}
return(ret);
@@ -362,10 +363,11 @@ void winwidget_setup_pixmaps(winwidget winwid)
return;
}
-void winwidget_render_image(winwidget winwid, int resize, int alias)
+void winwidget_render_image(winwidget winwid, int resize, int force_alias)
{
int sx, sy, sw, sh, dx, dy, dw, dh;
int calc_w, calc_h;
+ int antialias = 0;
if (!winwid->full_screen && resize) {
winwidget_resize(winwid, winwid->im_w, winwid->im_h);
@@ -378,8 +380,8 @@ void winwidget_render_image(winwidget winwid, int resize, int alias)
if (winwid->im_y > winwid->h)
winwid->im_y = winwid->h;
- D(("winwidget_render_image resize %d alias %d im %dx%d\n",
- resize, alias, winwid->im_w, winwid->im_h));
+ D(("winwidget_render_image resize %d force_alias %d im %dx%d\n",
+ resize, force_alias, winwid->im_w, winwid->im_h));
winwidget_setup_pixmaps(winwid);
@@ -524,17 +526,22 @@ void winwidget_render_image(winwidget winwid, int resize, int alias)
D(("sx: %d sy: %d sw: %d sh: %d dx: %d dy: %d dw: %d dh: %d zoom: %f\n",
sx, sy, sw, sh, dx, dy, dw, dh, winwid->zoom));
+ if ((winwid->zoom != 1.0) && !force_alias && !winwid->force_aliasing)
+ antialias = 1;
+
D(("winwidget_render(): winwid->im_angle = %f\n", winwid->im_angle));
if (winwid->has_rotated)
gib_imlib_render_image_part_on_drawable_at_size_with_rotation
- (winwid->bg_pmap, winwid->im, sx, sy, sw, sh, dx, dy, dw, dh, winwid->im_angle, 1, 1, alias);
+ (winwid->bg_pmap, winwid->im, sx, sy, sw, sh, dx, dy, dw, dh,
+ winwid->im_angle, 1, 1, antialias);
else
gib_imlib_render_image_part_on_drawable_at_size(winwid->bg_pmap,
winwid->im,
sx, sy, sw,
sh, dx, dy,
dw, dh, 1,
- gib_imlib_image_has_alpha(winwid->im), alias);
+ gib_imlib_image_has_alpha(winwid->im),
+ antialias);
if (opt.mode == MODE_NORMAL) {
if (opt.caption_path)
@@ -545,7 +552,7 @@ void winwidget_render_image(winwidget winwid, int resize, int alias)
feh_draw_actions(winwid);
if (opt.info_cmd)
feh_draw_info(winwid);
- } else if ((opt.mode == MODE_ZOOM) && !alias)
+ } else if ((opt.mode == MODE_ZOOM) && !antialias)
feh_draw_zoom(winwid);
XSetWindowBackgroundPixmap(disp, winwid->win, winwid->bg_pmap);
@@ -580,7 +587,7 @@ double feh_calc_needed_zoom(double *zoom, int orig_w, int orig_h, int dest_w, in
ratio = ((double) orig_w / orig_h) / ((double) dest_w / dest_h);
- if (opt.zoom_mode == ZOOM_MODE_MAX)
+ if (opt.zoom_mode == ZOOM_MODE_FILL)
ratio = 1.0 / ratio;
if (ratio > 1.0)
@@ -691,13 +698,13 @@ void winwidget_destroy_all(void)
return;
}
-void winwidget_rerender_all(int resize, int alias)
+void winwidget_rerender_all(int resize)
{
int i;
/* Have to DESCEND the list here, 'cos of the way _unregister works */
for (i = window_num - 1; i >= 0; i--)
- winwidget_render_image(windows[i], resize, alias);
+ winwidget_render_image(windows[i], resize, 0);
return;
}
@@ -988,7 +995,7 @@ void winwidget_size_to_image(winwidget winwid)
{
winwidget_resize(winwid, winwid->im_w * winwid->zoom, winwid->im_h * winwid->zoom);
winwid->im_x = winwid->im_y = 0;
- winwidget_render_image(winwid, 0, 1);
+ winwidget_render_image(winwid, 0, 0);
return;
}
diff --git a/src/winwidget.h b/src/winwidget.h
index 8b4579c..922ecf5 100644
--- a/src/winwidget.h
+++ b/src/winwidget.h
@@ -82,6 +82,7 @@ struct __winwidget {
int h;
int im_w;
int im_h;
+ int force_aliasing;
double im_angle;
enum win_type type;
unsigned char had_resize, full_screen;
@@ -123,14 +124,14 @@ void winwidget_hide(winwidget winwid);
void winwidget_destroy_all(void);
void winwidget_free_image(winwidget w);
void winwidget_center_image(winwidget w);
-void winwidget_render_image(winwidget winwid, int resize, int alias);
+void winwidget_render_image(winwidget winwid, int resize, int force_alias);
void winwidget_rotate_image(winwidget winid, double angle);
void winwidget_move(winwidget winwid, int x, int y);
void winwidget_resize(winwidget winwid, int w, int h);
void winwidget_setup_pixmaps(winwidget winwid);
void winwidget_update_title(winwidget ret);
void winwidget_update_caption(winwidget winwid);
-void winwidget_rerender_all(int resize, int alias);
+void winwidget_rerender_all(int resize);
void winwidget_destroy_xwin(winwidget winwid);
void winwidget_set_pointer(winwidget winwid, int visible);
diff --git a/test/feh.i b/test/feh.i
index 7ac6202..231f260 100755
--- a/test/feh.i
+++ b/test/feh.i
@@ -4,7 +4,7 @@ use warnings;
use 5.010;
use Cwd;
-use Test::More tests => 102;
+use Test::More tests => 103;
use Time::HiRes qw/sleep/;
use X11::GUITest qw/:ALL/;
@@ -445,3 +445,9 @@ ok(waitfor {
},
'disabled screen clip');
feh_stop();
+
+# GH-35 "Custom window title crashes feh on unloadable files"
+$win = feh_start('--title "feh %h"', 'test/ok/png test/fail/png test/ok/jpg');
+SendKeys('{RIG}');
+test_win_title($win, 'feh 16');
+feh_stop();
diff --git a/test/feh.t b/test/feh.t
index 69fd5d2..ac9262f 100644
--- a/test/feh.t
+++ b/test/feh.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.010;
-use Test::Command tests => 63;
+use Test::Command tests => 59;
$ENV{HOME} = 'test';
@@ -10,7 +10,7 @@ my $feh = "src/feh";
my $images = 'test/ok/gif test/ok/jpg test/ok/png test/ok/pnm '
. 'test/fail/gif test/fail/jpg test/fail/png test/fail/pnm';
-my ($feh_name, $feh_version) = @ENV{'PACKAGE', 'VERSION'};
+my $feh_name = $ENV{'PACKAGE'};
# These tests are meant to run non-interactively and without X.
# make sure they are capable of doing so.
@@ -18,18 +18,17 @@ delete $ENV{'DISPLAY'};
my $err_no_env = <<'EOF';
-Unable to determine feh PACKAGE or VERSION.
+Unable to determine feh PACKAGE.
This is most likely because you ran 'prove test' or 'perl test/feh.t'.
-Sinc this test uses make variables and is therefore designed to be run from
+Since this test uses make variables and is therefore designed to be run from
the Makefile only, use 'make test' instead.
If you absolutely need to run it the other way, use
- PACKAGE=feh VERSION=1.5 ${your_command}
-(with the appropiate values, of course).
+ PACKAGE=feh ${your_command}
EOF
-if (length($feh_name) == 0 or length($feh_version) == 0) {
+if (length($feh_name) == 0) {
die($err_no_env);
}
@@ -39,21 +38,9 @@ my $re_loadable = qr{test/ok/...};
my $re_unloadable = qr{test/fail/...};
my $re_list_action = qr{test/ok/... 16x16 \(${feh_name}\)};
-my $cmd = Test::Command->new(cmd => $feh);
-
-# Insufficient Arguments -> Usage should return failure
-$cmd->exit_is_num(1, 'missing arguments return 1');
-$cmd->stdout_is_eq('', 'missing arguments print usage (!stdout)');
-$cmd->stderr_is_eq(<<"EOF", 'missing arguments print usage (stderr)');
-${feh_name} - No loadable images specified.
-Use ${feh_name} --help for detailed usage information
-EOF
-
-$cmd = Test::Command->new(cmd => "$feh --version");
+my $cmd = Test::Command->new(cmd => "$feh --version");
$cmd->exit_is_num(0);
-$cmd->stdout_is_eq("${feh_name} version ${feh_version}\n"
- . "Compile-time switches: curl xinerama \n");
$cmd->stderr_is_eq('');
$cmd = Test::Command->new(cmd => "$feh --loadable $images");
diff --git a/test/scr/caption_done b/test/scr/caption_done
index d178e7e..d873599 100644
--- a/test/scr/caption_done
+++ b/test/scr/caption_done
Binary files differ
diff --git a/test/scr/caption_new b/test/scr/caption_new
index fc438fd..54d48ac 100644
--- a/test/scr/caption_new
+++ b/test/scr/caption_new
Binary files differ
diff --git a/test/scr/caption_while b/test/scr/caption_while
index e9db559..313565a 100644
--- a/test/scr/caption_while
+++ b/test/scr/caption_while
Binary files differ
diff --git a/test/scr/draw_action b/test/scr/draw_action
index 4a2b06c..3c49ba1 100644
--- a/test/scr/draw_action
+++ b/test/scr/draw_action
Binary files differ
diff --git a/test/scr/draw_all_multi b/test/scr/draw_all_multi
index d105fbe..0153eb7 100644
--- a/test/scr/draw_all_multi
+++ b/test/scr/draw_all_multi
Binary files differ
diff --git a/test/scr/draw_all_one b/test/scr/draw_all_one
index 7a3b796..f33566c 100644
--- a/test/scr/draw_all_one
+++ b/test/scr/draw_all_one
Binary files differ
diff --git a/test/scr/draw_filename b/test/scr/draw_filename
index dc32356..eea7dab 100644
--- a/test/scr/draw_filename
+++ b/test/scr/draw_filename
Binary files differ
diff --git a/test/scr/draw_filename_action b/test/scr/draw_filename_action
index 6039def..73f9afd 100644
--- a/test/scr/draw_filename_action
+++ b/test/scr/draw_filename_action
Binary files differ
diff --git a/test/scr/thumbnail_default b/test/scr/thumbnail_default
index 2c52059..eade08b 100644
--- a/test/scr/thumbnail_default
+++ b/test/scr/thumbnail_default
Binary files differ