diff options
| author | Richard M. Stallman | 1995-07-25 20:13:23 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-07-25 20:13:23 +0000 |
| commit | 2224b90547d14a57ea940acf4e1d908df3a8400a (patch) | |
| tree | 6e94d0245f27c23bb7cde99e04d401a204034ed5 /src | |
| parent | fd3a302261f7250696b177cc7cacfd6d729583f7 (diff) | |
| download | emacs-2224b90547d14a57ea940acf4e1d908df3a8400a.tar.gz emacs-2224b90547d14a57ea940acf4e1d908df3a8400a.zip | |
(next_noop_dpyinfo): New variable.
(XTread_socket): Use that to cycle through all displays for XNoOp.
(XTread_socket) [USE_X_TOOLKIT]: For ButtonPress in menu bar,
save the event--don't pass to Xt yet. Make a menu_bar_activate_event.
(temp_index, temp_buffer): Now static.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/src/xterm.c b/src/xterm.c index 3cd6c347886..798bde90361 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -86,6 +86,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 86 | #ifdef USE_X_TOOLKIT | 86 | #ifdef USE_X_TOOLKIT |
| 87 | extern void free_frame_menubar (); | 87 | extern void free_frame_menubar (); |
| 88 | extern void _XEditResCheckMessages (); | 88 | extern void _XEditResCheckMessages (); |
| 89 | extern FRAME_PTR x_menubar_window_to_frame (); | ||
| 89 | #endif /* USE_X_TOOLKIT */ | 90 | #endif /* USE_X_TOOLKIT */ |
| 90 | 91 | ||
| 91 | #ifndef USE_X_TOOLKIT | 92 | #ifndef USE_X_TOOLKIT |
| @@ -3218,13 +3219,19 @@ static XComposeStatus compose_status; | |||
| 3218 | 3219 | ||
| 3219 | /* Record the last 100 characters stored | 3220 | /* Record the last 100 characters stored |
| 3220 | to help debug the loss-of-chars-during-GC problem. */ | 3221 | to help debug the loss-of-chars-during-GC problem. */ |
| 3221 | int temp_index; | 3222 | static int temp_index; |
| 3222 | short temp_buffer[100]; | 3223 | static short temp_buffer[100]; |
| 3223 | 3224 | ||
| 3224 | /* Set this to nonzero to fake an "X I/O error" | 3225 | /* Set this to nonzero to fake an "X I/O error" |
| 3225 | on a particular display. */ | 3226 | on a particular display. */ |
| 3226 | struct x_display_info *XTread_socket_fake_io_error; | 3227 | struct x_display_info *XTread_socket_fake_io_error; |
| 3227 | 3228 | ||
| 3229 | /* When we find no input here, we occasionally do a no-op command | ||
| 3230 | to verify that the X server is still running and we can still talk with it. | ||
| 3231 | We try all the open displays, one by one. | ||
| 3232 | This variable is used for cycling thru the displays. */ | ||
| 3233 | static struct x_display_info *next_noop_dpyinfo; | ||
| 3234 | |||
| 3228 | /* Read events coming from the X server. | 3235 | /* Read events coming from the X server. |
| 3229 | This routine is called by the SIGIO handler. | 3236 | This routine is called by the SIGIO handler. |
| 3230 | We return as soon as there are no more events to be read. | 3237 | We return as soon as there are no more events to be read. |
| @@ -3965,7 +3972,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 3965 | && FRAME_LIVE_P (last_mouse_frame)) | 3972 | && FRAME_LIVE_P (last_mouse_frame)) |
| 3966 | f = last_mouse_frame; | 3973 | f = last_mouse_frame; |
| 3967 | else | 3974 | else |
| 3968 | f = x_window_to_frame (dpyinfo, event.xmotion.window); | 3975 | f = x_window_to_frame (dpyinfo, event.xbutton.window); |
| 3969 | 3976 | ||
| 3970 | if (f) | 3977 | if (f) |
| 3971 | { | 3978 | { |
| @@ -3979,18 +3986,6 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 3979 | 3986 | ||
| 3980 | if (bar) | 3987 | if (bar) |
| 3981 | x_scroll_bar_handle_click (bar, &event, &emacs_event); | 3988 | x_scroll_bar_handle_click (bar, &event, &emacs_event); |
| 3982 | #if 0 /* It doesn't make sense to do this. | ||
| 3983 | Menu bar clicks are handled within the toolkit itself. */ | ||
| 3984 | #ifdef USE_X_TOOLKIT | ||
| 3985 | else | ||
| 3986 | { | ||
| 3987 | /* Assume we have a menubar button press. A bad | ||
| 3988 | assumption should behave benignly. */ | ||
| 3989 | popup_get_selection (&event, dpyinfo); | ||
| 3990 | break; | ||
| 3991 | } | ||
| 3992 | #endif /* USE_X_TOOLKIT */ | ||
| 3993 | #endif | ||
| 3994 | } | 3989 | } |
| 3995 | 3990 | ||
| 3996 | if (event.type == ButtonPress) | 3991 | if (event.type == ButtonPress) |
| @@ -4012,7 +4007,30 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 4012 | } | 4007 | } |
| 4013 | 4008 | ||
| 4014 | #ifdef USE_X_TOOLKIT | 4009 | #ifdef USE_X_TOOLKIT |
| 4015 | goto OTHER; | 4010 | f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window); |
| 4011 | /* For a down-event in the menu bar, | ||
| 4012 | don't pass it to Xt right now. | ||
| 4013 | Instead, save it away | ||
| 4014 | and we will pass it to Xt from kbd_buffer_get_event. | ||
| 4015 | That way, we can run some Lisp code first. */ | ||
| 4016 | if (f && event.type == ButtonPress) | ||
| 4017 | { | ||
| 4018 | if (f->display.x->saved_button_event == 0) | ||
| 4019 | f->display.x->saved_button_event | ||
| 4020 | = (XButtonEvent *) xmalloc (sizeof (XButtonEvent)); | ||
| 4021 | bcopy (&event, f->display.x->saved_button_event, | ||
| 4022 | sizeof (XButtonEvent)); | ||
| 4023 | if (numchars >= 1) | ||
| 4024 | { | ||
| 4025 | bufp->kind = menu_bar_activate_event; | ||
| 4026 | XSETFRAME (bufp->frame_or_window, f); | ||
| 4027 | bufp++; | ||
| 4028 | count++; | ||
| 4029 | numchars--; | ||
| 4030 | } | ||
| 4031 | } | ||
| 4032 | else | ||
| 4033 | goto OTHER; | ||
| 4016 | #endif /* USE_X_TOOLKIT */ | 4034 | #endif /* USE_X_TOOLKIT */ |
| 4017 | } | 4035 | } |
| 4018 | break; | 4036 | break; |
| @@ -4061,8 +4079,14 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 4061 | if (x_noop_count >= 100) | 4079 | if (x_noop_count >= 100) |
| 4062 | { | 4080 | { |
| 4063 | x_noop_count=0; | 4081 | x_noop_count=0; |
| 4064 | /* Use the first display in the list. Why not? */ | 4082 | |
| 4065 | XNoOp (x_display_list->display); | 4083 | if (next_noop_dpyinfo == 0) |
| 4084 | next_noop_dpyinfo = x_display_list; | ||
| 4085 | |||
| 4086 | XNoOp (next_noop_dpyinfo->display); | ||
| 4087 | |||
| 4088 | /* Each time we get here, cycle through the displays now open. */ | ||
| 4089 | next_noop_dpyinfo = next_noop_dpyinfo->next; | ||
| 4066 | } | 4090 | } |
| 4067 | } | 4091 | } |
| 4068 | 4092 | ||