aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNick Roberts2007-05-20 02:29:50 +0000
committerNick Roberts2007-05-20 02:29:50 +0000
commitae372f41ec5486a381eb1e0e1e9eaff009c3bfd6 (patch)
tree919ba173963b57f2d7cd2c696860db128a50a4f1 /src
parente882229cca36a3c24031e18fe44be1865f282659 (diff)
downloademacs-ae372f41ec5486a381eb1e0e1e9eaff009c3bfd6.tar.gz
emacs-ae372f41ec5486a381eb1e0e1e9eaff009c3bfd6.zip
(Qmouse_fixup_help_message)
(make_lispy_movement, tracking_off, Ftrack_mouse, some_mouse_moved) (show_help_echo, readable_events, kbd_buffer_get_event, init_keyboard): Extend HAVE_MOUSE ifdefs to HAVE_GPM_H. (make_lispy_event): Add case GPM_CLICK_EVENT. (read_avail_input): Handle mouse input.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c106
1 files changed, 92 insertions, 14 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index bda07473ccf..2aa3b083cc0 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -521,7 +521,7 @@ Lisp_Object Qmake_frame_visible;
521Lisp_Object Qselect_window; 521Lisp_Object Qselect_window;
522Lisp_Object Qhelp_echo; 522Lisp_Object Qhelp_echo;
523 523
524#ifdef HAVE_MOUSE 524#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
525Lisp_Object Qmouse_fixup_help_message; 525Lisp_Object Qmouse_fixup_help_message;
526#endif 526#endif
527 527
@@ -677,7 +677,7 @@ static Lisp_Object read_char_x_menu_prompt ();
677static Lisp_Object read_char_minibuf_menu_prompt P_ ((int, int, 677static Lisp_Object read_char_minibuf_menu_prompt P_ ((int, int,
678 Lisp_Object *)); 678 Lisp_Object *));
679static Lisp_Object make_lispy_event P_ ((struct input_event *)); 679static Lisp_Object make_lispy_event P_ ((struct input_event *));
680#ifdef HAVE_MOUSE 680#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
681static Lisp_Object make_lispy_movement P_ ((struct frame *, Lisp_Object, 681static Lisp_Object make_lispy_movement P_ ((struct frame *, Lisp_Object,
682 enum scroll_bar_part, 682 enum scroll_bar_part,
683 Lisp_Object, Lisp_Object, 683 Lisp_Object, Lisp_Object,
@@ -1390,7 +1390,7 @@ DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0,
1390 return Qnil; 1390 return Qnil;
1391} 1391}
1392 1392
1393#ifdef HAVE_MOUSE 1393#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
1394 1394
1395/* Restore mouse tracking enablement. See Ftrack_mouse for the only use 1395/* Restore mouse tracking enablement. See Ftrack_mouse for the only use
1396 of this function. */ 1396 of this function. */
@@ -1466,7 +1466,7 @@ some_mouse_moved ()
1466 return 0; 1466 return 0;
1467} 1467}
1468 1468
1469#endif /* HAVE_MOUSE */ 1469#endif /* HAVE_MOUSE || HAVE_GPM */
1470 1470
1471/* This is the actual command reading loop, 1471/* This is the actual command reading loop,
1472 sans error-handling encapsulation. */ 1472 sans error-handling encapsulation. */
@@ -2388,7 +2388,7 @@ show_help_echo (help, window, object, pos, ok_to_overwrite_keystroke_echo)
2388 return; 2388 return;
2389 } 2389 }
2390 2390
2391#ifdef HAVE_MOUSE 2391#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
2392 if (!noninteractive && STRINGP (help)) 2392 if (!noninteractive && STRINGP (help))
2393 { 2393 {
2394 /* The mouse-fixup-help-message Lisp function can call 2394 /* The mouse-fixup-help-message Lisp function can call
@@ -3640,7 +3640,7 @@ readable_events (flags)
3640 return 1; 3640 return 1;
3641 } 3641 }
3642 3642
3643#ifdef HAVE_MOUSE 3643#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
3644 if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES) 3644 if (!(flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
3645 && !NILP (do_mouse_tracking) && some_mouse_moved ()) 3645 && !NILP (do_mouse_tracking) && some_mouse_moved ())
3646 return 1; 3646 return 1;
@@ -3992,7 +3992,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
3992 { 3992 {
3993 if (kbd_fetch_ptr != kbd_store_ptr) 3993 if (kbd_fetch_ptr != kbd_store_ptr)
3994 break; 3994 break;
3995#ifdef HAVE_MOUSE 3995#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
3996 if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 3996 if (!NILP (do_mouse_tracking) && some_mouse_moved ())
3997 break; 3997 break;
3998#endif 3998#endif
@@ -4014,7 +4014,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
4014#endif /* SIGIO */ 4014#endif /* SIGIO */
4015 if (kbd_fetch_ptr != kbd_store_ptr) 4015 if (kbd_fetch_ptr != kbd_store_ptr)
4016 break; 4016 break;
4017#ifdef HAVE_MOUSE 4017#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
4018 if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 4018 if (!NILP (do_mouse_tracking) && some_mouse_moved ())
4019 break; 4019 break;
4020#endif 4020#endif
@@ -4250,7 +4250,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
4250 } 4250 }
4251 } 4251 }
4252 } 4252 }
4253#ifdef HAVE_MOUSE 4253#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
4254 /* Try generating a mouse motion event. */ 4254 /* Try generating a mouse motion event. */
4255 else if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 4255 else if (!NILP (do_mouse_tracking) && some_mouse_moved ())
4256 { 4256 {
@@ -4291,7 +4291,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu, end_time)
4291 if (!NILP (x) && NILP (obj)) 4291 if (!NILP (x) && NILP (obj))
4292 obj = make_lispy_movement (f, bar_window, part, x, y, time); 4292 obj = make_lispy_movement (f, bar_window, part, x, y, time);
4293 } 4293 }
4294#endif /* HAVE_MOUSE */ 4294#endif /* HAVE_MOUSE || HAVE GPM */
4295 else 4295 else
4296 /* We were promised by the above while loop that there was 4296 /* We were promised by the above while loop that there was
4297 something for us to read! */ 4297 something for us to read! */
@@ -6008,6 +6008,64 @@ make_lispy_event (event)
6008 } 6008 }
6009#endif 6009#endif
6010 6010
6011 case GPM_CLICK_EVENT:
6012 {
6013 FRAME_PTR f = XFRAME (event->frame_or_window);
6014 Lisp_Object head, position;
6015 Lisp_Object *start_pos_ptr;
6016 Lisp_Object start_pos;
6017 int button = event->code;
6018
6019 if (button >= ASIZE (button_down_location))
6020 {
6021 button_down_location = larger_vector (button_down_location,
6022 button + 1, Qnil);
6023 mouse_syms = larger_vector (mouse_syms, button + 1, Qnil);
6024 }
6025
6026 start_pos_ptr = &AREF (button_down_location, button);
6027 start_pos = *start_pos_ptr;
6028
6029 position = make_lispy_position (f, &event->x, &event->y,
6030 event->timestamp);
6031
6032 if (event->modifiers & down_modifier)
6033 *start_pos_ptr = Fcopy_alist (position);
6034 else if (event->modifiers & (up_modifier | drag_modifier))
6035 {
6036 if (!CONSP (start_pos))
6037 return Qnil;
6038 event->modifiers &= ~up_modifier;
6039 }
6040
6041 head = modify_event_symbol (button,
6042 event->modifiers,
6043 Qmouse_click, Vlispy_mouse_stem,
6044 NULL,
6045 &mouse_syms,
6046 XVECTOR (mouse_syms)->size);
6047
6048 if (event->modifiers & drag_modifier)
6049 return Fcons (head,
6050 Fcons (start_pos,
6051 Fcons (position,
6052 Qnil)));
6053 else if (event->modifiers & double_modifier)
6054 return Fcons (head,
6055 Fcons (position,
6056 Fcons (make_number (2),
6057 Qnil)));
6058 else if (event->modifiers & triple_modifier)
6059 return Fcons (head,
6060 Fcons (position,
6061 Fcons (make_number (3),
6062 Qnil)));
6063 else
6064 return Fcons (head,
6065 Fcons (position,
6066 Qnil));
6067 }
6068
6011 /* The 'kind' field of the event is something we don't recognize. */ 6069 /* The 'kind' field of the event is something we don't recognize. */
6012 default: 6070 default:
6013 abort (); 6071 abort ();
@@ -6865,8 +6923,28 @@ read_avail_input (expected)
6865 if (n_to_read == 0) 6923 if (n_to_read == 0)
6866 return 0; 6924 return 0;
6867#else /* not MSDOS */ 6925#else /* not MSDOS */
6926#ifdef HAVE_GPM_H
6927 if (term_gpm)
6928 {
6929 Gpm_Event event;
6930 struct input_event hold_quit;
6931 int gpm;
6932
6933 EVENT_INIT (hold_quit);
6934 hold_quit.kind = NO_EVENT;
6935
6936 while (gpm = Gpm_GetEvent (&event), gpm == 1) {
6937 nread += handle_one_term_event (&event, &hold_quit);
6938 }
6939 if (hold_quit.kind != NO_EVENT)
6940 kbd_buffer_store_event (&hold_quit);
6941 if (nread)
6942 return nread;
6943 }
6944#endif /* HAVE_GPM_H */
6868#ifdef FIONREAD 6945#ifdef FIONREAD
6869 /* Find out how much input is available. */ 6946
6947 /* Find out how much input is available. */
6870 if (ioctl (input_fd, FIONREAD, &n_to_read) < 0) 6948 if (ioctl (input_fd, FIONREAD, &n_to_read) < 0)
6871 /* Formerly simply reported no input, but that sometimes led to 6949 /* Formerly simply reported no input, but that sometimes led to
6872 a failure of Emacs to terminate. 6950 a failure of Emacs to terminate.
@@ -11045,7 +11123,7 @@ init_keyboard ()
11045 recent_keys_index = 0; 11123 recent_keys_index = 0;
11046 kbd_fetch_ptr = kbd_buffer; 11124 kbd_fetch_ptr = kbd_buffer;
11047 kbd_store_ptr = kbd_buffer; 11125 kbd_store_ptr = kbd_buffer;
11048#ifdef HAVE_MOUSE 11126#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
11049 do_mouse_tracking = Qnil; 11127 do_mouse_tracking = Qnil;
11050#endif 11128#endif
11051 input_pending = 0; 11129 input_pending = 0;
@@ -11235,7 +11313,7 @@ syms_of_keyboard ()
11235 Qmenu_bar = intern ("menu-bar"); 11313 Qmenu_bar = intern ("menu-bar");
11236 staticpro (&Qmenu_bar); 11314 staticpro (&Qmenu_bar);
11237 11315
11238#ifdef HAVE_MOUSE 11316#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
11239 Qmouse_fixup_help_message = intern ("mouse-fixup-help-message"); 11317 Qmouse_fixup_help_message = intern ("mouse-fixup-help-message");
11240 staticpro (&Qmouse_fixup_help_message); 11318 staticpro (&Qmouse_fixup_help_message);
11241#endif 11319#endif
@@ -11367,7 +11445,7 @@ syms_of_keyboard ()
11367 defsubr (&Sread_key_sequence); 11445 defsubr (&Sread_key_sequence);
11368 defsubr (&Sread_key_sequence_vector); 11446 defsubr (&Sread_key_sequence_vector);
11369 defsubr (&Srecursive_edit); 11447 defsubr (&Srecursive_edit);
11370#ifdef HAVE_MOUSE 11448#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
11371 defsubr (&Strack_mouse); 11449 defsubr (&Strack_mouse);
11372#endif 11450#endif
11373 defsubr (&Sinput_pending_p); 11451 defsubr (&Sinput_pending_p);