diff --git a/man/feh.pre b/man/feh.pre index b1ef16a8..cffec7e9 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -365,6 +365,47 @@ add multiple paths. . Disable anti-aliasing for zooming, background setting etc. . +.It Cm --aa-scroll int +. +0 disable antialiasing for scroll +. +.Pp +. +1 enable antialiasing after scroll +. + +.It Cm --aa-scroll-page int +. +0 disable antialiasing for scroll-page +. +.Pp +. +1 enable antialiasing after scroll-page +. +.It Cm --aa-pan int +. +0 disable antialiasing for pan +. +.Pp +. +1 enable antialiasing after pan +. +.Pp +. +2 enable antialiasing during pan +. +.It Cm --aa-zoom int +. +0 disable antialiasing for zoom +. +.Pp +. +1 enable antialiasing after zoom +. +.Pp +. +2 enable antialiasing during zoom +. .It Cm -I , --fullindex . Same as index mode, but with additional information below the thumbnails. diff --git a/src/events.c b/src/events.c index 89eaab8a..bfdcb78b 100644 --- a/src/events.c +++ b/src/events.c @@ -267,7 +267,10 @@ static void feh_event_handle_ButtonPress(XEvent * ev) - (winwid->im_click_offset_y * winwid->zoom); winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 0); + if(opt.antialiasing_zoom == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 1 || opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_bb(EVENT_zoom_out, button, state)) { D(("Zoom_Out Button Press event\n")); @@ -295,7 +298,10 @@ static void feh_event_handle_ButtonPress(XEvent * ev) - (winwid->im_click_offset_y * winwid->zoom); winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 0); + if(opt.antialiasing_zoom == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 1 || opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_bb(EVENT_reload_image, button, state)) { D(("Reload Button Press event\n")); @@ -353,7 +359,10 @@ 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, 0); + if(opt.antialiasing_pan == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_pan == 1 || opt.antialiasing_pan == 2) + winwidget_render_image(winwid, 0, 0); } else if (opt.mode == MODE_NEXT) { opt.mode = MODE_NORMAL; winwid->mode = MODE_NORMAL; @@ -399,7 +408,10 @@ static void feh_event_handle_ButtonRelease(XEvent * ev) } else winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 0); + if(opt.antialiasing_zoom == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 1 || opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_bb(EVENT_blur, button, state)) { D(("Disabling Blur mode\n")); @@ -554,7 +566,10 @@ 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, 1); + if(opt.antialiasing_zoom == 0 || opt.antialiasing_zoom == 1) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } } else if ((opt.mode == MODE_PAN) || (opt.mode == MODE_NEXT)) { int orig_x, orig_y; @@ -621,7 +636,11 @@ static void feh_event_handle_MotionNotify(XEvent * ev) if ((winwid->im_x != orig_x) || (winwid->im_y != orig_y)) - winwidget_render_image(winwid, 0, 1); + if(opt.antialiasing_pan == 0 || opt.antialiasing_pan == 1) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_pan == 2) + winwidget_render_image(winwid, 0, 0); + } } else if (opt.mode == MODE_ROTATE) { while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev)); @@ -641,7 +660,10 @@ 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, 1); + if(opt.antialiasing_zoom == 0 || opt.antialiasing_zoom == 1) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } } else if (opt.mode == MODE_BLUR) { while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev)); diff --git a/src/help.raw b/src/help.raw index ca7c85c5..1441abc9 100644 --- a/src/help.raw +++ b/src/help.raw @@ -61,6 +61,16 @@ OPTIONS --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 + --aa-scroll NUM 0 disable antialiasing for scroll + 1 enable antialiasing after scroll + --aa-scroll-page NUM 0 disable antialiasing for scroll-page + 1 enable antialiasing after scroll-page + --aa-pan NUM 0 disable antialiasing for pan + 1 enable antialiasing after pan + 2 enable antialiasing during pan + --aa-zoom NUM 0 disable antialiasing for zoom + 1 enable antialiasing after zoom + 2 enable antialiasing during zoom -m, --montage Enable montage mode -i, --index Create an index print of all images --info CMD Run CMD and show its output in the image window diff --git a/src/keyevents.c b/src/keyevents.c index 6c2f06ef..11fde698 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -493,42 +493,66 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy else if (feh_is_kp(EVENT_scroll_right, state, keysym, button)) { winwid->im_x -= opt.scroll_step;; winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 1); + if(opt.antialiasing_scroll == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_scroll == 1) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_scroll_left, state, keysym, button)) { winwid->im_x += opt.scroll_step; winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 1); + if(opt.antialiasing_scroll == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_scroll == 1) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_scroll_down, state, keysym, button)) { winwid->im_y -= opt.scroll_step; winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 1); + if(opt.antialiasing_scroll == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_scroll == 1) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_scroll_up, state, keysym, button)) { winwid->im_y += opt.scroll_step; winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 1); + if(opt.antialiasing_scroll == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_scroll == 1) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_scroll_right_page, state, keysym, button)) { winwid->im_x -= winwid->w; winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 0); + if(opt.antialiasing_scroll_page == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_scroll_page == 1) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_scroll_left_page, state, keysym, button)) { winwid->im_x += winwid->w; winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 0); + if(opt.antialiasing_scroll_page == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_scroll_page == 1) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_scroll_down_page, state, keysym, button)) { winwid->im_y -= winwid->h; winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 0); + if(opt.antialiasing_scroll_page == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_scroll_page == 1) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_scroll_up_page, state, keysym, button)) { winwid->im_y += winwid->h; winwidget_sanitise_offsets(winwid); - winwidget_render_image(winwid, 0, 0); + if(opt.antialiasing_scroll_page == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_scroll_page == 1) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_jump_back, state, keysym, button)) { if (opt.slideshow) @@ -613,7 +637,10 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy 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, 0); + if(opt.antialiasing_zoom == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 1 || opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_zoom_out, state, keysym, button)) { winwid->old_zoom = winwid->zoom; @@ -627,24 +654,36 @@ void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysy 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, 0); + if(opt.antialiasing_zoom == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 1 || opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_zoom_default, state, keysym, button)) { winwid->zoom = 1.0; winwidget_center_image(winwid); - winwidget_render_image(winwid, 0, 0); + if(opt.antialiasing_zoom == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 1 || opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_zoom_fit, state, keysym, button)) { 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, 0); + if(opt.antialiasing_zoom == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 1 || opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); } else if (feh_is_kp(EVENT_zoom_fill, state, keysym, button)) { int save_zoom = opt.zoom_mode; opt.zoom_mode = ZOOM_MODE_FILL; 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, 0); + if(opt.antialiasing_zoom == 0) + winwidget_render_image(winwid, 0, 1); + else if(opt.antialiasing_zoom == 1 || opt.antialiasing_zoom == 2) + winwidget_render_image(winwid, 0, 0); opt.zoom_mode = save_zoom; } else if (feh_is_kp(EVENT_render, state, keysym, button)) { diff --git a/src/options.c b/src/options.c index 37fad889..74274495 100644 --- a/src/options.c +++ b/src/options.c @@ -73,6 +73,10 @@ void init_parse_options(int argc, char **argv) /* if we're using xinerama, then enable it by default */ opt.xinerama = 1; opt.xinerama_index = -1; + opt.antialiasing_scroll_page = 1; + opt.antialiasing_pan = 1; + opt.antialiasing_zoom = 1; + #endif /* HAVE_LIBXINERAMA */ feh_getopt_theme(argc, argv); @@ -425,6 +429,10 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) {"conversion-timeout" , 1, 0, 245}, {"version-sort" , 0, 0, 246}, {"offset" , 1, 0, 247}, + {"aa-scroll" , 1, 0, 248}, + {"aa-scroll-page", 1, 0, 249}, + {"aa-pan" , 1, 0, 250}, + {"aa-zoom" , 1, 0, 251}, {0, 0, 0, 0} }; int optch = 0, cmdx = 0; @@ -762,6 +770,10 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 235: opt.force_aliasing = 1; + opt.antialiasing_scroll = 0; + opt.antialiasing_scroll_page = 0; + opt.antialiasing_pan = 0; + opt.antialiasing_zoom = 0; break; case 236: opt.no_fehbg = 1; @@ -810,6 +822,50 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) opt.offset_flags = XParseGeometry(optarg, &opt.offset_x, &opt.offset_y, (unsigned int *)&discard, (unsigned int *)&discard); break; + case 248: + if(!opt.force_aliasing) { + if(atoi(optarg) == 0 || atoi(optarg) == 1) { + opt.antialiasing_scroll = atoi(optarg); + } else { + weprintf("Unrecognised aa-scroll option \"%s\". " + "Defaulting to 0", optarg); + opt.antialiasing_scroll = 0; + } + } + break; + case 249: + if(!opt.force_aliasing) { + if(atoi(optarg) == 0 || atoi(optarg) == 1) { + opt.antialiasing_scroll_page = atoi(optarg); + } else { + weprintf("Unrecognised aa-scroll-page mode \"%s\". " + "Defaulting to 1", optarg); + opt.antialiasing_scroll_page = 1; + } + } + break; + case 250: + if(!opt.force_aliasing) { + if(atoi(optarg) == 0 || atoi(optarg) == 1 || atoi(optarg) == 2) { + opt.antialiasing_pan = atoi(optarg); + } else { + weprintf("Unrecognised aa-pan mode \"%s\". " + "Defaulting to 1", optarg); + opt.antialiasing_pan = 1; + } + } + break; + case 251: + if(!opt.force_aliasing) { + if(atoi(optarg) == 0 || atoi(optarg) == 1 || atoi(optarg) == 2) { + opt.antialiasing_zoom = atoi(optarg); + } else { + weprintf("Unrecognised aa-zoom mode \"%s\". " + "Defaulting to 1", optarg); + opt.antialiasing_zoom = 1; + } + } + break; default: break; } diff --git a/src/options.h b/src/options.h index 7f8fe9c7..5f1a64db 100644 --- a/src/options.h +++ b/src/options.h @@ -102,6 +102,10 @@ struct __fehoptions { char *index_info; int force_aliasing; + int antialiasing_scroll; + int antialiasing_scroll_page; + int antialiasing_pan; + int antialiasing_zoom; int thumb_w; int thumb_h; int limit_w;