summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-05-11 23:17:59 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-05-11 23:17:59 +0200
commit44148026914b06417037f0d4fe6f714f99d1d687 (patch)
tree44d6dc25771c9bcedf0c3347a45216dd8c514877
parentb63fb7e5ebc63afc7a91e2af2f8c9145c04a121d (diff)
Do not push menus off the screen when hitting screen limits
Closes #279
-rw-r--r--src/events.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/events.c b/src/events.c
index 4a24935..89eaab8 100644
--- a/src/events.c
+++ b/src/events.c
@@ -509,6 +509,8 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
dy = scr_height - (m->y + m->h);
dx = dx < 0 ? dx : 0;
dy = dy < 0 ? dy : 0;
+ dx = m->x + dx < 0 ? -m->x : dx;
+ dy = m->y + dy < 0 ? -m->y : dy;
if (dx || dy)
feh_menu_slide_all_menus_relative(dx, dy);
}
@@ -521,6 +523,8 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
dy = scr->height - (m->next->y + m->next->h);
dx = dx < 0 ? dx : 0;
dy = dy < 0 ? dy : 0;
+ dx = m->x + dx < 0 ? -m->x : dx;
+ dy = m->y + dy < 0 ? -m->y : dy;
if (dx || dy)
feh_menu_slide_all_menus_relative(dx, dy);
}