Commit 09c59148 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Merge branch 'guns-dirnav'

parents 315bac46 36b09fa0
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -600,10 +600,10 @@ 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, mtime, width, height, pixels, size, format.  For sort
modes other than name, filename, or mtime, a preload run will be necessary,
causing a delay proportional to the number of images in the list.
The file list may be sorted according to image parameters.  Allowed sort types
are: name, filename, dirname, mtime, width, height, pixels, size, format.  For
sort modes other than name, filename, dirname, or mtime, a preload run will be
necessary, causing a delay proportional to the number of images in the list.
.
.Pp
.
@@ -1284,6 +1284,12 @@ Close current window
.
Jump to a random position in the current filelist
.
.It \&[, \&] Bq prev_dir, next_dir
.
Jump to the first image of the previous or next sequence of images sharing
a directory name in the current filelist.  Use --sort dirname if you would
like to ensure that all images in a directory are grouped together.
.
.It < , > Bq orient_3 , orient_1
.
In place editing - rotate the images 90 degrees (counter)clockwise.
+3 −1
Original line number Diff line number Diff line
@@ -102,7 +102,9 @@ enum text_bg { TEXT_BG_CLEAR = 0, TEXT_BG_TINTED };

enum slide_change { SLIDE_NEXT, SLIDE_PREV, SLIDE_RAND, SLIDE_FIRST, SLIDE_LAST,
	SLIDE_JUMP_FWD,
	SLIDE_JUMP_BACK
	SLIDE_JUMP_BACK,
	SLIDE_JUMP_NEXT_DIR,
	SLIDE_JUMP_PREV_DIR
};

enum image_bg { IMAGE_BG_CHECKS = 1, IMAGE_BG_BLACK, IMAGE_BG_WHITE };
+28 −0
Original line number Diff line number Diff line
@@ -383,6 +383,20 @@ int feh_file_info_load(feh_file * file, Imlib_Image im)
	return(0);
}

void feh_file_dirname(char *dst, feh_file * f, int maxlen)
{
	int n = strlen(f->filename) - strlen(f->name);

	/* Give up on long dirnames */
	if (n <= 0 || n >= maxlen) {
		dst[0] = '\0';
		return;
	}

	strncpy(dst, f->filename, n);
	dst[n] = '\0';
}

int feh_cmp_filename(void *file1, void *file2)
{
	return(strcmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename));
@@ -393,6 +407,17 @@ int feh_cmp_name(void *file1, void *file2)
	return(strcmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name));
}

int feh_cmp_dirname(void *file1, void *file2)
{
	char dir1[FEH_MAX_DIRNAME_LEN], dir2[FEH_MAX_DIRNAME_LEN];
	int cmp;
	feh_file_dirname(dir1, FEH_FILE(file1), FEH_MAX_DIRNAME_LEN);
	feh_file_dirname(dir2, FEH_FILE(file2), FEH_MAX_DIRNAME_LEN);
	if ((cmp = strcmp(dir1, dir2)) != 0)
		return(cmp);
	return(feh_cmp_name(file1, file2));
}

/* Return -1 if file1 is _newer_ than file2 */
int feh_cmp_mtime(void *file1, void *file2)
{
@@ -465,6 +490,9 @@ void feh_prepare_filelist(void)
	case SORT_FILENAME:
		filelist = gib_list_sort(filelist, feh_cmp_filename);
		break;
	case SORT_DIRNAME:
		filelist = gib_list_sort(filelist, feh_cmp_dirname);
		break;
	case SORT_MTIME:
		filelist = gib_list_sort(filelist, feh_cmp_mtime);
		break;
+12 −2
Original line number Diff line number Diff line
@@ -53,13 +53,21 @@ struct __feh_file_info {
};

#define FEH_FILE(l) ((feh_file *) l)
#define FEH_MAX_DIRNAME_LEN 4096

enum filelist_recurse { FILELIST_FIRST, FILELIST_CONTINUE, FILELIST_LAST };

enum sort_type { SORT_NONE, SORT_NAME, SORT_FILENAME, SORT_MTIME, SORT_WIDTH,
enum sort_type {
	SORT_NONE,
	SORT_NAME,
	SORT_FILENAME,
	SORT_DIRNAME,
	SORT_MTIME,
	SORT_WIDTH,
	SORT_HEIGHT,
	SORT_PIXELS,
	SORT_SIZE, SORT_FORMAT
	SORT_SIZE,
	SORT_FORMAT
};

feh_file *feh_file_new(char *filename);
@@ -73,6 +81,7 @@ void add_file_to_rm_filelist(char *file);
void delete_rm_files(void);
gib_list *feh_file_info_preload(gib_list * list);
int feh_file_info_load(feh_file * file, Imlib_Image im);
void feh_file_dirname(char *dst, feh_file * f, int maxlen);
void feh_prepare_filelist(void);
int feh_write_filelist(gib_list * list, char *filename);
gib_list *feh_read_filelist(char *filename);
@@ -81,6 +90,7 @@ gib_list *feh_file_remove_from_list(gib_list * list, gib_list * l);
void feh_save_filelist();

int feh_cmp_name(void *file1, void *file2);
int feh_cmp_dirname(void *file1, void *file2);
int feh_cmp_filename(void *file1, void *file2);
int feh_cmp_mtime(void *file1, void *file2);
int feh_cmp_width(void *file1, void *file2);
+14 −0
Original line number Diff line number Diff line
@@ -110,6 +110,8 @@ void init_keyevents(void) {
	feh_set_kb(&keys.next_img  , 0, XK_Right     , 0, XK_n         , 0, XK_space);
	feh_set_kb(&keys.jump_back , 0, XK_Page_Up   , 0, XK_KP_Page_Up, 0, 0);
	feh_set_kb(&keys.jump_fwd  , 0, XK_Page_Down , 0, XK_KP_Page_Down,0,0);
	feh_set_kb(&keys.prev_dir  , 0, XK_bracketleft, 0, 0           , 0, 0);
	feh_set_kb(&keys.next_dir  , 0, XK_bracketright, 0, 0          , 0, 0);
	feh_set_kb(&keys.jump_random,0, XK_z         , 0, 0            , 0, 0);
	feh_set_kb(&keys.quit      , 0, XK_Escape    , 0, XK_q         , 0, 0);
	feh_set_kb(&keys.close     , 0, XK_x         , 0, 0            , 0, 0);
@@ -222,6 +224,10 @@ void init_keyevents(void) {
			cur_kb = &keys.jump_back;
		else if (!strcmp(action, "jump_fwd"))
			cur_kb = &keys.jump_fwd;
		else if (!strcmp(action, "prev_dir"))
			cur_kb = &keys.prev_dir;
		else if (!strcmp(action, "next_dir"))
			cur_kb = &keys.next_dir;
		else if (!strcmp(action, "jump_random"))
			cur_kb = &keys.jump_random;
		else if (!strcmp(action, "quit"))
@@ -532,6 +538,14 @@ void feh_event_handle_keypress(XEvent * ev)
		else if (winwid->type == WIN_TYPE_THUMBNAIL)
			feh_thumbnail_select_next(winwid, 10);
	}
	else if (feh_is_kp(&keys.next_dir, keysym, state)) {
		if (opt.slideshow)
			slideshow_change_image(winwid, SLIDE_JUMP_NEXT_DIR, 1);
	}
	else if (feh_is_kp(&keys.prev_dir, keysym, state)) {
		if (opt.slideshow)
			slideshow_change_image(winwid, SLIDE_JUMP_PREV_DIR, 1);
	}
	else if (feh_is_kp(&keys.quit, keysym, state)) {
		winwidget_destroy_all();
	}
Loading