summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-03-08 14:03:45 +0000
committerGerd Moellmann <gerd@gnu.org>2001-03-08 14:03:45 +0000
commit129004d3cb4e5f8f2ef7842b0ca2c49c515e3341 (patch)
treeb642c0a1e3eb873baee9db05d5f04b81aeab0719 /src
parent80c8ab8c9b6428b52b014706d8901ee7602378a8 (diff)
downloademacs-129004d3cb4e5f8f2ef7842b0ca2c49c515e3341.tar.gz
(make_lispy_event): Avoid generating drag events
if the mouse hasn't actually moved to another buffer position.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/keyboard.c49
2 files changed, 36 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6eb06971f5d..774e19fe49c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,6 +1,11 @@
+2001-03-08 Gerd Moellmann <gerd@gnu.org>
+
+ * keyboard.c (make_lispy_event): Avoid generating drag events
+ if the mouse hasn't actually moved to another buffer position.
+
2001-03-08 Dave Love <fx@gnu.org>
- * eval.c (syms_of_eval) <debug-on-error>: DOc fix.
+ * eval.c (syms_of_eval) <debug-on-error>: Doc fix.
2001-03-08 Gerd Moellmann <gerd@gnu.org>
diff --git a/src/keyboard.c b/src/keyboard.c
index 53e918d30ba..c806bd7265e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4711,14 +4711,14 @@ make_lispy_event (event)
for (i = 0; i < XVECTOR (items)->size; i += 4)
{
Lisp_Object pos, string;
- string = XVECTOR (items)->contents[i + 1];
- pos = XVECTOR (items)->contents[i + 3];
+ string = AREF (items, i + 1);
+ pos = AREF (items, i + 3);
if (NILP (string))
break;
if (column >= XINT (pos)
&& column < XINT (pos) + XSTRING (string)->size)
{
- item = XVECTOR (items)->contents[i];
+ item = AREF (items, i);
break;
}
}
@@ -4810,15 +4810,14 @@ make_lispy_event (event)
}
#endif /* not USE_TOOLKIT_SCROLL_BARS */
- if (button >= XVECTOR (button_down_location)->size)
+ if (button >= ASIZE (button_down_location))
{
button_down_location = larger_vector (button_down_location,
button + 1, Qnil);
mouse_syms = larger_vector (mouse_syms, button + 1, Qnil);
}
- start_pos_ptr = &XVECTOR (button_down_location)->contents[button];
-
+ start_pos_ptr = &AREF (button_down_location, button);
start_pos = *start_pos_ptr;
*start_pos_ptr = Qnil;
@@ -4855,12 +4854,11 @@ make_lispy_event (event)
see if this was a click or a drag. */
else if (event->modifiers & up_modifier)
{
- /* If we did not see a down before this up,
- ignore the up. Probably this happened because
- the down event chose a menu item.
- It would be an annoyance to treat the release
- of the button that chose the menu item
- as a separate event. */
+ /* If we did not see a down before this up, ignore the up.
+ Probably this happened because the down event chose a
+ menu item. It would be an annoyance to treat the
+ release of the button that chose the menu item as a
+ separate event. */
if (!CONSP (start_pos))
return Qnil;
@@ -4877,16 +4875,29 @@ make_lispy_event (event)
Lisp_Object down;
down = Fnth (make_number (2), start_pos);
- if (EQ (event->x, XCAR (down))
- && EQ (event->y, XCDR (down)))
- {
- event->modifiers |= click_modifier;
- }
+ if (EQ (event->x, XCAR (down)) && EQ (event->y, XCDR (down)))
+ /* Mouse hasn't moved. */
+ event->modifiers |= click_modifier;
else
{
- button_down_time = 0;
- event->modifiers |= drag_modifier;
+ Lisp_Object window1, window2, posn1, posn2;
+
+ /* Avoid generating a drag event if the mouse
+ hasn't actually moved off the buffer position. */
+ window1 = Fnth (make_number (0), position);
+ posn1 = Fnth (make_number (1), position);
+ window2 = Fnth (make_number (0), start_pos);
+ posn2 = Fnth (make_number (1), start_pos);
+
+ if (EQ (window1, window2) && EQ (posn1, posn2))
+ event->modifiers |= click_modifier;
+ else
+ {
+ button_down_time = 0;
+ event->modifiers |= drag_modifier;
+ }
}
+
/* Don't check is_double; treat this as multiple
if the down-event was multiple. */
if (double_click_count > 1)