diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/events.c | 28 | ||||
-rw-r--r-- | src/filelist.c | 3 | ||||
-rw-r--r-- | src/imlib.c | 6 | ||||
-rw-r--r-- | src/options.c | 5 | ||||
-rw-r--r-- | src/wallpaper.c | 38 |
5 files changed, 61 insertions, 19 deletions
diff --git a/src/events.c b/src/events.c index fadae9b..e6cf0ac 100644 --- a/src/events.c +++ b/src/events.c @@ -378,8 +378,12 @@ static void feh_event_handle_ButtonRelease(XEvent * ev) x /= winwid->zoom; y /= winwid->zoom; thumbfile = feh_thumbnail_get_file_from_coords(x, y); - if (thumbfile) - feh_thumbnail_show_fullsize(thumbfile); + if (thumbfile) { + if (opt.actions[0]) + feh_action_run(thumbfile, opt.actions[0]); + else + feh_thumbnail_show_fullsize(thumbfile); + } } } else { opt.mode = MODE_NORMAL; @@ -578,36 +582,38 @@ static void feh_event_handle_MotionNotify(XEvent * ev) winwidget_sanitise_offsets(winwid); - D(("im_x %d, im_w %d, off %d, mx %d\n", winwid->im_x, - winwid->im_w, winwid->click_offset_x, ev->xmotion.x)); + D(("im_x %d, im_w %d, off %d, mx %d, my %d\n", winwid->im_x, + winwid->im_w, winwid->click_offset_x, ev->xmotion.x, + ev->xmotion.y)); /* XWarpPointer generates a MotionNotify event which we will * parse. Since that event would undo the effect of the pointer * warp, we need to change the click_offset to compensate this. */ - if ((winwid->w - ev->xmotion.x <= 1) - && (winwid->click_offset_x >= winwid->w - 4)) + if ((winwid->w - ev->xmotion.x <= 1) && (winwid->im_x < 0)) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, 3, ev->xmotion.y); winwid->click_offset_x -= winwid->w - 4; } - else if ((ev->xmotion.x <= 1) && (winwid->click_offset_x - <= (winwid->im_w * winwid->zoom) - winwid->w - 3)) + // TODO needlessly warps for certain zoom levels + else if ((ev->xmotion.x <= 1) && (winwid->im_x > + (winwid->w - winwid->im_w * winwid->zoom))) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, winwid->w - 4, ev->xmotion.y); winwid->click_offset_x += winwid->w - 4; } else if ((winwid->h - ev->xmotion.y <= 1) - && (winwid->click_offset_y >= winwid->h - 4)) + && (winwid->im_y < 0)) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, ev->xmotion.x, 3); winwid->click_offset_y -= winwid->h - 4; } - else if ((ev->xmotion.y <= 1) && (winwid->click_offset_y - <= (winwid->im_h * winwid->zoom) - winwid->h - 3)) + // TODO needlessly warps for certain zoomlevels + else if ((ev->xmotion.y <= 1) && (winwid->im_y > + (winwid->h - winwid->im_h * winwid->zoom))) { XWarpPointer(disp, None, winwid->win, 0, 0, 0, 0, ev->xmotion.x, winwid->h - 4); diff --git a/src/filelist.c b/src/filelist.c index bbde98c..8d19e41 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -213,7 +213,8 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level) if ((!strncmp(path, "http://", 7)) || (!strncmp(path, "https://", 8)) - || (!strncmp(path, "ftp://", 6))) { + || (!strncmp(path, "ftp://", 6)) + || (!strncmp(path, "file://", 7))) { /* Its a url */ D(("Adding url %s to filelist\n", path)); filelist = gib_list_add_front(filelist, feh_file_new(path)); diff --git a/src/imlib.c b/src/imlib.c index 2047c63..36de346 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -243,8 +243,10 @@ int feh_load_image(Imlib_Image * im, feh_file * file) return 0; /* Handle URLs */ - if ((!strncmp(file->filename, "http://", 7)) || (!strncmp(file->filename, "https://", 8)) - || (!strncmp(file->filename, "ftp://", 6))) { + if ((!strncmp(file->filename, "http://", 7)) + || (!strncmp(file->filename, "https://", 8)) + || (!strncmp(file->filename, "ftp://", 6)) + || (!strncmp(file->filename, "file://", 7))) { image_source = SRC_HTTP; if ((tmpname = feh_http_load_image(file->filename)) == NULL) diff --git a/src/options.c b/src/options.c index 627c7da..c6166d9 100644 --- a/src/options.c +++ b/src/options.c @@ -717,7 +717,10 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) break; case 234: opt.info_cmd = estrdup(optarg); - opt.draw_info = 1; + if (opt.info_cmd[0] == ';') + opt.info_cmd++; + else + opt.draw_info = 1; break; case 235: opt.force_aliasing = 1; diff --git a/src/wallpaper.c b/src/wallpaper.c index 30c3925..886beb6 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -104,8 +104,21 @@ static void feh_wm_set_bg_centered(Pixmap pmap, Imlib_Image im, int use_filelist if (use_filelist) feh_wm_load_next(&im); - offset_x = (w - gib_imlib_image_get_width(im)) >> 1; - offset_y = (h - gib_imlib_image_get_height(im)) >> 1; + if(opt.geom_flags & XValue) + if(opt.geom_flags & XNegative) + offset_x = (w - gib_imlib_image_get_width(im)) + opt.geom_x; + else + offset_x = opt.geom_x; + else + offset_x = (w - gib_imlib_image_get_width(im)) >> 1; + + if(opt.geom_flags & YValue) + if(opt.geom_flags & YNegative) + offset_y = (h - gib_imlib_image_get_height(im)) + opt.geom_y; + else + offset_y = opt.geom_y; + else + offset_y = (h - gib_imlib_image_get_height(im)) >> 1; gib_imlib_render_image_part_on_drawable_at_size(pmap, im, ((offset_x < 0) ? -offset_x : 0), @@ -161,6 +174,7 @@ static void feh_wm_set_bg_maxed(Pixmap pmap, Imlib_Image im, int use_filelist, { int img_w, img_h, border_x; int render_w, render_h, render_x, render_y; + int margin_x, margin_y; if (use_filelist) feh_wm_load_next(&im); @@ -173,8 +187,24 @@ static void feh_wm_set_bg_maxed(Pixmap pmap, Imlib_Image im, int use_filelist, render_w = ( border_x ? ((img_w * h) / img_h) : w); render_h = ( !border_x ? ((img_h * w) / img_w) : h); - render_x = x + ( border_x ? ((w - render_w) >> 1) : 0); - render_y = y + ( !border_x ? ((h - render_h) >> 1) : 0); + if(opt.geom_flags & XValue) + if(opt.geom_flags & XNegative) + margin_x = (w - render_w) + opt.geom_x; + else + margin_x = opt.geom_x; + else + margin_x = (w - render_w) >> 1; + + if(opt.geom_flags & YValue) + if(opt.geom_flags & YNegative) + margin_y = (h - render_h) + opt.geom_y; + else + margin_y = opt.geom_y; + else + margin_y = (h - render_h) >> 1; + + render_x = x + ( border_x ? margin_x : 0); + render_y = y + ( !border_x ? margin_y : 0); gib_imlib_render_image_on_drawable_at_size(pmap, im, render_x, render_y, |