summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/events.c14
-rw-r--r--src/slideshow.c8
-rw-r--r--src/wallpaper.c9
-rw-r--r--src/winwidget.h1
4 files changed, 24 insertions, 8 deletions
diff --git a/src/events.c b/src/events.c
index 0d5e07d..dcd1aa1 100644
--- a/src/events.c
+++ b/src/events.c
@@ -32,6 +32,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "events.h"
#include "thumbnail.h"
+#define FEH_JITTER_OFFSET 2
+#define FEH_JITTER_TIME 1
+
fehbb buttons;
feh_event_handler *ev_handler[LASTEvent];
@@ -226,6 +229,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
D(("click offset is %d,%d\n", ev->xbutton.x, ev->xbutton.y));
winwid->click_offset_x = ev->xbutton.x - winwid->im_x;
winwid->click_offset_y = ev->xbutton.y - winwid->im_y;
+ winwid->click_start_time = time(NULL);
} else if (feh_is_bb(&buttons.zoom, button, state)) {
D(("Zoom Button Press event\n"));
@@ -496,8 +500,14 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
winwid = winwidget_get_from_window(ev->xmotion.window);
if (winwid) {
if (opt.mode == MODE_NEXT) {
- opt.mode = MODE_PAN;
- winwid->mode = MODE_PAN;
+ if ((abs(winwid->click_offset_x - (ev->xmotion.x - winwid->im_x)) > FEH_JITTER_OFFSET)
+ || (abs(winwid->click_offset_y - (ev->xmotion.y - winwid->im_y)) > FEH_JITTER_OFFSET)
+ || (time(NULL) - winwid->click_start_time > FEH_JITTER_TIME)) {
+ opt.mode = MODE_PAN;
+ winwid->mode = MODE_PAN;
+ }
+ else
+ return;
}
D(("Panning\n"));
orig_x = winwid->im_x;
diff --git a/src/slideshow.c b/src/slideshow.c
index 7dcf791..d79c859 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -555,6 +555,14 @@ void feh_filelist_image_remove(winwidget winwid, char do_delete)
gib_list *doomed;
doomed = current_file;
+ /*
+ * work around feh_list_jump exiting if cycle_once is enabled
+ * and no further files are left (we need to delete first)
+ */
+ if (opt.cycle_once && ! doomed->next && do_delete) {
+ feh_file_rm_and_free(filelist, doomed);
+ exit(0);
+ }
slideshow_change_image(winwid, SLIDE_NEXT, 0);
if (do_delete)
filelist = feh_file_rm_and_free(filelist, doomed);
diff --git a/src/wallpaper.c b/src/wallpaper.c
index df78303..30c3925 100644
--- a/src/wallpaper.c
+++ b/src/wallpaper.c
@@ -190,6 +190,9 @@ static void feh_wm_set_bg_maxed(Pixmap pmap, Imlib_Image im, int use_filelist,
void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
int filled, int desktop, int use_filelist)
{
+ XGCValues gcvalues;
+ XGCValues gcval;
+ GC gc;
char bgname[20];
int num = (int) rand();
char bgfil[4096];
@@ -264,8 +267,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
Display *disp2;
Window root2;
int depth2;
- XGCValues gcvalues;
- GC gc;
int in, out, w, h;
if (opt.xinerama)
@@ -322,8 +323,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
0, 0, scr->width, scr->height);
fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-scale", filbuf, NULL);
} else if (centered) {
- XGCValues gcval;
- GC gc;
D(("centering\n"));
@@ -368,14 +367,12 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
fehbg = estrjoin(" ", "feh", fehbg_xinerama, "--bg-fill", filbuf, NULL);
} else if (filled == 2) {
- XGCValues gcval;
pmap_d1 = XCreatePixmap(disp, root, scr->width, scr->height, depth);
if (opt.image_bg == IMAGE_BG_WHITE)
gcval.foreground = WhitePixel(disp, DefaultScreen(disp));
else
gcval.foreground = BlackPixel(disp, DefaultScreen(disp));
- gcval.foreground = BlackPixel(disp, DefaultScreen(disp));
gc = XCreateGC(disp, root, GCForeground, &gcval);
XFillRectangle(disp, pmap_d1, gc, 0, 0, scr->width, scr->height);
diff --git a/src/winwidget.h b/src/winwidget.h
index 33ad945..be5a761 100644
--- a/src/winwidget.h
+++ b/src/winwidget.h
@@ -113,6 +113,7 @@ struct __winwidget {
int click_offset_y;
int im_click_offset_x;
int im_click_offset_y;
+ time_t click_start_time;
unsigned char has_rotated;
};