aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-02-11 17:05:54 -0500
committerJesse Luehrs <doy@tozt.net>2017-02-11 17:05:54 -0500
commitce7ea957602bc5295de08e13ba0fb7475f909b33 (patch)
tree8debfa9885c15d7a4977e5a03c6beb2a4ba978bb
parent1bacad0c4ae2cfac6bca888569e73bc18bf9268a (diff)
downloadrunes-ce7ea957602bc5295de08e13ba0fb7475f909b33.tar.gz
runes-ce7ea957602bc5295de08e13ba0fb7475f909b33.zip
fix moving the mouse after making a selection
previously it was always moving the existing selection around even if the mouse button wasn't held down
-rw-r--r--src/window-xlib.c23
-rw-r--r--src/window-xlib.h1
2 files changed, 18 insertions, 6 deletions
diff --git a/src/window-xlib.c b/src/window-xlib.c
index 20258f3..93e237d 100644
--- a/src/window-xlib.c
+++ b/src/window-xlib.c
@@ -869,7 +869,12 @@ static void runes_window_handle_button_event(RunesTerm *t, XButtonEvent *e)
static void runes_window_handle_motion_event(RunesTerm *t, XMotionEvent *e)
{
- if (!(e->state & Button1Mask)) {
+ RunesWindow *w = t->w;
+
+ /* unclear why we can't rely on (e->state & Button1Mask) here - it seems to
+ * always be true, which is confusing to me. i'd expect it to only be true
+ * if we had Button1 held down while moving the mouse. */
+ if (!w->mouse_down) {
return;
}
@@ -1043,11 +1048,14 @@ static int runes_window_handle_builtin_keypress(
static int runes_window_handle_builtin_button_press(
RunesTerm *t, XButtonEvent *e)
{
+ RunesWindow *w = t->w;
+
switch (e->type) {
case ButtonPress:
switch (e->button) {
case Button1:
runes_window_start_selection(t, e->x, e->y);
+ w->mouse_down = 1;
return 1;
break;
case Button2:
@@ -1071,7 +1079,14 @@ static int runes_window_handle_builtin_button_press(
}
break;
case ButtonRelease:
- runes_window_handle_multi_click(t, e);
+ switch (e->button) {
+ case Button1:
+ runes_window_handle_multi_click(t, e);
+ w->mouse_down = 0;
+ break;
+ default:
+ break;
+ }
break;
default:
break;
@@ -1084,10 +1099,6 @@ static void runes_window_handle_multi_click(RunesTerm *t, XButtonEvent *e)
{
RunesWindow *w = t->w;
- if (e->button != Button1) {
- return;
- }
-
if (w->multi_click_timer_event) {
runes_loop_timer_clear(t->loop, w->multi_click_timer_event);
runes_term_refcnt_dec(t);
diff --git a/src/window-xlib.h b/src/window-xlib.h
index 46ed900..c7bca22 100644
--- a/src/window-xlib.h
+++ b/src/window-xlib.h
@@ -20,6 +20,7 @@ struct runes_window {
unsigned int owns_selection: 1;
unsigned int visual_bell_is_ringing: 1;
unsigned int delaying: 1;
+ unsigned int mouse_down: 1;
};
RunesWindow *runes_window_new(RunesWindowBackend *wb);