diff options
| author | Kim F. Storm | 2004-11-05 11:30:01 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-11-05 11:30:01 +0000 |
| commit | e3f6e7c7d0a41ada6734f8386e13f8d5e5ac2d88 (patch) | |
| tree | ea96feddde89beae6cbde12b2d1cbe3880936307 /src | |
| parent | 36a2b04c38431656111b7740cb71db60e1e1b545 (diff) | |
| download | emacs-e3f6e7c7d0a41ada6734f8386e13f8d5e5ac2d88.tar.gz emacs-e3f6e7c7d0a41ada6734f8386e13f8d5e5ac2d88.zip | |
(kbd_buffer_store_event_hold): Remove obsolete code.
(kbd_buffer_unget_event): New function.
(kbd_buffer_get_event, swallow_events): Combine SELECTION events
and use x_handle_selection_event.
(mark_kboards): Don't mark x and y of SELECTION_CLEAR_EVENT.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 91 |
1 files changed, 25 insertions, 66 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index ba9db5b6e94..d145ec50d2c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -3698,36 +3698,26 @@ kbd_buffer_store_event_hold (event, hold_quit) | |||
| 3698 | Discard the event if it would fill the last slot. */ | 3698 | Discard the event if it would fill the last slot. */ |
| 3699 | if (kbd_fetch_ptr - 1 != kbd_store_ptr) | 3699 | if (kbd_fetch_ptr - 1 != kbd_store_ptr) |
| 3700 | { | 3700 | { |
| 3701 | *kbd_store_ptr = *event; | ||
| 3702 | ++kbd_store_ptr; | ||
| 3703 | } | ||
| 3704 | } | ||
| 3701 | 3705 | ||
| 3702 | #if 0 /* The SELECTION_REQUEST_EVENT case looks bogus, and it's error | ||
| 3703 | prone to assign individual members for other events, in case | ||
| 3704 | the input_event structure is changed. --2000-07-13, gerd. */ | ||
| 3705 | struct input_event *sp = kbd_store_ptr; | ||
| 3706 | sp->kind = event->kind; | ||
| 3707 | if (event->kind == SELECTION_REQUEST_EVENT) | ||
| 3708 | { | ||
| 3709 | /* We must not use the ordinary copying code for this case, | ||
| 3710 | since `part' is an enum and copying it might not copy enough | ||
| 3711 | in this case. */ | ||
| 3712 | bcopy (event, (char *) sp, sizeof (*event)); | ||
| 3713 | } | ||
| 3714 | else | ||
| 3715 | 3706 | ||
| 3716 | { | 3707 | /* Put an input event back in the head of the event queue. */ |
| 3717 | sp->code = event->code; | ||
| 3718 | sp->part = event->part; | ||
| 3719 | sp->frame_or_window = event->frame_or_window; | ||
| 3720 | sp->arg = event->arg; | ||
| 3721 | sp->modifiers = event->modifiers; | ||
| 3722 | sp->x = event->x; | ||
| 3723 | sp->y = event->y; | ||
| 3724 | sp->timestamp = event->timestamp; | ||
| 3725 | } | ||
| 3726 | #else | ||
| 3727 | *kbd_store_ptr = *event; | ||
| 3728 | #endif | ||
| 3729 | 3708 | ||
| 3730 | ++kbd_store_ptr; | 3709 | void |
| 3710 | kbd_buffer_unget_event (event) | ||
| 3711 | register struct input_event *event; | ||
| 3712 | { | ||
| 3713 | if (kbd_fetch_ptr == kbd_buffer) | ||
| 3714 | kbd_fetch_ptr = kbd_buffer + KBD_BUFFER_SIZE; | ||
| 3715 | |||
| 3716 | /* Don't let the very last slot in the buffer become full, */ | ||
| 3717 | if (kbd_fetch_ptr - 1 != kbd_store_ptr) | ||
| 3718 | { | ||
| 3719 | --kbd_fetch_ptr; | ||
| 3720 | *kbd_fetch_ptr = *event; | ||
| 3731 | } | 3721 | } |
| 3732 | } | 3722 | } |
| 3733 | 3723 | ||
| @@ -3942,7 +3932,8 @@ kbd_buffer_get_event (kbp, used_mouse_menu) | |||
| 3942 | /* These two kinds of events get special handling | 3932 | /* These two kinds of events get special handling |
| 3943 | and don't actually appear to the command loop. | 3933 | and don't actually appear to the command loop. |
| 3944 | We return nil for them. */ | 3934 | We return nil for them. */ |
| 3945 | if (event->kind == SELECTION_REQUEST_EVENT) | 3935 | if (event->kind == SELECTION_REQUEST_EVENT |
| 3936 | || event->kind == SELECTION_CLEAR_EVENT) | ||
| 3946 | { | 3937 | { |
| 3947 | #ifdef HAVE_X11 | 3938 | #ifdef HAVE_X11 |
| 3948 | struct input_event copy; | 3939 | struct input_event copy; |
| @@ -3953,7 +3944,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu) | |||
| 3953 | copy = *event; | 3944 | copy = *event; |
| 3954 | kbd_fetch_ptr = event + 1; | 3945 | kbd_fetch_ptr = event + 1; |
| 3955 | input_pending = readable_events (0); | 3946 | input_pending = readable_events (0); |
| 3956 | x_handle_selection_request (©); | 3947 | x_handle_selection_event (©); |
| 3957 | #else | 3948 | #else |
| 3958 | /* We're getting selection request events, but we don't have | 3949 | /* We're getting selection request events, but we don't have |
| 3959 | a window system. */ | 3950 | a window system. */ |
| @@ -3961,22 +3952,6 @@ kbd_buffer_get_event (kbp, used_mouse_menu) | |||
| 3961 | #endif | 3952 | #endif |
| 3962 | } | 3953 | } |
| 3963 | 3954 | ||
| 3964 | else if (event->kind == SELECTION_CLEAR_EVENT) | ||
| 3965 | { | ||
| 3966 | #ifdef HAVE_X11 | ||
| 3967 | struct input_event copy; | ||
| 3968 | |||
| 3969 | /* Remove it from the buffer before processing it. */ | ||
| 3970 | copy = *event; | ||
| 3971 | kbd_fetch_ptr = event + 1; | ||
| 3972 | input_pending = readable_events (0); | ||
| 3973 | x_handle_selection_clear (©); | ||
| 3974 | #else | ||
| 3975 | /* We're getting selection request events, but we don't have | ||
| 3976 | a window system. */ | ||
| 3977 | abort (); | ||
| 3978 | #endif | ||
| 3979 | } | ||
| 3980 | #if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) | 3955 | #if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) |
| 3981 | else if (event->kind == DELETE_WINDOW_EVENT) | 3956 | else if (event->kind == DELETE_WINDOW_EVENT) |
| 3982 | { | 3957 | { |
| @@ -4201,7 +4176,8 @@ swallow_events (do_display) | |||
| 4201 | 4176 | ||
| 4202 | /* These two kinds of events get special handling | 4177 | /* These two kinds of events get special handling |
| 4203 | and don't actually appear to the command loop. */ | 4178 | and don't actually appear to the command loop. */ |
| 4204 | if (event->kind == SELECTION_REQUEST_EVENT) | 4179 | if (event->kind == SELECTION_REQUEST_EVENT |
| 4180 | || event->kind == SELECTION_CLEAR_EVENT) | ||
| 4205 | { | 4181 | { |
| 4206 | #ifdef HAVE_X11 | 4182 | #ifdef HAVE_X11 |
| 4207 | struct input_event copy; | 4183 | struct input_event copy; |
| @@ -4212,25 +4188,7 @@ swallow_events (do_display) | |||
| 4212 | copy = *event; | 4188 | copy = *event; |
| 4213 | kbd_fetch_ptr = event + 1; | 4189 | kbd_fetch_ptr = event + 1; |
| 4214 | input_pending = readable_events (0); | 4190 | input_pending = readable_events (0); |
| 4215 | x_handle_selection_request (©); | 4191 | x_handle_selection_event (©); |
| 4216 | #else | ||
| 4217 | /* We're getting selection request events, but we don't have | ||
| 4218 | a window system. */ | ||
| 4219 | abort (); | ||
| 4220 | #endif | ||
| 4221 | } | ||
| 4222 | |||
| 4223 | else if (event->kind == SELECTION_CLEAR_EVENT) | ||
| 4224 | { | ||
| 4225 | #ifdef HAVE_X11 | ||
| 4226 | struct input_event copy; | ||
| 4227 | |||
| 4228 | /* Remove it from the buffer before processing it, */ | ||
| 4229 | copy = *event; | ||
| 4230 | |||
| 4231 | kbd_fetch_ptr = event + 1; | ||
| 4232 | input_pending = readable_events (0); | ||
| 4233 | x_handle_selection_clear (©); | ||
| 4234 | #else | 4192 | #else |
| 4235 | /* We're getting selection request events, but we don't have | 4193 | /* We're getting selection request events, but we don't have |
| 4236 | a window system. */ | 4194 | a window system. */ |
| @@ -11456,7 +11414,8 @@ mark_kboards () | |||
| 11456 | { | 11414 | { |
| 11457 | if (event == kbd_buffer + KBD_BUFFER_SIZE) | 11415 | if (event == kbd_buffer + KBD_BUFFER_SIZE) |
| 11458 | event = kbd_buffer; | 11416 | event = kbd_buffer; |
| 11459 | if (event->kind != SELECTION_REQUEST_EVENT) | 11417 | if (event->kind != SELECTION_REQUEST_EVENT |
| 11418 | && event->kind != SELECTION_CLEAR_EVENT) | ||
| 11460 | { | 11419 | { |
| 11461 | mark_object (event->x); | 11420 | mark_object (event->x); |
| 11462 | mark_object (event->y); | 11421 | mark_object (event->y); |