Mercurial > emacs
comparison src/keyboard.c @ 9840:81829106d303
(EVENT_QUEUES_EMPTY): Only test do_mouse_tracking and mouse_moved #ifdef
HAVE_MOUSE.
(Ftrack_mouse): Protect with #ifdef HAVE_MOUSE.
(syms_of_keyboard): Protect initialization of do_mouse_tracking, defsubr
of Strack_mouse, and DEFVAR of track-mouse with #ifdef HAVE_MOUSE.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Wed, 09 Nov 1994 03:43:30 +0000 |
parents | 8d151c06dc8b |
children | 0299d64cdd07 |
comparison
equal
deleted
inserted
replaced
9839:21c1a413ab75 | 9840:81829106d303 |
---|---|
373 | 373 |
374 Why not just have a flag set and cleared by the enqueuing and | 374 Why not just have a flag set and cleared by the enqueuing and |
375 dequeuing functions? Such a flag could be screwed up by interrupts | 375 dequeuing functions? Such a flag could be screwed up by interrupts |
376 at inopportune times. */ | 376 at inopportune times. */ |
377 | 377 |
378 #ifdef HAVE_MOUSE | |
378 /* If this flag is a frame, we check mouse_moved to see when the | 379 /* If this flag is a frame, we check mouse_moved to see when the |
379 mouse moves, and motion events will appear in the input stream. | 380 mouse moves, and motion events will appear in the input stream. |
380 Otherwise, mouse motion is ignored. */ | 381 Otherwise, mouse motion is ignored. */ |
381 static Lisp_Object do_mouse_tracking; | 382 static Lisp_Object do_mouse_tracking; |
382 | 383 |
394 events, and do_mouse_tracking might be off. */ | 395 events, and do_mouse_tracking might be off. */ |
395 #define EVENT_QUEUES_EMPTY \ | 396 #define EVENT_QUEUES_EMPTY \ |
396 ((kbd_fetch_ptr == kbd_store_ptr) \ | 397 ((kbd_fetch_ptr == kbd_store_ptr) \ |
397 && (! FRAMEP (do_mouse_tracking) || !mouse_moved)) | 398 && (! FRAMEP (do_mouse_tracking) || !mouse_moved)) |
398 | 399 |
400 #else /* Not HAVE_MOUSE. */ | |
401 #define EVENT_QUEUES_EMPTY (kbd_fetch_ptr == kbd_store_ptr) | |
402 #endif /* HAVE_MOUSE. */ | |
399 | 403 |
400 /* Symbols to head events. */ | 404 /* Symbols to head events. */ |
401 Lisp_Object Qmouse_movement; | 405 Lisp_Object Qmouse_movement; |
402 Lisp_Object Qscroll_bar_movement; | 406 Lisp_Object Qscroll_bar_movement; |
403 Lisp_Object Qswitch_frame; | 407 Lisp_Object Qswitch_frame; |
1933 { | 1937 { |
1934 bcopy (temp, getcjmp, sizeof getcjmp); | 1938 bcopy (temp, getcjmp, sizeof getcjmp); |
1935 } | 1939 } |
1936 | 1940 |
1937 | 1941 |
1942 #ifdef HAVE_MOUSE | |
1943 | |
1938 /* Restore mouse tracking enablement. See Ftrack_mouse for the only use | 1944 /* Restore mouse tracking enablement. See Ftrack_mouse for the only use |
1939 of this function. */ | 1945 of this function. */ |
1940 | 1946 |
1941 static Lisp_Object | 1947 static Lisp_Object |
1942 tracking_off (old_value) | 1948 tracking_off (old_value) |
1979 XSETFRAME (do_mouse_tracking, selected_frame); | 1985 XSETFRAME (do_mouse_tracking, selected_frame); |
1980 | 1986 |
1981 val = Fprogn (args); | 1987 val = Fprogn (args); |
1982 return unbind_to (count, val); | 1988 return unbind_to (count, val); |
1983 } | 1989 } |
1990 | |
1991 #endif /* HAVE_MOUSE */ | |
1984 | 1992 |
1985 /* Low level keyboard/mouse input. | 1993 /* Low level keyboard/mouse input. |
1986 kbd_buffer_store_event places events in kbd_buffer, and | 1994 kbd_buffer_store_event places events in kbd_buffer, and |
1987 kbd_buffer_get_event retrieves them. | 1995 kbd_buffer_get_event retrieves them. |
1988 mouse_moved indicates when the mouse has moved again, and | 1996 mouse_moved indicates when the mouse has moved again, and |
2259 | 2267 |
2260 kbd_fetch_ptr = event + 1; | 2268 kbd_fetch_ptr = event + 1; |
2261 } | 2269 } |
2262 } | 2270 } |
2263 } | 2271 } |
2272 #ifdef HAVE_MOUSE | |
2264 /* Try generating a mouse motion event. */ | 2273 /* Try generating a mouse motion event. */ |
2265 else if (FRAMEP (do_mouse_tracking) && mouse_moved) | 2274 else if (FRAMEP (do_mouse_tracking) && mouse_moved) |
2266 { | 2275 { |
2267 FRAME_PTR f = XFRAME (do_mouse_tracking); | 2276 FRAME_PTR f = XFRAME (do_mouse_tracking); |
2268 Lisp_Object bar_window; | 2277 Lisp_Object bar_window; |
2295 obj = make_lispy_switch_frame (frame); | 2304 obj = make_lispy_switch_frame (frame); |
2296 internal_last_event_frame = frame; | 2305 internal_last_event_frame = frame; |
2297 } | 2306 } |
2298 #endif | 2307 #endif |
2299 | 2308 |
2300 #if defined (MULTI_FRAME) || defined (HAVE_MOUSE) | |
2301 /* If we didn't decide to make a switch-frame event, go ahead and | 2309 /* If we didn't decide to make a switch-frame event, go ahead and |
2302 return a mouse-motion event. */ | 2310 return a mouse-motion event. */ |
2303 if (!NILP (x) && NILP (obj)) | 2311 if (!NILP (x) && NILP (obj)) |
2304 obj = make_lispy_movement (f, bar_window, part, x, y, time); | 2312 obj = make_lispy_movement (f, bar_window, part, x, y, time); |
2305 #endif | 2313 } |
2306 } | 2314 #endif /* HAVE_MOUSE */ |
2307 else | 2315 else |
2308 /* We were promised by the above while loop that there was | 2316 /* We were promised by the above while loop that there was |
2309 something for us to read! */ | 2317 something for us to read! */ |
2310 abort (); | 2318 abort (); |
2311 | 2319 |
5957 unread_command_char = -1; | 5965 unread_command_char = -1; |
5958 total_keys = 0; | 5966 total_keys = 0; |
5959 recent_keys_index = 0; | 5967 recent_keys_index = 0; |
5960 kbd_fetch_ptr = kbd_buffer; | 5968 kbd_fetch_ptr = kbd_buffer; |
5961 kbd_store_ptr = kbd_buffer; | 5969 kbd_store_ptr = kbd_buffer; |
5970 #ifdef HAVE_MOUSE | |
5962 do_mouse_tracking = Qnil; | 5971 do_mouse_tracking = Qnil; |
5972 #endif | |
5963 input_pending = 0; | 5973 input_pending = 0; |
5964 | 5974 |
5965 #ifdef MULTI_FRAME | 5975 #ifdef MULTI_FRAME |
5966 /* This means that command_loop_1 won't try to select anything the first | 5976 /* This means that command_loop_1 won't try to select anything the first |
5967 time through. */ | 5977 time through. */ |
6163 unread_switch_frame = Qnil; | 6173 unread_switch_frame = Qnil; |
6164 staticpro (&unread_switch_frame); | 6174 staticpro (&unread_switch_frame); |
6165 | 6175 |
6166 defsubr (&Sread_key_sequence); | 6176 defsubr (&Sread_key_sequence); |
6167 defsubr (&Srecursive_edit); | 6177 defsubr (&Srecursive_edit); |
6178 #ifdef HAVE_MOUSE | |
6168 defsubr (&Strack_mouse); | 6179 defsubr (&Strack_mouse); |
6180 #endif | |
6169 defsubr (&Sinput_pending_p); | 6181 defsubr (&Sinput_pending_p); |
6170 defsubr (&Scommand_execute); | 6182 defsubr (&Scommand_execute); |
6171 defsubr (&Srecent_keys); | 6183 defsubr (&Srecent_keys); |
6172 defsubr (&Sthis_command_keys); | 6184 defsubr (&Sthis_command_keys); |
6173 defsubr (&Ssuspend_emacs); | 6185 defsubr (&Ssuspend_emacs); |
6381 "Non-nil means `overriding-local-map' applies to the menu bar.\n\ | 6393 "Non-nil means `overriding-local-map' applies to the menu bar.\n\ |
6382 Otherwise, the menu bar continues to reflect the buffer's local map\n\ | 6394 Otherwise, the menu bar continues to reflect the buffer's local map\n\ |
6383 and the minor mode maps regardless of `overriding-local-map'."); | 6395 and the minor mode maps regardless of `overriding-local-map'."); |
6384 Voverriding_local_map_menu_flag = Qnil; | 6396 Voverriding_local_map_menu_flag = Qnil; |
6385 | 6397 |
6398 #ifdef HAVE_MOUSE | |
6386 DEFVAR_BOOL ("track-mouse", &do_mouse_tracking, | 6399 DEFVAR_BOOL ("track-mouse", &do_mouse_tracking, |
6387 "*Non-nil means generate motion events for mouse motion."); | 6400 "*Non-nil means generate motion events for mouse motion."); |
6401 #endif | |
6388 | 6402 |
6389 DEFVAR_LISP ("system-key-alist", &Vsystem_key_alist, | 6403 DEFVAR_LISP ("system-key-alist", &Vsystem_key_alist, |
6390 "Alist of system-specific X windows key symbols.\n\ | 6404 "Alist of system-specific X windows key symbols.\n\ |
6391 Each element should have the form (N . SYMBOL) where N is the\n\ | 6405 Each element should have the form (N . SYMBOL) where N is the\n\ |
6392 numeric keysym code (sans the \"system-specific\" bit 1<<28)\n\ | 6406 numeric keysym code (sans the \"system-specific\" bit 1<<28)\n\ |