emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/keyboard.c,v


From: Nick Roberts
Subject: [Emacs-diffs] Changes to emacs/src/keyboard.c,v
Date: Sun, 20 May 2007 02:29:51 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Nick Roberts <nickrob>  07/05/20 02:29:51

Index: keyboard.c
===================================================================
RCS file: /sources/emacs/emacs/src/keyboard.c,v
retrieving revision 1.899
retrieving revision 1.900
diff -u -b -r1.899 -r1.900
--- keyboard.c  1 Apr 2007 22:03:03 -0000       1.899
+++ keyboard.c  20 May 2007 02:29:50 -0000      1.900
@@ -521,7 +521,7 @@
 Lisp_Object Qselect_window;
 Lisp_Object Qhelp_echo;
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
 Lisp_Object Qmouse_fixup_help_message;
 #endif
 
@@ -677,7 +677,7 @@
 static Lisp_Object read_char_minibuf_menu_prompt P_ ((int, int,
                                                      Lisp_Object *));
 static Lisp_Object make_lispy_event P_ ((struct input_event *));
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
 static Lisp_Object make_lispy_movement P_ ((struct frame *, Lisp_Object,
                                            enum scroll_bar_part,
                                            Lisp_Object, Lisp_Object,
@@ -1390,7 +1390,7 @@
   return Qnil;
 }
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
 
 /* Restore mouse tracking enablement.  See Ftrack_mouse for the only use
    of this function.  */
@@ -1466,7 +1466,7 @@
   return 0;
 }
 
-#endif /* HAVE_MOUSE */
+#endif /* HAVE_MOUSE || HAVE_GPM */
 
 /* This is the actual command reading loop,
    sans error-handling encapsulation.  */
@@ -2388,7 +2388,7 @@
        return;
     }
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   if (!noninteractive && STRINGP (help))
     {
       /* The mouse-fixup-help-message Lisp function can call
@@ -3640,7 +3640,7 @@
        return 1;
     }
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
       && !NILP (do_mouse_tracking) && some_mouse_moved ())
     return 1;
@@ -3992,7 +3992,7 @@
     {
       if (kbd_fetch_ptr != kbd_store_ptr)
        break;
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
       if (!NILP (do_mouse_tracking) && some_mouse_moved ())
        break;
 #endif
@@ -4014,7 +4014,7 @@
 #endif /* SIGIO */
       if (kbd_fetch_ptr != kbd_store_ptr)
        break;
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
       if (!NILP (do_mouse_tracking) && some_mouse_moved ())
        break;
 #endif
@@ -4250,7 +4250,7 @@
            }
        }
     }
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   /* Try generating a mouse motion event.  */
   else if (!NILP (do_mouse_tracking) && some_mouse_moved ())
     {
@@ -4291,7 +4291,7 @@
       if (!NILP (x) && NILP (obj))
        obj = make_lispy_movement (f, bar_window, part, x, y, time);
     }
-#endif /* HAVE_MOUSE */
+#endif /* HAVE_MOUSE || HAVE GPM */
   else
     /* We were promised by the above while loop that there was
        something for us to read!  */
@@ -6008,6 +6008,64 @@
       }
 #endif
 
+    case GPM_CLICK_EVENT:
+      {
+       FRAME_PTR f = XFRAME (event->frame_or_window);
+       Lisp_Object head, position;
+       Lisp_Object *start_pos_ptr;
+       Lisp_Object start_pos;
+       int button = event->code;
+
+       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 = &AREF (button_down_location, button);
+       start_pos = *start_pos_ptr;
+
+       position = make_lispy_position (f, &event->x, &event->y,
+                                           event->timestamp);
+
+       if (event->modifiers & down_modifier)
+         *start_pos_ptr = Fcopy_alist (position);
+       else if (event->modifiers & (up_modifier | drag_modifier))
+         {
+           if (!CONSP (start_pos))
+             return Qnil;
+           event->modifiers &= ~up_modifier;
+         }
+
+       head = modify_event_symbol (button,
+                                   event->modifiers,
+                                   Qmouse_click, Vlispy_mouse_stem,
+                                   NULL,
+                                   &mouse_syms,
+                                   XVECTOR (mouse_syms)->size);
+
+       if (event->modifiers & drag_modifier)
+         return Fcons (head,
+                       Fcons (start_pos,
+                              Fcons (position,
+                                     Qnil)));
+       else if (event->modifiers & double_modifier)
+         return Fcons (head,
+                       Fcons (position,
+                              Fcons (make_number (2),
+                                     Qnil)));
+       else if (event->modifiers & triple_modifier)
+         return Fcons (head,
+                       Fcons (position,
+                              Fcons (make_number (3),
+                                     Qnil)));
+       else
+         return Fcons (head,
+                       Fcons (position,
+                              Qnil));
+       }
+
       /* The 'kind' field of the event is something we don't recognize.  */
     default:
       abort ();
@@ -6865,7 +6923,27 @@
       if (n_to_read == 0)
        return 0;
 #else /* not MSDOS */
+#ifdef HAVE_GPM_H
+      if (term_gpm)
+       {
+         Gpm_Event event;
+         struct input_event hold_quit;
+         int gpm;
+
+         EVENT_INIT (hold_quit);
+         hold_quit.kind = NO_EVENT;
+
+         while (gpm = Gpm_GetEvent (&event), gpm == 1) {
+           nread += handle_one_term_event (&event, &hold_quit);
+         }
+         if (hold_quit.kind != NO_EVENT)
+           kbd_buffer_store_event (&hold_quit);
+         if (nread)
+           return nread;
+       }
+#endif /* HAVE_GPM_H */
 #ifdef FIONREAD
+
       /* Find out how much input is available.  */
       if (ioctl (input_fd, FIONREAD, &n_to_read) < 0)
        /* Formerly simply reported no input, but that sometimes led to
@@ -11045,7 +11123,7 @@
   recent_keys_index = 0;
   kbd_fetch_ptr = kbd_buffer;
   kbd_store_ptr = kbd_buffer;
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   do_mouse_tracking = Qnil;
 #endif
   input_pending = 0;
@@ -11235,7 +11313,7 @@
   Qmenu_bar = intern ("menu-bar");
   staticpro (&Qmenu_bar);
 
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   Qmouse_fixup_help_message = intern ("mouse-fixup-help-message");
   staticpro (&Qmouse_fixup_help_message);
 #endif
@@ -11367,7 +11445,7 @@
   defsubr (&Sread_key_sequence);
   defsubr (&Sread_key_sequence_vector);
   defsubr (&Srecursive_edit);
-#ifdef HAVE_MOUSE
+#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
   defsubr (&Strack_mouse);
 #endif
   defsubr (&Sinput_pending_p);




reply via email to

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