diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/events.c | 20 | ||||
-rw-r--r-- | src/keyevents.c | 31 | ||||
-rw-r--r-- | src/menu.c | 10 | ||||
-rw-r--r-- | src/options.c | 4 | ||||
-rw-r--r-- | src/options.h | 2 | ||||
-rw-r--r-- | src/slideshow.c | 4 | ||||
-rw-r--r-- | src/thumbnail.c | 4 | ||||
-rw-r--r-- | src/winwidget.c | 21 | ||||
-rw-r--r-- | src/winwidget.h | 5 |
9 files changed, 60 insertions, 41 deletions
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/keyevents.c b/src/keyevents.c index 8e2b181..896087e 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")) @@ -424,19 +427,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 +508,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 +518,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 +529,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 +556,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 +621,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 @@ -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/options.c b/src/options.c index 9afbeb0..5a45362 100644 --- a/src/options.c +++ b/src/options.c @@ -423,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} }; @@ -772,6 +773,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; } 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/slideshow.c b/src/slideshow.c index a75affd..497b9bc 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -163,7 +163,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); @@ -264,7 +264,7 @@ 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); 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 426fd74..019d0ab 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 alias = 0; /* TODO should be called antialias */ 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,6 +526,9 @@ 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) + alias = 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 @@ -691,13 +696,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 +993,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); |