emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src keyboard.c


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] emacs/src keyboard.c
Date: Sun, 27 Sep 2009 04:40:31 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     YAMAMOTO Mitsuharu <mituharu>   09/09/27 04:40:31

Modified files:
        src            : keyboard.c 

Log message:
        (make_lispy_event): Remember last wheel direction.
        (syms_of_keyboard) <wheel_syms>: Compute array size at compile time.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/keyboard.c?cvsroot=emacs&r1=1.1013&r2=1.1014

Patches:
Index: keyboard.c
===================================================================
RCS file: /sources/emacs/emacs/src/keyboard.c,v
retrieving revision 1.1013
retrieving revision 1.1014
diff -u -b -r1.1013 -r1.1014
--- keyboard.c  10 Sep 2009 18:19:08 -0000      1.1013
+++ keyboard.c  27 Sep 2009 04:40:30 -0000      1.1014
@@ -5953,6 +5953,7 @@
             as a multiple of 1/8 characters.  */
          struct frame *f;
          int fuzz;
+         int symbol_num;
          int is_double;
 
          if (WINDOWP (event->frame_or_window))
@@ -5967,7 +5968,27 @@
          else
            fuzz = double_click_fuzz / 8;
 
-         is_double = (last_mouse_button < 0
+         if (event->modifiers & up_modifier)
+           {
+             /* Emit a wheel-up event.  */
+             event->modifiers &= ~up_modifier;
+             symbol_num = 0;
+           }
+         else if (event->modifiers & down_modifier)
+           {
+             /* Emit a wheel-down event.  */
+             event->modifiers &= ~down_modifier;
+             symbol_num = 1;
+           }
+         else
+           /* Every wheel event should either have the down_modifier or
+              the up_modifier set.  */
+           abort ();
+
+          if (event->kind == HORIZ_WHEEL_EVENT)
+            symbol_num += 2;
+
+         is_double = (last_mouse_button == - (1 + symbol_num)
                       && (eabs (XINT (event->x) - last_mouse_x) <= fuzz)
                       && (eabs (XINT (event->y) - last_mouse_y) <= fuzz)
                       && button_down_time != 0
@@ -5990,33 +6011,9 @@
 
          button_down_time = event->timestamp;
          /* Use a negative value to distinguish wheel from mouse button.  */
-         last_mouse_button = -1;
+         last_mouse_button = - (1 + symbol_num);
          last_mouse_x = XINT (event->x);
          last_mouse_y = XINT (event->y);
-       }
-
-       {
-         int symbol_num;
-
-         if (event->modifiers & up_modifier)
-           {
-             /* Emit a wheel-up event.  */
-             event->modifiers &= ~up_modifier;
-             symbol_num = 0;
-           }
-         else if (event->modifiers & down_modifier)
-           {
-             /* Emit a wheel-down event.  */
-             event->modifiers &= ~down_modifier;
-             symbol_num = 1;
-           }
-         else
-           /* Every wheel event should either have the down_modifier or
-              the up_modifier set.  */
-           abort ();
-
-          if (event->kind == HORIZ_WHEEL_EVENT)
-            symbol_num += 2;
 
          /* Get the symbol we should use for the wheel event.  */
          head = modify_event_symbol (symbol_num,
@@ -11898,7 +11895,9 @@
   staticpro (&button_down_location);
   mouse_syms = Fmake_vector (make_number (5), Qnil);
   staticpro (&mouse_syms);
-  wheel_syms = Fmake_vector (make_number (4), Qnil);
+  wheel_syms = Fmake_vector (make_number (sizeof (lispy_wheel_names)
+                                         / sizeof (lispy_wheel_names[0])),
+                            Qnil);
   staticpro (&wheel_syms);
 
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]