aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2009-09-27 04:40:41 +0000
committerYAMAMOTO Mitsuharu2009-09-27 04:40:41 +0000
commit3208cb35e9e9cb34f1a3c62c07ca0a174863d27f (patch)
tree4243c95ceab2ecad9e0134d5ce7ac0a3e066aead /src
parentce9a0ccb72711855dfd994d0500c01e4417d09d5 (diff)
downloademacs-3208cb35e9e9cb34f1a3c62c07ca0a174863d27f.tar.gz
emacs-3208cb35e9e9cb34f1a3c62c07ca0a174863d27f.zip
(make_lispy_event): Remember last wheel direction.
(syms_of_keyboard) <wheel_syms>: Compute array size at compile time.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/keyboard.c53
2 files changed, 31 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a5c15250948..1f485031ed4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12009-09-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * keyboard.c (make_lispy_event): Remember last wheel direction.
4 (syms_of_keyboard) <wheel_syms>: Compute array size at compile time.
5
12009-09-26 Glenn Morris <rgm@gnu.org> 62009-09-26 Glenn Morris <rgm@gnu.org>
2 7
3 * Makefile.in (MSDOS_SUPPORT) [MSDOS]: Remove unneeded '/' in 8 * Makefile.in (MSDOS_SUPPORT) [MSDOS]: Remove unneeded '/' in
diff --git a/src/keyboard.c b/src/keyboard.c
index 35c338cc74c..396f22fa7a1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5953,6 +5953,7 @@ make_lispy_event (event)
5953 as a multiple of 1/8 characters. */ 5953 as a multiple of 1/8 characters. */
5954 struct frame *f; 5954 struct frame *f;
5955 int fuzz; 5955 int fuzz;
5956 int symbol_num;
5956 int is_double; 5957 int is_double;
5957 5958
5958 if (WINDOWP (event->frame_or_window)) 5959 if (WINDOWP (event->frame_or_window))
@@ -5967,7 +5968,27 @@ make_lispy_event (event)
5967 else 5968 else
5968 fuzz = double_click_fuzz / 8; 5969 fuzz = double_click_fuzz / 8;
5969 5970
5970 is_double = (last_mouse_button < 0 5971 if (event->modifiers & up_modifier)
5972 {
5973 /* Emit a wheel-up event. */
5974 event->modifiers &= ~up_modifier;
5975 symbol_num = 0;
5976 }
5977 else if (event->modifiers & down_modifier)
5978 {
5979 /* Emit a wheel-down event. */
5980 event->modifiers &= ~down_modifier;
5981 symbol_num = 1;
5982 }
5983 else
5984 /* Every wheel event should either have the down_modifier or
5985 the up_modifier set. */
5986 abort ();
5987
5988 if (event->kind == HORIZ_WHEEL_EVENT)
5989 symbol_num += 2;
5990
5991 is_double = (last_mouse_button == - (1 + symbol_num)
5971 && (eabs (XINT (event->x) - last_mouse_x) <= fuzz) 5992 && (eabs (XINT (event->x) - last_mouse_x) <= fuzz)
5972 && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) 5993 && (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
5973 && button_down_time != 0 5994 && button_down_time != 0
@@ -5990,33 +6011,9 @@ make_lispy_event (event)
5990 6011
5991 button_down_time = event->timestamp; 6012 button_down_time = event->timestamp;
5992 /* Use a negative value to distinguish wheel from mouse button. */ 6013 /* Use a negative value to distinguish wheel from mouse button. */
5993 last_mouse_button = -1; 6014 last_mouse_button = - (1 + symbol_num);
5994 last_mouse_x = XINT (event->x); 6015 last_mouse_x = XINT (event->x);
5995 last_mouse_y = XINT (event->y); 6016 last_mouse_y = XINT (event->y);
5996 }
5997
5998 {
5999 int symbol_num;
6000
6001 if (event->modifiers & up_modifier)
6002 {
6003 /* Emit a wheel-up event. */
6004 event->modifiers &= ~up_modifier;
6005 symbol_num = 0;
6006 }
6007 else if (event->modifiers & down_modifier)
6008 {
6009 /* Emit a wheel-down event. */
6010 event->modifiers &= ~down_modifier;
6011 symbol_num = 1;
6012 }
6013 else
6014 /* Every wheel event should either have the down_modifier or
6015 the up_modifier set. */
6016 abort ();
6017
6018 if (event->kind == HORIZ_WHEEL_EVENT)
6019 symbol_num += 2;
6020 6017
6021 /* Get the symbol we should use for the wheel event. */ 6018 /* Get the symbol we should use for the wheel event. */
6022 head = modify_event_symbol (symbol_num, 6019 head = modify_event_symbol (symbol_num,
@@ -11898,7 +11895,9 @@ syms_of_keyboard ()
11898 staticpro (&button_down_location); 11895 staticpro (&button_down_location);
11899 mouse_syms = Fmake_vector (make_number (5), Qnil); 11896 mouse_syms = Fmake_vector (make_number (5), Qnil);
11900 staticpro (&mouse_syms); 11897 staticpro (&mouse_syms);
11901 wheel_syms = Fmake_vector (make_number (4), Qnil); 11898 wheel_syms = Fmake_vector (make_number (sizeof (lispy_wheel_names)
11899 / sizeof (lispy_wheel_names[0])),
11900 Qnil);
11902 staticpro (&wheel_syms); 11901 staticpro (&wheel_syms);
11903 11902
11904 { 11903 {