diff -Nau feh-1.3.4/src/events.c feh-1.3.4_mod/src/events.c --- feh-1.3.4/src/events.c 2005-07-14 07:59:03.000000000 -0400 +++ feh-1.3.4_mod/src/events.c 2008-02-22 21:08:27.000000000 -0500 @@ -51,6 +51,7 @@ ev_handler[i] = NULL; ev_handler[KeyPress] = feh_event_handle_keypress; + ev_handler[KeyRelease] = feh_event_handle_keyrelease; ev_handler[ButtonPress] = feh_event_handle_ButtonPress; ev_handler[ButtonRelease] = feh_event_handle_ButtonRelease; ev_handler[ConfigureNotify] = feh_event_handle_ConfigureNotify; diff -Nau feh-1.3.4/src/feh.h feh-1.3.4_mod/src/feh.h --- feh-1.3.4/src/feh.h 2005-07-14 07:59:03.000000000 -0400 +++ feh-1.3.4_mod/src/feh.h 2008-02-22 22:55:26.000000000 -0500 @@ -106,6 +106,7 @@ void show_version(void); int feh_main_iteration(int block); void feh_handle_event(XEvent * ev); +void feh_set_color_modifier( void ); void init_x_and_imlib(void); #ifdef HAVE_LIBXINERAMA void init_xinerama(void); @@ -126,6 +127,7 @@ char *slideshow_create_name(feh_file * file); char *chop_file_from_full_path(char *str); void feh_event_handle_keypress(XEvent * ev); +void feh_event_handle_keyrelease(XEvent * ev); void feh_action_run(feh_file * file, char *action); char *feh_printf(char *str, feh_file * file); void feh_draw_zoom(winwidget w); diff -Nau feh-1.3.4/src/imlib.c feh-1.3.4_mod/src/imlib.c --- feh-1.3.4/src/imlib.c 2005-07-14 07:59:03.000000000 -0400 +++ feh-1.3.4_mod/src/imlib.c 2008-02-22 23:33:25.000000000 -0500 @@ -66,6 +66,23 @@ } #endif /* HAVE_LIBXINERAMA */ + +void +feh_set_color_modifier( void ) +{ + Imlib_Color_Modifier cmod = imlib_create_color_modifier(); + if( cmod ) { + if( imlib_context_get_color_modifier() ) + imlib_free_color_modifier(); + imlib_context_set_color_modifier( cmod ); + imlib_modify_color_modifier_brightness(opt.brightness); + imlib_modify_color_modifier_contrast(opt.contrast); + imlib_modify_color_modifier_gamma(opt.gamma); + } +} + + + void init_x_and_imlib(void) { @@ -101,6 +118,9 @@ imlib_add_path_to_font_path(PREFIX "/share/feh/fonts"); imlib_add_path_to_font_path("./ttfonts"); + if( opt.flag&(FEH_FLAG_BRIGHTNESS|FEH_FLAG_CONTRAST|FEH_FLAG_GAMMA) ) + feh_set_color_modifier(); + D_RETURN_(4); } diff -Nau feh-1.3.4/src/keyevents.c feh-1.3.4_mod/src/keyevents.c --- feh-1.3.4/src/keyevents.c 2005-07-14 07:59:03.000000000 -0400 +++ feh-1.3.4_mod/src/keyevents.c 2008-02-22 23:23:10.000000000 -0500 @@ -29,6 +29,8 @@ #include "winwidget.h" #include "options.h" +extern int panpixel; + void feh_event_invoke_action(winwidget winwid, char *action) { @@ -58,6 +60,22 @@ } void +feh_event_handle_keyrelease(XEvent * ev) +{ + switch( XKeycodeToKeysym( disp, ev->xkey.keycode, 0 ) ) { + case XK_Shift_L : case XK_Shift_R: + panpixel = opt.normal_pan; + } +} + +static void +feh_apply_color_modifier( winwidget winwid ) +{ + feh_set_color_modifier(); + winwidget_render_image(winwid, 0, 0); +} + +void feh_event_handle_keypress(XEvent * ev) { int len; @@ -188,25 +206,27 @@ D_RETURN_(4); } - switch (keysym) { - case XK_Left: + int orig_x, orig_y; + case XK_Page_Up: + case XK_KP_Left: /* originally XK_Left */ if (opt.slideshow) slideshow_change_image(winwid, SLIDE_PREV); break; - case XK_Right: + case XK_Page_Down: + case XK_KP_Right: /* originally XK_Right */ if (opt.slideshow) slideshow_change_image(winwid, SLIDE_NEXT); break; - case XK_Page_Up: + case XK_KP_Up: /* originally XK_Page_Up */ if (opt.slideshow) slideshow_change_image(winwid, SLIDE_JUMP_BACK); break; - case XK_Escape: + case XK_Escape: /* originally XK_Page_Down */ winwidget_destroy_all(); break; - case XK_Page_Down: + case XK_KP_Down: if (opt.slideshow) slideshow_change_image(winwid, SLIDE_JUMP_FWD); break; @@ -281,34 +301,68 @@ case XK_9: feh_event_invoke_action(winwid,opt.actions[9]); break; - case XK_KP_Left: - winwid->im_x = winwid->im_x - 10; - winwidget_render_image(winwid, 0, 0); + case XK_Shift_L: + case XK_Shift_R: + panpixel = opt.fast_pan; + break; + case XK_Left: + orig_x = winwid->im_x; + winwid->im_x += panpixel; + winwidget_sanitise_offsets(winwid); + if( winwid->im_x != orig_x ) + winwidget_render_image(winwid, 0, 0); break; - case XK_KP_Right: - winwid->im_x = winwid->im_x + 10; - winwidget_render_image(winwid, 0, 0); + case XK_Right: + orig_x = winwid->im_x; + winwid->im_x -= panpixel; + winwidget_sanitise_offsets(winwid); + if( winwid->im_x != orig_x ) + winwidget_render_image(winwid, 0, 0); + break; + case XK_Up: + orig_y = winwid->im_y; + winwid->im_y += panpixel; + winwidget_sanitise_offsets(winwid); + if( winwid->im_y != orig_y ) + winwidget_render_image(winwid, 0, 0); + break; + case XK_Down: + orig_y = winwid->im_y; + winwid->im_y -= panpixel; + winwidget_sanitise_offsets(winwid); + if ( winwid->im_y != orig_y ) + winwidget_render_image(winwid, 0, 0); break; - case XK_KP_Up: - winwid->im_y = winwid->im_y - 10; - winwidget_render_image(winwid, 0, 0); + case XK_KP_Add: +// case '=': + // case '+': + if (opt.reload < SLIDESHOW_RELOAD_MAX) + opt.reload++; + else if (opt.verbose) + weprintf("Cannot set RELOAD higher than %d seconds.", opt.reload); break; - case XK_KP_Down: - winwid->im_y = winwid->im_y + 10; - winwidget_render_image(winwid, 0, 0); +// case '-': + // case '_': + case XK_KP_Subtract: + if (opt.reload > 1) + opt.reload--; + else if (opt.verbose) + weprintf("Cannot set RELOAD lower than 1 second."); break; - case XK_KP_Add: + case '+': case '=': // acdsee rule winwid->zoom = winwid->zoom * 1.25; winwidget_render_image(winwid, 0, 0); break; - case XK_KP_Subtract: + case '-': case '_': // acdsee rule winwid->zoom = winwid->zoom * 0.75; winwidget_render_image(winwid, 0, 0); break; + case '/': /* acdsee rule */ case XK_KP_Multiply: winwid->zoom = 1; winwidget_render_image(winwid, 0, 0); break; + case '*': /* acdsee rule */ case XK_KP_Divide: feh_calc_needed_zoom(&winwid->zoom, winwid->im_w, winwid->im_h, winwid->w, winwid->h); winwidget_render_image(winwid, 0, 0); @@ -323,6 +377,30 @@ switch (*kbuf) { + case 'b': + opt.brightness -= opt.brightness_inc; + feh_apply_color_modifier(winwid); + break; + case 'B': + opt.brightness += opt.brightness_inc; + feh_apply_color_modifier(winwid); + break; + case 'g': + opt.gamma -= opt.gamma_inc; + feh_apply_color_modifier(winwid); + break; + case 'G': + opt.gamma += opt.gamma_inc; + feh_apply_color_modifier(winwid); + break; + case 't': + opt.contrast -= opt.contrast_inc; + feh_apply_color_modifier(winwid); + break; + case 'T': + opt.contrast += opt.contrast_inc; + feh_apply_color_modifier(winwid); + break; case 'n': case 'N': case ' ': @@ -424,20 +502,6 @@ xinerama_screens[curr_screen].y_org); } #endif /* HAVE_LIBXINERAMA */ - case '=': - case '+': - if (opt.reload < SLIDESHOW_RELOAD_MAX) - opt.reload++; - else if (opt.verbose) - weprintf("Cannot set RELOAD higher than %d seconds.", opt.reload); - break; - case '-': - case '_': - if (opt.reload > 1) - opt.reload--; - else if (opt.verbose) - weprintf("Cannot set RELOAD lower than 1 second."); - break; default: break; } diff -Nau feh-1.3.4/src/main.c feh-1.3.4_mod/src/main.c --- feh-1.3.4/src/main.c 2005-07-14 07:59:03.000000000 -0400 +++ feh-1.3.4_mod/src/main.c 2008-02-22 23:36:33.000000000 -0500 @@ -35,6 +35,7 @@ int cmdargc = 0; int call_level = 0; char *mode = NULL; +int panpixel; int main(int argc, char **argv) @@ -81,6 +82,7 @@ init_slideshow_mode(); } + panpixel = opt.normal_pan; /* main event loop */ while (feh_main_iteration(1)); @@ -210,6 +212,9 @@ { D_ENTER(4); + if( imlib_context_get_color_modifier() ) + imlib_free_color_modifier(); + delete_rm_files(); if (opt.filelistfile) diff -Nau feh-1.3.4/src/options.c feh-1.3.4_mod/src/options.c --- feh-1.3.4/src/options.c 2005-07-14 07:59:03.000000000 -0400 +++ feh-1.3.4_mod/src/options.c 2008-02-22 23:26:36.000000000 -0500 @@ -27,6 +27,9 @@ #include "filelist.h" #include "options.h" +#define FEH_DEFAULT_NORMAL_PAN 10 +#define FEH_DEFAULT_FAST_PAN 30 + static void check_options(void); static void feh_parse_option_array(int argc, char **argv); static void feh_parse_environment_options(void); @@ -82,6 +85,14 @@ #endif /* HAVE_LIBXINERAMA */ opt.fmmode = 0; + + opt.normal_pan = FEH_DEFAULT_NORMAL_PAN; + opt.fast_pan = FEH_DEFAULT_FAST_PAN; + opt.brightness = 0.; + opt.contrast = 1.; + opt.gamma = 1.; + opt.brightness_inc = opt.contrast_inc = opt.gamma_inc = 0.05; + opt.flag = 0; D(3, ("About to parse env options (if any)\n")); /* Check for and parse any options in FEH_OPTIONS */ @@ -410,6 +421,17 @@ {"draw-actions", 0, 0, 222}, {"cache-thumbnails", 0, 0, 223}, {"cycle-once", 0, 0, 224}, + {"normal-pan", 1, 0, 225 }, + {"fast-pan",1,0,226 }, + {"antialias",0,0,227 }, + {"right",0,0,228}, + {"bottom",0,0,229}, + {"brightness",1,0,230}, + {"contrast",1,0,231}, + {"gamma",1,0,232}, + {"brightness-inc",1,0,233}, + {"contrast-inc",1,0,234}, + {"gamma-inc",1,0,235}, {0, 0, 0, 0} }; int optch = 0, cmdx = 0, i = 0; @@ -738,6 +760,44 @@ case 224: opt.cycle_once = 1; break; + case 225: /* normal pan */ + opt.normal_pan = atoi(optarg); + if( opt.normal_pan<0 ) opt.normal_pan = FEH_DEFAULT_NORMAL_PAN; + break; + case 226: /* fast pan */ + opt.fast_pan = atoi(optarg); + if( opt.fast_pan<0 ) opt.normal_pan = FEH_DEFAULT_FAST_PAN; + break; + case 227: /* antialias */ + opt.flag |= FEH_FLAG_ANTIALIAS; + break; + case 228: /* right */ + opt.flag |= FEH_FLAG_RIGHT; + break; + case 229: /* bottom */ + opt.flag |= FEH_FLAG_BOTTOM; + break; + case 230: /* brightness */ + opt.brightness = atof(optarg); + opt.flag |= FEH_FLAG_BRIGHTNESS; + break; + case 231: /* contrast */ + opt.contrast = atof(optarg); + opt.flag |= FEH_FLAG_CONTRAST; + break; + case 232: /* gamma */ + opt.gamma = atof(optarg); + opt.flag |= FEH_FLAG_GAMMA; + break; + case 233: /* brightness inc */ + opt.brightness_inc = atof(optarg); + break; + case 234: /* contrast inc */ + opt.contrast_inc = atof(optarg); + break; + case 235: /* gamma inc */ + opt.gamma_inc = atof(optarg); + break; default: break; } diff -Nau feh-1.3.4/src/options.h feh-1.3.4_mod/src/options.h --- feh-1.3.4/src/options.h 2005-07-14 07:59:03.000000000 -0400 +++ feh-1.3.4_mod/src/options.h 2008-02-22 23:21:39.000000000 -0500 @@ -126,8 +126,21 @@ double slideshow_delay; Imlib_Font menu_fn; + int normal_pan; + int fast_pan; + double brightness, brightness_inc; + double contrast, contrast_inc; + double gamma, gamma_inc; + unsigned flag; }; +#define FEH_FLAG_ANTIALIAS 0x00000001 +#define FEH_FLAG_RIGHT 0x00000002 +#define FEH_FLAG_BOTTOM 0x00000004 +#define FEH_FLAG_BRIGHTNESS 0x00000008 +#define FEH_FLAG_CONTRAST 0x00000010 +#define FEH_FLAG_GAMMA 0x00000020 + void init_parse_options(int argc, char **argv); char *feh_string_normalize(char *str); void feh_create_default_config(char *rcfile); Common subdirectories: feh-1.3.4/src/ttfonts and feh-1.3.4_mod/src/ttfonts diff -Nau feh-1.3.4/src/winwidget.c feh-1.3.4_mod/src/winwidget.c --- feh-1.3.4/src/winwidget.c 2005-07-14 07:59:03.000000000 -0400 +++ feh-1.3.4_mod/src/winwidget.c 2008-02-22 22:25:15.000000000 -0500 @@ -355,9 +355,14 @@ D_ENTER(4); + if( opt.flag&FEH_FLAG_ANTIALIAS ) + alias = 1; + if (!winwid->full_screen && resize) { winwidget_resize(winwid, winwid->im_w, winwid->im_h); winwidget_reset_image(winwid); + if( opt.flag&FEH_FLAG_RIGHT ) winwid->im_x = winwid->w - winwid->im_w; + if( opt.flag&FEH_FLAG_BOTTOM ) winwid->im_y = winwid->h - winwid->im_h; } /* bounds checks for panning */