diff options
| author | Richard M. Stallman | 1993-05-25 22:21:11 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-25 22:21:11 +0000 |
| commit | 1e12dd87cf755ea090a7b7b13994910e6ce83249 (patch) | |
| tree | ba0ec654b2e711e44b49b2249aa58e60b7b0bc04 /src | |
| parent | fedc33f7a838ed2e2ad7f47f4600753ac3e58ca9 (diff) | |
| download | emacs-1e12dd87cf755ea090a7b7b13994910e6ce83249.tar.gz emacs-1e12dd87cf755ea090a7b7b13994910e6ce83249.zip | |
(read_char): If kbd_buffer_get_event returns nil, redisplay and retry.
(kbd_buffer_get_event): If event is handled here, return nil.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 894ecbda056..9ca8d39d631 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1485,11 +1485,14 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1485 | } | 1485 | } |
| 1486 | 1486 | ||
| 1487 | /* Actually read a character, waiting if necessary. */ | 1487 | /* Actually read a character, waiting if necessary. */ |
| 1488 | if (NILP (c)) | 1488 | while (1) |
| 1489 | c = kbd_buffer_get_event (); | 1489 | { |
| 1490 | 1490 | c = kbd_buffer_get_event (); | |
| 1491 | if (NILP (c)) | 1491 | if (!NILP (c)) |
| 1492 | abort (); /* Don't think this can happen. */ | 1492 | break; |
| 1493 | if (commandflag >= 0 && !input_pending && !detect_input_pending ()) | ||
| 1494 | redisplay (); | ||
| 1495 | } | ||
| 1493 | 1496 | ||
| 1494 | /* Terminate Emacs in batch mode if at eof. */ | 1497 | /* Terminate Emacs in batch mode if at eof. */ |
| 1495 | if (noninteractive && XTYPE (c) == Lisp_Int && XINT (c) < 0) | 1498 | if (noninteractive && XTYPE (c) == Lisp_Int && XINT (c) < 0) |
| @@ -1852,7 +1855,6 @@ kbd_buffer_get_event () | |||
| 1852 | #ifdef HAVE_X11 | 1855 | #ifdef HAVE_X11 |
| 1853 | x_handle_selection_request (event); | 1856 | x_handle_selection_request (event); |
| 1854 | kbd_fetch_ptr = event + 1; | 1857 | kbd_fetch_ptr = event + 1; |
| 1855 | goto retry; | ||
| 1856 | #else | 1858 | #else |
| 1857 | /* We're getting selection request events, but we don't have | 1859 | /* We're getting selection request events, but we don't have |
| 1858 | a window system. */ | 1860 | a window system. */ |
| @@ -1860,12 +1862,11 @@ kbd_buffer_get_event () | |||
| 1860 | #endif | 1862 | #endif |
| 1861 | } | 1863 | } |
| 1862 | 1864 | ||
| 1863 | if (event->kind == selection_clear_event) | 1865 | else if (event->kind == selection_clear_event) |
| 1864 | { | 1866 | { |
| 1865 | #ifdef HAVE_X11 | 1867 | #ifdef HAVE_X11 |
| 1866 | x_handle_selection_clear (event); | 1868 | x_handle_selection_clear (event); |
| 1867 | kbd_fetch_ptr = event + 1; | 1869 | kbd_fetch_ptr = event + 1; |
| 1868 | goto retry; | ||
| 1869 | #else | 1870 | #else |
| 1870 | /* We're getting selection request events, but we don't have | 1871 | /* We're getting selection request events, but we don't have |
| 1871 | a window system. */ | 1872 | a window system. */ |
| @@ -1876,37 +1877,39 @@ kbd_buffer_get_event () | |||
| 1876 | #ifdef MULTI_FRAME | 1877 | #ifdef MULTI_FRAME |
| 1877 | /* If this event is on a different frame, return a switch-frame this | 1878 | /* If this event is on a different frame, return a switch-frame this |
| 1878 | time, and leave the event in the queue for next time. */ | 1879 | time, and leave the event in the queue for next time. */ |
| 1879 | { | 1880 | else |
| 1880 | Lisp_Object frame = event->frame_or_window; | 1881 | { |
| 1881 | Lisp_Object focus; | 1882 | Lisp_Object frame = event->frame_or_window; |
| 1883 | Lisp_Object focus; | ||
| 1882 | 1884 | ||
| 1883 | if (XTYPE (frame) == Lisp_Window) | 1885 | if (XTYPE (frame) == Lisp_Window) |
| 1884 | frame = WINDOW_FRAME (XWINDOW (frame)); | 1886 | frame = WINDOW_FRAME (XWINDOW (frame)); |
| 1885 | 1887 | ||
| 1886 | focus = FRAME_FOCUS_FRAME (XFRAME (frame)); | 1888 | focus = FRAME_FOCUS_FRAME (XFRAME (frame)); |
| 1887 | if (! NILP (focus)) | 1889 | if (! NILP (focus)) |
| 1888 | frame = focus; | 1890 | frame = focus; |
| 1889 | 1891 | ||
| 1890 | if (! EQ (frame, internal_last_event_frame) | 1892 | if (! EQ (frame, internal_last_event_frame) |
| 1891 | && XFRAME (frame) != selected_frame) | 1893 | && XFRAME (frame) != selected_frame) |
| 1892 | obj = make_lispy_switch_frame (frame); | 1894 | obj = make_lispy_switch_frame (frame); |
| 1893 | internal_last_event_frame = frame; | 1895 | internal_last_event_frame = frame; |
| 1894 | } | ||
| 1895 | #endif | ||
| 1896 | 1896 | ||
| 1897 | /* If we didn't decide to make a switch-frame event, go ahead | 1897 | /* If we didn't decide to make a switch-frame event, go ahead |
| 1898 | and build a real event from the queue entry. */ | 1898 | and build a real event from the queue entry. */ |
| 1899 | if (NILP (obj)) | ||
| 1900 | { | ||
| 1901 | obj = make_lispy_event (event); | ||
| 1902 | |||
| 1903 | /* Wipe out this event, to catch bugs. */ | ||
| 1904 | event->kind = no_event; | ||
| 1905 | (XVECTOR (kbd_buffer_frame_or_window)->contents[event - kbd_buffer] | ||
| 1906 | = Qnil); | ||
| 1907 | 1899 | ||
| 1908 | kbd_fetch_ptr = event + 1; | 1900 | if (NILP (obj)) |
| 1901 | { | ||
| 1902 | obj = make_lispy_event (event); | ||
| 1903 | |||
| 1904 | /* Wipe out this event, to catch bugs. */ | ||
| 1905 | event->kind = no_event; | ||
| 1906 | (XVECTOR (kbd_buffer_frame_or_window)->contents[event - kbd_buffer] | ||
| 1907 | = Qnil); | ||
| 1908 | |||
| 1909 | kbd_fetch_ptr = event + 1; | ||
| 1910 | } | ||
| 1909 | } | 1911 | } |
| 1912 | #endif | ||
| 1910 | } | 1913 | } |
| 1911 | else if (do_mouse_tracking && mouse_moved) | 1914 | else if (do_mouse_tracking && mouse_moved) |
| 1912 | { | 1915 | { |
| @@ -1948,10 +1951,12 @@ kbd_buffer_get_event () | |||
| 1948 | something for us to read! */ | 1951 | something for us to read! */ |
| 1949 | abort (); | 1952 | abort (); |
| 1950 | 1953 | ||
| 1954 | #if 0 | ||
| 1951 | /* If something gave back nil as the Lispy event, | 1955 | /* If something gave back nil as the Lispy event, |
| 1952 | it means the event was discarded, so try again. */ | 1956 | it means the event was discarded, so try again. */ |
| 1953 | if (NILP (obj)) | 1957 | if (NILP (obj)) |
| 1954 | goto retry; | 1958 | goto retry; |
| 1959 | #endif | ||
| 1955 | 1960 | ||
| 1956 | input_pending = readable_events (); | 1961 | input_pending = readable_events (); |
| 1957 | 1962 | ||