diff options
| author | Karoly Lorentey | 2004-02-28 04:52:40 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-02-28 04:52:40 +0000 |
| commit | 057a9ab495a5fd334f9bd3c7704176502e5219c4 (patch) | |
| tree | a833e67f7903c9e091282644c54e1fa6a0abff3c /src | |
| parent | ed62242d19b79fd8c14cd614ec6029e09d6e4618 (diff) | |
| parent | a874691c6cd8d74d0b51fae607b74543f1ffa1ca (diff) | |
| download | emacs-057a9ab495a5fd334f9bd3c7704176502e5219c4.tar.gz emacs-057a9ab495a5fd334f9bd3c7704176502e5219c4.zip | |
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-118
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-119
src/keyboard.c (adjust_point_for_property): #ifdef-out dodgy xassert
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-120
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-107
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 88 | ||||
| -rw-r--r-- | src/dispnew.c | 20 | ||||
| -rw-r--r-- | src/keyboard.c | 199 | ||||
| -rw-r--r-- | src/keyboard.h | 10 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/macterm.c | 149 | ||||
| -rw-r--r-- | src/sysdep.c | 30 | ||||
| -rw-r--r-- | src/termhooks.h | 7 | ||||
| -rw-r--r-- | src/w32inevt.c | 25 | ||||
| -rw-r--r-- | src/w32inevt.h | 4 | ||||
| -rw-r--r-- | src/w32term.c | 251 | ||||
| -rw-r--r-- | src/window.c | 9 | ||||
| -rw-r--r-- | src/xsmfns.c | 20 | ||||
| -rw-r--r-- | src/xterm.c | 811 | ||||
| -rw-r--r-- | src/xterm.h | 3 |
15 files changed, 748 insertions, 879 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0fe8fbf9225..8b5944a1866 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,91 @@ | |||
| 1 | 2004-02-28 Miles Bader <miles@gnu.org> | ||
| 2 | |||
| 3 | * keyboard.c (adjust_point_for_property): #ifdef-out dodgy xassert. | ||
| 4 | |||
| 5 | 2004-02-28 Kim F. Storm <storm@cua.dk> | ||
| 6 | |||
| 7 | * keyboard.c (kbd_buffer_store_event_hold): New function to store | ||
| 8 | an event into kbd fifo, but with special handling of quit event; | ||
| 9 | a quit event is saved for later, and further events are discarded | ||
| 10 | until the saved quit event has been processed. | ||
| 11 | (kbd_buffer_store_event): Use kbd_buffer_store_event_hold. | ||
| 12 | (gen_help_event): Store help event in kbd fifo. | ||
| 13 | (NREAD_INPUT_EVENTS): Remove. | ||
| 14 | (read_avail_input): Adapt to new read_socket_hook interface. | ||
| 15 | Remove allocation and initialization of local input_event buffer, | ||
| 16 | as read_socket_hook stores events directly in fifo. Allocate and | ||
| 17 | initialize local hold_quit event to handle postponed quit event | ||
| 18 | (and store it if set by kbd_buffer_store_event_hold). | ||
| 19 | |||
| 20 | * keyboard.h (kbd_buffer_store_event_hold): Add prototype. | ||
| 21 | (gen_help_event): Fix prototype. | ||
| 22 | |||
| 23 | * macterm.c (XTread_socket): Remove bufp_r and | ||
| 24 | numcharsp args. Add hold_quit arg. | ||
| 25 | Rework to use just one, local, inev input_event. Store inev | ||
| 26 | directly in fifo using kbd_buffer_store_event_hold. | ||
| 27 | |||
| 28 | * sysdep.c (BUFFER_SIZE_FACTOR): Remove. | ||
| 29 | (read_input_waiting): Adapt to new read_socket_hook interface. | ||
| 30 | Remove allocation and initialization of local input_event buffer, | ||
| 31 | as read_socket_hook stores events directly in fifo. Allocate and | ||
| 32 | initialize local hold_quit event to handle postponed quit event | ||
| 33 | (and store it if set by kbd_buffer_store_event_hold). | ||
| 34 | |||
| 35 | * term.c (read_socket_hook): Fix arg list. | ||
| 36 | |||
| 37 | * termhooks.h (read_socket_hook): Fix prototype. | ||
| 38 | |||
| 39 | * w32inevt.c (w32_console_read_socket): Remove bufp_r and | ||
| 40 | numcharsp args. Add hold_quit arg. | ||
| 41 | Rework to use just one, local, inev input_event. Store inev | ||
| 42 | directly in fifo using kbd_buffer_store_event_hold. | ||
| 43 | |||
| 44 | * w32inevt.h (w32_console_mouse_position): Fix prototype. | ||
| 45 | |||
| 46 | * w32term.c (w32_read_socket): Remove bufp_r and numcharsp args. | ||
| 47 | Add hold_quit arg. Rework to use just one, local, inev | ||
| 48 | input_event. Store inev directly in fifo using | ||
| 49 | kbd_buffer_store_event_hold. Update count in one place. | ||
| 50 | Postpone call to gen_help_event until inev is stored; use new | ||
| 51 | local do_help for this. | ||
| 52 | Remove local emacs_event in handing of ButtonPress event; just use | ||
| 53 | inev instead (so no reason to copy it later). | ||
| 54 | |||
| 55 | * xsmfns.c (x_session_check_input): Remove numchars arg. | ||
| 56 | |||
| 57 | * xterm.c (x_focus_changed, x_detect_focus_change): Remove | ||
| 58 | numchars arg. Always store event into bufp arg. Return nothing. | ||
| 59 | Callers changed accordingly. | ||
| 60 | (glyph_rect): Simplify. | ||
| 61 | (STORE_KEYSYM_FOR_DEBUG): New macro. | ||
| 62 | (SET_SAVED_MENU_EVENT): Use inev instead of bufp, etc. | ||
| 63 | (current_bufp, current_numcharsp) [USE_GTK]: Remove. | ||
| 64 | (current_hold_quit) [USE_GTK]: Add. | ||
| 65 | (event_handler_gdk): Adapt to new handle_one_xevent. | ||
| 66 | (handle_one_xevent): Remove bufp_r and numcharsp args. | ||
| 67 | Add hold_quit arg. Rework to use just one, local, inev | ||
| 68 | input_event. Store inev directly in fifo using | ||
| 69 | kbd_buffer_store_event_hold. Update count in one place. | ||
| 70 | Postpone call to gen_help_event until inev is stored; use new | ||
| 71 | local do_help for this. | ||
| 72 | Simplify handling of keysyms (consolidate common code). Fix bug | ||
| 73 | where count was updated with nchars instead of nbytes. | ||
| 74 | Remove local emacs_event in handing of ButtonPress event; just use | ||
| 75 | inev instead (so no reason to copy it later). | ||
| 76 | Remove `out' label. Rename label `ret' to `done'; add various | ||
| 77 | `goto done' to clarify code flow in deeply nested blocks. | ||
| 78 | (x_dispatch_event): Simplify as handle_one_xevent now calls | ||
| 79 | kbd_buffer_store_event itself. | ||
| 80 | (XTread_socket): Remove bufp_r and numcharsp args. Add hold_quit | ||
| 81 | arg. Call handle_one_xevent with new arglist. Store event from | ||
| 82 | x_session_check_input in fifo. | ||
| 83 | [USE_GTK]: Setup current_hold_quit. | ||
| 84 | Decrement handling_signal before unblocking input. | ||
| 85 | (x_initialize) [USE_GTK]: Initialize current_count. | ||
| 86 | |||
| 87 | * xterm.h (x_session_check_input): Fix prototype. | ||
| 88 | |||
| 1 | 2004-02-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 89 | 2004-02-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 90 | ||
| 3 | * s/darwin.h (LD_SWITCH_SYSTEM_TEMACS): Add `-framework | 91 | * s/darwin.h (LD_SWITCH_SYSTEM_TEMACS): Add `-framework |
diff --git a/src/dispnew.c b/src/dispnew.c index 8a3d7013c3e..b4d3020e81d 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -4137,16 +4137,6 @@ update_window (w, force_p) | |||
| 4137 | changed_p = 1; | 4137 | changed_p = 1; |
| 4138 | } | 4138 | } |
| 4139 | 4139 | ||
| 4140 | /* Update the header line after scrolling because a new header | ||
| 4141 | line would otherwise overwrite lines at the top of the window | ||
| 4142 | that can be scrolled. */ | ||
| 4143 | if (header_line_row && header_line_row->enabled_p) | ||
| 4144 | { | ||
| 4145 | header_line_row->y = 0; | ||
| 4146 | update_window_line (w, 0, &mouse_face_overwritten_p); | ||
| 4147 | changed_p = 1; | ||
| 4148 | } | ||
| 4149 | |||
| 4150 | /* Update the rest of the lines. */ | 4140 | /* Update the rest of the lines. */ |
| 4151 | for (n_updated = 0; row < end && (force_p || !input_pending); ++row) | 4141 | for (n_updated = 0; row < end && (force_p || !input_pending); ++row) |
| 4152 | if (row->enabled_p) | 4142 | if (row->enabled_p) |
| @@ -4183,6 +4173,16 @@ update_window (w, force_p) | |||
| 4183 | 4173 | ||
| 4184 | set_cursor: | 4174 | set_cursor: |
| 4185 | 4175 | ||
| 4176 | /* Update the header line after scrolling because a new header | ||
| 4177 | line would otherwise overwrite lines at the top of the window | ||
| 4178 | that can be scrolled. */ | ||
| 4179 | if (header_line_row && header_line_row->enabled_p) | ||
| 4180 | { | ||
| 4181 | header_line_row->y = 0; | ||
| 4182 | update_window_line (w, 0, &mouse_face_overwritten_p); | ||
| 4183 | changed_p = 1; | ||
| 4184 | } | ||
| 4185 | |||
| 4186 | /* Fix the appearance of overlapping/overlapped rows. */ | 4186 | /* Fix the appearance of overlapping/overlapped rows. */ |
| 4187 | if (!paused_p && !w->pseudo_window_p) | 4187 | if (!paused_p && !w->pseudo_window_p) |
| 4188 | { | 4188 | { |
diff --git a/src/keyboard.c b/src/keyboard.c index 2aff293c610..5e8397e7458 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1916,7 +1916,12 @@ adjust_point_for_property (last_pt, modified) | |||
| 1916 | : (PT < last_pt ? beg : end)); | 1916 | : (PT < last_pt ? beg : end)); |
| 1917 | check_composition = check_display = 1; | 1917 | check_composition = check_display = 1; |
| 1918 | } | 1918 | } |
| 1919 | #if 0 /* This assertion isn't correct, because SET_PT may end up setting | ||
| 1920 | the point to something other than its argument, due to | ||
| 1921 | point-motion hooks, intangibility, etc. */ | ||
| 1919 | xassert (PT == beg || PT == end); | 1922 | xassert (PT == beg || PT == end); |
| 1923 | #endif | ||
| 1924 | |||
| 1920 | /* Pretend the area doesn't exist if the buffer is not | 1925 | /* Pretend the area doesn't exist if the buffer is not |
| 1921 | modified. */ | 1926 | modified. */ |
| 1922 | if (!modified && !ellipsis && beg < end) | 1927 | if (!modified && !ellipsis && beg < end) |
| @@ -3516,9 +3521,32 @@ void | |||
| 3516 | kbd_buffer_store_event (event) | 3521 | kbd_buffer_store_event (event) |
| 3517 | register struct input_event *event; | 3522 | register struct input_event *event; |
| 3518 | { | 3523 | { |
| 3524 | kbd_buffer_store_event_hold (event, 0); | ||
| 3525 | } | ||
| 3526 | |||
| 3527 | /* Store EVENT obtained at interrupt level into kbd_buffer, fifo. | ||
| 3528 | |||
| 3529 | If HOLD_QUIT is 0, just stuff EVENT into the fifo. | ||
| 3530 | Else, if HOLD_QUIT.kind != NO_EVENT, discard EVENT. | ||
| 3531 | Else, if EVENT is a quit event, store the quit event | ||
| 3532 | in HOLD_QUIT, and return (thus ignoring further events). | ||
| 3533 | |||
| 3534 | This is used in read_avail_input to postpone the processing | ||
| 3535 | of the quit event until all subsequent input events have been | ||
| 3536 | parsed (and discarded). | ||
| 3537 | */ | ||
| 3538 | |||
| 3539 | void | ||
| 3540 | kbd_buffer_store_event_hold (event, hold_quit) | ||
| 3541 | register struct input_event *event; | ||
| 3542 | struct input_event *hold_quit; | ||
| 3543 | { | ||
| 3519 | if (event->kind == NO_EVENT) | 3544 | if (event->kind == NO_EVENT) |
| 3520 | abort (); | 3545 | abort (); |
| 3521 | 3546 | ||
| 3547 | if (hold_quit && hold_quit->kind != NO_EVENT) | ||
| 3548 | return; | ||
| 3549 | |||
| 3522 | if (event->kind == ASCII_KEYSTROKE_EVENT) | 3550 | if (event->kind == ASCII_KEYSTROKE_EVENT) |
| 3523 | { | 3551 | { |
| 3524 | register int c = event->code & 0377; | 3552 | register int c = event->code & 0377; |
| @@ -3560,6 +3588,12 @@ kbd_buffer_store_event (event) | |||
| 3560 | } | 3588 | } |
| 3561 | #endif | 3589 | #endif |
| 3562 | 3590 | ||
| 3591 | if (hold_quit) | ||
| 3592 | { | ||
| 3593 | bcopy (event, (char *) hold_quit, sizeof (*event)); | ||
| 3594 | return; | ||
| 3595 | } | ||
| 3596 | |||
| 3563 | /* If this results in a quit_char being returned to Emacs as | 3597 | /* If this results in a quit_char being returned to Emacs as |
| 3564 | input, set Vlast_event_frame properly. If this doesn't | 3598 | input, set Vlast_event_frame properly. If this doesn't |
| 3565 | get returned to Emacs as an event, the next event read | 3599 | get returned to Emacs as an event, the next event read |
| @@ -3589,7 +3623,9 @@ kbd_buffer_store_event (event) | |||
| 3589 | Just ignore the second one. */ | 3623 | Just ignore the second one. */ |
| 3590 | else if (event->kind == BUFFER_SWITCH_EVENT | 3624 | else if (event->kind == BUFFER_SWITCH_EVENT |
| 3591 | && kbd_fetch_ptr != kbd_store_ptr | 3625 | && kbd_fetch_ptr != kbd_store_ptr |
| 3592 | && kbd_store_ptr->kind == BUFFER_SWITCH_EVENT) | 3626 | && ((kbd_store_ptr == kbd_buffer |
| 3627 | ? kbd_buffer + KBD_BUFFER_SIZE - 1 | ||
| 3628 | : kbd_store_ptr - 1)->kind) == BUFFER_SWITCH_EVENT) | ||
| 3593 | return; | 3629 | return; |
| 3594 | 3630 | ||
| 3595 | if (kbd_store_ptr - kbd_buffer == KBD_BUFFER_SIZE) | 3631 | if (kbd_store_ptr - kbd_buffer == KBD_BUFFER_SIZE) |
| @@ -3648,24 +3684,22 @@ kbd_buffer_store_event (event) | |||
| 3648 | 3684 | ||
| 3649 | Value is the number of input_events generated. */ | 3685 | Value is the number of input_events generated. */ |
| 3650 | 3686 | ||
| 3651 | int | 3687 | void |
| 3652 | gen_help_event (bufp, size, help, frame, window, object, pos) | 3688 | gen_help_event (help, frame, window, object, pos) |
| 3653 | struct input_event *bufp; | ||
| 3654 | int size; | ||
| 3655 | Lisp_Object help, frame, object, window; | 3689 | Lisp_Object help, frame, object, window; |
| 3656 | int pos; | 3690 | int pos; |
| 3657 | { | 3691 | { |
| 3658 | if (size >= 1) | 3692 | struct input_event event; |
| 3659 | { | 3693 | |
| 3660 | bufp->kind = HELP_EVENT; | 3694 | EVENT_INIT (event); |
| 3661 | bufp->frame_or_window = frame; | 3695 | |
| 3662 | bufp->arg = object; | 3696 | event.kind = HELP_EVENT; |
| 3663 | bufp->x = WINDOWP (window) ? window : frame; | 3697 | event.frame_or_window = frame; |
| 3664 | bufp->y = help; | 3698 | event.arg = object; |
| 3665 | bufp->code = pos; | 3699 | event.x = WINDOWP (window) ? window : frame; |
| 3666 | return 1; | 3700 | event.y = help; |
| 3667 | } | 3701 | event.code = pos; |
| 3668 | return 0; | 3702 | kbd_buffer_store_event (&event); |
| 3669 | } | 3703 | } |
| 3670 | 3704 | ||
| 3671 | 3705 | ||
| @@ -6570,15 +6604,7 @@ record_asynch_buffer_change () | |||
| 6570 | only when SIGIO is blocked. | 6604 | only when SIGIO is blocked. |
| 6571 | 6605 | ||
| 6572 | Returns the number of keyboard chars read, or -1 meaning | 6606 | Returns the number of keyboard chars read, or -1 meaning |
| 6573 | this is a bad time to try to read input. | 6607 | this is a bad time to try to read input. */ |
| 6574 | |||
| 6575 | Typically, there are just a few available input events to be read | ||
| 6576 | here, so we really don't need to allocate and initialize a big | ||
| 6577 | buffer of input_events as we used to do. Instead, we just allocate | ||
| 6578 | a small buffer of input events -- and then poll for more input if we | ||
| 6579 | read a full buffer of input events. */ | ||
| 6580 | |||
| 6581 | #define NREAD_INPUT_EVENTS 512 | ||
| 6582 | 6608 | ||
| 6583 | static int | 6609 | static int |
| 6584 | read_avail_input (expected) | 6610 | read_avail_input (expected) |
| @@ -6600,59 +6626,47 @@ read_avail_input (expected) | |||
| 6600 | int discard = 0; | 6626 | int discard = 0; |
| 6601 | int nr; | 6627 | int nr; |
| 6602 | 6628 | ||
| 6603 | do { | 6629 | struct input_event hold_quit; |
| 6604 | struct input_event buf[NREAD_INPUT_EVENTS]; | ||
| 6605 | 6630 | ||
| 6606 | for (i = 0; i < NREAD_INPUT_EVENTS; i++) | 6631 | EVENT_INIT (hold_quit); |
| 6607 | EVENT_INIT (buf[i]); | 6632 | hold_quit.kind = NO_EVENT; |
| 6608 | 6633 | ||
| 6609 | /* No need for FIONREAD or fcntl; just say don't wait. */ | 6634 | /* No need for FIONREAD or fcntl; just say don't wait. */ |
| 6610 | nr = (*d->read_socket_hook) (d, buf, NREAD_INPUT_EVENTS, expected); | 6635 | while (nr = (*d->read_socket_hook) (d, expected, &hold_quit), nr > 0) |
| 6636 | { | ||
| 6637 | nread += nr; | ||
| 6638 | expected = 0; | ||
| 6639 | } | ||
| 6640 | |||
| 6641 | if (nr == -1) /* Not OK to read input now. */ | ||
| 6642 | { | ||
| 6643 | err = 1; | ||
| 6644 | } | ||
| 6645 | else if (nr == -2) /* Non-transient error. */ | ||
| 6646 | { | ||
| 6647 | /* The display device terminated; it should be closed. */ | ||
| 6648 | |||
| 6649 | /* Kill Emacs if this was our last display. */ | ||
| 6650 | if (! display_list->next_display) | ||
| 6651 | /* Formerly simply reported no input, but that | ||
| 6652 | sometimes led to a failure of Emacs to terminate. | ||
| 6653 | SIGHUP seems appropriate if we can't reach the | ||
| 6654 | terminal. */ | ||
| 6655 | /* ??? Is it really right to send the signal just to | ||
| 6656 | this process rather than to the whole process | ||
| 6657 | group? Perhaps on systems with FIONREAD Emacs is | ||
| 6658 | alone in its group. */ | ||
| 6659 | kill (getpid (), SIGHUP); | ||
| 6660 | |||
| 6661 | /* XXX Is calling delete_display safe here? It calls Fdelete_frame. */ | ||
| 6662 | if (d->delete_display_hook) | ||
| 6663 | (*d->delete_display_hook) (d); | ||
| 6664 | else | ||
| 6665 | delete_display (d); | ||
| 6666 | } | ||
| 6611 | 6667 | ||
| 6612 | if (nr > 0) | 6668 | if (hold_quit.kind != NO_EVENT) |
| 6613 | { | 6669 | kbd_buffer_store_event (&hold_quit); |
| 6614 | /* We've got input. */ | ||
| 6615 | nread += nr; | ||
| 6616 | expected = 0; | ||
| 6617 | |||
| 6618 | /* Scan the chars for C-g and store them in kbd_buffer. */ | ||
| 6619 | for (i = 0; !discard && i < nr; i++) | ||
| 6620 | { | ||
| 6621 | kbd_buffer_store_event (&buf[i]); | ||
| 6622 | /* Don't look at input that follows a C-g too closely. | ||
| 6623 | This reduces lossage due to autorepeat on C-g. */ | ||
| 6624 | if (buf[i].kind == ASCII_KEYSTROKE_EVENT | ||
| 6625 | && buf[i].code == quit_char) | ||
| 6626 | discard = 1; | ||
| 6627 | } | ||
| 6628 | } | ||
| 6629 | else if (nr == -1) /* Not OK to read input now. */ | ||
| 6630 | { | ||
| 6631 | err = 1; | ||
| 6632 | } | ||
| 6633 | else if (nr == -2) /* Non-transient error. */ | ||
| 6634 | { | ||
| 6635 | /* The display device terminated; it should be closed. */ | ||
| 6636 | |||
| 6637 | /* Kill Emacs if this was our last display. */ | ||
| 6638 | if (! display_list->next_display) | ||
| 6639 | /* Formerly simply reported no input, but that | ||
| 6640 | sometimes led to a failure of Emacs to terminate. | ||
| 6641 | SIGHUP seems appropriate if we can't reach the | ||
| 6642 | terminal. */ | ||
| 6643 | /* ??? Is it really right to send the signal just to | ||
| 6644 | this process rather than to the whole process | ||
| 6645 | group? Perhaps on systems with FIONREAD Emacs is | ||
| 6646 | alone in its group. */ | ||
| 6647 | kill (getpid (), SIGHUP); | ||
| 6648 | |||
| 6649 | /* XXX Is calling delete_display safe here? It calls Fdelete_frame. */ | ||
| 6650 | if (d->delete_display_hook) | ||
| 6651 | (*d->delete_display_hook) (d); | ||
| 6652 | else | ||
| 6653 | delete_display (d); | ||
| 6654 | } | ||
| 6655 | } while (nr == NREAD_INPUT_EVENTS); | ||
| 6656 | } | 6670 | } |
| 6657 | 6671 | ||
| 6658 | d = next; | 6672 | d = next; |
| @@ -6672,13 +6686,13 @@ read_avail_input (expected) | |||
| 6672 | 6686 | ||
| 6673 | int | 6687 | int |
| 6674 | tty_read_avail_input (struct display *display, | 6688 | tty_read_avail_input (struct display *display, |
| 6675 | struct input_event *buf, | 6689 | int expected, |
| 6676 | int numchars, int expected) | 6690 | struct input_event *hold_quit) |
| 6677 | { | 6691 | { |
| 6678 | /* Using numchars here avoids reading more than the buf can | 6692 | /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than |
| 6679 | really hold. That may prevent loss of characters on some systems | 6693 | the kbd_buffer can really hold. That may prevent loss |
| 6680 | when input is stuffed at us. */ | 6694 | of characters on some systems when input is stuffed at us. */ |
| 6681 | unsigned char cbuf[numchars]; | 6695 | unsigned char cbuf[KBD_BUFFER_SIZE - 1]; |
| 6682 | int n_to_read, i; | 6696 | int n_to_read, i; |
| 6683 | struct tty_display_info *tty = display->display_info.tty; | 6697 | struct tty_display_info *tty = display->display_info.tty; |
| 6684 | int nread = 0; | 6698 | int nread = 0; |
| @@ -6785,19 +6799,28 @@ tty_read_avail_input (struct display *display, | |||
| 6785 | 6799 | ||
| 6786 | for (i = 0; i < nread; i++) | 6800 | for (i = 0; i < nread; i++) |
| 6787 | { | 6801 | { |
| 6788 | buf[i].kind = ASCII_KEYSTROKE_EVENT; | 6802 | struct input_event buf; |
| 6789 | buf[i].modifiers = 0; | 6803 | EVENT_INIT (buf); |
| 6804 | buf.kind = ASCII_KEYSTROKE_EVENT; | ||
| 6805 | buf.modifiers = 0; | ||
| 6790 | if (tty->meta_key == 1 && (cbuf[i] & 0x80)) | 6806 | if (tty->meta_key == 1 && (cbuf[i] & 0x80)) |
| 6791 | buf[i].modifiers = meta_modifier; | 6807 | buf.modifiers = meta_modifier; |
| 6792 | if (tty->meta_key != 2) | 6808 | if (tty->meta_key != 2) |
| 6793 | cbuf[i] &= ~0x80; | 6809 | cbuf[i] &= ~0x80; |
| 6794 | 6810 | ||
| 6795 | buf[i].code = cbuf[i]; | 6811 | buf.code = cbuf[i]; |
| 6796 | /* Set the frame corresponding to the active tty. Note that the | 6812 | /* Set the frame corresponding to the active tty. Note that the |
| 6797 | value of selected_frame is not reliable here, redisplay tends | 6813 | value of selected_frame is not reliable here, redisplay tends |
| 6798 | to temporarily change it. */ | 6814 | to temporarily change it. */ |
| 6799 | buf[i].frame_or_window = tty->top_frame; | 6815 | buf.frame_or_window = tty->top_frame; |
| 6800 | buf[i].arg = Qnil; | 6816 | buf.arg = Qnil; |
| 6817 | |||
| 6818 | kbd_buffer_store_event (&buf); | ||
| 6819 | /* Don't look at input that follows a C-g too closely. | ||
| 6820 | This reduces lossage due to autorepeat on C-g. */ | ||
| 6821 | if (buf.kind == ASCII_KEYSTROKE_EVENT | ||
| 6822 | && buf.code == quit_char) | ||
| 6823 | break; | ||
| 6801 | } | 6824 | } |
| 6802 | 6825 | ||
| 6803 | return nread; | 6826 | return nread; |
diff --git a/src/keyboard.h b/src/keyboard.h index a084efa7791..3f38b7ded6b 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -329,19 +329,21 @@ extern void timer_start_idle P_ ((void)); | |||
| 329 | extern void timer_stop_idle P_ ((void)); | 329 | extern void timer_stop_idle P_ ((void)); |
| 330 | extern int lucid_event_type_list_p P_ ((Lisp_Object)); | 330 | extern int lucid_event_type_list_p P_ ((Lisp_Object)); |
| 331 | extern void kbd_buffer_store_event P_ ((struct input_event *)); | 331 | extern void kbd_buffer_store_event P_ ((struct input_event *)); |
| 332 | extern void kbd_buffer_store_event_hold P_ ((struct input_event *, | ||
| 333 | struct input_event *)); | ||
| 332 | #ifdef POLL_FOR_INPUT | 334 | #ifdef POLL_FOR_INPUT |
| 333 | extern void poll_for_input_1 P_ ((void)); | 335 | extern void poll_for_input_1 P_ ((void)); |
| 334 | #endif | 336 | #endif |
| 335 | extern void show_help_echo P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 337 | extern void show_help_echo P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
| 336 | Lisp_Object, int)); | 338 | Lisp_Object, int)); |
| 337 | extern int gen_help_event P_ ((struct input_event *, int, Lisp_Object, | 339 | extern void gen_help_event P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
| 338 | Lisp_Object, Lisp_Object, Lisp_Object, int)); | 340 | Lisp_Object, int)); |
| 339 | extern void kbd_buffer_store_help_event P_ ((Lisp_Object, Lisp_Object)); | 341 | extern void kbd_buffer_store_help_event P_ ((Lisp_Object, Lisp_Object)); |
| 340 | extern Lisp_Object menu_item_eval_property P_ ((Lisp_Object)); | 342 | extern Lisp_Object menu_item_eval_property P_ ((Lisp_Object)); |
| 341 | extern int kbd_buffer_events_waiting P_ ((int)); | 343 | extern int kbd_buffer_events_waiting P_ ((int)); |
| 342 | 344 | ||
| 343 | extern int tty_read_avail_input P_ ((struct display *, | 345 | extern int tty_read_avail_input P_ ((struct display *, int, |
| 344 | struct input_event *, int, int)); | 346 | struct input_event *)); |
| 345 | 347 | ||
| 346 | /* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3 | 348 | /* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3 |
| 347 | (do not change this comment) */ | 349 | (do not change this comment) */ |
diff --git a/src/lisp.h b/src/lisp.h index 8affbc76126..371bd0d729d 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2380,7 +2380,6 @@ extern void redisplay P_ ((void)); | |||
| 2380 | extern int check_point_in_composition | 2380 | extern int check_point_in_composition |
| 2381 | P_ ((struct buffer *, int, struct buffer *, int)); | 2381 | P_ ((struct buffer *, int, struct buffer *, int)); |
| 2382 | extern void redisplay_preserve_echo_area P_ ((int)); | 2382 | extern void redisplay_preserve_echo_area P_ ((int)); |
| 2383 | extern void mark_window_display_accurate P_ ((Lisp_Object, int)); | ||
| 2384 | extern void prepare_menu_bars P_ ((void)); | 2383 | extern void prepare_menu_bars P_ ((void)); |
| 2385 | 2384 | ||
| 2386 | void set_frame_cursor_types P_ ((struct frame *, Lisp_Object)); | 2385 | void set_frame_cursor_types P_ ((struct frame *, Lisp_Object)); |
diff --git a/src/macterm.c b/src/macterm.c index 90c850c596b..f6269791c51 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -8016,8 +8016,9 @@ keycode_to_xkeysym (int keyCode, int *xKeySym) | |||
| 8016 | /* Emacs calls this whenever it wants to read an input event from the | 8016 | /* Emacs calls this whenever it wants to read an input event from the |
| 8017 | user. */ | 8017 | user. */ |
| 8018 | int | 8018 | int |
| 8019 | XTread_socket (struct input_event *bufp, int numchars, int expected) | 8019 | XTread_socket (int sd, int expected, struct input_event *hold_quit) |
| 8020 | { | 8020 | { |
| 8021 | struct input_event inev; | ||
| 8021 | int count = 0; | 8022 | int count = 0; |
| 8022 | #if USE_CARBON_EVENTS | 8023 | #if USE_CARBON_EVENTS |
| 8023 | OSStatus rneResult; | 8024 | OSStatus rneResult; |
| @@ -8042,9 +8043,6 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8042 | /* So people can tell when we have read the available input. */ | 8043 | /* So people can tell when we have read the available input. */ |
| 8043 | input_signal_count++; | 8044 | input_signal_count++; |
| 8044 | 8045 | ||
| 8045 | if (numchars <= 0) | ||
| 8046 | abort (); | ||
| 8047 | |||
| 8048 | /* Don't poll for events to process (specifically updateEvt) if | 8046 | /* Don't poll for events to process (specifically updateEvt) if |
| 8049 | window update currently already in progress. A call to redisplay | 8047 | window update currently already in progress. A call to redisplay |
| 8050 | (in do_window_update) can be preempted by another call to | 8048 | (in do_window_update) can be preempted by another call to |
| @@ -8063,7 +8061,9 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8063 | event to nil because keyboard.c protects incompletely processed | 8061 | event to nil because keyboard.c protects incompletely processed |
| 8064 | event from being garbage collected by placing them in the | 8062 | event from being garbage collected by placing them in the |
| 8065 | kbd_buffer_gcpro vector. */ | 8063 | kbd_buffer_gcpro vector. */ |
| 8066 | bufp->arg = Qnil; | 8064 | EVENT_INIT (inev); |
| 8065 | inev.kind = NO_EVENT; | ||
| 8066 | inev.arg = Qnil; | ||
| 8067 | 8067 | ||
| 8068 | event_mask = everyEvent; | 8068 | event_mask = everyEvent; |
| 8069 | if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) | 8069 | if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) |
| @@ -8101,18 +8101,17 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8101 | GetEventParameter(eventRef, kEventParamMouseLocation, | 8101 | GetEventParameter(eventRef, kEventParamMouseLocation, |
| 8102 | typeQDPoint, NULL, sizeof (Point), | 8102 | typeQDPoint, NULL, sizeof (Point), |
| 8103 | NULL, &point); | 8103 | NULL, &point); |
| 8104 | bufp->kind = WHEEL_EVENT; | 8104 | inev.kind = WHEEL_EVENT; |
| 8105 | bufp->code = 0; | 8105 | inev.code = 0; |
| 8106 | bufp->modifiers = (mac_event_to_emacs_modifiers(eventRef) | 8106 | inev.modifiers = (mac_event_to_emacs_modifiers(eventRef) |
| 8107 | | ((delta < 0) ? down_modifier | 8107 | | ((delta < 0) ? down_modifier |
| 8108 | : up_modifier)); | 8108 | : up_modifier)); |
| 8109 | SetPort (GetWindowPort (window_ptr)); | 8109 | SetPort (GetWindowPort (window_ptr)); |
| 8110 | GlobalToLocal (&point); | 8110 | GlobalToLocal (&point); |
| 8111 | XSETINT (bufp->x, point.h); | 8111 | XSETINT (inev.x, point.h); |
| 8112 | XSETINT (bufp->y, point.v); | 8112 | XSETINT (inev.y, point.v); |
| 8113 | XSETFRAME (bufp->frame_or_window, mwp->mFP); | 8113 | XSETFRAME (inev.frame_or_window, mwp->mFP); |
| 8114 | bufp->timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60); | 8114 | inev.timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60); |
| 8115 | count++; | ||
| 8116 | } | 8115 | } |
| 8117 | else | 8116 | else |
| 8118 | SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()); | 8117 | SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()); |
| @@ -8161,28 +8160,27 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8161 | GlobalToLocal (&mouse_loc); | 8160 | GlobalToLocal (&mouse_loc); |
| 8162 | 8161 | ||
| 8163 | #if USE_CARBON_EVENTS | 8162 | #if USE_CARBON_EVENTS |
| 8164 | bufp->code = mac_get_mouse_btn (eventRef); | 8163 | inev.code = mac_get_mouse_btn (eventRef); |
| 8165 | #else | 8164 | #else |
| 8166 | bufp_.code = mac_get_emulate_btn (er.modifiers); | 8165 | inev.code = mac_get_emulate_btn (er.modifiers); |
| 8167 | #endif | 8166 | #endif |
| 8168 | bufp->kind = SCROLL_BAR_CLICK_EVENT; | 8167 | inev.kind = SCROLL_BAR_CLICK_EVENT; |
| 8169 | bufp->frame_or_window = tracked_scroll_bar->window; | 8168 | inev.frame_or_window = tracked_scroll_bar->window; |
| 8170 | bufp->part = scroll_bar_handle; | 8169 | inev.part = scroll_bar_handle; |
| 8171 | #if USE_CARBON_EVENTS | 8170 | #if USE_CARBON_EVENTS |
| 8172 | bufp->modifiers = mac_event_to_emacs_modifiers (eventRef); | 8171 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); |
| 8173 | #else | 8172 | #else |
| 8174 | bufp->modifiers = mac_to_emacs_modifiers (er.modifiers); | 8173 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); |
| 8175 | #endif | 8174 | #endif |
| 8176 | bufp->modifiers |= up_modifier; | 8175 | inev.modifiers |= up_modifier; |
| 8177 | bufp->timestamp = er.when * (1000 / 60); | 8176 | inev.timestamp = er.when * (1000 / 60); |
| 8178 | /* ticks to milliseconds */ | 8177 | /* ticks to milliseconds */ |
| 8179 | 8178 | ||
| 8180 | XSETINT (bufp->x, tracked_scroll_bar->left + 2); | 8179 | XSETINT (inev.x, tracked_scroll_bar->left + 2); |
| 8181 | XSETINT (bufp->y, mouse_loc.v - 24); | 8180 | XSETINT (inev.y, mouse_loc.v - 24); |
| 8182 | tracked_scroll_bar->dragging = Qnil; | 8181 | tracked_scroll_bar->dragging = Qnil; |
| 8183 | mouse_tracking_in_progress = mouse_tracking_none; | 8182 | mouse_tracking_in_progress = mouse_tracking_none; |
| 8184 | tracked_scroll_bar = NULL; | 8183 | tracked_scroll_bar = NULL; |
| 8185 | count++; | ||
| 8186 | break; | 8184 | break; |
| 8187 | } | 8185 | } |
| 8188 | 8186 | ||
| @@ -8196,9 +8194,8 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8196 | struct frame *f = ((mac_output *) | 8194 | struct frame *f = ((mac_output *) |
| 8197 | GetWRefCon (FrontWindow ()))->mFP; | 8195 | GetWRefCon (FrontWindow ()))->mFP; |
| 8198 | saved_menu_event_location = er.where; | 8196 | saved_menu_event_location = er.where; |
| 8199 | bufp->kind = MENU_BAR_ACTIVATE_EVENT; | 8197 | inev.kind = MENU_BAR_ACTIVATE_EVENT; |
| 8200 | XSETFRAME (bufp->frame_or_window, f); | 8198 | XSETFRAME (inev.frame_or_window, f); |
| 8201 | count++; | ||
| 8202 | } | 8199 | } |
| 8203 | break; | 8200 | break; |
| 8204 | 8201 | ||
| @@ -8229,13 +8226,13 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8229 | #endif | 8226 | #endif |
| 8230 | 8227 | ||
| 8231 | #if USE_CARBON_EVENTS | 8228 | #if USE_CARBON_EVENTS |
| 8232 | bufp->code = mac_get_mouse_btn (eventRef); | 8229 | inev.code = mac_get_mouse_btn (eventRef); |
| 8233 | #else | 8230 | #else |
| 8234 | bufp_.code = mac_get_emulate_btn (er.modifiers); | 8231 | inev.code = mac_get_emulate_btn (er.modifiers); |
| 8235 | #endif | 8232 | #endif |
| 8236 | XSETINT (bufp->x, mouse_loc.h); | 8233 | XSETINT (inev.x, mouse_loc.h); |
| 8237 | XSETINT (bufp->y, mouse_loc.v); | 8234 | XSETINT (inev.y, mouse_loc.v); |
| 8238 | bufp->timestamp = er.when * (1000 / 60); | 8235 | inev.timestamp = er.when * (1000 / 60); |
| 8239 | /* ticks to milliseconds */ | 8236 | /* ticks to milliseconds */ |
| 8240 | 8237 | ||
| 8241 | #if TARGET_API_MAC_CARBON | 8238 | #if TARGET_API_MAC_CARBON |
| @@ -8247,7 +8244,7 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8247 | struct scroll_bar *bar = (struct scroll_bar *) | 8244 | struct scroll_bar *bar = (struct scroll_bar *) |
| 8248 | GetControlReference (ch); | 8245 | GetControlReference (ch); |
| 8249 | x_scroll_bar_handle_click (bar, control_part_code, &er, | 8246 | x_scroll_bar_handle_click (bar, control_part_code, &er, |
| 8250 | bufp); | 8247 | &inev); |
| 8251 | if (er.what == mouseDown | 8248 | if (er.what == mouseDown |
| 8252 | && control_part_code == kControlIndicatorPart) | 8249 | && control_part_code == kControlIndicatorPart) |
| 8253 | { | 8250 | { |
| @@ -8264,22 +8261,22 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8264 | else | 8261 | else |
| 8265 | { | 8262 | { |
| 8266 | Lisp_Object window; | 8263 | Lisp_Object window; |
| 8267 | 8264 | ||
| 8268 | bufp->kind = MOUSE_CLICK_EVENT; | 8265 | inev.kind = MOUSE_CLICK_EVENT; |
| 8269 | XSETFRAME (bufp->frame_or_window, mwp->mFP); | 8266 | XSETFRAME (inev.frame_or_window, mwp->mFP); |
| 8270 | if (er.what == mouseDown) | 8267 | if (er.what == mouseDown) |
| 8271 | mouse_tracking_in_progress | 8268 | mouse_tracking_in_progress |
| 8272 | = mouse_tracking_mouse_movement; | 8269 | = mouse_tracking_mouse_movement; |
| 8273 | else | 8270 | else |
| 8274 | mouse_tracking_in_progress = mouse_tracking_none; | 8271 | mouse_tracking_in_progress = mouse_tracking_none; |
| 8275 | window = window_from_coordinates (mwp->mFP, bufp->x, bufp->y, 0, 0, 0, 1); | 8272 | window = window_from_coordinates (mwp->mFP, inev.x, inev.y, 0, 0, 0, 1); |
| 8276 | 8273 | ||
| 8277 | if (EQ (window, mwp->mFP->tool_bar_window)) | 8274 | if (EQ (window, mwp->mFP->tool_bar_window)) |
| 8278 | { | 8275 | { |
| 8279 | if (er.what == mouseDown) | 8276 | if (er.what == mouseDown) |
| 8280 | handle_tool_bar_click (mwp->mFP, bufp->x, bufp->y, 1, 0); | 8277 | handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 1, 0); |
| 8281 | else | 8278 | else |
| 8282 | handle_tool_bar_click (mwp->mFP, bufp->x, bufp->y, 0, | 8279 | handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 0, |
| 8283 | #if USE_CARBON_EVENTS | 8280 | #if USE_CARBON_EVENTS |
| 8284 | mac_event_to_emacs_modifiers (eventRef) | 8281 | mac_event_to_emacs_modifiers (eventRef) |
| 8285 | #else | 8282 | #else |
| @@ -8291,22 +8288,20 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8291 | } | 8288 | } |
| 8292 | 8289 | ||
| 8293 | #if USE_CARBON_EVENTS | 8290 | #if USE_CARBON_EVENTS |
| 8294 | bufp->modifiers = mac_event_to_emacs_modifiers (eventRef); | 8291 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); |
| 8295 | #else | 8292 | #else |
| 8296 | bufp->modifiers = mac_to_emacs_modifiers (er.modifiers); | 8293 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); |
| 8297 | #endif | 8294 | #endif |
| 8298 | 8295 | ||
| 8299 | switch (er.what) | 8296 | switch (er.what) |
| 8300 | { | 8297 | { |
| 8301 | case mouseDown: | 8298 | case mouseDown: |
| 8302 | bufp->modifiers |= down_modifier; | 8299 | inev.modifiers |= down_modifier; |
| 8303 | break; | 8300 | break; |
| 8304 | case mouseUp: | 8301 | case mouseUp: |
| 8305 | bufp->modifiers |= up_modifier; | 8302 | inev.modifiers |= up_modifier; |
| 8306 | break; | 8303 | break; |
| 8307 | } | 8304 | } |
| 8308 | |||
| 8309 | count++; | ||
| 8310 | } | 8305 | } |
| 8311 | break; | 8306 | break; |
| 8312 | 8307 | ||
| @@ -8327,10 +8322,9 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8327 | case inGoAway: | 8322 | case inGoAway: |
| 8328 | if (TrackGoAway (window_ptr, er.where)) | 8323 | if (TrackGoAway (window_ptr, er.where)) |
| 8329 | { | 8324 | { |
| 8330 | bufp->kind = DELETE_WINDOW_EVENT; | 8325 | inev.kind = DELETE_WINDOW_EVENT; |
| 8331 | XSETFRAME (bufp->frame_or_window, | 8326 | XSETFRAME (inev.frame_or_window, |
| 8332 | ((mac_output *) GetWRefCon (window_ptr))->mFP); | 8327 | ((mac_output *) GetWRefCon (window_ptr))->mFP); |
| 8333 | count++; | ||
| 8334 | } | 8328 | } |
| 8335 | break; | 8329 | break; |
| 8336 | 8330 | ||
| @@ -8399,8 +8393,8 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8399 | 8393 | ||
| 8400 | if (keycode_to_xkeysym (keycode, &xkeysym)) | 8394 | if (keycode_to_xkeysym (keycode, &xkeysym)) |
| 8401 | { | 8395 | { |
| 8402 | bufp->code = 0xff00 | xkeysym; | 8396 | inev.code = 0xff00 | xkeysym; |
| 8403 | bufp->kind = NON_ASCII_KEYSTROKE_EVENT; | 8397 | inev.kind = NON_ASCII_KEYSTROKE_EVENT; |
| 8404 | } | 8398 | } |
| 8405 | else | 8399 | else |
| 8406 | { | 8400 | { |
| @@ -8419,12 +8413,12 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8419 | int new_keycode = keycode | new_modifiers; | 8413 | int new_keycode = keycode | new_modifiers; |
| 8420 | Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache); | 8414 | Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache); |
| 8421 | unsigned long some_state = 0; | 8415 | unsigned long some_state = 0; |
| 8422 | bufp->code = KeyTranslate (kchr_ptr, new_keycode, | 8416 | inev.code = KeyTranslate (kchr_ptr, new_keycode, |
| 8423 | &some_state) & 0xff; | 8417 | &some_state) & 0xff; |
| 8424 | } | 8418 | } |
| 8425 | else | 8419 | else |
| 8426 | bufp->code = er.message & charCodeMask; | 8420 | inev.code = er.message & charCodeMask; |
| 8427 | bufp->kind = ASCII_KEYSTROKE_EVENT; | 8421 | inev.kind = ASCII_KEYSTROKE_EVENT; |
| 8428 | } | 8422 | } |
| 8429 | } | 8423 | } |
| 8430 | 8424 | ||
| @@ -8435,7 +8429,7 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8435 | Mac keyboard to be used to enter non-ASCII iso-latin-1 | 8429 | Mac keyboard to be used to enter non-ASCII iso-latin-1 |
| 8436 | characters directly. */ | 8430 | characters directly. */ |
| 8437 | if (mac_keyboard_text_encoding != kTextEncodingMacRoman | 8431 | if (mac_keyboard_text_encoding != kTextEncodingMacRoman |
| 8438 | && bufp->kind == ASCII_KEYSTROKE_EVENT && bufp->code >= 128) | 8432 | && inev.kind == ASCII_KEYSTROKE_EVENT && inev.code >= 128) |
| 8439 | { | 8433 | { |
| 8440 | static TECObjectRef converter = NULL; | 8434 | static TECObjectRef converter = NULL; |
| 8441 | OSStatus the_err = noErr; | 8435 | OSStatus the_err = noErr; |
| @@ -8464,7 +8458,7 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8464 | 8458 | ||
| 8465 | if (the_err == noErr) | 8459 | if (the_err == noErr) |
| 8466 | { | 8460 | { |
| 8467 | unsigned char ch = bufp->code; | 8461 | unsigned char ch = inev.code; |
| 8468 | ByteCount actual_input_length, actual_output_length; | 8462 | ByteCount actual_input_length, actual_output_length; |
| 8469 | unsigned char outch; | 8463 | unsigned char outch; |
| 8470 | 8464 | ||
| @@ -8475,25 +8469,23 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8475 | if (convert_status == noErr | 8469 | if (convert_status == noErr |
| 8476 | && actual_input_length == 1 | 8470 | && actual_input_length == 1 |
| 8477 | && actual_output_length == 1) | 8471 | && actual_output_length == 1) |
| 8478 | bufp->code = outch; | 8472 | inev.code = outch; |
| 8479 | } | 8473 | } |
| 8480 | } | 8474 | } |
| 8481 | 8475 | ||
| 8482 | #if USE_CARBON_EVENTS | 8476 | #if USE_CARBON_EVENTS |
| 8483 | bufp->modifiers = mac_event_to_emacs_modifiers (eventRef); | 8477 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); |
| 8484 | #else | 8478 | #else |
| 8485 | bufp->modifiers = mac_to_emacs_modifiers (er.modifiers); | 8479 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); |
| 8486 | #endif | 8480 | #endif |
| 8487 | 8481 | ||
| 8488 | { | 8482 | { |
| 8489 | mac_output *mwp | 8483 | mac_output *mwp |
| 8490 | = (mac_output *) GetWRefCon (FrontNonFloatingWindow ()); | 8484 | = (mac_output *) GetWRefCon (FrontNonFloatingWindow ()); |
| 8491 | XSETFRAME (bufp->frame_or_window, mwp->mFP); | 8485 | XSETFRAME (inev.frame_or_window, mwp->mFP); |
| 8492 | } | 8486 | } |
| 8493 | 8487 | ||
| 8494 | bufp->timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ | 8488 | inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ |
| 8495 | |||
| 8496 | count++; | ||
| 8497 | break; | 8489 | break; |
| 8498 | 8490 | ||
| 8499 | case kHighLevelEvent: | 8491 | case kHighLevelEvent: |
| @@ -8521,21 +8513,21 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8521 | if (wp && is_emacs_window(wp)) | 8513 | if (wp && is_emacs_window(wp)) |
| 8522 | f = ((mac_output *) GetWRefCon (wp))->mFP; | 8514 | f = ((mac_output *) GetWRefCon (wp))->mFP; |
| 8523 | 8515 | ||
| 8524 | bufp->kind = DRAG_N_DROP_EVENT; | 8516 | inev.kind = DRAG_N_DROP_EVENT; |
| 8525 | bufp->code = 0; | 8517 | inev.code = 0; |
| 8526 | bufp->timestamp = er.when * (1000 / 60); | 8518 | inev.timestamp = er.when * (1000 / 60); |
| 8527 | /* ticks to milliseconds */ | 8519 | /* ticks to milliseconds */ |
| 8528 | #if USE_CARBON_EVENTS | 8520 | #if USE_CARBON_EVENTS |
| 8529 | bufp->modifiers = mac_event_to_emacs_modifiers (eventRef); | 8521 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); |
| 8530 | #else | 8522 | #else |
| 8531 | bufp->modifiers = mac_to_emacs_modifiers (er.modifiers); | 8523 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); |
| 8532 | #endif | 8524 | #endif |
| 8533 | 8525 | ||
| 8534 | XSETINT (bufp->x, 0); | 8526 | XSETINT (inev.x, 0); |
| 8535 | XSETINT (bufp->y, 0); | 8527 | XSETINT (inev.y, 0); |
| 8536 | 8528 | ||
| 8537 | XSETFRAME (frame, f); | 8529 | XSETFRAME (frame, f); |
| 8538 | bufp->frame_or_window = Fcons (frame, drag_and_drop_file_list); | 8530 | inev.frame_or_window = Fcons (frame, drag_and_drop_file_list); |
| 8539 | 8531 | ||
| 8540 | /* Regardless of whether Emacs was suspended or in the | 8532 | /* Regardless of whether Emacs was suspended or in the |
| 8541 | foreground, ask it to redraw its entire screen. | 8533 | foreground, ask it to redraw its entire screen. |
| @@ -8552,8 +8544,6 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8552 | #else /* not TARGET_API_MAC_CARBON */ | 8544 | #else /* not TARGET_API_MAC_CARBON */ |
| 8553 | InvalRect (&(wp->portRect)); | 8545 | InvalRect (&(wp->portRect)); |
| 8554 | #endif /* not TARGET_API_MAC_CARBON */ | 8546 | #endif /* not TARGET_API_MAC_CARBON */ |
| 8555 | |||
| 8556 | count++; | ||
| 8557 | } | 8547 | } |
| 8558 | default: | 8548 | default: |
| 8559 | break; | 8549 | break; |
| @@ -8622,8 +8612,13 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 8622 | } | 8612 | } |
| 8623 | } | 8613 | } |
| 8624 | 8614 | ||
| 8625 | UNBLOCK_INPUT; | 8615 | if (inev.kind != NO_EVENT) |
| 8616 | { | ||
| 8617 | kbd_buffer_store_event_hold (&inev, hold_quit); | ||
| 8618 | count++; | ||
| 8619 | } | ||
| 8626 | 8620 | ||
| 8621 | UNBLOCK_INPUT; | ||
| 8627 | return count; | 8622 | return count; |
| 8628 | } | 8623 | } |
| 8629 | 8624 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index d4693f99a94..20d57b6a6a3 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -2711,13 +2711,6 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2711 | /* Read keyboard input into the standard buffer, | 2711 | /* Read keyboard input into the standard buffer, |
| 2712 | waiting for at least one character. */ | 2712 | waiting for at least one character. */ |
| 2713 | 2713 | ||
| 2714 | /* Make all keyboard buffers much bigger when using a window system. */ | ||
| 2715 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 2716 | #define BUFFER_SIZE_FACTOR 16 | ||
| 2717 | #else | ||
| 2718 | #define BUFFER_SIZE_FACTOR 1 | ||
| 2719 | #endif | ||
| 2720 | |||
| 2721 | void | 2714 | void |
| 2722 | read_input_waiting () | 2715 | read_input_waiting () |
| 2723 | { | 2716 | { |
| @@ -2728,26 +2721,19 @@ read_input_waiting () | |||
| 2728 | 2721 | ||
| 2729 | if (read_socket_hook) | 2722 | if (read_socket_hook) |
| 2730 | { | 2723 | { |
| 2731 | struct input_event buf[256]; | 2724 | struct input_event hold_quit; |
| 2732 | for (i = 0; i < 256; i++) | 2725 | |
| 2733 | EVENT_INIT (buf[i]); | 2726 | EVENT_INIT (hold_quit); |
| 2734 | 2727 | hold_quit.kind = NO_EVENT; | |
| 2728 | |||
| 2735 | read_alarm_should_throw = 0; | 2729 | read_alarm_should_throw = 0; |
| 2736 | if (! setjmp (read_alarm_throw)) | 2730 | if (! setjmp (read_alarm_throw)) |
| 2737 | nread = (*read_socket_hook) (0, buf, 256, 1); | 2731 | nread = (*read_socket_hook) (0, 1, &hold_quit); |
| 2738 | else | 2732 | else |
| 2739 | nread = -1; | 2733 | nread = -1; |
| 2740 | 2734 | ||
| 2741 | /* Scan the chars for C-g and store them in kbd_buffer. */ | 2735 | if (hold_quit.kind != NO_EVENT) |
| 2742 | for (i = 0; i < nread; i++) | 2736 | kbd_buffer_store_event (&hold_quit); |
| 2743 | { | ||
| 2744 | kbd_buffer_store_event (&buf[i]); | ||
| 2745 | /* Don't look at input that follows a C-g too closely. | ||
| 2746 | This reduces lossage due to autorepeat on C-g. */ | ||
| 2747 | if (buf[i].kind == ASCII_KEYSTROKE_EVENT | ||
| 2748 | && buf[i].code == quit_char) | ||
| 2749 | break; | ||
| 2750 | } | ||
| 2751 | } | 2737 | } |
| 2752 | else | 2738 | else |
| 2753 | { | 2739 | { |
diff --git a/src/termhooks.h b/src/termhooks.h index 6b2b0d07867..49a0cbac85b 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -489,10 +489,11 @@ struct display | |||
| 489 | there is available input on at least one of the currently opened | 489 | there is available input on at least one of the currently opened |
| 490 | display devices -- but not necessarily on this device. | 490 | display devices -- but not necessarily on this device. |
| 491 | Therefore, in most cases EXPECTED should be simply ignored. | 491 | Therefore, in most cases EXPECTED should be simply ignored. |
| 492 | */ | 492 | |
| 493 | XXX This documentation needs to be updated. */ | ||
| 493 | int (*read_socket_hook) P_ ((struct display *display, | 494 | int (*read_socket_hook) P_ ((struct display *display, |
| 494 | struct input_event *buf, | 495 | int expected, |
| 495 | int size, int expected)); | 496 | struct input_event *hold_quit)); |
| 496 | 497 | ||
| 497 | /* Called when a frame's display becomes entirely up to date. */ | 498 | /* Called when a frame's display becomes entirely up to date. */ |
| 498 | void (*frame_up_to_date_hook) P_ ((struct frame *)); | 499 | void (*frame_up_to_date_hook) P_ ((struct frame *)); |
diff --git a/src/w32inevt.c b/src/w32inevt.c index 24295e122d0..168a0fb87b3 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c | |||
| @@ -642,8 +642,7 @@ maybe_generate_resize_event () | |||
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | int | 644 | int |
| 645 | w32_console_read_socket (struct input_event *bufp, int numchars, | 645 | w32_console_read_socket (int sd, int expected, struct input_event *hold_quit) |
| 646 | int expected) | ||
| 647 | { | 646 | { |
| 648 | BOOL no_events = TRUE; | 647 | BOOL no_events = TRUE; |
| 649 | int nev, ret = 0, add; | 648 | int nev, ret = 0, add; |
| @@ -670,27 +669,31 @@ w32_console_read_socket (struct input_event *bufp, int numchars, | |||
| 670 | return nev; | 669 | return nev; |
| 671 | } | 670 | } |
| 672 | 671 | ||
| 673 | while (nev > 0 && numchars > 0) | 672 | while (nev > 0) |
| 674 | { | 673 | { |
| 674 | struct input_event inev; | ||
| 675 | |||
| 676 | EVENT_INIT (inev); | ||
| 677 | inev.kind = NO_EVENT; | ||
| 678 | inev.arg = Qnil; | ||
| 679 | |||
| 675 | switch (queue_ptr->EventType) | 680 | switch (queue_ptr->EventType) |
| 676 | { | 681 | { |
| 677 | case KEY_EVENT: | 682 | case KEY_EVENT: |
| 678 | add = key_event (&queue_ptr->Event.KeyEvent, bufp, &isdead); | 683 | add = key_event (&queue_ptr->Event.KeyEvent, &inev, &isdead); |
| 679 | if (add == -1) /* 95.7.25 by himi */ | 684 | if (add == -1) /* 95.7.25 by himi */ |
| 680 | { | 685 | { |
| 681 | queue_ptr--; | 686 | queue_ptr--; |
| 682 | add = 1; | 687 | add = 1; |
| 683 | } | 688 | } |
| 684 | bufp += add; | 689 | if (add) |
| 685 | ret += add; | 690 | kbd_buffer_store_event_hold (&inev, hold_quit); |
| 686 | numchars -= add; | ||
| 687 | break; | 691 | break; |
| 688 | 692 | ||
| 689 | case MOUSE_EVENT: | 693 | case MOUSE_EVENT: |
| 690 | add = do_mouse_event (&queue_ptr->Event.MouseEvent, bufp); | 694 | add = do_mouse_event (&queue_ptr->Event.MouseEvent, &inev); |
| 691 | bufp += add; | 695 | if (add) |
| 692 | ret += add; | 696 | kbd_buffer_store_event_hold (&inev, hold_quit); |
| 693 | numchars -= add; | ||
| 694 | break; | 697 | break; |
| 695 | 698 | ||
| 696 | case WINDOW_BUFFER_SIZE_EVENT: | 699 | case WINDOW_BUFFER_SIZE_EVENT: |
diff --git a/src/w32inevt.h b/src/w32inevt.h index 0b3c70a141e..fb61cb0ef55 100644 --- a/src/w32inevt.h +++ b/src/w32inevt.h | |||
| @@ -21,8 +21,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 21 | #ifndef EMACS_W32INEVT_H | 21 | #ifndef EMACS_W32INEVT_H |
| 22 | #define EMACS_W32INEVT_H | 22 | #define EMACS_W32INEVT_H |
| 23 | 23 | ||
| 24 | extern int w32_console_read_socket (int sd, struct input_event *bufp, | 24 | extern int w32_console_read_socket (int sd, int numchars, |
| 25 | int numchars, int expected); | 25 | struct input_event *hold_quit); |
| 26 | extern void w32_console_mouse_position (FRAME_PTR *f, int insist, | 26 | extern void w32_console_mouse_position (FRAME_PTR *f, int insist, |
| 27 | Lisp_Object *bar_window, | 27 | Lisp_Object *bar_window, |
| 28 | enum scroll_bar_part *part, | 28 | enum scroll_bar_part *part, |
diff --git a/src/w32term.c b/src/w32term.c index 92d508691cd..c59dabc27b0 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -4122,8 +4122,6 @@ static short temp_buffer[100]; | |||
| 4122 | This routine is called by the SIGIO handler. | 4122 | This routine is called by the SIGIO handler. |
| 4123 | We return as soon as there are no more events to be read. | 4123 | We return as soon as there are no more events to be read. |
| 4124 | 4124 | ||
| 4125 | Events representing keys are stored in buffer BUFP, | ||
| 4126 | which can hold up to NUMCHARS characters. | ||
| 4127 | We return the number of characters stored into the buffer, | 4125 | We return the number of characters stored into the buffer, |
| 4128 | thus pretending to be `read'. | 4126 | thus pretending to be `read'. |
| 4129 | 4127 | ||
| @@ -4139,10 +4137,10 @@ static short temp_buffer[100]; | |||
| 4139 | */ | 4137 | */ |
| 4140 | 4138 | ||
| 4141 | int | 4139 | int |
| 4142 | w32_read_socket (bufp, numchars, expected) | 4140 | w32_read_socket (sd, expected, hold_quit) |
| 4143 | /* register */ struct input_event *bufp; | 4141 | register int sd; |
| 4144 | /* register */ int numchars; | ||
| 4145 | int expected; | 4142 | int expected; |
| 4143 | struct input_event *hold_quit; | ||
| 4146 | { | 4144 | { |
| 4147 | int count = 0; | 4145 | int count = 0; |
| 4148 | int check_visibility = 0; | 4146 | int check_visibility = 0; |
| @@ -4162,13 +4160,17 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4162 | /* So people can tell when we have read the available input. */ | 4160 | /* So people can tell when we have read the available input. */ |
| 4163 | input_signal_count++; | 4161 | input_signal_count++; |
| 4164 | 4162 | ||
| 4165 | if (numchars <= 0) | ||
| 4166 | abort (); /* Don't think this happens. */ | ||
| 4167 | |||
| 4168 | /* TODO: tool-bars, ghostscript integration, mouse | 4163 | /* TODO: tool-bars, ghostscript integration, mouse |
| 4169 | cursors. */ | 4164 | cursors. */ |
| 4170 | while (get_next_msg (&msg, FALSE)) | 4165 | while (get_next_msg (&msg, FALSE)) |
| 4171 | { | 4166 | { |
| 4167 | struct input_event inev; | ||
| 4168 | int do_help = 0; | ||
| 4169 | |||
| 4170 | EVENT_INIT (inev); | ||
| 4171 | inev.kind = NO_EVENT; | ||
| 4172 | inev.arg = Qnil; | ||
| 4173 | |||
| 4172 | switch (msg.msg.message) | 4174 | switch (msg.msg.message) |
| 4173 | { | 4175 | { |
| 4174 | case WM_PAINT: | 4176 | case WM_PAINT: |
| @@ -4197,12 +4199,8 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4197 | visibility changes properly. */ | 4199 | visibility changes properly. */ |
| 4198 | if (f->iconified) | 4200 | if (f->iconified) |
| 4199 | { | 4201 | { |
| 4200 | bufp->kind = DEICONIFY_EVENT; | 4202 | inev.kind = DEICONIFY_EVENT; |
| 4201 | XSETFRAME (bufp->frame_or_window, f); | 4203 | XSETFRAME (inev.frame_or_window, f); |
| 4202 | bufp->arg = Qnil; | ||
| 4203 | bufp++; | ||
| 4204 | count++; | ||
| 4205 | numchars--; | ||
| 4206 | } | 4204 | } |
| 4207 | else if (! NILP (Vframe_list) | 4205 | else if (! NILP (Vframe_list) |
| 4208 | && ! NILP (XCDR (Vframe_list))) | 4206 | && ! NILP (XCDR (Vframe_list))) |
| @@ -4232,17 +4230,10 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4232 | 4230 | ||
| 4233 | if (f) | 4231 | if (f) |
| 4234 | { | 4232 | { |
| 4235 | if (numchars == 0) | 4233 | inev.kind = LANGUAGE_CHANGE_EVENT; |
| 4236 | abort (); | 4234 | XSETFRAME (inev.frame_or_window, f); |
| 4237 | 4235 | inev.code = msg.msg.wParam; | |
| 4238 | bufp->kind = LANGUAGE_CHANGE_EVENT; | 4236 | inev.modifiers = msg.msg.lParam & 0xffff; |
| 4239 | XSETFRAME (bufp->frame_or_window, f); | ||
| 4240 | bufp->arg = Qnil; | ||
| 4241 | bufp->code = msg.msg.wParam; | ||
| 4242 | bufp->modifiers = msg.msg.lParam & 0xffff; | ||
| 4243 | bufp++; | ||
| 4244 | count++; | ||
| 4245 | numchars--; | ||
| 4246 | } | 4237 | } |
| 4247 | break; | 4238 | break; |
| 4248 | 4239 | ||
| @@ -4261,15 +4252,11 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4261 | if (temp_index == sizeof temp_buffer / sizeof (short)) | 4252 | if (temp_index == sizeof temp_buffer / sizeof (short)) |
| 4262 | temp_index = 0; | 4253 | temp_index = 0; |
| 4263 | temp_buffer[temp_index++] = msg.msg.wParam; | 4254 | temp_buffer[temp_index++] = msg.msg.wParam; |
| 4264 | bufp->kind = NON_ASCII_KEYSTROKE_EVENT; | 4255 | inev.kind = NON_ASCII_KEYSTROKE_EVENT; |
| 4265 | bufp->code = msg.msg.wParam; | 4256 | inev.code = msg.msg.wParam; |
| 4266 | bufp->modifiers = msg.dwModifiers; | 4257 | inev.modifiers = msg.dwModifiers; |
| 4267 | XSETFRAME (bufp->frame_or_window, f); | 4258 | XSETFRAME (inev.frame_or_window, f); |
| 4268 | bufp->arg = Qnil; | 4259 | inev.timestamp = msg.msg.time; |
| 4269 | bufp->timestamp = msg.msg.time; | ||
| 4270 | bufp++; | ||
| 4271 | numchars--; | ||
| 4272 | count++; | ||
| 4273 | } | 4260 | } |
| 4274 | break; | 4261 | break; |
| 4275 | 4262 | ||
| @@ -4288,15 +4275,11 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4288 | if (temp_index == sizeof temp_buffer / sizeof (short)) | 4275 | if (temp_index == sizeof temp_buffer / sizeof (short)) |
| 4289 | temp_index = 0; | 4276 | temp_index = 0; |
| 4290 | temp_buffer[temp_index++] = msg.msg.wParam; | 4277 | temp_buffer[temp_index++] = msg.msg.wParam; |
| 4291 | bufp->kind = ASCII_KEYSTROKE_EVENT; | 4278 | inev.kind = ASCII_KEYSTROKE_EVENT; |
| 4292 | bufp->code = msg.msg.wParam; | 4279 | inev.code = msg.msg.wParam; |
| 4293 | bufp->modifiers = msg.dwModifiers; | 4280 | inev.modifiers = msg.dwModifiers; |
| 4294 | XSETFRAME (bufp->frame_or_window, f); | 4281 | XSETFRAME (inev.frame_or_window, f); |
| 4295 | bufp->arg = Qnil; | 4282 | inev.timestamp = msg.msg.time; |
| 4296 | bufp->timestamp = msg.msg.time; | ||
| 4297 | bufp++; | ||
| 4298 | numchars--; | ||
| 4299 | count++; | ||
| 4300 | } | 4283 | } |
| 4301 | break; | 4284 | break; |
| 4302 | 4285 | ||
| @@ -4342,13 +4325,10 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4342 | iff it is active. */ | 4325 | iff it is active. */ |
| 4343 | if (WINDOWP(window) | 4326 | if (WINDOWP(window) |
| 4344 | && !EQ (window, last_window) | 4327 | && !EQ (window, last_window) |
| 4345 | && !EQ (window, selected_window) | 4328 | && !EQ (window, selected_window)) |
| 4346 | && numchars > 0) | ||
| 4347 | { | 4329 | { |
| 4348 | bufp->kind = SELECT_WINDOW_EVENT; | 4330 | inev.kind = SELECT_WINDOW_EVENT; |
| 4349 | bufp->frame_or_window = window; | 4331 | inev.frame_or_window = window; |
| 4350 | bufp->arg = Qnil; | ||
| 4351 | ++bufp, ++count, --numchars; | ||
| 4352 | } | 4332 | } |
| 4353 | 4333 | ||
| 4354 | last_window=window; | 4334 | last_window=window; |
| @@ -4366,27 +4346,8 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4366 | has changed, generate a HELP_EVENT. */ | 4346 | has changed, generate a HELP_EVENT. */ |
| 4367 | if (help_echo_string != previous_help_echo_string || | 4347 | if (help_echo_string != previous_help_echo_string || |
| 4368 | (!NILP (help_echo_string) && !STRINGP (help_echo_string) && f->mouse_moved)) | 4348 | (!NILP (help_echo_string) && !STRINGP (help_echo_string) && f->mouse_moved)) |
| 4369 | { | 4349 | do_help = 1; |
| 4370 | Lisp_Object frame; | ||
| 4371 | int n; | ||
| 4372 | |||
| 4373 | if (help_echo_string == Qnil) | ||
| 4374 | { | ||
| 4375 | help_echo_object = help_echo_window = Qnil; | ||
| 4376 | help_echo_pos = -1; | ||
| 4377 | } | ||
| 4378 | |||
| 4379 | if (f) | ||
| 4380 | XSETFRAME (frame, f); | ||
| 4381 | else | ||
| 4382 | frame = Qnil; | ||
| 4383 | 4350 | ||
| 4384 | any_help_event_p = 1; | ||
| 4385 | n = gen_help_event (bufp, numchars, help_echo_string, frame, | ||
| 4386 | help_echo_window, help_echo_object, | ||
| 4387 | help_echo_pos); | ||
| 4388 | bufp += n, count += n, numchars -= n; | ||
| 4389 | } | ||
| 4390 | break; | 4351 | break; |
| 4391 | 4352 | ||
| 4392 | case WM_LBUTTONDOWN: | 4353 | case WM_LBUTTONDOWN: |
| @@ -4400,13 +4361,10 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4400 | { | 4361 | { |
| 4401 | /* If we decide we want to generate an event to be seen | 4362 | /* If we decide we want to generate an event to be seen |
| 4402 | by the rest of Emacs, we put it here. */ | 4363 | by the rest of Emacs, we put it here. */ |
| 4403 | struct input_event emacs_event; | ||
| 4404 | int tool_bar_p = 0; | 4364 | int tool_bar_p = 0; |
| 4405 | int button; | 4365 | int button; |
| 4406 | int up; | 4366 | int up; |
| 4407 | 4367 | ||
| 4408 | emacs_event.kind = NO_EVENT; | ||
| 4409 | |||
| 4410 | if (dpyinfo->grabbed && last_mouse_frame | 4368 | if (dpyinfo->grabbed && last_mouse_frame |
| 4411 | && FRAME_LIVE_P (last_mouse_frame)) | 4369 | && FRAME_LIVE_P (last_mouse_frame)) |
| 4412 | f = last_mouse_frame; | 4370 | f = last_mouse_frame; |
| @@ -4415,35 +4373,29 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4415 | 4373 | ||
| 4416 | if (f) | 4374 | if (f) |
| 4417 | { | 4375 | { |
| 4418 | construct_mouse_click (&emacs_event, &msg, f); | 4376 | construct_mouse_click (&inev, &msg, f); |
| 4419 | 4377 | ||
| 4420 | /* Is this in the tool-bar? */ | 4378 | /* Is this in the tool-bar? */ |
| 4421 | if (WINDOWP (f->tool_bar_window) | 4379 | if (WINDOWP (f->tool_bar_window) |
| 4422 | && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) | 4380 | && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) |
| 4423 | { | 4381 | { |
| 4424 | Lisp_Object window; | 4382 | Lisp_Object window; |
| 4425 | int x = XFASTINT (emacs_event.x); | 4383 | int x = XFASTINT (inev.x); |
| 4426 | int y = XFASTINT (emacs_event.y); | 4384 | int y = XFASTINT (inev.y); |
| 4427 | 4385 | ||
| 4428 | window = window_from_coordinates (f, x, y, 0, 0, 0, 1); | 4386 | window = window_from_coordinates (f, x, y, 0, 0, 0, 1); |
| 4429 | 4387 | ||
| 4430 | if (EQ (window, f->tool_bar_window)) | 4388 | if (EQ (window, f->tool_bar_window)) |
| 4431 | { | 4389 | { |
| 4432 | w32_handle_tool_bar_click (f, &emacs_event); | 4390 | w32_handle_tool_bar_click (f, &inev); |
| 4433 | tool_bar_p = 1; | 4391 | tool_bar_p = 1; |
| 4434 | } | 4392 | } |
| 4435 | } | 4393 | } |
| 4436 | 4394 | ||
| 4437 | if (!tool_bar_p) | 4395 | if (tool_bar_p |
| 4438 | if (!dpyinfo->w32_focus_frame | 4396 | || (dpyinfo->w32_focus_frame |
| 4439 | || f == dpyinfo->w32_focus_frame | 4397 | && f == dpyinfo->w32_focus_frame)) |
| 4440 | && (numchars >= 1)) | 4398 | inev.kind = NO_EVENT; |
| 4441 | { | ||
| 4442 | construct_mouse_click (bufp, &msg, f); | ||
| 4443 | bufp++; | ||
| 4444 | count++; | ||
| 4445 | numchars--; | ||
| 4446 | } | ||
| 4447 | } | 4399 | } |
| 4448 | 4400 | ||
| 4449 | parse_button (msg.msg.message, HIWORD (msg.msg.wParam), | 4401 | parse_button (msg.msg.message, HIWORD (msg.msg.wParam), |
| @@ -4481,15 +4433,11 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4481 | if (f) | 4433 | if (f) |
| 4482 | { | 4434 | { |
| 4483 | 4435 | ||
| 4484 | if ((!dpyinfo->w32_focus_frame | 4436 | if (!dpyinfo->w32_focus_frame |
| 4485 | || f == dpyinfo->w32_focus_frame) | 4437 | || f == dpyinfo->w32_focus_frame) |
| 4486 | && (numchars >= 1)) | ||
| 4487 | { | 4438 | { |
| 4488 | /* Emit an Emacs wheel-up/down event. */ | 4439 | /* Emit an Emacs wheel-up/down event. */ |
| 4489 | construct_mouse_wheel (bufp, &msg, f); | 4440 | construct_mouse_wheel (&inev, &msg, f); |
| 4490 | bufp++; | ||
| 4491 | count++; | ||
| 4492 | numchars--; | ||
| 4493 | } | 4441 | } |
| 4494 | /* Ignore any mouse motion that happened before this | 4442 | /* Ignore any mouse motion that happened before this |
| 4495 | event; any subsequent mouse-movement Emacs events | 4443 | event; any subsequent mouse-movement Emacs events |
| @@ -4506,12 +4454,7 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4506 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 4454 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 4507 | 4455 | ||
| 4508 | if (f) | 4456 | if (f) |
| 4509 | { | 4457 | construct_drag_n_drop (&inev, &msg, f); |
| 4510 | construct_drag_n_drop (bufp, &msg, f); | ||
| 4511 | bufp++; | ||
| 4512 | count++; | ||
| 4513 | numchars--; | ||
| 4514 | } | ||
| 4515 | break; | 4458 | break; |
| 4516 | 4459 | ||
| 4517 | case WM_VSCROLL: | 4460 | case WM_VSCROLL: |
| @@ -4519,15 +4462,8 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4519 | struct scroll_bar *bar = | 4462 | struct scroll_bar *bar = |
| 4520 | x_window_to_scroll_bar ((HWND)msg.msg.lParam); | 4463 | x_window_to_scroll_bar ((HWND)msg.msg.lParam); |
| 4521 | 4464 | ||
| 4522 | if (bar && numchars >= 1) | 4465 | if (bar) |
| 4523 | { | 4466 | w32_scroll_bar_handle_click (bar, &msg, &inev); |
| 4524 | if (w32_scroll_bar_handle_click (bar, &msg, bufp)) | ||
| 4525 | { | ||
| 4526 | bufp++; | ||
| 4527 | count++; | ||
| 4528 | numchars--; | ||
| 4529 | } | ||
| 4530 | } | ||
| 4531 | break; | 4467 | break; |
| 4532 | } | 4468 | } |
| 4533 | 4469 | ||
| @@ -4603,12 +4539,8 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4603 | f->async_visible = 0; | 4539 | f->async_visible = 0; |
| 4604 | f->async_iconified = 1; | 4540 | f->async_iconified = 1; |
| 4605 | 4541 | ||
| 4606 | bufp->kind = ICONIFY_EVENT; | 4542 | inev.kind = ICONIFY_EVENT; |
| 4607 | XSETFRAME (bufp->frame_or_window, f); | 4543 | XSETFRAME (inev.frame_or_window, f); |
| 4608 | bufp->arg = Qnil; | ||
| 4609 | bufp++; | ||
| 4610 | count++; | ||
| 4611 | numchars--; | ||
| 4612 | break; | 4544 | break; |
| 4613 | 4545 | ||
| 4614 | case SIZE_MAXIMIZED: | 4546 | case SIZE_MAXIMIZED: |
| @@ -4633,12 +4565,8 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4633 | f->left_pos = x; | 4565 | f->left_pos = x; |
| 4634 | f->top_pos = y; | 4566 | f->top_pos = y; |
| 4635 | 4567 | ||
| 4636 | bufp->kind = DEICONIFY_EVENT; | 4568 | inev.kind = DEICONIFY_EVENT; |
| 4637 | XSETFRAME (bufp->frame_or_window, f); | 4569 | XSETFRAME (inev.frame_or_window, f); |
| 4638 | bufp->arg = Qnil; | ||
| 4639 | bufp++; | ||
| 4640 | count++; | ||
| 4641 | numchars--; | ||
| 4642 | } | 4570 | } |
| 4643 | else if (! NILP (Vframe_list) | 4571 | else if (! NILP (Vframe_list) |
| 4644 | && ! NILP (XCDR (Vframe_list))) | 4572 | && ! NILP (XCDR (Vframe_list))) |
| @@ -4706,16 +4634,7 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4706 | Otherwise, the startup message is cleared when | 4634 | Otherwise, the startup message is cleared when |
| 4707 | the mouse leaves the frame. */ | 4635 | the mouse leaves the frame. */ |
| 4708 | if (any_help_event_p) | 4636 | if (any_help_event_p) |
| 4709 | { | 4637 | do_help = -1; |
| 4710 | Lisp_Object frame; | ||
| 4711 | int n; | ||
| 4712 | |||
| 4713 | XSETFRAME (frame, f); | ||
| 4714 | help_echo_string = Qnil; | ||
| 4715 | n = gen_help_event (bufp, numchars, | ||
| 4716 | Qnil, frame, Qnil, Qnil, 0); | ||
| 4717 | bufp += n, count += n, numchars -= n; | ||
| 4718 | } | ||
| 4719 | } | 4638 | } |
| 4720 | break; | 4639 | break; |
| 4721 | 4640 | ||
| @@ -4765,16 +4684,7 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4765 | Otherwise, the startup message is cleared when | 4684 | Otherwise, the startup message is cleared when |
| 4766 | the mouse leaves the frame. */ | 4685 | the mouse leaves the frame. */ |
| 4767 | if (any_help_event_p) | 4686 | if (any_help_event_p) |
| 4768 | { | 4687 | do_help = -1; |
| 4769 | Lisp_Object frame; | ||
| 4770 | int n; | ||
| 4771 | |||
| 4772 | XSETFRAME (frame, f); | ||
| 4773 | help_echo_string = Qnil; | ||
| 4774 | n = gen_help_event (bufp, numchars, | ||
| 4775 | Qnil, frame, Qnil, Qnil, 0); | ||
| 4776 | bufp += n, count += n, numchars -=n; | ||
| 4777 | } | ||
| 4778 | } | 4688 | } |
| 4779 | 4689 | ||
| 4780 | dpyinfo->grabbed = 0; | 4690 | dpyinfo->grabbed = 0; |
| @@ -4786,15 +4696,8 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4786 | 4696 | ||
| 4787 | if (f) | 4697 | if (f) |
| 4788 | { | 4698 | { |
| 4789 | if (numchars == 0) | 4699 | inev.kind = DELETE_WINDOW_EVENT; |
| 4790 | abort (); | 4700 | XSETFRAME (inev.frame_or_window, f); |
| 4791 | |||
| 4792 | bufp->kind = DELETE_WINDOW_EVENT; | ||
| 4793 | XSETFRAME (bufp->frame_or_window, f); | ||
| 4794 | bufp->arg = Qnil; | ||
| 4795 | bufp++; | ||
| 4796 | count++; | ||
| 4797 | numchars--; | ||
| 4798 | } | 4701 | } |
| 4799 | break; | 4702 | break; |
| 4800 | 4703 | ||
| @@ -4803,15 +4706,8 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4803 | 4706 | ||
| 4804 | if (f) | 4707 | if (f) |
| 4805 | { | 4708 | { |
| 4806 | if (numchars == 0) | 4709 | inev.kind = MENU_BAR_ACTIVATE_EVENT; |
| 4807 | abort (); | 4710 | XSETFRAME (inev.frame_or_window, f); |
| 4808 | |||
| 4809 | bufp->kind = MENU_BAR_ACTIVATE_EVENT; | ||
| 4810 | XSETFRAME (bufp->frame_or_window, f); | ||
| 4811 | bufp->arg = Qnil; | ||
| 4812 | bufp++; | ||
| 4813 | count++; | ||
| 4814 | numchars--; | ||
| 4815 | } | 4711 | } |
| 4816 | break; | 4712 | break; |
| 4817 | 4713 | ||
| @@ -4853,6 +4749,42 @@ w32_read_socket (bufp, numchars, expected) | |||
| 4853 | } | 4749 | } |
| 4854 | break; | 4750 | break; |
| 4855 | } | 4751 | } |
| 4752 | |||
| 4753 | if (inev.kind != NO_EVENT) | ||
| 4754 | { | ||
| 4755 | kbd_buffer_store_event_hold (&inev, hold_quit); | ||
| 4756 | count++; | ||
| 4757 | } | ||
| 4758 | |||
| 4759 | if (do_help | ||
| 4760 | && !(hold_quit && hold_quit->kind != NO_EVENT)) | ||
| 4761 | { | ||
| 4762 | Lisp_Object frame; | ||
| 4763 | |||
| 4764 | if (f) | ||
| 4765 | XSETFRAME (frame, f); | ||
| 4766 | else | ||
| 4767 | frame = Qnil; | ||
| 4768 | |||
| 4769 | if (do_help > 0) | ||
| 4770 | { | ||
| 4771 | if (help_echo_string == Qnil) | ||
| 4772 | { | ||
| 4773 | help_echo_object = help_echo_window = Qnil; | ||
| 4774 | help_echo_pos = -1; | ||
| 4775 | } | ||
| 4776 | |||
| 4777 | any_help_event_p = 1; | ||
| 4778 | gen_help_event (help_echo_string, frame, help_echo_window, | ||
| 4779 | help_echo_object, help_echo_pos); | ||
| 4780 | } | ||
| 4781 | else | ||
| 4782 | { | ||
| 4783 | help_echo_string = Qnil; | ||
| 4784 | gen_help_event (Qnil, frame, Qnil, Qnil, 0); | ||
| 4785 | } | ||
| 4786 | count++; | ||
| 4787 | } | ||
| 4856 | } | 4788 | } |
| 4857 | 4789 | ||
| 4858 | /* If the focus was just given to an autoraising frame, | 4790 | /* If the focus was just given to an autoraising frame, |
| @@ -5144,6 +5076,9 @@ w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, act | |||
| 5144 | cursor remains invisible. */ | 5076 | cursor remains invisible. */ |
| 5145 | if (w32_use_visible_system_caret) | 5077 | if (w32_use_visible_system_caret) |
| 5146 | { | 5078 | { |
| 5079 | /* Call to erase_phys_cursor here seems to use the | ||
| 5080 | wrong values of w->phys_cursor, as they have been | ||
| 5081 | overwritten before this function was called. */ | ||
| 5147 | if (w->phys_cursor_type != NO_CURSOR) | 5082 | if (w->phys_cursor_type != NO_CURSOR) |
| 5148 | erase_phys_cursor (w); | 5083 | erase_phys_cursor (w); |
| 5149 | 5084 | ||
diff --git a/src/window.c b/src/window.c index 8f971ab0260..7419239752a 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -2046,6 +2046,9 @@ window_loop (type, obj, mini, frames) | |||
| 2046 | if (EQ (w->buffer, obj)) | 2046 | if (EQ (w->buffer, obj)) |
| 2047 | { | 2047 | { |
| 2048 | mark_window_display_accurate (window, 0); | 2048 | mark_window_display_accurate (window, 0); |
| 2049 | w->update_mode_line = Qt; | ||
| 2050 | XBUFFER (obj)->prevent_redisplay_optimizations_p = 1; | ||
| 2051 | ++update_mode_lines; | ||
| 2049 | best_window = window; | 2052 | best_window = window; |
| 2050 | } | 2053 | } |
| 2051 | break; | 2054 | break; |
| @@ -3464,12 +3467,18 @@ displaying that buffer. */) | |||
| 3464 | if (NILP (object)) | 3467 | if (NILP (object)) |
| 3465 | { | 3468 | { |
| 3466 | windows_or_buffers_changed++; | 3469 | windows_or_buffers_changed++; |
| 3470 | update_mode_lines++; | ||
| 3467 | return Qt; | 3471 | return Qt; |
| 3468 | } | 3472 | } |
| 3469 | 3473 | ||
| 3470 | if (WINDOWP (object)) | 3474 | if (WINDOWP (object)) |
| 3471 | { | 3475 | { |
| 3476 | struct window *w = XWINDOW (object); | ||
| 3472 | mark_window_display_accurate (object, 0); | 3477 | mark_window_display_accurate (object, 0); |
| 3478 | w->update_mode_line = Qt; | ||
| 3479 | if (BUFFERP (w->buffer)) | ||
| 3480 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | ||
| 3481 | ++update_mode_lines; | ||
| 3473 | return Qt; | 3482 | return Qt; |
| 3474 | } | 3483 | } |
| 3475 | 3484 | ||
diff --git a/src/xsmfns.c b/src/xsmfns.c index 88ee0a78188..35c7429b66b 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c | |||
| @@ -107,13 +107,10 @@ Lisp_Object Vx_session_previous_id; | |||
| 107 | 107 | ||
| 108 | /* Handle any messages from the session manager. If no connection is | 108 | /* Handle any messages from the session manager. If no connection is |
| 109 | open to a session manager, just return 0. | 109 | open to a session manager, just return 0. |
| 110 | Otherwise returns the number of events stored in buffer BUFP, | 110 | Otherwise returns 1 if SAVE_SESSION_EVENT is stored in buffer BUFP. */ |
| 111 | which can hold up to *NUMCHARS characters. At most one event is | ||
| 112 | stored, a SAVE_SESSION_EVENT. */ | ||
| 113 | int | 111 | int |
| 114 | x_session_check_input (bufp, numchars) | 112 | x_session_check_input (bufp) |
| 115 | struct input_event *bufp; | 113 | struct input_event *bufp; |
| 116 | int *numchars; | ||
| 117 | { | 114 | { |
| 118 | SELECT_TYPE read_fds; | 115 | SELECT_TYPE read_fds; |
| 119 | EMACS_TIME tmout; | 116 | EMACS_TIME tmout; |
| @@ -147,16 +144,11 @@ x_session_check_input (bufp, numchars) | |||
| 147 | 144 | ||
| 148 | /* Check if smc_interact_CB was called and we shall generate a | 145 | /* Check if smc_interact_CB was called and we shall generate a |
| 149 | SAVE_SESSION_EVENT. */ | 146 | SAVE_SESSION_EVENT. */ |
| 150 | if (*numchars > 0 && emacs_event.kind != NO_EVENT) | 147 | if (emacs_event.kind == NO_EVENT) |
| 151 | { | 148 | return 0; |
| 152 | bcopy (&emacs_event, bufp, sizeof (struct input_event)); | ||
| 153 | bufp++; | ||
| 154 | (*numchars)--; | ||
| 155 | |||
| 156 | return 1; | ||
| 157 | } | ||
| 158 | 149 | ||
| 159 | return 0; | 150 | bcopy (&emacs_event, bufp, sizeof (struct input_event)); |
| 151 | return 1; | ||
| 160 | } | 152 | } |
| 161 | 153 | ||
| 162 | /* Return non-zero if we have a connection to a session manager.*/ | 154 | /* Return non-zero if we have a connection to a session manager.*/ |
diff --git a/src/xterm.c b/src/xterm.c index 546c93600d4..6100eaacffa 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -337,16 +337,10 @@ static void x_clear_frame P_ ((void)); | |||
| 337 | static void frame_highlight P_ ((struct frame *)); | 337 | static void frame_highlight P_ ((struct frame *)); |
| 338 | static void frame_unhighlight P_ ((struct frame *)); | 338 | static void frame_unhighlight P_ ((struct frame *)); |
| 339 | static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); | 339 | static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); |
| 340 | static int x_focus_changed P_ ((int, | 340 | static void x_focus_changed P_ ((int, int, struct x_display_info *, |
| 341 | int, | 341 | struct frame *, struct input_event *)); |
| 342 | struct x_display_info *, | 342 | static void x_detect_focus_change P_ ((struct x_display_info *, |
| 343 | struct frame *, | 343 | XEvent *, struct input_event *)); |
| 344 | struct input_event *, | ||
| 345 | int)); | ||
| 346 | static int x_detect_focus_change P_ ((struct x_display_info *, | ||
| 347 | XEvent *, | ||
| 348 | struct input_event *, | ||
| 349 | int)); | ||
| 350 | static void XTframe_rehighlight P_ ((struct frame *)); | 344 | static void XTframe_rehighlight P_ ((struct frame *)); |
| 351 | static void x_frame_rehighlight P_ ((struct x_display_info *)); | 345 | static void x_frame_rehighlight P_ ((struct x_display_info *)); |
| 352 | static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); | 346 | static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); |
| @@ -365,11 +359,8 @@ static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, | |||
| 365 | unsigned long *)); | 359 | unsigned long *)); |
| 366 | static void x_check_fullscreen P_ ((struct frame *)); | 360 | static void x_check_fullscreen P_ ((struct frame *)); |
| 367 | static void x_check_expected_move P_ ((struct frame *)); | 361 | static void x_check_expected_move P_ ((struct frame *)); |
| 368 | static int handle_one_xevent P_ ((struct x_display_info *, | 362 | static int handle_one_xevent P_ ((struct x_display_info *, XEvent *, |
| 369 | XEvent *, | 363 | int *, struct input_event *)); |
| 370 | struct input_event **, | ||
| 371 | int *, | ||
| 372 | int *)); | ||
| 373 | 364 | ||
| 374 | 365 | ||
| 375 | /* Flush display of frame F, or of all frames if F is null. */ | 366 | /* Flush display of frame F, or of all frames if F is null. */ |
| @@ -3169,20 +3160,16 @@ x_new_focus_frame (dpyinfo, frame) | |||
| 3169 | 3160 | ||
| 3170 | /* Handle FocusIn and FocusOut state changes for FRAME. | 3161 | /* Handle FocusIn and FocusOut state changes for FRAME. |
| 3171 | If FRAME has focus and there exists more than one frame, puts | 3162 | If FRAME has focus and there exists more than one frame, puts |
| 3172 | a FOCUS_IN_EVENT into BUFP. | 3163 | a FOCUS_IN_EVENT into *BUFP. */ |
| 3173 | Returns number of events inserted into BUFP. */ | ||
| 3174 | 3164 | ||
| 3175 | static int | 3165 | static void |
| 3176 | x_focus_changed (type, state, dpyinfo, frame, bufp, numchars) | 3166 | x_focus_changed (type, state, dpyinfo, frame, bufp) |
| 3177 | int type; | 3167 | int type; |
| 3178 | int state; | 3168 | int state; |
| 3179 | struct x_display_info *dpyinfo; | 3169 | struct x_display_info *dpyinfo; |
| 3180 | struct frame *frame; | 3170 | struct frame *frame; |
| 3181 | struct input_event *bufp; | 3171 | struct input_event *bufp; |
| 3182 | int numchars; | ||
| 3183 | { | 3172 | { |
| 3184 | int nr_events = 0; | ||
| 3185 | |||
| 3186 | if (type == FocusIn) | 3173 | if (type == FocusIn) |
| 3187 | { | 3174 | { |
| 3188 | if (dpyinfo->x_focus_event_frame != frame) | 3175 | if (dpyinfo->x_focus_event_frame != frame) |
| @@ -3192,17 +3179,12 @@ x_focus_changed (type, state, dpyinfo, frame, bufp, numchars) | |||
| 3192 | 3179 | ||
| 3193 | /* Don't stop displaying the initial startup message | 3180 | /* Don't stop displaying the initial startup message |
| 3194 | for a switch-frame event we don't need. */ | 3181 | for a switch-frame event we don't need. */ |
| 3195 | if (numchars > 0 | 3182 | if (GC_NILP (Vterminal_frame) |
| 3196 | && GC_NILP (Vterminal_frame) | ||
| 3197 | && GC_CONSP (Vframe_list) | 3183 | && GC_CONSP (Vframe_list) |
| 3198 | && !GC_NILP (XCDR (Vframe_list))) | 3184 | && !GC_NILP (XCDR (Vframe_list))) |
| 3199 | { | 3185 | { |
| 3200 | bufp->kind = FOCUS_IN_EVENT; | 3186 | bufp->kind = FOCUS_IN_EVENT; |
| 3201 | XSETFRAME (bufp->frame_or_window, frame); | 3187 | XSETFRAME (bufp->frame_or_window, frame); |
| 3202 | bufp->arg = Qnil; | ||
| 3203 | ++bufp; | ||
| 3204 | numchars--; | ||
| 3205 | ++nr_events; | ||
| 3206 | } | 3188 | } |
| 3207 | } | 3189 | } |
| 3208 | 3190 | ||
| @@ -3228,27 +3210,25 @@ x_focus_changed (type, state, dpyinfo, frame, bufp, numchars) | |||
| 3228 | XUnsetICFocus (FRAME_XIC (frame)); | 3210 | XUnsetICFocus (FRAME_XIC (frame)); |
| 3229 | #endif | 3211 | #endif |
| 3230 | } | 3212 | } |
| 3231 | |||
| 3232 | return nr_events; | ||
| 3233 | } | 3213 | } |
| 3234 | 3214 | ||
| 3235 | /* The focus may have changed. Figure out if it is a real focus change, | 3215 | /* The focus may have changed. Figure out if it is a real focus change, |
| 3236 | by checking both FocusIn/Out and Enter/LeaveNotify events. | 3216 | by checking both FocusIn/Out and Enter/LeaveNotify events. |
| 3237 | 3217 | ||
| 3238 | Returns number of events inserted into BUFP. */ | 3218 | Returns FOCUS_IN_EVENT event in *BUFP. */ |
| 3239 | 3219 | ||
| 3240 | static int | 3220 | static void |
| 3241 | x_detect_focus_change (dpyinfo, event, bufp, numchars) | 3221 | x_detect_focus_change (dpyinfo, event, bufp) |
| 3242 | struct x_display_info *dpyinfo; | 3222 | struct x_display_info *dpyinfo; |
| 3243 | XEvent *event; | 3223 | XEvent *event; |
| 3244 | struct input_event *bufp; | 3224 | struct input_event *bufp; |
| 3245 | int numchars; | ||
| 3246 | { | 3225 | { |
| 3247 | struct frame *frame; | 3226 | struct frame *frame; |
| 3248 | int nr_events = 0; | 3227 | int nr_events = 0; |
| 3249 | 3228 | ||
| 3250 | frame = x_any_window_to_frame (dpyinfo, event->xany.window); | 3229 | frame = x_any_window_to_frame (dpyinfo, event->xany.window); |
| 3251 | if (! frame) return nr_events; | 3230 | if (! frame) |
| 3231 | return; | ||
| 3252 | 3232 | ||
| 3253 | switch (event->type) | 3233 | switch (event->type) |
| 3254 | { | 3234 | { |
| @@ -3262,29 +3242,20 @@ x_detect_focus_change (dpyinfo, event, bufp, numchars) | |||
| 3262 | if (event->xcrossing.detail != NotifyInferior | 3242 | if (event->xcrossing.detail != NotifyInferior |
| 3263 | && event->xcrossing.focus | 3243 | && event->xcrossing.focus |
| 3264 | && ! (focus_state & FOCUS_EXPLICIT)) | 3244 | && ! (focus_state & FOCUS_EXPLICIT)) |
| 3265 | nr_events = x_focus_changed ((event->type == EnterNotify | 3245 | x_focus_changed ((event->type == EnterNotify ? FocusIn : FocusOut), |
| 3266 | ? FocusIn : FocusOut), | 3246 | FOCUS_IMPLICIT, |
| 3267 | FOCUS_IMPLICIT, | 3247 | dpyinfo, frame, bufp); |
| 3268 | dpyinfo, | ||
| 3269 | frame, | ||
| 3270 | bufp, | ||
| 3271 | numchars); | ||
| 3272 | } | 3248 | } |
| 3273 | break; | 3249 | break; |
| 3274 | 3250 | ||
| 3275 | case FocusIn: | 3251 | case FocusIn: |
| 3276 | case FocusOut: | 3252 | case FocusOut: |
| 3277 | nr_events = x_focus_changed (event->type, | 3253 | x_focus_changed (event->type, |
| 3278 | (event->xfocus.detail == NotifyPointer | 3254 | (event->xfocus.detail == NotifyPointer ? |
| 3279 | ? FOCUS_IMPLICIT : FOCUS_EXPLICIT), | 3255 | FOCUS_IMPLICIT : FOCUS_EXPLICIT), |
| 3280 | dpyinfo, | 3256 | dpyinfo, frame, bufp); |
| 3281 | frame, | ||
| 3282 | bufp, | ||
| 3283 | numchars); | ||
| 3284 | break; | 3257 | break; |
| 3285 | } | 3258 | } |
| 3286 | |||
| 3287 | return nr_events; | ||
| 3288 | } | 3259 | } |
| 3289 | 3260 | ||
| 3290 | 3261 | ||
| @@ -3629,35 +3600,39 @@ glyph_rect (f, x, y, rect) | |||
| 3629 | XRectangle *rect; | 3600 | XRectangle *rect; |
| 3630 | { | 3601 | { |
| 3631 | Lisp_Object window; | 3602 | Lisp_Object window; |
| 3632 | int found = 0; | 3603 | struct window *w; |
| 3604 | struct glyph_row *r, *end_row; | ||
| 3633 | 3605 | ||
| 3634 | window = window_from_coordinates (f, x, y, 0, &x, &y, 0); | 3606 | window = window_from_coordinates (f, x, y, 0, &x, &y, 0); |
| 3635 | if (!NILP (window)) | 3607 | if (NILP (window)) |
| 3636 | { | 3608 | return 0; |
| 3637 | struct window *w = XWINDOW (window); | ||
| 3638 | struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 3639 | struct glyph_row *end = r + w->current_matrix->nrows - 1; | ||
| 3640 | 3609 | ||
| 3641 | for (; !found && r < end && r->enabled_p; ++r) | 3610 | w = XWINDOW (window); |
| 3642 | if (r->y >= y) | 3611 | r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
| 3643 | { | 3612 | end_row = r + w->current_matrix->nrows - 1; |
| 3644 | struct glyph *g = r->glyphs[TEXT_AREA]; | ||
| 3645 | struct glyph *end = g + r->used[TEXT_AREA]; | ||
| 3646 | int gx; | ||
| 3647 | 3613 | ||
| 3648 | for (gx = r->x; !found && g < end; gx += g->pixel_width, ++g) | 3614 | for (; r < end_row && r->enabled_p; ++r) |
| 3649 | if (gx >= x) | 3615 | { |
| 3650 | { | 3616 | if (r->y >= y) |
| 3651 | rect->width = g->pixel_width; | 3617 | { |
| 3652 | rect->height = r->height; | 3618 | struct glyph *g = r->glyphs[TEXT_AREA]; |
| 3653 | rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx); | 3619 | struct glyph *end = g + r->used[TEXT_AREA]; |
| 3654 | rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); | 3620 | int gx = r->x; |
| 3655 | found = 1; | 3621 | while (g < end && gx < x) |
| 3656 | } | 3622 | gx += g->pixel_width, ++g; |
| 3657 | } | 3623 | if (g < end) |
| 3624 | { | ||
| 3625 | rect->width = g->pixel_width; | ||
| 3626 | rect->height = r->height; | ||
| 3627 | rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 3628 | rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); | ||
| 3629 | return 1; | ||
| 3630 | } | ||
| 3631 | break; | ||
| 3632 | } | ||
| 3658 | } | 3633 | } |
| 3659 | 3634 | ||
| 3660 | return found; | 3635 | return 0; |
| 3661 | } | 3636 | } |
| 3662 | 3637 | ||
| 3663 | 3638 | ||
| @@ -5657,6 +5632,11 @@ static XComposeStatus compose_status; | |||
| 5657 | static int temp_index; | 5632 | static int temp_index; |
| 5658 | static short temp_buffer[100]; | 5633 | static short temp_buffer[100]; |
| 5659 | 5634 | ||
| 5635 | #define STORE_KEYSYM_FOR_DEBUG(keysym) \ | ||
| 5636 | if (temp_index == sizeof temp_buffer / sizeof (short)) \ | ||
| 5637 | temp_index = 0; \ | ||
| 5638 | temp_buffer[temp_index++] = (keysym) | ||
| 5639 | |||
| 5660 | /* Set this to nonzero to fake an "X I/O error" | 5640 | /* Set this to nonzero to fake an "X I/O error" |
| 5661 | on a particular display. */ | 5641 | on a particular display. */ |
| 5662 | 5642 | ||
| @@ -5676,15 +5656,8 @@ static struct x_display_info *next_noop_dpyinfo; | |||
| 5676 | f->output_data.x->saved_menu_event \ | 5656 | f->output_data.x->saved_menu_event \ |
| 5677 | = (XEvent *) xmalloc (sizeof (XEvent)); \ | 5657 | = (XEvent *) xmalloc (sizeof (XEvent)); \ |
| 5678 | bcopy (&event, f->output_data.x->saved_menu_event, size); \ | 5658 | bcopy (&event, f->output_data.x->saved_menu_event, size); \ |
| 5679 | if (numchars >= 1) \ | 5659 | inev.kind = MENU_BAR_ACTIVATE_EVENT; \ |
| 5680 | { \ | 5660 | XSETFRAME (inev.frame_or_window, f); \ |
| 5681 | bufp->kind = MENU_BAR_ACTIVATE_EVENT; \ | ||
| 5682 | XSETFRAME (bufp->frame_or_window, f); \ | ||
| 5683 | bufp->arg = Qnil; \ | ||
| 5684 | bufp++; \ | ||
| 5685 | count++; \ | ||
| 5686 | numchars--; \ | ||
| 5687 | } \ | ||
| 5688 | } \ | 5661 | } \ |
| 5689 | while (0) | 5662 | while (0) |
| 5690 | 5663 | ||
| @@ -5726,14 +5699,13 @@ x_filter_event (dpyinfo, event) | |||
| 5726 | #endif | 5699 | #endif |
| 5727 | 5700 | ||
| 5728 | #ifdef USE_GTK | 5701 | #ifdef USE_GTK |
| 5729 | static struct input_event **current_bufp; | ||
| 5730 | static int *current_numcharsp; | ||
| 5731 | static int current_count; | 5702 | static int current_count; |
| 5732 | static int current_finish; | 5703 | static int current_finish; |
| 5704 | static struct input_event *current_hold_quit; | ||
| 5733 | 5705 | ||
| 5734 | /* This is the filter function invoked by the GTK event loop. | 5706 | /* This is the filter function invoked by the GTK event loop. |
| 5735 | It is invoked before the XEvent is translated to a GdkEvent, | 5707 | It is invoked before the XEvent is translated to a GdkEvent, |
| 5736 | so we have a chanse to act on the event before GTK. */ | 5708 | so we have a chance to act on the event before GTK. */ |
| 5737 | static GdkFilterReturn | 5709 | static GdkFilterReturn |
| 5738 | event_handler_gdk (gxev, ev, data) | 5710 | event_handler_gdk (gxev, ev, data) |
| 5739 | GdkXEvent *gxev; | 5711 | GdkXEvent *gxev; |
| @@ -5742,7 +5714,7 @@ event_handler_gdk (gxev, ev, data) | |||
| 5742 | { | 5714 | { |
| 5743 | XEvent *xev = (XEvent *) gxev; | 5715 | XEvent *xev = (XEvent *) gxev; |
| 5744 | 5716 | ||
| 5745 | if (current_numcharsp) | 5717 | if (current_count >= 0) |
| 5746 | { | 5718 | { |
| 5747 | struct x_display_info *dpyinfo; | 5719 | struct x_display_info *dpyinfo; |
| 5748 | 5720 | ||
| @@ -5760,11 +5732,11 @@ event_handler_gdk (gxev, ev, data) | |||
| 5760 | if (! dpyinfo) | 5732 | if (! dpyinfo) |
| 5761 | current_finish = X_EVENT_NORMAL; | 5733 | current_finish = X_EVENT_NORMAL; |
| 5762 | else | 5734 | else |
| 5763 | current_count += handle_one_xevent (dpyinfo, | 5735 | { |
| 5764 | xev, | 5736 | current_count += |
| 5765 | current_bufp, | 5737 | handle_one_xevent (dpyinfo, xev, ¤t_finish, |
| 5766 | current_numcharsp, | 5738 | current_hold_quit); |
| 5767 | ¤t_finish); | 5739 | } |
| 5768 | } | 5740 | } |
| 5769 | else | 5741 | else |
| 5770 | current_finish = x_dispatch_event (xev, xev->xany.display); | 5742 | current_finish = x_dispatch_event (xev, xev->xany.display); |
| @@ -5783,28 +5755,29 @@ event_handler_gdk (gxev, ev, data) | |||
| 5783 | *FINISH is zero if caller should continue reading events. | 5755 | *FINISH is zero if caller should continue reading events. |
| 5784 | *FINISH is X_EVENT_DROP if event should not be passed to the toolkit. | 5756 | *FINISH is X_EVENT_DROP if event should not be passed to the toolkit. |
| 5785 | 5757 | ||
| 5786 | Events representing keys are stored in buffer *BUFP_R, | ||
| 5787 | which can hold up to *NUMCHARSP characters. | ||
| 5788 | We return the number of characters stored into the buffer. */ | 5758 | We return the number of characters stored into the buffer. */ |
| 5789 | 5759 | ||
| 5790 | static int | 5760 | static int |
| 5791 | handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | 5761 | handle_one_xevent (dpyinfo, eventp, finish, hold_quit) |
| 5792 | struct x_display_info *dpyinfo; | 5762 | struct x_display_info *dpyinfo; |
| 5793 | XEvent *eventp; | 5763 | XEvent *eventp; |
| 5794 | /* register */ struct input_event **bufp_r; | ||
| 5795 | /* register */ int *numcharsp; | ||
| 5796 | int *finish; | 5764 | int *finish; |
| 5765 | struct input_event *hold_quit; | ||
| 5797 | { | 5766 | { |
| 5767 | struct input_event inev; | ||
| 5798 | int count = 0; | 5768 | int count = 0; |
| 5769 | int do_help = 0; | ||
| 5799 | int nbytes = 0; | 5770 | int nbytes = 0; |
| 5800 | struct frame *f; | 5771 | struct frame *f; |
| 5801 | struct coding_system coding; | 5772 | struct coding_system coding; |
| 5802 | struct input_event *bufp = *bufp_r; | ||
| 5803 | int numchars = *numcharsp; | ||
| 5804 | XEvent event = *eventp; | 5773 | XEvent event = *eventp; |
| 5805 | 5774 | ||
| 5806 | *finish = X_EVENT_NORMAL; | 5775 | *finish = X_EVENT_NORMAL; |
| 5807 | 5776 | ||
| 5777 | EVENT_INIT (inev); | ||
| 5778 | inev.kind = NO_EVENT; | ||
| 5779 | inev.arg = Qnil; | ||
| 5780 | |||
| 5808 | switch (event.type) | 5781 | switch (event.type) |
| 5809 | { | 5782 | { |
| 5810 | case ClientMessage: | 5783 | case ClientMessage: |
| @@ -5859,8 +5832,10 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 5859 | } | 5832 | } |
| 5860 | /* Not certain about handling scroll bars here */ | 5833 | /* Not certain about handling scroll bars here */ |
| 5861 | #endif /* 0 */ | 5834 | #endif /* 0 */ |
| 5835 | goto done; | ||
| 5862 | } | 5836 | } |
| 5863 | else if (event.xclient.data.l[0] | 5837 | |
| 5838 | if (event.xclient.data.l[0] | ||
| 5864 | == dpyinfo->Xatom_wm_save_yourself) | 5839 | == dpyinfo->Xatom_wm_save_yourself) |
| 5865 | { | 5840 | { |
| 5866 | /* Save state modify the WM_COMMAND property to | 5841 | /* Save state modify the WM_COMMAND property to |
| @@ -5871,11 +5846,9 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 5871 | /* If we have a session manager, don't set this. | 5846 | /* If we have a session manager, don't set this. |
| 5872 | KDE will then start two Emacsen, one for the | 5847 | KDE will then start two Emacsen, one for the |
| 5873 | session manager and one for this. */ | 5848 | session manager and one for this. */ |
| 5874 | if (numchars > 0 | ||
| 5875 | #ifdef HAVE_X_SM | 5849 | #ifdef HAVE_X_SM |
| 5876 | && ! x_session_have_connection () | 5850 | if (! x_session_have_connection ()) |
| 5877 | #endif | 5851 | #endif |
| 5878 | ) | ||
| 5879 | { | 5852 | { |
| 5880 | f = x_top_window_to_frame (dpyinfo, | 5853 | f = x_top_window_to_frame (dpyinfo, |
| 5881 | event.xclient.window); | 5854 | event.xclient.window); |
| @@ -5890,41 +5863,36 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 5890 | event.xclient.window, | 5863 | event.xclient.window, |
| 5891 | 0, 0); | 5864 | 0, 0); |
| 5892 | } | 5865 | } |
| 5866 | goto done; | ||
| 5893 | } | 5867 | } |
| 5894 | else if (event.xclient.data.l[0] | 5868 | |
| 5895 | == dpyinfo->Xatom_wm_delete_window) | 5869 | if (event.xclient.data.l[0] |
| 5870 | == dpyinfo->Xatom_wm_delete_window) | ||
| 5896 | { | 5871 | { |
| 5897 | struct frame *f | 5872 | f = x_any_window_to_frame (dpyinfo, |
| 5898 | = x_any_window_to_frame (dpyinfo, | ||
| 5899 | event.xclient.window); | 5873 | event.xclient.window); |
| 5874 | if (!f) | ||
| 5875 | goto OTHER; /* May be a dialog that is to be removed */ | ||
| 5900 | 5876 | ||
| 5901 | if (f) | 5877 | inev.kind = DELETE_WINDOW_EVENT; |
| 5902 | { | 5878 | XSETFRAME (inev.frame_or_window, f); |
| 5903 | if (numchars == 0) | 5879 | goto done; |
| 5904 | abort (); | ||
| 5905 | |||
| 5906 | bufp->kind = DELETE_WINDOW_EVENT; | ||
| 5907 | XSETFRAME (bufp->frame_or_window, f); | ||
| 5908 | bufp->arg = Qnil; | ||
| 5909 | bufp++; | ||
| 5910 | |||
| 5911 | count += 1; | ||
| 5912 | numchars -= 1; | ||
| 5913 | } | ||
| 5914 | else | ||
| 5915 | goto OTHER; /* May be a dialog that is to be removed */ | ||
| 5916 | } | 5880 | } |
| 5881 | |||
| 5882 | goto done; | ||
| 5917 | } | 5883 | } |
| 5918 | else if (event.xclient.message_type | 5884 | |
| 5885 | if (event.xclient.message_type | ||
| 5919 | == dpyinfo->Xatom_wm_configure_denied) | 5886 | == dpyinfo->Xatom_wm_configure_denied) |
| 5920 | { | 5887 | { |
| 5888 | goto done; | ||
| 5921 | } | 5889 | } |
| 5922 | else if (event.xclient.message_type | 5890 | |
| 5923 | == dpyinfo->Xatom_wm_window_moved) | 5891 | if (event.xclient.message_type |
| 5892 | == dpyinfo->Xatom_wm_window_moved) | ||
| 5924 | { | 5893 | { |
| 5925 | int new_x, new_y; | 5894 | int new_x, new_y; |
| 5926 | struct frame *f | 5895 | f = x_window_to_frame (dpyinfo, event.xclient.window); |
| 5927 | = x_window_to_frame (dpyinfo, event.xclient.window); | ||
| 5928 | 5896 | ||
| 5929 | new_x = event.xclient.data.s[0]; | 5897 | new_x = event.xclient.data.s[0]; |
| 5930 | new_y = event.xclient.data.s[1]; | 5898 | new_y = event.xclient.data.s[1]; |
| @@ -5934,63 +5902,55 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 5934 | f->left_pos = new_x; | 5902 | f->left_pos = new_x; |
| 5935 | f->top_pos = new_y; | 5903 | f->top_pos = new_y; |
| 5936 | } | 5904 | } |
| 5905 | goto done; | ||
| 5937 | } | 5906 | } |
| 5907 | |||
| 5938 | #ifdef HACK_EDITRES | 5908 | #ifdef HACK_EDITRES |
| 5939 | else if (event.xclient.message_type | 5909 | if (event.xclient.message_type |
| 5940 | == dpyinfo->Xatom_editres) | 5910 | == dpyinfo->Xatom_editres) |
| 5941 | { | 5911 | { |
| 5942 | struct frame *f | 5912 | f = x_any_window_to_frame (dpyinfo, event.xclient.window); |
| 5943 | = x_any_window_to_frame (dpyinfo, event.xclient.window); | ||
| 5944 | _XEditResCheckMessages (f->output_data.x->widget, NULL, | 5913 | _XEditResCheckMessages (f->output_data.x->widget, NULL, |
| 5945 | &event, NULL); | 5914 | &event, NULL); |
| 5915 | goto done; | ||
| 5946 | } | 5916 | } |
| 5947 | #endif /* HACK_EDITRES */ | 5917 | #endif /* HACK_EDITRES */ |
| 5948 | else if ((event.xclient.message_type | 5918 | |
| 5949 | == dpyinfo->Xatom_DONE) | 5919 | if ((event.xclient.message_type |
| 5950 | || (event.xclient.message_type | 5920 | == dpyinfo->Xatom_DONE) |
| 5951 | == dpyinfo->Xatom_PAGE)) | 5921 | || (event.xclient.message_type |
| 5922 | == dpyinfo->Xatom_PAGE)) | ||
| 5952 | { | 5923 | { |
| 5953 | /* Ghostview job completed. Kill it. We could | 5924 | /* Ghostview job completed. Kill it. We could |
| 5954 | reply with "Next" if we received "Page", but we | 5925 | reply with "Next" if we received "Page", but we |
| 5955 | currently never do because we are interested in | 5926 | currently never do because we are interested in |
| 5956 | images, only, which should have 1 page. */ | 5927 | images, only, which should have 1 page. */ |
| 5957 | Pixmap pixmap = (Pixmap) event.xclient.data.l[1]; | 5928 | Pixmap pixmap = (Pixmap) event.xclient.data.l[1]; |
| 5958 | struct frame *f | 5929 | f = x_window_to_frame (dpyinfo, event.xclient.window); |
| 5959 | = x_window_to_frame (dpyinfo, event.xclient.window); | ||
| 5960 | x_kill_gs_process (pixmap, f); | 5930 | x_kill_gs_process (pixmap, f); |
| 5961 | expose_frame (f, 0, 0, 0, 0); | 5931 | expose_frame (f, 0, 0, 0, 0); |
| 5932 | goto done; | ||
| 5962 | } | 5933 | } |
| 5934 | |||
| 5963 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5935 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5964 | /* Scroll bar callbacks send a ClientMessage from which | 5936 | /* Scroll bar callbacks send a ClientMessage from which |
| 5965 | we construct an input_event. */ | 5937 | we construct an input_event. */ |
| 5966 | else if (event.xclient.message_type | 5938 | if (event.xclient.message_type |
| 5967 | == dpyinfo->Xatom_Scrollbar) | 5939 | == dpyinfo->Xatom_Scrollbar) |
| 5968 | { | 5940 | { |
| 5969 | x_scroll_bar_to_input_event (&event, bufp); | 5941 | x_scroll_bar_to_input_event (&event, &inev); |
| 5970 | ++bufp, ++count, --numchars; | 5942 | *finish = X_EVENT_GOTO_OUT; |
| 5971 | goto out; | 5943 | goto done; |
| 5972 | } | 5944 | } |
| 5973 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | 5945 | #endif /* USE_TOOLKIT_SCROLL_BARS */ |
| 5974 | else | ||
| 5975 | { | ||
| 5976 | struct frame *f | ||
| 5977 | = x_any_window_to_frame (dpyinfo, event.xclient.window); | ||
| 5978 | 5946 | ||
| 5979 | if (f) | 5947 | f = x_any_window_to_frame (dpyinfo, event.xclient.window); |
| 5980 | { | ||
| 5981 | int ret = x_handle_dnd_message (f, &event.xclient, | ||
| 5982 | dpyinfo, bufp); | ||
| 5983 | if (ret > 0) | ||
| 5984 | { | ||
| 5985 | ++bufp, ++count, --numchars; | ||
| 5986 | } | ||
| 5987 | 5948 | ||
| 5988 | if (ret != 0) | 5949 | if (!f) |
| 5989 | *finish = X_EVENT_DROP; | 5950 | goto OTHER; |
| 5990 | } | 5951 | |
| 5991 | else | 5952 | if (x_handle_dnd_message (f, &event.xclient, dpyinfo, &inev)) |
| 5992 | goto OTHER; | 5953 | *finish = X_EVENT_DROP; |
| 5993 | } | ||
| 5994 | } | 5954 | } |
| 5995 | break; | 5955 | break; |
| 5996 | 5956 | ||
| @@ -6010,19 +5970,11 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6010 | { | 5970 | { |
| 6011 | XSelectionClearEvent *eventp = (XSelectionClearEvent *) &event; | 5971 | XSelectionClearEvent *eventp = (XSelectionClearEvent *) &event; |
| 6012 | 5972 | ||
| 6013 | if (numchars == 0) | 5973 | inev.kind = SELECTION_CLEAR_EVENT; |
| 6014 | abort (); | 5974 | SELECTION_EVENT_DISPLAY (&inev) = eventp->display; |
| 6015 | 5975 | SELECTION_EVENT_SELECTION (&inev) = eventp->selection; | |
| 6016 | bufp->kind = SELECTION_CLEAR_EVENT; | 5976 | SELECTION_EVENT_TIME (&inev) = eventp->time; |
| 6017 | SELECTION_EVENT_DISPLAY (bufp) = eventp->display; | 5977 | inev.frame_or_window = Qnil; |
| 6018 | SELECTION_EVENT_SELECTION (bufp) = eventp->selection; | ||
| 6019 | SELECTION_EVENT_TIME (bufp) = eventp->time; | ||
| 6020 | bufp->frame_or_window = Qnil; | ||
| 6021 | bufp->arg = Qnil; | ||
| 6022 | bufp++; | ||
| 6023 | |||
| 6024 | count += 1; | ||
| 6025 | numchars -= 1; | ||
| 6026 | } | 5978 | } |
| 6027 | break; | 5979 | break; |
| 6028 | 5980 | ||
| @@ -6039,22 +5991,14 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6039 | XSelectionRequestEvent *eventp | 5991 | XSelectionRequestEvent *eventp |
| 6040 | = (XSelectionRequestEvent *) &event; | 5992 | = (XSelectionRequestEvent *) &event; |
| 6041 | 5993 | ||
| 6042 | if (numchars == 0) | 5994 | inev.kind = SELECTION_REQUEST_EVENT; |
| 6043 | abort (); | 5995 | SELECTION_EVENT_DISPLAY (&inev) = eventp->display; |
| 6044 | 5996 | SELECTION_EVENT_REQUESTOR (&inev) = eventp->requestor; | |
| 6045 | bufp->kind = SELECTION_REQUEST_EVENT; | 5997 | SELECTION_EVENT_SELECTION (&inev) = eventp->selection; |
| 6046 | SELECTION_EVENT_DISPLAY (bufp) = eventp->display; | 5998 | SELECTION_EVENT_TARGET (&inev) = eventp->target; |
| 6047 | SELECTION_EVENT_REQUESTOR (bufp) = eventp->requestor; | 5999 | SELECTION_EVENT_PROPERTY (&inev) = eventp->property; |
| 6048 | SELECTION_EVENT_SELECTION (bufp) = eventp->selection; | 6000 | SELECTION_EVENT_TIME (&inev) = eventp->time; |
| 6049 | SELECTION_EVENT_TARGET (bufp) = eventp->target; | 6001 | inev.frame_or_window = Qnil; |
| 6050 | SELECTION_EVENT_PROPERTY (bufp) = eventp->property; | ||
| 6051 | SELECTION_EVENT_TIME (bufp) = eventp->time; | ||
| 6052 | bufp->frame_or_window = Qnil; | ||
| 6053 | bufp->arg = Qnil; | ||
| 6054 | bufp++; | ||
| 6055 | |||
| 6056 | count += 1; | ||
| 6057 | numchars -= 1; | ||
| 6058 | } | 6002 | } |
| 6059 | break; | 6003 | break; |
| 6060 | 6004 | ||
| @@ -6084,7 +6028,6 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6084 | FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN; | 6028 | FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN; |
| 6085 | } | 6029 | } |
| 6086 | goto OTHER; | 6030 | goto OTHER; |
| 6087 | break; | ||
| 6088 | 6031 | ||
| 6089 | case Expose: | 6032 | case Expose: |
| 6090 | f = x_window_to_frame (dpyinfo, event.xexpose.window); | 6033 | f = x_window_to_frame (dpyinfo, event.xexpose.window); |
| @@ -6186,12 +6129,8 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6186 | { | 6129 | { |
| 6187 | f->async_iconified = 1; | 6130 | f->async_iconified = 1; |
| 6188 | 6131 | ||
| 6189 | bufp->kind = ICONIFY_EVENT; | 6132 | inev.kind = ICONIFY_EVENT; |
| 6190 | XSETFRAME (bufp->frame_or_window, f); | 6133 | XSETFRAME (inev.frame_or_window, f); |
| 6191 | bufp->arg = Qnil; | ||
| 6192 | bufp++; | ||
| 6193 | count++; | ||
| 6194 | numchars--; | ||
| 6195 | } | 6134 | } |
| 6196 | } | 6135 | } |
| 6197 | goto OTHER; | 6136 | goto OTHER; |
| @@ -6223,12 +6162,8 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6223 | 6162 | ||
| 6224 | if (f->iconified) | 6163 | if (f->iconified) |
| 6225 | { | 6164 | { |
| 6226 | bufp->kind = DEICONIFY_EVENT; | 6165 | inev.kind = DEICONIFY_EVENT; |
| 6227 | XSETFRAME (bufp->frame_or_window, f); | 6166 | XSETFRAME (inev.frame_or_window, f); |
| 6228 | bufp->arg = Qnil; | ||
| 6229 | bufp++; | ||
| 6230 | count++; | ||
| 6231 | numchars--; | ||
| 6232 | } | 6167 | } |
| 6233 | else if (! NILP (Vframe_list) | 6168 | else if (! NILP (Vframe_list) |
| 6234 | && ! NILP (XCDR (Vframe_list))) | 6169 | && ! NILP (XCDR (Vframe_list))) |
| @@ -6289,6 +6224,7 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6289 | int copy_bufsiz = sizeof (copy_buffer); | 6224 | int copy_bufsiz = sizeof (copy_buffer); |
| 6290 | int modifiers; | 6225 | int modifiers; |
| 6291 | Lisp_Object coding_system = Qlatin_1; | 6226 | Lisp_Object coding_system = Qlatin_1; |
| 6227 | Lisp_Object c; | ||
| 6292 | 6228 | ||
| 6293 | event.xkey.state | 6229 | event.xkey.state |
| 6294 | |= x_emacs_to_x_modifiers (FRAME_X_DISPLAY_INFO (f), | 6230 | |= x_emacs_to_x_modifiers (FRAME_X_DISPLAY_INFO (f), |
| @@ -6382,49 +6318,37 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6382 | 6318 | ||
| 6383 | orig_keysym = keysym; | 6319 | orig_keysym = keysym; |
| 6384 | 6320 | ||
| 6385 | if (numchars > 0) | 6321 | /* Common for all keysym input events. */ |
| 6386 | { | 6322 | XSETFRAME (inev.frame_or_window, f); |
| 6387 | Lisp_Object c; | 6323 | inev.modifiers |
| 6388 | 6324 | = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), modifiers); | |
| 6389 | /* First deal with keysyms which have defined | 6325 | inev.timestamp = event.xkey.time; |
| 6390 | translations to characters. */ | 6326 | |
| 6391 | if (keysym >= 32 && keysym < 128) | 6327 | /* First deal with keysyms which have defined |
| 6392 | /* Avoid explicitly decoding each ASCII character. */ | 6328 | translations to characters. */ |
| 6393 | { | 6329 | if (keysym >= 32 && keysym < 128) |
| 6394 | bufp->kind = ASCII_KEYSTROKE_EVENT; | 6330 | /* Avoid explicitly decoding each ASCII character. */ |
| 6395 | bufp->code = keysym; | 6331 | { |
| 6396 | XSETFRAME (bufp->frame_or_window, f); | 6332 | inev.kind = ASCII_KEYSTROKE_EVENT; |
| 6397 | bufp->arg = Qnil; | 6333 | inev.code = keysym; |
| 6398 | bufp->modifiers | 6334 | goto done_keysym; |
| 6399 | = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), | 6335 | } |
| 6400 | modifiers); | 6336 | |
| 6401 | bufp->timestamp = event.xkey.time; | 6337 | /* Now non-ASCII. */ |
| 6402 | bufp++; | 6338 | if (HASH_TABLE_P (Vx_keysym_table) |
| 6403 | count++; | 6339 | && (NATNUMP (c = Fgethash (make_number (keysym), |
| 6404 | numchars--; | 6340 | Vx_keysym_table, |
| 6405 | } | 6341 | Qnil)))) |
| 6406 | /* Now non-ASCII. */ | 6342 | { |
| 6407 | else if (HASH_TABLE_P (Vx_keysym_table) | 6343 | inev.kind = (SINGLE_BYTE_CHAR_P (XFASTINT (c)) |
| 6408 | && (NATNUMP (c = Fgethash (make_number (keysym), | 6344 | ? ASCII_KEYSTROKE_EVENT |
| 6409 | Vx_keysym_table, | 6345 | : MULTIBYTE_CHAR_KEYSTROKE_EVENT); |
| 6410 | Qnil)))) | 6346 | inev.code = XFASTINT (c); |
| 6411 | { | 6347 | goto done_keysym; |
| 6412 | bufp->kind = (SINGLE_BYTE_CHAR_P (XFASTINT (c)) | 6348 | } |
| 6413 | ? ASCII_KEYSTROKE_EVENT | 6349 | |
| 6414 | : MULTIBYTE_CHAR_KEYSTROKE_EVENT); | 6350 | /* Random non-modifier sorts of keysyms. */ |
| 6415 | bufp->code = XFASTINT (c); | 6351 | if (((keysym >= XK_BackSpace && keysym <= XK_Escape) |
| 6416 | XSETFRAME (bufp->frame_or_window, f); | ||
| 6417 | bufp->arg = Qnil; | ||
| 6418 | bufp->modifiers | ||
| 6419 | = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), | ||
| 6420 | modifiers); | ||
| 6421 | bufp->timestamp = event.xkey.time; | ||
| 6422 | bufp++; | ||
| 6423 | count++; | ||
| 6424 | numchars--; | ||
| 6425 | } | ||
| 6426 | /* Random non-modifier sorts of keysyms. */ | ||
| 6427 | else if (((keysym >= XK_BackSpace && keysym <= XK_Escape) | ||
| 6428 | || keysym == XK_Delete | 6352 | || keysym == XK_Delete |
| 6429 | #ifdef XK_ISO_Left_Tab | 6353 | #ifdef XK_ISO_Left_Tab |
| 6430 | || (keysym >= XK_ISO_Left_Tab | 6354 | || (keysym >= XK_ISO_Left_Tab |
| @@ -6505,104 +6429,80 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6505 | <= XK_ISO_Last_Group_Lock) | 6429 | <= XK_ISO_Last_Group_Lock) |
| 6506 | #endif | 6430 | #endif |
| 6507 | )) | 6431 | )) |
| 6508 | { | 6432 | { |
| 6509 | if (temp_index == sizeof temp_buffer / sizeof (short)) | 6433 | STORE_KEYSYM_FOR_DEBUG (keysym); |
| 6510 | temp_index = 0; | 6434 | /* make_lispy_event will convert this to a symbolic |
| 6511 | temp_buffer[temp_index++] = keysym; | 6435 | key. */ |
| 6512 | /* make_lispy_event will convert this to a symbolic | 6436 | inev.kind = NON_ASCII_KEYSTROKE_EVENT; |
| 6513 | key. */ | 6437 | inev.code = keysym; |
| 6514 | bufp->kind = NON_ASCII_KEYSTROKE_EVENT; | 6438 | goto done_keysym; |
| 6515 | bufp->code = keysym; | 6439 | } |
| 6516 | XSETFRAME (bufp->frame_or_window, f); | ||
| 6517 | bufp->arg = Qnil; | ||
| 6518 | bufp->modifiers | ||
| 6519 | = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), | ||
| 6520 | modifiers); | ||
| 6521 | bufp->timestamp = event.xkey.time; | ||
| 6522 | bufp++; | ||
| 6523 | count++; | ||
| 6524 | numchars--; | ||
| 6525 | } | ||
| 6526 | else if (numchars > nbytes) | ||
| 6527 | { /* Raw bytes, not keysym. */ | ||
| 6528 | register int i; | ||
| 6529 | register int c; | ||
| 6530 | int nchars, len; | ||
| 6531 | |||
| 6532 | /* The input should be decoded with `coding_system' | ||
| 6533 | which depends on which X*LookupString function | ||
| 6534 | we used just above and the locale. */ | ||
| 6535 | setup_coding_system (coding_system, &coding); | ||
| 6536 | coding.src_multibyte = 0; | ||
| 6537 | coding.dst_multibyte = 1; | ||
| 6538 | /* The input is converted to events, thus we can't | ||
| 6539 | handle composition. Anyway, there's no XIM that | ||
| 6540 | gives us composition information. */ | ||
| 6541 | coding.composing = COMPOSITION_DISABLED; | ||
| 6542 | |||
| 6543 | for (i = 0; i < nbytes; i++) | ||
| 6544 | { | ||
| 6545 | if (temp_index == (sizeof temp_buffer | ||
| 6546 | / sizeof (short))) | ||
| 6547 | temp_index = 0; | ||
| 6548 | temp_buffer[temp_index++] = copy_bufptr[i]; | ||
| 6549 | } | ||
| 6550 | 6440 | ||
| 6551 | { | 6441 | { /* Raw bytes, not keysym. */ |
| 6552 | /* Decode the input data. */ | 6442 | register int i; |
| 6553 | int require; | 6443 | register int c; |
| 6554 | unsigned char *p; | 6444 | int nchars, len; |
| 6555 | 6445 | ||
| 6556 | require = decoding_buffer_size (&coding, nbytes); | 6446 | /* The input should be decoded with `coding_system' |
| 6557 | p = (unsigned char *) alloca (require); | 6447 | which depends on which X*LookupString function |
| 6558 | coding.mode |= CODING_MODE_LAST_BLOCK; | 6448 | we used just above and the locale. */ |
| 6559 | /* We explicitly disable composition | 6449 | setup_coding_system (coding_system, &coding); |
| 6560 | handling because key data should | 6450 | coding.src_multibyte = 0; |
| 6561 | not contain any composition | 6451 | coding.dst_multibyte = 1; |
| 6562 | sequence. */ | 6452 | /* The input is converted to events, thus we can't |
| 6563 | coding.composing = COMPOSITION_DISABLED; | 6453 | handle composition. Anyway, there's no XIM that |
| 6564 | decode_coding (&coding, copy_bufptr, p, | 6454 | gives us composition information. */ |
| 6565 | nbytes, require); | 6455 | coding.composing = COMPOSITION_DISABLED; |
| 6566 | nbytes = coding.produced; | 6456 | |
| 6567 | nchars = coding.produced_char; | 6457 | for (i = 0; i < nbytes; i++) |
| 6568 | copy_bufptr = p; | 6458 | { |
| 6569 | } | 6459 | STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); |
| 6460 | } | ||
| 6570 | 6461 | ||
| 6571 | /* Convert the input data to a sequence of | 6462 | { |
| 6572 | character events. */ | 6463 | /* Decode the input data. */ |
| 6573 | for (i = 0; i < nbytes; i += len) | 6464 | int require; |
| 6574 | { | 6465 | unsigned char *p; |
| 6575 | if (nchars == nbytes) | 6466 | |
| 6576 | c = copy_bufptr[i], len = 1; | 6467 | require = decoding_buffer_size (&coding, nbytes); |
| 6577 | else | 6468 | p = (unsigned char *) alloca (require); |
| 6578 | c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, | 6469 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6579 | nbytes - i, len); | 6470 | /* We explicitly disable composition handling because |
| 6580 | 6471 | key data should not contain any composition sequence. */ | |
| 6581 | bufp->kind = (SINGLE_BYTE_CHAR_P (c) | 6472 | coding.composing = COMPOSITION_DISABLED; |
| 6582 | ? ASCII_KEYSTROKE_EVENT | 6473 | decode_coding (&coding, copy_bufptr, p, nbytes, require); |
| 6583 | : MULTIBYTE_CHAR_KEYSTROKE_EVENT); | 6474 | nbytes = coding.produced; |
| 6584 | bufp->code = c; | 6475 | nchars = coding.produced_char; |
| 6585 | XSETFRAME (bufp->frame_or_window, f); | 6476 | copy_bufptr = p; |
| 6586 | bufp->arg = Qnil; | 6477 | } |
| 6587 | bufp->modifiers | ||
| 6588 | = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), | ||
| 6589 | modifiers); | ||
| 6590 | bufp->timestamp = event.xkey.time; | ||
| 6591 | bufp++; | ||
| 6592 | } | ||
| 6593 | 6478 | ||
| 6594 | count += nchars; | 6479 | /* Convert the input data to a sequence of |
| 6595 | numchars -= nchars; | 6480 | character events. */ |
| 6481 | for (i = 0; i < nbytes; i += len) | ||
| 6482 | { | ||
| 6483 | if (nchars == nbytes) | ||
| 6484 | c = copy_bufptr[i], len = 1; | ||
| 6485 | else | ||
| 6486 | c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, | ||
| 6487 | nbytes - i, len); | ||
| 6488 | inev.kind = (SINGLE_BYTE_CHAR_P (c) | ||
| 6489 | ? ASCII_KEYSTROKE_EVENT | ||
| 6490 | : MULTIBYTE_CHAR_KEYSTROKE_EVENT); | ||
| 6491 | inev.code = c; | ||
| 6492 | kbd_buffer_store_event_hold (&inev, hold_quit); | ||
| 6493 | } | ||
| 6596 | 6494 | ||
| 6597 | if (keysym == NoSymbol) | 6495 | /* Previous code updated count by nchars rather than nbytes, |
| 6598 | break; | 6496 | but that seems bogus to me. ++kfs */ |
| 6599 | } | 6497 | count += nbytes; |
| 6600 | else | 6498 | |
| 6601 | abort (); | 6499 | inev.kind = NO_EVENT; /* Already stored above. */ |
| 6602 | } | 6500 | |
| 6603 | else | 6501 | if (keysym == NoSymbol) |
| 6604 | abort (); | 6502 | break; |
| 6503 | } | ||
| 6605 | } | 6504 | } |
| 6505 | done_keysym: | ||
| 6606 | #ifdef HAVE_X_I18N | 6506 | #ifdef HAVE_X_I18N |
| 6607 | /* Don't dispatch this event since XtDispatchEvent calls | 6507 | /* Don't dispatch this event since XtDispatchEvent calls |
| 6608 | XFilterEvent, and two calls in a row may freeze the | 6508 | XFilterEvent, and two calls in a row may freeze the |
| @@ -6623,63 +6523,38 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6623 | #endif | 6523 | #endif |
| 6624 | 6524 | ||
| 6625 | case EnterNotify: | 6525 | case EnterNotify: |
| 6626 | { | 6526 | x_detect_focus_change (dpyinfo, &event, &inev); |
| 6627 | int n; | ||
| 6628 | |||
| 6629 | n = x_detect_focus_change (dpyinfo, &event, bufp, numchars); | ||
| 6630 | if (n > 0) | ||
| 6631 | { | ||
| 6632 | bufp += n, count += n, numchars -= n; | ||
| 6633 | } | ||
| 6634 | 6527 | ||
| 6635 | f = x_any_window_to_frame (dpyinfo, event.xcrossing.window); | 6528 | f = x_any_window_to_frame (dpyinfo, event.xcrossing.window); |
| 6636 | 6529 | ||
| 6637 | #if 0 | 6530 | #if 0 |
| 6638 | if (event.xcrossing.focus) | 6531 | if (event.xcrossing.focus) |
| 6639 | { | 6532 | { |
| 6640 | /* Avoid nasty pop/raise loops. */ | 6533 | /* Avoid nasty pop/raise loops. */ |
| 6641 | if (f && (!(f->auto_raise) | 6534 | if (f && (!(f->auto_raise) |
| 6642 | || !(f->auto_lower) | 6535 | || !(f->auto_lower) |
| 6643 | || (event.xcrossing.time - enter_timestamp) > 500)) | 6536 | || (event.xcrossing.time - enter_timestamp) > 500)) |
| 6644 | { | 6537 | { |
| 6645 | x_new_focus_frame (dpyinfo, f); | 6538 | x_new_focus_frame (dpyinfo, f); |
| 6646 | enter_timestamp = event.xcrossing.time; | 6539 | enter_timestamp = event.xcrossing.time; |
| 6647 | } | 6540 | } |
| 6648 | } | 6541 | } |
| 6649 | else if (f == dpyinfo->x_focus_frame) | 6542 | else if (f == dpyinfo->x_focus_frame) |
| 6650 | x_new_focus_frame (dpyinfo, 0); | 6543 | x_new_focus_frame (dpyinfo, 0); |
| 6651 | #endif | 6544 | #endif |
| 6652 | 6545 | ||
| 6653 | /* EnterNotify counts as mouse movement, | 6546 | /* EnterNotify counts as mouse movement, |
| 6654 | so update things that depend on mouse position. */ | 6547 | so update things that depend on mouse position. */ |
| 6655 | if (f && !f->output_data.x->hourglass_p) | 6548 | if (f && !f->output_data.x->hourglass_p) |
| 6656 | note_mouse_movement (f, &event.xmotion); | 6549 | note_mouse_movement (f, &event.xmotion); |
| 6657 | goto OTHER; | 6550 | goto OTHER; |
| 6658 | } | ||
| 6659 | 6551 | ||
| 6660 | case FocusIn: | 6552 | case FocusIn: |
| 6661 | { | 6553 | x_detect_focus_change (dpyinfo, &event, &inev); |
| 6662 | int n; | ||
| 6663 | |||
| 6664 | n = x_detect_focus_change (dpyinfo, &event, bufp, numchars); | ||
| 6665 | if (n > 0) | ||
| 6666 | { | ||
| 6667 | bufp += n, count += n, numchars -= n; | ||
| 6668 | } | ||
| 6669 | } | ||
| 6670 | |||
| 6671 | goto OTHER; | 6554 | goto OTHER; |
| 6672 | 6555 | ||
| 6673 | case LeaveNotify: | 6556 | case LeaveNotify: |
| 6674 | { | 6557 | x_detect_focus_change (dpyinfo, &event, &inev); |
| 6675 | int n; | ||
| 6676 | |||
| 6677 | n = x_detect_focus_change (dpyinfo, &event, bufp, numchars); | ||
| 6678 | if (n > 0) | ||
| 6679 | { | ||
| 6680 | bufp += n, count += n, numchars -= n; | ||
| 6681 | } | ||
| 6682 | } | ||
| 6683 | 6558 | ||
| 6684 | f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); | 6559 | f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); |
| 6685 | if (f) | 6560 | if (f) |
| @@ -6697,31 +6572,12 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6697 | Otherwise, the startup message is cleared when | 6572 | Otherwise, the startup message is cleared when |
| 6698 | the mouse leaves the frame. */ | 6573 | the mouse leaves the frame. */ |
| 6699 | if (any_help_event_p) | 6574 | if (any_help_event_p) |
| 6700 | { | 6575 | do_help = -1; |
| 6701 | Lisp_Object frame; | ||
| 6702 | int n; | ||
| 6703 | |||
| 6704 | XSETFRAME (frame, f); | ||
| 6705 | help_echo_string = Qnil; | ||
| 6706 | n = gen_help_event (bufp, numchars, | ||
| 6707 | Qnil, frame, Qnil, Qnil, 0); | ||
| 6708 | bufp += n, count += n, numchars -= n; | ||
| 6709 | } | ||
| 6710 | |||
| 6711 | } | 6576 | } |
| 6712 | goto OTHER; | 6577 | goto OTHER; |
| 6713 | 6578 | ||
| 6714 | case FocusOut: | 6579 | case FocusOut: |
| 6715 | { | 6580 | x_detect_focus_change (dpyinfo, &event, &inev); |
| 6716 | int n; | ||
| 6717 | |||
| 6718 | n = x_detect_focus_change (dpyinfo, &event, bufp, numchars); | ||
| 6719 | if (n > 0) | ||
| 6720 | { | ||
| 6721 | bufp += n, count += n, numchars -= n; | ||
| 6722 | } | ||
| 6723 | } | ||
| 6724 | |||
| 6725 | goto OTHER; | 6581 | goto OTHER; |
| 6726 | 6582 | ||
| 6727 | case MotionNotify: | 6583 | case MotionNotify: |
| @@ -6759,13 +6615,10 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6759 | will be selected iff it is active. */ | 6615 | will be selected iff it is active. */ |
| 6760 | if (WINDOWP (window) | 6616 | if (WINDOWP (window) |
| 6761 | && !EQ (window, last_window) | 6617 | && !EQ (window, last_window) |
| 6762 | && !EQ (window, selected_window) | 6618 | && !EQ (window, selected_window)) |
| 6763 | && numchars > 0) | ||
| 6764 | { | 6619 | { |
| 6765 | bufp->kind = SELECT_WINDOW_EVENT; | 6620 | inev.kind = SELECT_WINDOW_EVENT; |
| 6766 | bufp->frame_or_window = window; | 6621 | inev.frame_or_window = window; |
| 6767 | bufp->arg = Qnil; | ||
| 6768 | ++bufp, ++count, --numchars; | ||
| 6769 | } | 6622 | } |
| 6770 | 6623 | ||
| 6771 | last_window=window; | 6624 | last_window=window; |
| @@ -6792,22 +6645,7 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6792 | has changed, generate a HELP_EVENT. */ | 6645 | has changed, generate a HELP_EVENT. */ |
| 6793 | if (!NILP (help_echo_string) | 6646 | if (!NILP (help_echo_string) |
| 6794 | || !NILP (previous_help_echo_string)) | 6647 | || !NILP (previous_help_echo_string)) |
| 6795 | { | 6648 | do_help = 1; |
| 6796 | Lisp_Object frame; | ||
| 6797 | int n; | ||
| 6798 | |||
| 6799 | if (f) | ||
| 6800 | XSETFRAME (frame, f); | ||
| 6801 | else | ||
| 6802 | frame = Qnil; | ||
| 6803 | |||
| 6804 | any_help_event_p = 1; | ||
| 6805 | n = gen_help_event (bufp, numchars, help_echo_string, frame, | ||
| 6806 | help_echo_window, help_echo_object, | ||
| 6807 | help_echo_pos); | ||
| 6808 | bufp += n, count += n, numchars -= n; | ||
| 6809 | } | ||
| 6810 | |||
| 6811 | goto OTHER; | 6649 | goto OTHER; |
| 6812 | } | 6650 | } |
| 6813 | 6651 | ||
| @@ -6891,10 +6729,8 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6891 | { | 6729 | { |
| 6892 | /* If we decide we want to generate an event to be seen | 6730 | /* If we decide we want to generate an event to be seen |
| 6893 | by the rest of Emacs, we put it here. */ | 6731 | by the rest of Emacs, we put it here. */ |
| 6894 | struct input_event emacs_event; | ||
| 6895 | int tool_bar_p = 0; | 6732 | int tool_bar_p = 0; |
| 6896 | 6733 | ||
| 6897 | emacs_event.kind = NO_EVENT; | ||
| 6898 | bzero (&compose_status, sizeof (compose_status)); | 6734 | bzero (&compose_status, sizeof (compose_status)); |
| 6899 | 6735 | ||
| 6900 | if (dpyinfo->grabbed | 6736 | if (dpyinfo->grabbed |
| @@ -6934,7 +6770,7 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6934 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 6770 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 6935 | if (! popup_activated ()) | 6771 | if (! popup_activated ()) |
| 6936 | #endif | 6772 | #endif |
| 6937 | construct_mouse_click (&emacs_event, &event, f); | 6773 | construct_mouse_click (&inev, &event, f); |
| 6938 | } | 6774 | } |
| 6939 | } | 6775 | } |
| 6940 | else | 6776 | else |
| @@ -6948,12 +6784,12 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6948 | scroll bars. */ | 6784 | scroll bars. */ |
| 6949 | if (bar && event.xbutton.state & ControlMask) | 6785 | if (bar && event.xbutton.state & ControlMask) |
| 6950 | { | 6786 | { |
| 6951 | x_scroll_bar_handle_click (bar, &event, &emacs_event); | 6787 | x_scroll_bar_handle_click (bar, &event, &inev); |
| 6952 | *finish = X_EVENT_DROP; | 6788 | *finish = X_EVENT_DROP; |
| 6953 | } | 6789 | } |
| 6954 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 6790 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 6955 | if (bar) | 6791 | if (bar) |
| 6956 | x_scroll_bar_handle_click (bar, &event, &emacs_event); | 6792 | x_scroll_bar_handle_click (bar, &event, &inev); |
| 6957 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 6793 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 6958 | } | 6794 | } |
| 6959 | 6795 | ||
| @@ -6974,14 +6810,6 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 6974 | else | 6810 | else |
| 6975 | dpyinfo->grabbed &= ~(1 << event.xbutton.button); | 6811 | dpyinfo->grabbed &= ~(1 << event.xbutton.button); |
| 6976 | 6812 | ||
| 6977 | if (numchars >= 1 && emacs_event.kind != NO_EVENT) | ||
| 6978 | { | ||
| 6979 | bcopy (&emacs_event, bufp, sizeof (struct input_event)); | ||
| 6980 | bufp++; | ||
| 6981 | count++; | ||
| 6982 | numchars--; | ||
| 6983 | } | ||
| 6984 | |||
| 6985 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 6813 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 6986 | f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window); | 6814 | f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window); |
| 6987 | /* For a down-event in the menu bar, | 6815 | /* For a down-event in the menu bar, |
| @@ -7068,16 +6896,38 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 7068 | break; | 6896 | break; |
| 7069 | } | 6897 | } |
| 7070 | 6898 | ||
| 7071 | goto ret; | 6899 | done: |
| 6900 | if (inev.kind != NO_EVENT) | ||
| 6901 | { | ||
| 6902 | kbd_buffer_store_event_hold (&inev, hold_quit); | ||
| 6903 | count++; | ||
| 6904 | } | ||
| 7072 | 6905 | ||
| 7073 | out: | 6906 | if (do_help |
| 7074 | *finish = X_EVENT_GOTO_OUT; | 6907 | && !(hold_quit && hold_quit->kind != NO_EVENT)) |
| 6908 | { | ||
| 6909 | Lisp_Object frame; | ||
| 7075 | 6910 | ||
| 7076 | ret: | 6911 | if (f) |
| 7077 | *bufp_r = bufp; | 6912 | XSETFRAME (frame, f); |
| 7078 | *numcharsp = numchars; | 6913 | else |
| 7079 | *eventp = event; | 6914 | frame = Qnil; |
| 6915 | |||
| 6916 | if (do_help > 0) | ||
| 6917 | { | ||
| 6918 | any_help_event_p = 1; | ||
| 6919 | gen_help_event (help_echo_string, frame, help_echo_window, | ||
| 6920 | help_echo_object, help_echo_pos); | ||
| 6921 | } | ||
| 6922 | else | ||
| 6923 | { | ||
| 6924 | help_echo_string = Qnil; | ||
| 6925 | gen_help_event (Qnil, frame, Qnil, Qnil, 0); | ||
| 6926 | } | ||
| 6927 | count++; | ||
| 6928 | } | ||
| 7080 | 6929 | ||
| 6930 | *eventp = event; | ||
| 7081 | return count; | 6931 | return count; |
| 7082 | } | 6932 | } |
| 7083 | 6933 | ||
| @@ -7093,28 +6943,12 @@ x_dispatch_event (event, display) | |||
| 7093 | Display *display; | 6943 | Display *display; |
| 7094 | { | 6944 | { |
| 7095 | struct x_display_info *dpyinfo; | 6945 | struct x_display_info *dpyinfo; |
| 7096 | struct input_event bufp[10]; | ||
| 7097 | struct input_event *bufpp; | ||
| 7098 | int numchars = 10; | ||
| 7099 | int finish = X_EVENT_NORMAL; | 6946 | int finish = X_EVENT_NORMAL; |
| 7100 | 6947 | ||
| 7101 | for (bufpp = bufp; bufpp != bufp + 10; bufpp++) | ||
| 7102 | EVENT_INIT (*bufpp); | ||
| 7103 | bufpp = bufp; | ||
| 7104 | |||
| 7105 | dpyinfo = x_display_info_for_display (display); | 6948 | dpyinfo = x_display_info_for_display (display); |
| 7106 | 6949 | ||
| 7107 | if (dpyinfo) | 6950 | if (dpyinfo) |
| 7108 | { | 6951 | handle_one_xevent (dpyinfo, event, &finish, 0); |
| 7109 | int i, events; | ||
| 7110 | events = handle_one_xevent (dpyinfo, | ||
| 7111 | event, | ||
| 7112 | &bufpp, | ||
| 7113 | &numchars, | ||
| 7114 | &finish); | ||
| 7115 | for (i = 0; i < events; ++i) | ||
| 7116 | kbd_buffer_store_event (&bufp[i]); | ||
| 7117 | } | ||
| 7118 | 6952 | ||
| 7119 | return finish; | 6953 | return finish; |
| 7120 | } | 6954 | } |
| @@ -7124,19 +6958,16 @@ x_dispatch_event (event, display) | |||
| 7124 | This routine is called by the SIGIO handler. | 6958 | This routine is called by the SIGIO handler. |
| 7125 | We return as soon as there are no more events to be read. | 6959 | We return as soon as there are no more events to be read. |
| 7126 | 6960 | ||
| 7127 | Events representing keys are stored in buffer BUFP, | ||
| 7128 | which can hold up to NUMCHARS characters. | ||
| 7129 | We return the number of characters stored into the buffer, | 6961 | We return the number of characters stored into the buffer, |
| 7130 | thus pretending to be `read'. | 6962 | thus pretending to be `read'. |
| 7131 | 6963 | ||
| 7132 | EXPECTED is nonzero if the caller knows input is available. */ | 6964 | EXPECTED is nonzero if the caller knows input is available. */ |
| 7133 | 6965 | ||
| 7134 | static int | 6966 | static int |
| 7135 | XTread_socket (display, bufp, numchars, expected) | 6967 | XTread_socket (display, expected, hold_quit) |
| 7136 | struct display *display; | 6968 | struct display *display; |
| 7137 | struct input_event *bufp; | ||
| 7138 | int numchars; | ||
| 7139 | int expected; | 6969 | int expected; |
| 6970 | struct input_event *hold_quit; | ||
| 7140 | { | 6971 | { |
| 7141 | int count = 0; | 6972 | int count = 0; |
| 7142 | XEvent event; | 6973 | XEvent event; |
| @@ -7155,9 +6986,6 @@ XTread_socket (display, bufp, numchars, expected) | |||
| 7155 | /* So people can tell when we have read the available input. */ | 6986 | /* So people can tell when we have read the available input. */ |
| 7156 | input_signal_count++; | 6987 | input_signal_count++; |
| 7157 | 6988 | ||
| 7158 | if (numchars <= 0) | ||
| 7159 | abort (); /* Don't think this happens. */ | ||
| 7160 | |||
| 7161 | ++handling_signal; | 6989 | ++handling_signal; |
| 7162 | 6990 | ||
| 7163 | /* Find the display we are supposed to read input for. | 6991 | /* Find the display we are supposed to read input for. |
| @@ -7199,13 +7027,22 @@ XTread_socket (display, bufp, numchars, expected) | |||
| 7199 | } | 7027 | } |
| 7200 | 7028 | ||
| 7201 | #ifdef HAVE_X_SM | 7029 | #ifdef HAVE_X_SM |
| 7202 | BLOCK_INPUT; | 7030 | { |
| 7203 | count += x_session_check_input (bufp, &numchars); | 7031 | struct input_event inev; |
| 7204 | UNBLOCK_INPUT; | 7032 | BLOCK_INPUT; |
| 7033 | /* We don't need to EVENT_INIT (inev) here, as | ||
| 7034 | x_session_check_input copies an entire input_event. */ | ||
| 7035 | if (x_session_check_input (&inev)) | ||
| 7036 | { | ||
| 7037 | kbd_buffer_store_event_hold (&inev, hold_quit); | ||
| 7038 | count++; | ||
| 7039 | } | ||
| 7040 | UNBLOCK_INPUT; | ||
| 7041 | } | ||
| 7205 | #endif | 7042 | #endif |
| 7206 | 7043 | ||
| 7207 | #ifndef USE_GTK | 7044 | #ifndef USE_GTK |
| 7208 | while (numchars > 0 && XPending (dpyinfo->display)) | 7045 | while (XPending (dpyinfo->display)) |
| 7209 | { | 7046 | { |
| 7210 | int finish; | 7047 | int finish; |
| 7211 | 7048 | ||
| @@ -7218,11 +7055,7 @@ XTread_socket (display, bufp, numchars, expected) | |||
| 7218 | #endif | 7055 | #endif |
| 7219 | event_found = 1; | 7056 | event_found = 1; |
| 7220 | 7057 | ||
| 7221 | count += handle_one_xevent (dpyinfo, | 7058 | count += handle_one_xevent (dpyinfo, &event, &finish, hold_quit); |
| 7222 | &event, | ||
| 7223 | &bufp, | ||
| 7224 | &numchars, | ||
| 7225 | &finish); | ||
| 7226 | 7059 | ||
| 7227 | if (finish == X_EVENT_GOTO_OUT) | 7060 | if (finish == X_EVENT_GOTO_OUT) |
| 7228 | goto out; | 7061 | goto out; |
| @@ -7243,14 +7076,13 @@ XTread_socket (display, bufp, numchars, expected) | |||
| 7243 | while (gtk_events_pending ()) | 7076 | while (gtk_events_pending ()) |
| 7244 | { | 7077 | { |
| 7245 | current_count = count; | 7078 | current_count = count; |
| 7246 | current_numcharsp = &numchars; | 7079 | current_hold_quit = hold_quit; |
| 7247 | current_bufp = &bufp; | ||
| 7248 | 7080 | ||
| 7249 | gtk_main_iteration (); | 7081 | gtk_main_iteration (); |
| 7250 | 7082 | ||
| 7251 | count = current_count; | 7083 | count = current_count; |
| 7252 | current_bufp = 0; | 7084 | current_count = -1; |
| 7253 | current_numcharsp = 0; | 7085 | current_hold_quit = 0; |
| 7254 | 7086 | ||
| 7255 | if (current_finish == X_EVENT_GOTO_OUT) | 7087 | if (current_finish == X_EVENT_GOTO_OUT) |
| 7256 | break; | 7088 | break; |
| @@ -7290,8 +7122,9 @@ XTread_socket (display, bufp, numchars, expected) | |||
| 7290 | pending_autoraise_frame = 0; | 7122 | pending_autoraise_frame = 0; |
| 7291 | } | 7123 | } |
| 7292 | 7124 | ||
| 7293 | UNBLOCK_INPUT; | ||
| 7294 | --handling_signal; | 7125 | --handling_signal; |
| 7126 | UNBLOCK_INPUT; | ||
| 7127 | |||
| 7295 | return count; | 7128 | return count; |
| 7296 | } | 7129 | } |
| 7297 | 7130 | ||
| @@ -11000,6 +10833,10 @@ x_initialize () | |||
| 11000 | last_tool_bar_item = -1; | 10833 | last_tool_bar_item = -1; |
| 11001 | any_help_event_p = 0; | 10834 | any_help_event_p = 0; |
| 11002 | 10835 | ||
| 10836 | #ifdef USE_GTK | ||
| 10837 | current_count = -1; | ||
| 10838 | #endif | ||
| 10839 | |||
| 11003 | /* Try to use interrupt input; if we can't, then start polling. */ | 10840 | /* Try to use interrupt input; if we can't, then start polling. */ |
| 11004 | Fset_input_mode (Qt, Qnil, Qt, Qnil); | 10841 | Fset_input_mode (Qt, Qnil, Qt, Qnil); |
| 11005 | 10842 | ||
diff --git a/src/xterm.h b/src/xterm.h index 45de640f165..4a19d2c0d56 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -1089,8 +1089,7 @@ extern void widget_store_internal_border P_ ((Widget)); | |||
| 1089 | /* Defined in xsmfns.c */ | 1089 | /* Defined in xsmfns.c */ |
| 1090 | #ifdef HAVE_X_SM | 1090 | #ifdef HAVE_X_SM |
| 1091 | extern void x_session_initialize P_ ((struct x_display_info *dpyinfo)); | 1091 | extern void x_session_initialize P_ ((struct x_display_info *dpyinfo)); |
| 1092 | extern int x_session_check_input P_ ((struct input_event *bufp, | 1092 | extern int x_session_check_input P_ ((struct input_event *bufp)); |
| 1093 | int *numchars)); | ||
| 1094 | extern int x_session_have_connection P_ ((void)); | 1093 | extern int x_session_have_connection P_ ((void)); |
| 1095 | #endif | 1094 | #endif |
| 1096 | 1095 | ||