diff options
| author | Karl Heuer | 1995-02-07 02:07:03 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-02-07 02:07:03 +0000 |
| commit | 40f239ee68ced65c99b847856538fe7b6ba88274 (patch) | |
| tree | 46508cd1c081a644a00b26428ba6c29026fe5463 /src | |
| parent | 4299da2a85a9e45858232963453591eacca07b95 (diff) | |
| download | emacs-40f239ee68ced65c99b847856538fe7b6ba88274.tar.gz emacs-40f239ee68ced65c99b847856538fe7b6ba88274.zip | |
(internal_last_event_frame, Vlast_event_frame): Deleted; now part of
perdisplay. All uses changed.
(MOUSE_ACTIVITY_AVAILABLE) Deleted.
(find_active_event_queue): New arg check_mouse. All callers changed.
(Vlast_event_frame): Change from DEFVAR_LISP to DEFVAR_DISPLAY.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 102 |
1 files changed, 49 insertions, 53 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index c9aec9d0779..df2c372f441 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -259,20 +259,6 @@ int last_point_position; | |||
| 259 | /* The buffer that was current when the last command was started. */ | 259 | /* The buffer that was current when the last command was started. */ |
| 260 | Lisp_Object last_point_position_buffer; | 260 | Lisp_Object last_point_position_buffer; |
| 261 | 261 | ||
| 262 | #ifdef MULTI_FRAME | ||
| 263 | /* The frame in which the last input event occurred, or Qmacro if the | ||
| 264 | last event came from a macro. We use this to determine when to | ||
| 265 | generate switch-frame events. This may be cleared by functions | ||
| 266 | like Fselect_frame, to make sure that a switch-frame event is | ||
| 267 | generated by the next character. */ | ||
| 268 | Lisp_Object internal_last_event_frame; | ||
| 269 | #endif | ||
| 270 | |||
| 271 | /* A user-visible version of the above, intended to allow users to | ||
| 272 | figure out where the last event came from, if the event doesn't | ||
| 273 | carry that information itself (i.e. if it was a character). */ | ||
| 274 | Lisp_Object Vlast_event_frame; | ||
| 275 | |||
| 276 | /* The timestamp of the last input event we received from the X server. | 262 | /* The timestamp of the last input event we received from the X server. |
| 277 | X Windows wants this for selection ownership. */ | 263 | X Windows wants this for selection ownership. */ |
| 278 | unsigned long last_event_timestamp; | 264 | unsigned long last_event_timestamp; |
| @@ -344,10 +330,6 @@ static Lisp_Object do_mouse_tracking; | |||
| 344 | call mouse_position_hook to get the promised position, so don't set | 330 | call mouse_position_hook to get the promised position, so don't set |
| 345 | it unless you're prepared to substantiate the claim! */ | 331 | it unless you're prepared to substantiate the claim! */ |
| 346 | int mouse_moved; | 332 | int mouse_moved; |
| 347 | |||
| 348 | #define MOUSE_ACTIVITY_AVAILABLE (FRAMEP (do_mouse_tracking) && mouse_moved) | ||
| 349 | #else /* Not HAVE_MOUSE. */ | ||
| 350 | #define MOUSE_ACTIVITY_AVAILABLE 0 | ||
| 351 | #endif /* HAVE_MOUSE. */ | 333 | #endif /* HAVE_MOUSE. */ |
| 352 | 334 | ||
| 353 | /* Symbols to head events. */ | 335 | /* Symbols to head events. */ |
| @@ -1489,7 +1471,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1489 | internal_last_event_frame after each command is read, but | 1471 | internal_last_event_frame after each command is read, but |
| 1490 | events read from a macro should never cause a new frame to be | 1472 | events read from a macro should never cause a new frame to be |
| 1491 | selected. */ | 1473 | selected. */ |
| 1492 | Vlast_event_frame = internal_last_event_frame = Qmacro; | 1474 | if (!current_perdisplay) |
| 1475 | abort (); | ||
| 1476 | current_perdisplay->internal_last_event_frame = Qmacro; | ||
| 1477 | current_perdisplay->Vlast_event_frame = Qmacro; | ||
| 1493 | #endif | 1478 | #endif |
| 1494 | 1479 | ||
| 1495 | /* Exit the macro if we are at the end. | 1480 | /* Exit the macro if we are at the end. |
| @@ -1540,8 +1525,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1540 | { | 1525 | { |
| 1541 | XSETINT (c, quit_char); | 1526 | XSETINT (c, quit_char); |
| 1542 | #ifdef MULTI_FRAME | 1527 | #ifdef MULTI_FRAME |
| 1543 | XSETFRAME (internal_last_event_frame, selected_frame); | 1528 | XSETFRAME (current_perdisplay->internal_last_event_frame, |
| 1544 | Vlast_event_frame = internal_last_event_frame; | 1529 | selected_frame); |
| 1530 | current_perdisplay->Vlast_event_frame | ||
| 1531 | = current_perdisplay->internal_last_event_frame; | ||
| 1545 | #endif | 1532 | #endif |
| 1546 | /* If we report the quit char as an event, | 1533 | /* If we report the quit char as an event, |
| 1547 | don't do so more than once. */ | 1534 | don't do so more than once. */ |
| @@ -1953,7 +1940,8 @@ Normally, mouse motion is ignored.") | |||
| 1953 | *mouse_position_hook provides the mouse position. */ | 1940 | *mouse_position_hook provides the mouse position. */ |
| 1954 | 1941 | ||
| 1955 | static PERDISPLAY * | 1942 | static PERDISPLAY * |
| 1956 | find_active_event_queue () | 1943 | find_active_event_queue (check_mouse) |
| 1944 | int check_mouse; | ||
| 1957 | { | 1945 | { |
| 1958 | PERDISPLAY *perd; | 1946 | PERDISPLAY *perd; |
| 1959 | 1947 | ||
| @@ -1961,6 +1949,10 @@ find_active_event_queue () | |||
| 1961 | { | 1949 | { |
| 1962 | if (perd->kbd_fetch_ptr != perd->kbd_store_ptr) | 1950 | if (perd->kbd_fetch_ptr != perd->kbd_store_ptr) |
| 1963 | return perd; | 1951 | return perd; |
| 1952 | #ifdef HAVE_MOUSE | ||
| 1953 | if (check_mouse && FRAMEP (do_mouse_tracking) && mouse_moved) | ||
| 1954 | return perd; | ||
| 1955 | #endif | ||
| 1964 | } | 1956 | } |
| 1965 | return 0; | 1957 | return 0; |
| 1966 | } | 1958 | } |
| @@ -1970,7 +1962,7 @@ find_active_event_queue () | |||
| 1970 | static int | 1962 | static int |
| 1971 | readable_events () | 1963 | readable_events () |
| 1972 | { | 1964 | { |
| 1973 | return find_active_event_queue () != NULL || MOUSE_ACTIVITY_AVAILABLE; | 1965 | return find_active_event_queue (1) != NULL; |
| 1974 | } | 1966 | } |
| 1975 | 1967 | ||
| 1976 | /* Set this for debugging, to have a way to get out */ | 1968 | /* Set this for debugging, to have a way to get out */ |
| @@ -2012,10 +2004,10 @@ kbd_buffer_store_event (event) | |||
| 2012 | 2004 | ||
| 2013 | focus = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window)); | 2005 | focus = FRAME_FOCUS_FRAME (XFRAME (event->frame_or_window)); |
| 2014 | if (NILP (focus)) | 2006 | if (NILP (focus)) |
| 2015 | internal_last_event_frame = event->frame_or_window; | 2007 | perd->internal_last_event_frame = event->frame_or_window; |
| 2016 | else | 2008 | else |
| 2017 | internal_last_event_frame = focus; | 2009 | perd->internal_last_event_frame = focus; |
| 2018 | Vlast_event_frame = internal_last_event_frame; | 2010 | perd->Vlast_event_frame = perd->internal_last_event_frame; |
| 2019 | } | 2011 | } |
| 2020 | #endif | 2012 | #endif |
| 2021 | 2013 | ||
| @@ -2090,8 +2082,8 @@ kbd_buffer_get_event () | |||
| 2090 | /* Wait until there is input available. */ | 2082 | /* Wait until there is input available. */ |
| 2091 | for (;;) | 2083 | for (;;) |
| 2092 | { | 2084 | { |
| 2093 | perd = find_active_event_queue (); | 2085 | perd = find_active_event_queue (1); |
| 2094 | if (perd || MOUSE_ACTIVITY_AVAILABLE) | 2086 | if (perd) |
| 2095 | break; | 2087 | break; |
| 2096 | 2088 | ||
| 2097 | /* If the quit flag is set, then read_char will return | 2089 | /* If the quit flag is set, then read_char will return |
| @@ -2109,15 +2101,15 @@ kbd_buffer_get_event () | |||
| 2109 | #ifdef SIGIO | 2101 | #ifdef SIGIO |
| 2110 | gobble_input (0); | 2102 | gobble_input (0); |
| 2111 | #endif /* SIGIO */ | 2103 | #endif /* SIGIO */ |
| 2112 | perd = find_active_event_queue (); | 2104 | perd = find_active_event_queue (1); |
| 2113 | if (!(perd || MOUSE_ACTIVITY_AVAILABLE)) | 2105 | if (!perd) |
| 2114 | { | 2106 | { |
| 2115 | Lisp_Object minus_one; | 2107 | Lisp_Object minus_one; |
| 2116 | 2108 | ||
| 2117 | XSETINT (minus_one, -1); | 2109 | XSETINT (minus_one, -1); |
| 2118 | wait_reading_process_input (0, 0, minus_one, 1); | 2110 | wait_reading_process_input (0, 0, minus_one, 1); |
| 2119 | 2111 | ||
| 2120 | if (!interrupt_input && find_active_event_queue () == NULL) | 2112 | if (!interrupt_input && find_active_event_queue (0) == NULL) |
| 2121 | /* Pass 1 for EXPECT since we just waited to have input. */ | 2113 | /* Pass 1 for EXPECT since we just waited to have input. */ |
| 2122 | read_avail_input (1); | 2114 | read_avail_input (1); |
| 2123 | } | 2115 | } |
| @@ -2127,7 +2119,7 @@ kbd_buffer_get_event () | |||
| 2127 | /* At this point, we know that there is a readable event available | 2119 | /* At this point, we know that there is a readable event available |
| 2128 | somewhere. If the event queue is empty, then there must be a | 2120 | somewhere. If the event queue is empty, then there must be a |
| 2129 | mouse movement enabled and available. */ | 2121 | mouse movement enabled and available. */ |
| 2130 | if (perd) | 2122 | if (perd->kbd_fetch_ptr != perd->kbd_store_ptr) |
| 2131 | { | 2123 | { |
| 2132 | struct input_event *event; | 2124 | struct input_event *event; |
| 2133 | 2125 | ||
| @@ -2226,10 +2218,10 @@ kbd_buffer_get_event () | |||
| 2226 | if (! NILP (focus)) | 2218 | if (! NILP (focus)) |
| 2227 | frame = focus; | 2219 | frame = focus; |
| 2228 | 2220 | ||
| 2229 | if (! EQ (frame, internal_last_event_frame) | 2221 | if (! EQ (frame, perd->internal_last_event_frame) |
| 2230 | && XFRAME (frame) != selected_frame) | 2222 | && XFRAME (frame) != selected_frame) |
| 2231 | obj = make_lispy_switch_frame (frame); | 2223 | obj = make_lispy_switch_frame (frame); |
| 2232 | internal_last_event_frame = frame; | 2224 | perd->internal_last_event_frame = frame; |
| 2233 | #endif /* MULTI_FRAME */ | 2225 | #endif /* MULTI_FRAME */ |
| 2234 | 2226 | ||
| 2235 | /* If we didn't decide to make a switch-frame event, go ahead | 2227 | /* If we didn't decide to make a switch-frame event, go ahead |
| @@ -2277,10 +2269,10 @@ kbd_buffer_get_event () | |||
| 2277 | if (NILP (frame)) | 2269 | if (NILP (frame)) |
| 2278 | XSETFRAME (frame, f); | 2270 | XSETFRAME (frame, f); |
| 2279 | 2271 | ||
| 2280 | if (! EQ (frame, internal_last_event_frame) | 2272 | if (! EQ (frame, perd->internal_last_event_frame) |
| 2281 | && XFRAME (frame) != selected_frame) | 2273 | && XFRAME (frame) != selected_frame) |
| 2282 | obj = make_lispy_switch_frame (frame); | 2274 | obj = make_lispy_switch_frame (frame); |
| 2283 | internal_last_event_frame = frame; | 2275 | perd->internal_last_event_frame = frame; |
| 2284 | } | 2276 | } |
| 2285 | #endif | 2277 | #endif |
| 2286 | 2278 | ||
| @@ -2298,7 +2290,7 @@ kbd_buffer_get_event () | |||
| 2298 | input_pending = readable_events (); | 2290 | input_pending = readable_events (); |
| 2299 | 2291 | ||
| 2300 | #ifdef MULTI_FRAME | 2292 | #ifdef MULTI_FRAME |
| 2301 | Vlast_event_frame = internal_last_event_frame; | 2293 | perd->Vlast_event_frame = perd->internal_last_event_frame; |
| 2302 | #endif | 2294 | #endif |
| 2303 | 2295 | ||
| 2304 | return (obj); | 2296 | return (obj); |
| @@ -2311,7 +2303,7 @@ void | |||
| 2311 | swallow_events () | 2303 | swallow_events () |
| 2312 | { | 2304 | { |
| 2313 | PERDISPLAY *perd; | 2305 | PERDISPLAY *perd; |
| 2314 | while ((perd = find_active_event_queue ()) != NULL) | 2306 | while ((perd = find_active_event_queue (0)) != NULL) |
| 2315 | { | 2307 | { |
| 2316 | struct input_event *event; | 2308 | struct input_event *event; |
| 2317 | 2309 | ||
| @@ -5938,9 +5930,15 @@ quit_throw_to_read_char () | |||
| 5938 | abort (); | 5930 | abort (); |
| 5939 | #endif | 5931 | #endif |
| 5940 | #ifdef MULTI_FRAME | 5932 | #ifdef MULTI_FRAME |
| 5941 | if (FRAMEP (internal_last_event_frame) | 5933 | { |
| 5942 | && XFRAME (internal_last_event_frame) != selected_frame) | 5934 | Lisp_Object frame; |
| 5943 | Fhandle_switch_frame (make_lispy_switch_frame (internal_last_event_frame)); | 5935 | |
| 5936 | if (!current_perdisplay) | ||
| 5937 | abort (); | ||
| 5938 | frame = current_perdisplay->internal_last_event_frame; | ||
| 5939 | if (FRAMEP (frame) && XFRAME (frame) != selected_frame) | ||
| 5940 | Fhandle_switch_frame (make_lispy_switch_frame (frame)); | ||
| 5941 | } | ||
| 5944 | #endif | 5942 | #endif |
| 5945 | 5943 | ||
| 5946 | _longjmp (getcjmp, 1); | 5944 | _longjmp (getcjmp, 1); |
| @@ -6047,6 +6045,12 @@ init_perdisplay (perd) | |||
| 6047 | perd->kbd_store_ptr = perd->kbd_buffer; | 6045 | perd->kbd_store_ptr = perd->kbd_buffer; |
| 6048 | perd->kbd_buffer_frame_or_window | 6046 | perd->kbd_buffer_frame_or_window |
| 6049 | = Fmake_vector (make_number (KBD_BUFFER_SIZE), Qnil); | 6047 | = Fmake_vector (make_number (KBD_BUFFER_SIZE), Qnil); |
| 6048 | #ifdef MULTI_FRAME | ||
| 6049 | /* This means that command_loop_1 won't try to select anything the first | ||
| 6050 | time through. */ | ||
| 6051 | perd->internal_last_event_frame = Qnil; | ||
| 6052 | #endif | ||
| 6053 | perd->Vlast_event_frame = Qnil; | ||
| 6050 | } | 6054 | } |
| 6051 | 6055 | ||
| 6052 | /* | 6056 | /* |
| @@ -6076,13 +6080,6 @@ init_keyboard () | |||
| 6076 | #endif | 6080 | #endif |
| 6077 | input_pending = 0; | 6081 | input_pending = 0; |
| 6078 | 6082 | ||
| 6079 | #ifdef MULTI_FRAME | ||
| 6080 | /* This means that command_loop_1 won't try to select anything the first | ||
| 6081 | time through. */ | ||
| 6082 | internal_last_event_frame = Qnil; | ||
| 6083 | Vlast_event_frame = internal_last_event_frame; | ||
| 6084 | #endif | ||
| 6085 | |||
| 6086 | #ifndef MULTI_PERDISPLAY | 6083 | #ifndef MULTI_PERDISPLAY |
| 6087 | if (initialized) | 6084 | if (initialized) |
| 6088 | wipe_perdisplay (&the_only_perdisplay); | 6085 | wipe_perdisplay (&the_only_perdisplay); |
| @@ -6380,11 +6377,6 @@ by position only."); | |||
| 6380 | "Number of complete keys read from the keyboard so far."); | 6377 | "Number of complete keys read from the keyboard so far."); |
| 6381 | num_input_keys = 0; | 6378 | num_input_keys = 0; |
| 6382 | 6379 | ||
| 6383 | DEFVAR_LISP ("last-event-frame", &Vlast_event_frame, | ||
| 6384 | "The frame in which the most recently read event occurred.\n\ | ||
| 6385 | If the last event came from a keyboard macro, this is set to `macro'."); | ||
| 6386 | Vlast_event_frame = Qnil; | ||
| 6387 | |||
| 6388 | DEFVAR_LISP ("help-char", &Vhelp_char, | 6380 | DEFVAR_LISP ("help-char", &Vhelp_char, |
| 6389 | "Character to recognize as meaning Help.\n\ | 6381 | "Character to recognize as meaning Help.\n\ |
| 6390 | When it is read, do `(eval help-form)', and display result if it's a string.\n\ | 6382 | When it is read, do `(eval help-form)', and display result if it's a string.\n\ |
| @@ -6543,6 +6535,10 @@ It may be a number, or the symbol `-' for just a minus sign as arg,\n\ | |||
| 6543 | or a list whose car is a number for just one or more C-U's\n\ | 6535 | or a list whose car is a number for just one or more C-U's\n\ |
| 6544 | or nil if no argument has been specified.\n\ | 6536 | or nil if no argument has been specified.\n\ |
| 6545 | This is what `(interactive \"P\")' returns."); | 6537 | This is what `(interactive \"P\")' returns."); |
| 6538 | |||
| 6539 | DEFVAR_DISPLAY ("last-event-frame", Vlast_event_frame, | ||
| 6540 | "The frame in which the most recently read event occurred.\n\ | ||
| 6541 | If the last event came from a keyboard macro, this is set to `macro'."); | ||
| 6546 | } | 6542 | } |
| 6547 | 6543 | ||
| 6548 | keys_of_keyboard () | 6544 | keys_of_keyboard () |