Commit 71c7ff9f authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Add option and keybinding to keep zoom and viewport settings.

Patch by sdaau on IRC. Thanks!
parent 75ef6f2a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
git HEAD
    * Add --keep-zoom-vp option to keep zoom and offsets when switching
      images (patch by sdaau). Press 'k' to toggle it.

Mon, 24 Dec 2012 15:45:54 +0100  Daniel Friesel <derf+feh@finalrewind.org>

* Release v2.8
+16 −5
Original line number Diff line number Diff line
@@ -375,6 +375,11 @@ with
.Qq Nm
in the name.
.
.It Cm --keep-zoom-vp
.
When switching images, keep zoom and viewport settings
.Pq zoom level and X, Y offsets
.
.It Cm -l , --list
.
Don't display images.  Analyze them and display an
@@ -1048,16 +1053,16 @@ and save the caption, or escape to cancel editing. Note that you can insert
an actual newline into the caption using
.Aq CTRL+return .
.
.It e Bq toggle_exif
.
.Pq only if compiled with exif=1
Toggle EXIF tag display
.
.It d Bq toggle_filenames
.
Toggle filename display
.Pq see Cm --draw-filename
.
.It e Bq toggle_exif
.
.Pq only if compiled with exif=1
Toggle EXIF tag display
.
.It f Bq save_filelist
.
Save the current filelist as
@@ -1074,6 +1079,12 @@ change slides based on
Toggle info display
.Pq see Cm --info
.
.It k Bq toggle_keep_vp
.
Toggle zoom and viewport keeping. When enabled,
.Nm
will keep zoom and X, Y offset when switching images.
.
.It m Bq toggle_menu
.
Show menu.  Use the arrow keys and return to select items,
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ OPTIONS
                           mode or when window geometry is fixed. If combined
                           with --auto-zoom, zooming will be limited to the
                           the size.
     --keep-zoom-vp        Keep viewport zoom and settings while changing images
 -w, --multiwindow         Open all files at once, one window per image
 -x, --borderless          Create borderless windows
 -d, --draw-filename       Show the filename in the image window
+6 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ void init_keyevents(void) {
	feh_set_kb(&keys.mirror, 0, XK_bar, 0, 0, 0, 0);
	feh_set_kb(&keys.reload_minus, 0, XK_minus, 0, 0, 0, 0);
	feh_set_kb(&keys.reload_plus, 0, XK_plus, 0, 0, 0, 0);
	feh_set_kb(&keys.toggle_keep_vp, 0, XK_k, 0, 0, 0, 0);

	home = getenv("HOME");
	if (!home)
@@ -307,6 +308,8 @@ void init_keyevents(void) {
			cur_kb = &keys.reload_minus;
		else if (!strcmp(action, "reload_plus"))
			cur_kb = &keys.reload_plus;
		else if (!strcmp(action, "toggle_keep_vp"))
			cur_kb = &keys.toggle_keep_vp;
		else
			weprintf("keys: Invalid action: %s", action);

@@ -761,5 +764,8 @@ void feh_event_handle_keypress(XEvent * ev)
		else if (opt.verbose)
			weprintf("Cannot set RELOAD lower than 1 second.");
	}
	else if (feh_is_kp(&keys.toggle_keep_vp, keysym, state)) {
		opt.keep_zoom_vp = !opt.keep_zoom_vp;
	}
	return;
}
+11 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ enum {
	CB_SORT_FILENAME, CB_SORT_IMAGENAME, CB_SORT_FILESIZE, CB_SORT_RANDOMIZE,
	CB_SAVE_IMAGE, CB_SAVE_FILELIST, CB_FIT, CB_OPT_DRAW_FILENAME,
	CB_OPT_DRAW_ACTIONS, CB_OPT_KEEP_HTTP, CB_OPT_FREEZE_WINDOW,
	CB_OPT_FULLSCREEN, CB_EDIT_ROTATE, CB_OPT_AUTO_ZOOM
	CB_OPT_FULLSCREEN, CB_EDIT_ROTATE, CB_OPT_AUTO_ZOOM, CB_OPT_KEEP_ZOOM_VP
};

feh_menu *feh_menu_new(void)
@@ -1326,6 +1326,14 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, unsigned short dat
				opt.zoom_mode = 0;
			winwidget_rerender_all(1);
			break;
		case CB_OPT_KEEP_ZOOM_VP:
			MENU_ITEM_TOGGLE(i);
			if (MENU_ITEM_IS_ON(i))
				opt.keep_zoom_vp = 1;
			else
				opt.keep_zoom_vp = 0;
			winwidget_rerender_all(1);
			break;
	}
	return;
}
@@ -1381,6 +1389,8 @@ static feh_menu *feh_menu_func_gen_options(feh_menu * m)
				CB_OPT_FREEZE_WINDOW, 0, NULL, opt.geom_flags);
	feh_menu_add_toggle_entry(mm, "Fullscreen", NULL,
				CB_OPT_FULLSCREEN, 0, NULL, m->fehwin->full_screen);
	feh_menu_add_toggle_entry(mm, "Keep viewport zoom & pos", NULL,
				CB_OPT_KEEP_ZOOM_VP, 0, NULL, opt.keep_zoom_vp);

	feh_menu_add_entry(mm, NULL, NULL, 0, 0, NULL);

Loading