aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2013-09-16 12:55:50 +0200
committerJoakim Verona2013-09-16 12:55:50 +0200
commit2676aa6d82f3b92f060daa088cffbfdb4c56904d (patch)
treed78196d4cb02b9610064c8864d78c80e9f7d18ae
parent2386911380e1261d50a3eb323853a711c60fcac0 (diff)
parent61582e6aadc24dda730055d9907e7c053dd6218b (diff)
downloademacs-2676aa6d82f3b92f060daa088cffbfdb4c56904d.tar.gz
emacs-2676aa6d82f3b92f060daa088cffbfdb4c56904d.zip
merge from trunk
-rw-r--r--src/ChangeLog21
-rw-r--r--src/gtkutil.c4
-rw-r--r--src/gtkutil.h4
-rw-r--r--src/xselect.c6
-rw-r--r--src/xsettings.c2
-rw-r--r--src/xsettings.h5
-rw-r--r--src/xterm.c404
-rw-r--r--src/xterm.h13
8 files changed, 226 insertions, 233 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 10349aea412..4b862f27a02 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,26 @@
12013-09-16 Dmitry Antipov <dmantipov@yandex.ru> 12013-09-16 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 Do not copy X event in handle_one_xevent except KeyPress case.
4 Wnen XEvent is processed, it is unlikely to be changed except
5 KeyPress case, so we can avoid copying and use const pointer to
6 const data to make sure that an event is not changed elsewhere.
7 * xterm.c (handle_one_xevent): Change 2nd arg to 'const XEvent *
8 const' and do not create local copy except for the KeyPress event.
9 Use casts to avoid a few glitches. Adjust formatting. Add comments.
10 (SET_SAVED_BUTTON_EVENT): Remove and move the code to the only user.
11 (x_handle_net_wm_state, x_menubar_window_to_frame)
12 (x_detect_focus_change, construct_mouse_click, note_mouse_movement)
13 (x_scroll_bar_to_input_event, x_scroll_bar_expose)
14 (x_scroll_bar_handle_click, x_scroll_bar_note_movement):
15 * gtkutil.c (xg_event_is_for_menubar, xg_event_is_for_scrollbar):
16 * xselect.c (x_handle_property_notify, x_handle_selection_notify)
17 (x_handle_dnd_message):
18 * xsettings.c (xft_settings_event):
19 Use 'const XEvent * const' where appropriate.
20 * xterm.h, gtkutil.h, xsettngs.h: Adjust related prototypes.
21
222013-09-16 Dmitry Antipov <dmantipov@yandex.ru>
23
3 Fix X event waiting to handle multiple frames. 24 Fix X event waiting to handle multiple frames.
4 * frame.h (struct frame) [HAVE_X_WINDOWS]: New member wait_event_type. 25 * frame.h (struct frame) [HAVE_X_WINDOWS]: New member wait_event_type.
5 * xterm.c (pending_event_wait): Remove. Adjust users. 26 * xterm.c (pending_event_wait): Remove. Adjust users.
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 95154ef9b52..57b7b58d9d6 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3409,7 +3409,7 @@ free_frame_menubar (struct frame *f)
3409} 3409}
3410 3410
3411bool 3411bool
3412xg_event_is_for_menubar (struct frame *f, XEvent *event) 3412xg_event_is_for_menubar (struct frame *f, const XEvent * const event)
3413{ 3413{
3414 struct x_output *x = f->output_data.x; 3414 struct x_output *x = f->output_data.x;
3415 GList *iter; 3415 GList *iter;
@@ -3861,7 +3861,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3861 frame. This function does additional checks. */ 3861 frame. This function does additional checks. */
3862 3862
3863bool 3863bool
3864xg_event_is_for_scrollbar (struct frame *f, XEvent *event) 3864xg_event_is_for_scrollbar (struct frame *f, const XEvent * const event)
3865{ 3865{
3866 bool retval = 0; 3866 bool retval = 0;
3867 3867
diff --git a/src/gtkutil.h b/src/gtkutil.h
index fc959862fd3..57971cf4a38 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -105,7 +105,7 @@ extern void xg_modify_menubar_widgets (GtkWidget *menubar,
105 105
106extern void xg_update_frame_menubar (struct frame *f); 106extern void xg_update_frame_menubar (struct frame *f);
107 107
108extern bool xg_event_is_for_menubar (struct frame *f, XEvent *event); 108extern bool xg_event_is_for_menubar (struct frame *, const XEvent * const);
109 109
110extern bool xg_have_tear_offs (void); 110extern bool xg_have_tear_offs (void);
111 111
@@ -129,7 +129,7 @@ extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
129 int portion, 129 int portion,
130 int position, 130 int position,
131 int whole); 131 int whole);
132extern bool xg_event_is_for_scrollbar (struct frame *f, XEvent *event); 132extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent * const);
133extern int xg_get_default_scrollbar_width (void); 133extern int xg_get_default_scrollbar_width (void);
134 134
135extern void update_frame_tool_bar (struct frame *f); 135extern void update_frame_tool_bar (struct frame *f);
diff --git a/src/xselect.c b/src/xselect.c
index 238eea50df6..cec91e41e75 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1141,7 +1141,7 @@ wait_for_property_change (struct prop_location *location)
1141/* Called from XTread_socket in response to a PropertyNotify event. */ 1141/* Called from XTread_socket in response to a PropertyNotify event. */
1142 1142
1143void 1143void
1144x_handle_property_notify (XPropertyEvent *event) 1144x_handle_property_notify (const XPropertyEvent * const event)
1145{ 1145{
1146 struct prop_location *rest; 1146 struct prop_location *rest;
1147 1147
@@ -1888,7 +1888,7 @@ clean_local_selection_data (Lisp_Object obj)
1888 We store t there if the reply is successful, lambda if not. */ 1888 We store t there if the reply is successful, lambda if not. */
1889 1889
1890void 1890void
1891x_handle_selection_notify (XSelectionEvent *event) 1891x_handle_selection_notify (const XSelectionEvent * const event)
1892{ 1892{
1893 if (event->requestor != reading_selection_window) 1893 if (event->requestor != reading_selection_window)
1894 return; 1894 return;
@@ -2488,7 +2488,7 @@ FRAME is on. If FRAME is nil, the selected frame is used. */)
2488/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ 2488/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */
2489 2489
2490int 2490int
2491x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, 2491x_handle_dnd_message (struct frame *f, const XClientMessageEvent * const event,
2492 struct x_display_info *dpyinfo, struct input_event *bufp) 2492 struct x_display_info *dpyinfo, struct input_event *bufp)
2493{ 2493{
2494 Lisp_Object vec; 2494 Lisp_Object vec;
diff --git a/src/xsettings.c b/src/xsettings.c
index b5d5f4db59b..b9813e2b369 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -754,7 +754,7 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
754/* Check if EVENT for the display in DPYINFO is XSettings related. */ 754/* Check if EVENT for the display in DPYINFO is XSettings related. */
755 755
756void 756void
757xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) 757xft_settings_event (struct x_display_info *dpyinfo, const XEvent * const event)
758{ 758{
759 bool check_window_p = 0, apply_settings_p = 0; 759 bool check_window_p = 0, apply_settings_p = 0;
760 760
diff --git a/src/xsettings.h b/src/xsettings.h
index e3738c593bd..4407ca7df92 100644
--- a/src/xsettings.h
+++ b/src/xsettings.h
@@ -20,9 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#ifndef XSETTINGS_H 20#ifndef XSETTINGS_H
21#define XSETTINGS_H 21#define XSETTINGS_H
22 22
23extern void xsettings_initialize (struct x_display_info *dpyinfo); 23extern void xsettings_initialize (struct x_display_info *);
24extern void xft_settings_event (struct x_display_info *dpyinfo, 24extern void xft_settings_event (struct x_display_info *, const XEvent * const);
25 XEvent *);
26extern const char *xsettings_get_system_font (void); 25extern const char *xsettings_get_system_font (void);
27#ifdef USE_LUCID 26#ifdef USE_LUCID
28extern const char *xsettings_get_system_normal_font (void); 27extern const char *xsettings_get_system_normal_font (void);
diff --git a/src/xterm.c b/src/xterm.c
index cb29caddb41..c548443157d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -305,12 +305,13 @@ static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
305 enum scroll_bar_part *, 305 enum scroll_bar_part *,
306 Lisp_Object *, Lisp_Object *, 306 Lisp_Object *, Lisp_Object *,
307 Time *); 307 Time *);
308static int x_handle_net_wm_state (struct frame *, XPropertyEvent *); 308static int x_handle_net_wm_state (struct frame *, const XPropertyEvent * const);
309static void x_check_fullscreen (struct frame *); 309static void x_check_fullscreen (struct frame *);
310static void x_check_expected_move (struct frame *, int, int); 310static void x_check_expected_move (struct frame *, int, int);
311static void x_sync_with_move (struct frame *, int, int, int); 311static void x_sync_with_move (struct frame *, int, int, int);
312static int handle_one_xevent (struct x_display_info *, XEvent *, 312static int handle_one_xevent (struct x_display_info *,
313 int *, struct input_event *); 313 const XEvent * const, int *,
314 struct input_event *);
314#ifdef USE_GTK 315#ifdef USE_GTK
315static int x_dispatch_event (XEvent *, Display *); 316static int x_dispatch_event (XEvent *, Display *);
316#endif 317#endif
@@ -3468,7 +3469,8 @@ x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
3468/* Likewise, but consider only the menu bar widget. */ 3469/* Likewise, but consider only the menu bar widget. */
3469 3470
3470static struct frame * 3471static struct frame *
3471x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event) 3472x_menubar_window_to_frame (struct x_display_info *dpyinfo,
3473 const XEvent * const event)
3472{ 3474{
3473 Window wdesc = event->xany.window; 3475 Window wdesc = event->xany.window;
3474 Lisp_Object tail, frame; 3476 Lisp_Object tail, frame;
@@ -3550,7 +3552,7 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
3550 3552
3551static void 3553static void
3552x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, 3554x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame,
3553 XEvent *event, struct input_event *bufp) 3555 const XEvent * const event, struct input_event *bufp)
3554{ 3556{
3555 if (!frame) 3557 if (!frame)
3556 return; 3558 return;
@@ -3840,7 +3842,9 @@ x_get_keysym_name (int keysym)
3840 the mouse. */ 3842 the mouse. */
3841 3843
3842static Lisp_Object 3844static Lisp_Object
3843construct_mouse_click (struct input_event *result, XButtonEvent *event, struct frame *f) 3845construct_mouse_click (struct input_event *result,
3846 const XButtonEvent * const event,
3847 struct frame *f)
3844{ 3848{
3845 /* Make the event type NO_EVENT; we'll change that when we decide 3849 /* Make the event type NO_EVENT; we'll change that when we decide
3846 otherwise. */ 3850 otherwise. */
@@ -3872,7 +3876,7 @@ static XMotionEvent last_mouse_motion_event;
3872static Lisp_Object last_mouse_motion_frame; 3876static Lisp_Object last_mouse_motion_frame;
3873 3877
3874static int 3878static int
3875note_mouse_movement (struct frame *frame, XMotionEvent *event) 3879note_mouse_movement (struct frame *frame, const XMotionEvent * const event)
3876{ 3880{
3877 last_mouse_movement_time = event->time; 3881 last_mouse_movement_time = event->time;
3878 last_mouse_motion_event = *event; 3882 last_mouse_motion_event = *event;
@@ -4216,13 +4220,7 @@ x_window_to_menu_bar (Window window)
4216 4220
4217#ifdef USE_TOOLKIT_SCROLL_BARS 4221#ifdef USE_TOOLKIT_SCROLL_BARS
4218 4222
4219static void x_scroll_bar_to_input_event (XEvent *, struct input_event *);
4220static void x_send_scroll_bar_event (Lisp_Object, int, int, int); 4223static void x_send_scroll_bar_event (Lisp_Object, int, int, int);
4221static void x_create_toolkit_scroll_bar (struct frame *,
4222 struct scroll_bar *);
4223static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *,
4224 int, int, int);
4225
4226 4224
4227/* Lisp window being scrolled. Set when starting to interact with 4225/* Lisp window being scrolled. Set when starting to interact with
4228 a toolkit scroll bar, reset to nil when ending the interaction. */ 4226 a toolkit scroll bar, reset to nil when ending the interaction. */
@@ -4369,7 +4367,8 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
4369 in *IEVENT. */ 4367 in *IEVENT. */
4370 4368
4371static void 4369static void
4372x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent) 4370x_scroll_bar_to_input_event (const XEvent * const event,
4371 struct input_event *ievent)
4373{ 4372{
4374 XClientMessageEvent *ev = (XClientMessageEvent *) event; 4373 XClientMessageEvent *ev = (XClientMessageEvent *) event;
4375 Lisp_Object window; 4374 Lisp_Object window;
@@ -5513,7 +5512,7 @@ XTjudge_scroll_bars (struct frame *f)
5513 mark bits. */ 5512 mark bits. */
5514 5513
5515static void 5514static void
5516x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) 5515x_scroll_bar_expose (struct scroll_bar *bar, const XEvent * const event)
5517{ 5516{
5518 Window w = bar->x_window; 5517 Window w = bar->x_window;
5519 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5518 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
@@ -5551,7 +5550,9 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
5551 5550
5552 5551
5553static void 5552static void
5554x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_event *emacs_event) 5553x_scroll_bar_handle_click (struct scroll_bar *bar,
5554 const XEvent * const event,
5555 struct input_event *emacs_event)
5555{ 5556{
5556 if (! WINDOWP (bar->window)) 5557 if (! WINDOWP (bar->window))
5557 emacs_abort (); 5558 emacs_abort ();
@@ -5608,7 +5609,8 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e
5608 mark bits. */ 5609 mark bits. */
5609 5610
5610static void 5611static void
5611x_scroll_bar_note_movement (struct scroll_bar *bar, XMotionEvent *event) 5612x_scroll_bar_note_movement (struct scroll_bar *bar,
5613 const XMotionEvent * const event)
5612{ 5614{
5613 struct frame *f = XFRAME (XWINDOW (bar->window)->frame); 5615 struct frame *f = XFRAME (XWINDOW (bar->window)->frame);
5614 5616
@@ -5760,20 +5762,6 @@ static struct x_display_info *XTread_socket_fake_io_error;
5760 5762
5761static struct x_display_info *next_noop_dpyinfo; 5763static struct x_display_info *next_noop_dpyinfo;
5762 5764
5763#if defined USE_X_TOOLKIT || defined USE_GTK
5764#define SET_SAVED_BUTTON_EVENT \
5765 do \
5766 { \
5767 if (f->output_data.x->saved_menu_event == 0) \
5768 f->output_data.x->saved_menu_event = \
5769 xmalloc (sizeof (XEvent)); \
5770 *f->output_data.x->saved_menu_event = event; \
5771 inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \
5772 XSETFRAME (inev.ie.frame_or_window, f); \
5773 } \
5774 while (0)
5775#endif
5776
5777enum 5765enum
5778{ 5766{
5779 X_EVENT_NORMAL, 5767 X_EVENT_NORMAL,
@@ -5867,11 +5855,13 @@ static void xembed_send_message (struct frame *f, Time,
5867 *FINISH is X_EVENT_GOTO_OUT if caller should stop reading events. 5855 *FINISH is X_EVENT_GOTO_OUT if caller should stop reading events.
5868 *FINISH is zero if caller should continue reading events. 5856 *FINISH is zero if caller should continue reading events.
5869 *FINISH is X_EVENT_DROP if event should not be passed to the toolkit. 5857 *FINISH is X_EVENT_DROP if event should not be passed to the toolkit.
5858 *EVENT is unchanged unless we're processing KeyPress event.
5870 5859
5871 We return the number of characters stored into the buffer. */ 5860 We return the number of characters stored into the buffer. */
5872 5861
5873static int 5862static int
5874handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, 5863handle_one_xevent (struct x_display_info *dpyinfo,
5864 const XEvent * const event,
5875 int *finish, struct input_event *hold_quit) 5865 int *finish, struct input_event *hold_quit)
5876{ 5866{
5877 union { 5867 union {
@@ -5883,7 +5873,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
5883 ptrdiff_t nbytes = 0; 5873 ptrdiff_t nbytes = 0;
5884 struct frame *any, *f = NULL; 5874 struct frame *any, *f = NULL;
5885 struct coding_system coding; 5875 struct coding_system coding;
5886 XEvent event = *eventptr;
5887 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; 5876 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5888 /* This holds the state XLookupString needs to implement dead keys 5877 /* This holds the state XLookupString needs to implement dead keys
5889 and other tricks known as "compose processing". _X Window System_ 5878 and other tricks known as "compose processing". _X Window System_
@@ -5899,21 +5888,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
5899 inev.ie.kind = NO_EVENT; 5888 inev.ie.kind = NO_EVENT;
5900 inev.ie.arg = Qnil; 5889 inev.ie.arg = Qnil;
5901 5890
5902 any = x_any_window_to_frame (dpyinfo, event.xany.window); 5891 any = x_any_window_to_frame (dpyinfo, event->xany.window);
5903 5892
5904 if (any && any->wait_event_type == event.type) 5893 if (any && any->wait_event_type == event->type)
5905 any->wait_event_type = 0; /* Indicates we got it. */ 5894 any->wait_event_type = 0; /* Indicates we got it. */
5906 5895
5907 switch (event.type) 5896 switch (event->type)
5908 { 5897 {
5909 case ClientMessage: 5898 case ClientMessage:
5910 { 5899 {
5911 if (event.xclient.message_type 5900 if (event->xclient.message_type == dpyinfo->Xatom_wm_protocols
5912 == dpyinfo->Xatom_wm_protocols 5901 && event->xclient.format == 32)
5913 && event.xclient.format == 32)
5914 { 5902 {
5915 if (event.xclient.data.l[0] 5903 if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_take_focus)
5916 == dpyinfo->Xatom_wm_take_focus)
5917 { 5904 {
5918 /* Use the value returned by x_any_window_to_frame 5905 /* Use the value returned by x_any_window_to_frame
5919 because this could be the shell widget window 5906 because this could be the shell widget window
@@ -5942,15 +5929,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
5942 since that might be an event for a deleted frame. */ 5929 since that might be an event for a deleted frame. */
5943 if (f) 5930 if (f)
5944 { 5931 {
5945 Display *d = event.xclient.display; 5932 Display *d = event->xclient.display;
5946 /* Catch and ignore errors, in case window has been 5933 /* Catch and ignore errors, in case window has been
5947 iconified by a window manager such as GWM. */ 5934 iconified by a window manager such as GWM. */
5948 x_catch_errors (d); 5935 x_catch_errors (d);
5949 XSetInputFocus (d, event.xclient.window, 5936 XSetInputFocus (d, event->xclient.window,
5950 /* The ICCCM says this is 5937 /* The ICCCM says this is
5951 the only valid choice. */ 5938 the only valid choice. */
5952 RevertToParent, 5939 RevertToParent,
5953 event.xclient.data.l[1]); 5940 event->xclient.data.l[1]);
5954 /* This is needed to detect the error 5941 /* This is needed to detect the error
5955 if there is an error. */ 5942 if there is an error. */
5956 XSync (d, False); 5943 XSync (d, False);
@@ -5961,8 +5948,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
5961 goto done; 5948 goto done;
5962 } 5949 }
5963 5950
5964 if (event.xclient.data.l[0] 5951 if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_save_yourself)
5965 == dpyinfo->Xatom_wm_save_yourself)
5966 { 5952 {
5967 /* Save state modify the WM_COMMAND property to 5953 /* Save state modify the WM_COMMAND property to
5968 something which can reinstate us. This notifies 5954 something which can reinstate us. This notifies
@@ -5977,23 +5963,22 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
5977#endif 5963#endif
5978 { 5964 {
5979 f = x_top_window_to_frame (dpyinfo, 5965 f = x_top_window_to_frame (dpyinfo,
5980 event.xclient.window); 5966 event->xclient.window);
5981 /* This is just so we only give real data once 5967 /* This is just so we only give real data once
5982 for a single Emacs process. */ 5968 for a single Emacs process. */
5983 if (f == SELECTED_FRAME ()) 5969 if (f == SELECTED_FRAME ())
5984 XSetCommand (FRAME_X_DISPLAY (f), 5970 XSetCommand (FRAME_X_DISPLAY (f),
5985 event.xclient.window, 5971 event->xclient.window,
5986 initial_argv, initial_argc); 5972 initial_argv, initial_argc);
5987 else if (f) 5973 else if (f)
5988 XSetCommand (FRAME_X_DISPLAY (f), 5974 XSetCommand (FRAME_X_DISPLAY (f),
5989 event.xclient.window, 5975 event->xclient.window,
5990 0, 0); 5976 0, 0);
5991 } 5977 }
5992 goto done; 5978 goto done;
5993 } 5979 }
5994 5980
5995 if (event.xclient.data.l[0] 5981 if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_delete_window)
5996 == dpyinfo->Xatom_wm_delete_window)
5997 { 5982 {
5998 f = any; 5983 f = any;
5999 if (!f) 5984 if (!f)
@@ -6007,20 +5992,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6007 goto done; 5992 goto done;
6008 } 5993 }
6009 5994
6010 if (event.xclient.message_type 5995 if (event->xclient.message_type == dpyinfo->Xatom_wm_configure_denied)
6011 == dpyinfo->Xatom_wm_configure_denied) 5996 goto done;
6012 {
6013 goto done;
6014 }
6015 5997
6016 if (event.xclient.message_type 5998 if (event->xclient.message_type == dpyinfo->Xatom_wm_window_moved)
6017 == dpyinfo->Xatom_wm_window_moved)
6018 { 5999 {
6019 int new_x, new_y; 6000 int new_x, new_y;
6020 f = x_window_to_frame (dpyinfo, event.xclient.window); 6001 f = x_window_to_frame (dpyinfo, event->xclient.window);
6021 6002
6022 new_x = event.xclient.data.s[0]; 6003 new_x = event->xclient.data.s[0];
6023 new_y = event.xclient.data.s[1]; 6004 new_y = event->xclient.data.s[1];
6024 6005
6025 if (f) 6006 if (f)
6026 { 6007 {
@@ -6031,28 +6012,25 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6031 } 6012 }
6032 6013
6033#ifdef HACK_EDITRES 6014#ifdef HACK_EDITRES
6034 if (event.xclient.message_type 6015 if (event->xclient.message_type == dpyinfo->Xatom_editres)
6035 == dpyinfo->Xatom_editres)
6036 { 6016 {
6037 f = any; 6017 f = any;
6038 if (f) 6018 if (f)
6039 _XEditResCheckMessages (f->output_data.x->widget, NULL, 6019 _XEditResCheckMessages (f->output_data.x->widget,
6040 &event, NULL); 6020 NULL, (XEvent *) event, NULL);
6041 goto done; 6021 goto done;
6042 } 6022 }
6043#endif /* HACK_EDITRES */ 6023#endif /* HACK_EDITRES */
6044 6024
6045 if ((event.xclient.message_type 6025 if (event->xclient.message_type == dpyinfo->Xatom_DONE
6046 == dpyinfo->Xatom_DONE) 6026 || event->xclient.message_type == dpyinfo->Xatom_PAGE)
6047 || (event.xclient.message_type
6048 == dpyinfo->Xatom_PAGE))
6049 { 6027 {
6050 /* Ghostview job completed. Kill it. We could 6028 /* Ghostview job completed. Kill it. We could
6051 reply with "Next" if we received "Page", but we 6029 reply with "Next" if we received "Page", but we
6052 currently never do because we are interested in 6030 currently never do because we are interested in
6053 images, only, which should have 1 page. */ 6031 images, only, which should have 1 page. */
6054 Pixmap pixmap = (Pixmap) event.xclient.data.l[1]; 6032 Pixmap pixmap = (Pixmap) event->xclient.data.l[1];
6055 f = x_window_to_frame (dpyinfo, event.xclient.window); 6033 f = x_window_to_frame (dpyinfo, event->xclient.window);
6056 if (!f) 6034 if (!f)
6057 goto OTHER; 6035 goto OTHER;
6058 x_kill_gs_process (pixmap, f); 6036 x_kill_gs_process (pixmap, f);
@@ -6063,54 +6041,52 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6063#ifdef USE_TOOLKIT_SCROLL_BARS 6041#ifdef USE_TOOLKIT_SCROLL_BARS
6064 /* Scroll bar callbacks send a ClientMessage from which 6042 /* Scroll bar callbacks send a ClientMessage from which
6065 we construct an input_event. */ 6043 we construct an input_event. */
6066 if (event.xclient.message_type 6044 if (event->xclient.message_type == dpyinfo->Xatom_Scrollbar)
6067 == dpyinfo->Xatom_Scrollbar)
6068 { 6045 {
6069 x_scroll_bar_to_input_event (&event, &inev.ie); 6046 x_scroll_bar_to_input_event (event, &inev.ie);
6070 *finish = X_EVENT_GOTO_OUT; 6047 *finish = X_EVENT_GOTO_OUT;
6071 goto done; 6048 goto done;
6072 } 6049 }
6073#endif /* USE_TOOLKIT_SCROLL_BARS */ 6050#endif /* USE_TOOLKIT_SCROLL_BARS */
6074 6051
6075 /* XEmbed messages from the embedder (if any). */ 6052 /* XEmbed messages from the embedder (if any). */
6076 if (event.xclient.message_type 6053 if (event->xclient.message_type == dpyinfo->Xatom_XEMBED)
6077 == dpyinfo->Xatom_XEMBED)
6078 { 6054 {
6079 enum xembed_message msg = event.xclient.data.l[1]; 6055 enum xembed_message msg = event->xclient.data.l[1];
6080 if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT) 6056 if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT)
6081 x_detect_focus_change (dpyinfo, any, &event, &inev.ie); 6057 x_detect_focus_change (dpyinfo, any, event, &inev.ie);
6082 6058
6083 *finish = X_EVENT_GOTO_OUT; 6059 *finish = X_EVENT_GOTO_OUT;
6084 goto done; 6060 goto done;
6085 } 6061 }
6086 6062
6087 xft_settings_event (dpyinfo, &event); 6063 xft_settings_event (dpyinfo, event);
6088 6064
6089 f = any; 6065 f = any;
6090 if (!f) 6066 if (!f)
6091 goto OTHER; 6067 goto OTHER;
6092 if (x_handle_dnd_message (f, &event.xclient, dpyinfo, &inev.ie)) 6068 if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev.ie))
6093 *finish = X_EVENT_DROP; 6069 *finish = X_EVENT_DROP;
6094 } 6070 }
6095 break; 6071 break;
6096 6072
6097 case SelectionNotify: 6073 case SelectionNotify:
6098 dpyinfo->last_user_time = event.xselection.time; 6074 dpyinfo->last_user_time = event->xselection.time;
6099#ifdef USE_X_TOOLKIT 6075#ifdef USE_X_TOOLKIT
6100 if (! x_window_to_frame (dpyinfo, event.xselection.requestor)) 6076 if (! x_window_to_frame (dpyinfo, event->xselection.requestor))
6101 goto OTHER; 6077 goto OTHER;
6102#endif /* not USE_X_TOOLKIT */ 6078#endif /* not USE_X_TOOLKIT */
6103 x_handle_selection_notify (&event.xselection); 6079 x_handle_selection_notify (&event->xselection);
6104 break; 6080 break;
6105 6081
6106 case SelectionClear: /* Someone has grabbed ownership. */ 6082 case SelectionClear: /* Someone has grabbed ownership. */
6107 dpyinfo->last_user_time = event.xselectionclear.time; 6083 dpyinfo->last_user_time = event->xselectionclear.time;
6108#ifdef USE_X_TOOLKIT 6084#ifdef USE_X_TOOLKIT
6109 if (! x_window_to_frame (dpyinfo, event.xselectionclear.window)) 6085 if (! x_window_to_frame (dpyinfo, event->xselectionclear.window))
6110 goto OTHER; 6086 goto OTHER;
6111#endif /* USE_X_TOOLKIT */ 6087#endif /* USE_X_TOOLKIT */
6112 { 6088 {
6113 XSelectionClearEvent *eventp = &(event.xselectionclear); 6089 const XSelectionClearEvent * const eventp = &event->xselectionclear;
6114 6090
6115 inev.ie.kind = SELECTION_CLEAR_EVENT; 6091 inev.ie.kind = SELECTION_CLEAR_EVENT;
6116 SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; 6092 SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;
@@ -6120,29 +6096,29 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6120 break; 6096 break;
6121 6097
6122 case SelectionRequest: /* Someone wants our selection. */ 6098 case SelectionRequest: /* Someone wants our selection. */
6123 dpyinfo->last_user_time = event.xselectionrequest.time; 6099 dpyinfo->last_user_time = event->xselectionrequest.time;
6124#ifdef USE_X_TOOLKIT 6100#ifdef USE_X_TOOLKIT
6125 if (!x_window_to_frame (dpyinfo, event.xselectionrequest.owner)) 6101 if (!x_window_to_frame (dpyinfo, event->xselectionrequest.owner))
6126 goto OTHER; 6102 goto OTHER;
6127#endif /* USE_X_TOOLKIT */ 6103#endif /* USE_X_TOOLKIT */
6128 { 6104 {
6129 XSelectionRequestEvent *eventp = &(event.xselectionrequest); 6105 const XSelectionRequestEvent * const eventp = &event->xselectionrequest;
6130 6106
6131 inev.ie.kind = SELECTION_REQUEST_EVENT; 6107 inev.ie.kind = SELECTION_REQUEST_EVENT;
6132 SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; 6108 SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;
6133 SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor; 6109 SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor;
6134 SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection; 6110 SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection;
6135 SELECTION_EVENT_TARGET (&inev.sie) = eventp->target; 6111 SELECTION_EVENT_TARGET (&inev.sie) = eventp->target;
6136 SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property; 6112 SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property;
6137 SELECTION_EVENT_TIME (&inev.sie) = eventp->time; 6113 SELECTION_EVENT_TIME (&inev.sie) = eventp->time;
6138 } 6114 }
6139 break; 6115 break;
6140 6116
6141 case PropertyNotify: 6117 case PropertyNotify:
6142 dpyinfo->last_user_time = event.xproperty.time; 6118 dpyinfo->last_user_time = event->xproperty.time;
6143 f = x_top_window_to_frame (dpyinfo, event.xproperty.window); 6119 f = x_top_window_to_frame (dpyinfo, event->xproperty.window);
6144 if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state) 6120 if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state)
6145 if (x_handle_net_wm_state (f, &event.xproperty) 6121 if (x_handle_net_wm_state (f, &event->xproperty)
6146 && FRAME_ICONIFIED_P (f) 6122 && FRAME_ICONIFIED_P (f)
6147 && f->output_data.x->net_wm_state_hidden_seen) 6123 && f->output_data.x->net_wm_state_hidden_seen)
6148 { 6124 {
@@ -6157,16 +6133,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6157 XSETFRAME (inev.ie.frame_or_window, f); 6133 XSETFRAME (inev.ie.frame_or_window, f);
6158 } 6134 }
6159 6135
6160 x_handle_property_notify (&event.xproperty); 6136 x_handle_property_notify (&event->xproperty);
6161 xft_settings_event (dpyinfo, &event); 6137 xft_settings_event (dpyinfo, event);
6162 goto OTHER; 6138 goto OTHER;
6163 6139
6164 case ReparentNotify: 6140 case ReparentNotify:
6165 f = x_top_window_to_frame (dpyinfo, event.xreparent.window); 6141 f = x_top_window_to_frame (dpyinfo, event->xreparent.window);
6166 if (f) 6142 if (f)
6167 { 6143 {
6168 int x, y; 6144 int x, y;
6169 f->output_data.x->parent_desc = event.xreparent.parent; 6145 f->output_data.x->parent_desc = event->xreparent.parent;
6170 x_real_positions (f, &x, &y); 6146 x_real_positions (f, &x, &y);
6171 f->left_pos = x; 6147 f->left_pos = x;
6172 f->top_pos = y; 6148 f->top_pos = y;
@@ -6180,15 +6156,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6180 goto OTHER; 6156 goto OTHER;
6181 6157
6182 case Expose: 6158 case Expose:
6183 f = x_window_to_frame (dpyinfo, event.xexpose.window); 6159 f = x_window_to_frame (dpyinfo, event->xexpose.window);
6184 if (f) 6160 if (f)
6185 { 6161 {
6186#ifdef USE_GTK 6162#ifdef USE_GTK
6187 /* This seems to be needed for GTK 2.6. */ 6163 /* This seems to be needed for GTK 2.6. */
6188 x_clear_area (event.xexpose.display, 6164 x_clear_area (event->xexpose.display,
6189 event.xexpose.window, 6165 event->xexpose.window,
6190 event.xexpose.x, event.xexpose.y, 6166 event->xexpose.x, event->xexpose.y,
6191 event.xexpose.width, event.xexpose.height); 6167 event->xexpose.width, event->xexpose.height);
6192#endif 6168#endif
6193 if (!FRAME_VISIBLE_P (f)) 6169 if (!FRAME_VISIBLE_P (f))
6194 { 6170 {
@@ -6198,9 +6174,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6198 SET_FRAME_GARBAGED (f); 6174 SET_FRAME_GARBAGED (f);
6199 } 6175 }
6200 else 6176 else
6201 expose_frame (f, 6177 expose_frame (f, event->xexpose.x, event->xexpose.y,
6202 event.xexpose.x, event.xexpose.y, 6178 event->xexpose.width, event->xexpose.height);
6203 event.xexpose.width, event.xexpose.height);
6204 } 6179 }
6205 else 6180 else
6206 { 6181 {
@@ -6212,8 +6187,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6212 themselves, so there's no way to dispatch events 6187 themselves, so there's no way to dispatch events
6213 to them. Recognize this case separately. */ 6188 to them. Recognize this case separately. */
6214 { 6189 {
6215 Widget widget 6190 Widget widget = x_window_to_menu_bar (event->xexpose.window);
6216 = x_window_to_menu_bar (event.xexpose.window);
6217 if (widget) 6191 if (widget)
6218 xlwmenu_redisplay (widget); 6192 xlwmenu_redisplay (widget);
6219 } 6193 }
@@ -6223,11 +6197,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6223 /* Dispatch event to the widget. */ 6197 /* Dispatch event to the widget. */
6224 goto OTHER; 6198 goto OTHER;
6225#else /* not USE_TOOLKIT_SCROLL_BARS */ 6199#else /* not USE_TOOLKIT_SCROLL_BARS */
6226 bar = x_window_to_scroll_bar (event.xexpose.display, 6200 bar = x_window_to_scroll_bar (event->xexpose.display,
6227 event.xexpose.window); 6201 event->xexpose.window);
6228 6202
6229 if (bar) 6203 if (bar)
6230 x_scroll_bar_expose (bar, &event); 6204 x_scroll_bar_expose (bar, event);
6231#ifdef USE_X_TOOLKIT 6205#ifdef USE_X_TOOLKIT
6232 else 6206 else
6233 goto OTHER; 6207 goto OTHER;
@@ -6239,14 +6213,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6239 case GraphicsExpose: /* This occurs when an XCopyArea's 6213 case GraphicsExpose: /* This occurs when an XCopyArea's
6240 source area was obscured or not 6214 source area was obscured or not
6241 available. */ 6215 available. */
6242 f = x_window_to_frame (dpyinfo, event.xgraphicsexpose.drawable); 6216 f = x_window_to_frame (dpyinfo, event->xgraphicsexpose.drawable);
6243 if (f) 6217 if (f)
6244 { 6218 expose_frame (f, event->xgraphicsexpose.x,
6245 expose_frame (f, 6219 event->xgraphicsexpose.y,
6246 event.xgraphicsexpose.x, event.xgraphicsexpose.y, 6220 event->xgraphicsexpose.width,
6247 event.xgraphicsexpose.width, 6221 event->xgraphicsexpose.height);
6248 event.xgraphicsexpose.height);
6249 }
6250#ifdef USE_X_TOOLKIT 6222#ifdef USE_X_TOOLKIT
6251 else 6223 else
6252 goto OTHER; 6224 goto OTHER;
@@ -6260,13 +6232,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6260 6232
6261 case UnmapNotify: 6233 case UnmapNotify:
6262 /* Redo the mouse-highlight after the tooltip has gone. */ 6234 /* Redo the mouse-highlight after the tooltip has gone. */
6263 if (event.xunmap.window == tip_window) 6235 if (event->xunmap.window == tip_window)
6264 { 6236 {
6265 tip_window = 0; 6237 tip_window = 0;
6266 redo_mouse_highlight (); 6238 redo_mouse_highlight ();
6267 } 6239 }
6268 6240
6269 f = x_top_window_to_frame (dpyinfo, event.xunmap.window); 6241 f = x_top_window_to_frame (dpyinfo, event->xunmap.window);
6270 if (f) /* F may no longer exist if 6242 if (f) /* F may no longer exist if
6271 the frame was deleted. */ 6243 the frame was deleted. */
6272 { 6244 {
@@ -6291,7 +6263,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6291 goto OTHER; 6263 goto OTHER;
6292 6264
6293 case MapNotify: 6265 case MapNotify:
6294 if (event.xmap.window == tip_window) 6266 if (event->xmap.window == tip_window)
6295 /* The tooltip has been drawn already. Avoid 6267 /* The tooltip has been drawn already. Avoid
6296 the SET_FRAME_GARBAGED below. */ 6268 the SET_FRAME_GARBAGED below. */
6297 goto OTHER; 6269 goto OTHER;
@@ -6299,7 +6271,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6299 /* We use x_top_window_to_frame because map events can 6271 /* We use x_top_window_to_frame because map events can
6300 come for sub-windows and they don't mean that the 6272 come for sub-windows and they don't mean that the
6301 frame is visible. */ 6273 frame is visible. */
6302 f = x_top_window_to_frame (dpyinfo, event.xmap.window); 6274 f = x_top_window_to_frame (dpyinfo, event->xmap.window);
6303 if (f) 6275 if (f)
6304 { 6276 {
6305 bool iconified = FRAME_ICONIFIED_P (f); 6277 bool iconified = FRAME_ICONIFIED_P (f);
@@ -6339,7 +6311,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6339 6311
6340 case KeyPress: 6312 case KeyPress:
6341 6313
6342 dpyinfo->last_user_time = event.xkey.time; 6314 dpyinfo->last_user_time = event->xkey.time;
6343 ignore_next_mouse_click_timeout = 0; 6315 ignore_next_mouse_click_timeout = 0;
6344 6316
6345#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6317#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
@@ -6368,7 +6340,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6368 /* Scroll bars consume key events, but we want 6340 /* Scroll bars consume key events, but we want
6369 the keys to go to the scroll bar's frame. */ 6341 the keys to go to the scroll bar's frame. */
6370 Widget widget = XtWindowToWidget (dpyinfo->display, 6342 Widget widget = XtWindowToWidget (dpyinfo->display,
6371 event.xkey.window); 6343 event->xkey.window);
6372 if (widget && XmIsScrollBar (widget)) 6344 if (widget && XmIsScrollBar (widget))
6373 { 6345 {
6374 widget = XtParent (widget); 6346 widget = XtParent (widget);
@@ -6397,6 +6369,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6397 int modifiers; 6369 int modifiers;
6398 Lisp_Object coding_system = Qlatin_1; 6370 Lisp_Object coding_system = Qlatin_1;
6399 Lisp_Object c; 6371 Lisp_Object c;
6372 /* Event will be modified. */
6373 XKeyEvent xkey = event->xkey;
6400 6374
6401#ifdef USE_GTK 6375#ifdef USE_GTK
6402 /* Don't pass keys to GTK. A Tab will shift focus to the 6376 /* Don't pass keys to GTK. A Tab will shift focus to the
@@ -6406,20 +6380,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6406 *finish = X_EVENT_DROP; 6380 *finish = X_EVENT_DROP;
6407#endif 6381#endif
6408 6382
6409 event.xkey.state 6383 xkey.state |= x_emacs_to_x_modifiers (FRAME_DISPLAY_INFO (f),
6410 |= x_emacs_to_x_modifiers (FRAME_DISPLAY_INFO (f), 6384 extra_keyboard_modifiers);
6411 extra_keyboard_modifiers); 6385 modifiers = xkey.state;
6412 modifiers = event.xkey.state;
6413 6386
6414 /* This will have to go some day... */ 6387 /* This will have to go some day... */
6415 6388
6416 /* make_lispy_event turns chars into control chars. 6389 /* make_lispy_event turns chars into control chars.
6417 Don't do it here because XLookupString is too eager. */ 6390 Don't do it here because XLookupString is too eager. */
6418 event.xkey.state &= ~ControlMask; 6391 xkey.state &= ~ControlMask;
6419 event.xkey.state &= ~(dpyinfo->meta_mod_mask 6392 xkey.state &= ~(dpyinfo->meta_mod_mask
6420 | dpyinfo->super_mod_mask 6393 | dpyinfo->super_mod_mask
6421 | dpyinfo->hyper_mod_mask 6394 | dpyinfo->hyper_mod_mask
6422 | dpyinfo->alt_mod_mask); 6395 | dpyinfo->alt_mod_mask);
6423 6396
6424 /* In case Meta is ComposeCharacter, 6397 /* In case Meta is ComposeCharacter,
6425 clear its status. According to Markus Ehrnsperger 6398 clear its status. According to Markus Ehrnsperger
@@ -6436,7 +6409,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6436 6409
6437 coding_system = Vlocale_coding_system; 6410 coding_system = Vlocale_coding_system;
6438 nbytes = XmbLookupString (FRAME_XIC (f), 6411 nbytes = XmbLookupString (FRAME_XIC (f),
6439 &event.xkey, (char *) copy_bufptr, 6412 &xkey, (char *) copy_bufptr,
6440 copy_bufsiz, &keysym, 6413 copy_bufsiz, &keysym,
6441 &status_return); 6414 &status_return);
6442 if (status_return == XBufferOverflow) 6415 if (status_return == XBufferOverflow)
@@ -6444,7 +6417,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6444 copy_bufsiz = nbytes + 1; 6417 copy_bufsiz = nbytes + 1;
6445 copy_bufptr = alloca (copy_bufsiz); 6418 copy_bufptr = alloca (copy_bufsiz);
6446 nbytes = XmbLookupString (FRAME_XIC (f), 6419 nbytes = XmbLookupString (FRAME_XIC (f),
6447 &event.xkey, (char *) copy_bufptr, 6420 &xkey, (char *) copy_bufptr,
6448 copy_bufsiz, &keysym, 6421 copy_bufsiz, &keysym,
6449 &status_return); 6422 &status_return);
6450 } 6423 }
@@ -6461,11 +6434,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6461 emacs_abort (); 6434 emacs_abort ();
6462 } 6435 }
6463 else 6436 else
6464 nbytes = XLookupString (&event.xkey, (char *) copy_bufptr, 6437 nbytes = XLookupString (&xkey, (char *) copy_bufptr,
6465 copy_bufsiz, &keysym, 6438 copy_bufsiz, &keysym,
6466 &compose_status); 6439 &compose_status);
6467#else 6440#else
6468 nbytes = XLookupString (&event.xkey, (char *) copy_bufptr, 6441 nbytes = XLookupString (&xkey, (char *) copy_bufptr,
6469 copy_bufsiz, &keysym, 6442 copy_bufsiz, &keysym,
6470 &compose_status); 6443 &compose_status);
6471#endif 6444#endif
@@ -6482,7 +6455,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6482 XSETFRAME (inev.ie.frame_or_window, f); 6455 XSETFRAME (inev.ie.frame_or_window, f);
6483 inev.ie.modifiers 6456 inev.ie.modifiers
6484 = x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), modifiers); 6457 = x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), modifiers);
6485 inev.ie.timestamp = event.xkey.time; 6458 inev.ie.timestamp = xkey.time;
6486 6459
6487 /* First deal with keysyms which have defined 6460 /* First deal with keysyms which have defined
6488 translations to characters. */ 6461 translations to characters. */
@@ -6658,6 +6631,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6658 if (keysym == NoSymbol) 6631 if (keysym == NoSymbol)
6659 break; 6632 break;
6660 } 6633 }
6634 /* FIXME: check side effects and remove this. */
6635 ((XEvent *) event)->xkey = xkey;
6661 } 6636 }
6662 done_keysym: 6637 done_keysym:
6663#ifdef HAVE_X_I18N 6638#ifdef HAVE_X_I18N
@@ -6670,7 +6645,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6670#endif 6645#endif
6671 6646
6672 case KeyRelease: 6647 case KeyRelease:
6673 dpyinfo->last_user_time = event.xkey.time; 6648 dpyinfo->last_user_time = event->xkey.time;
6674#ifdef HAVE_X_I18N 6649#ifdef HAVE_X_I18N
6675 /* Don't dispatch this event since XtDispatchEvent calls 6650 /* Don't dispatch this event since XtDispatchEvent calls
6676 XFilterEvent, and two calls in a row may freeze the 6651 XFilterEvent, and two calls in a row may freeze the
@@ -6681,35 +6656,35 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6681#endif 6656#endif
6682 6657
6683 case EnterNotify: 6658 case EnterNotify:
6684 dpyinfo->last_user_time = event.xcrossing.time; 6659 dpyinfo->last_user_time = event->xcrossing.time;
6685 x_detect_focus_change (dpyinfo, any, &event, &inev.ie); 6660 x_detect_focus_change (dpyinfo, any, event, &inev.ie);
6686 6661
6687 f = any; 6662 f = any;
6688 6663
6689 if (f && x_mouse_click_focus_ignore_position) 6664 if (f && x_mouse_click_focus_ignore_position)
6690 ignore_next_mouse_click_timeout = event.xmotion.time + 200; 6665 ignore_next_mouse_click_timeout = event->xmotion.time + 200;
6691 6666
6692 /* EnterNotify counts as mouse movement, 6667 /* EnterNotify counts as mouse movement,
6693 so update things that depend on mouse position. */ 6668 so update things that depend on mouse position. */
6694 if (f && !f->output_data.x->hourglass_p) 6669 if (f && !f->output_data.x->hourglass_p)
6695 note_mouse_movement (f, &event.xmotion); 6670 note_mouse_movement (f, &event->xmotion);
6696#ifdef USE_GTK 6671#ifdef USE_GTK
6697 /* We may get an EnterNotify on the buttons in the toolbar. In that 6672 /* We may get an EnterNotify on the buttons in the toolbar. In that
6698 case we moved out of any highlighted area and need to note this. */ 6673 case we moved out of any highlighted area and need to note this. */
6699 if (!f && last_mouse_glyph_frame) 6674 if (!f && last_mouse_glyph_frame)
6700 note_mouse_movement (last_mouse_glyph_frame, &event.xmotion); 6675 note_mouse_movement (last_mouse_glyph_frame, &event->xmotion);
6701#endif 6676#endif
6702 goto OTHER; 6677 goto OTHER;
6703 6678
6704 case FocusIn: 6679 case FocusIn:
6705 x_detect_focus_change (dpyinfo, any, &event, &inev.ie); 6680 x_detect_focus_change (dpyinfo, any, event, &inev.ie);
6706 goto OTHER; 6681 goto OTHER;
6707 6682
6708 case LeaveNotify: 6683 case LeaveNotify:
6709 dpyinfo->last_user_time = event.xcrossing.time; 6684 dpyinfo->last_user_time = event->xcrossing.time;
6710 x_detect_focus_change (dpyinfo, any, &event, &inev.ie); 6685 x_detect_focus_change (dpyinfo, any, event, &inev.ie);
6711 6686
6712 f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); 6687 f = x_top_window_to_frame (dpyinfo, event->xcrossing.window);
6713 if (f) 6688 if (f)
6714 { 6689 {
6715 if (f == hlinfo->mouse_face_mouse_frame) 6690 if (f == hlinfo->mouse_face_mouse_frame)
@@ -6730,17 +6705,17 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6730#ifdef USE_GTK 6705#ifdef USE_GTK
6731 /* See comment in EnterNotify above */ 6706 /* See comment in EnterNotify above */
6732 else if (last_mouse_glyph_frame) 6707 else if (last_mouse_glyph_frame)
6733 note_mouse_movement (last_mouse_glyph_frame, &event.xmotion); 6708 note_mouse_movement (last_mouse_glyph_frame, &event->xmotion);
6734#endif 6709#endif
6735 goto OTHER; 6710 goto OTHER;
6736 6711
6737 case FocusOut: 6712 case FocusOut:
6738 x_detect_focus_change (dpyinfo, any, &event, &inev.ie); 6713 x_detect_focus_change (dpyinfo, any, event, &inev.ie);
6739 goto OTHER; 6714 goto OTHER;
6740 6715
6741 case MotionNotify: 6716 case MotionNotify:
6742 { 6717 {
6743 dpyinfo->last_user_time = event.xmotion.time; 6718 dpyinfo->last_user_time = event->xmotion.time;
6744 previous_help_echo_string = help_echo_string; 6719 previous_help_echo_string = help_echo_string;
6745 help_echo_string = Qnil; 6720 help_echo_string = Qnil;
6746 6721
@@ -6748,7 +6723,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6748 && FRAME_LIVE_P (last_mouse_frame)) 6723 && FRAME_LIVE_P (last_mouse_frame))
6749 f = last_mouse_frame; 6724 f = last_mouse_frame;
6750 else 6725 else
6751 f = x_window_to_frame (dpyinfo, event.xmotion.window); 6726 f = x_window_to_frame (dpyinfo, event->xmotion.window);
6752 6727
6753 if (hlinfo->mouse_face_hidden) 6728 if (hlinfo->mouse_face_hidden)
6754 { 6729 {
@@ -6757,7 +6732,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6757 } 6732 }
6758 6733
6759#ifdef USE_GTK 6734#ifdef USE_GTK
6760 if (f && xg_event_is_for_scrollbar (f, &event)) 6735 if (f && xg_event_is_for_scrollbar (f, event))
6761 f = 0; 6736 f = 0;
6762#endif 6737#endif
6763 if (f) 6738 if (f)
@@ -6769,7 +6744,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6769 { 6744 {
6770 static Lisp_Object last_mouse_window; 6745 static Lisp_Object last_mouse_window;
6771 Lisp_Object window = window_from_coordinates 6746 Lisp_Object window = window_from_coordinates
6772 (f, event.xmotion.x, event.xmotion.y, 0, 0); 6747 (f, event->xmotion.x, event->xmotion.y, 0, 0);
6773 6748
6774 /* Window will be selected only when it is not selected now and 6749 /* Window will be selected only when it is not selected now and
6775 last mouse movement event was not in it. Minibuffer window 6750 last mouse movement event was not in it. Minibuffer window
@@ -6790,18 +6765,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6790 /* Remember the last window where we saw the mouse. */ 6765 /* Remember the last window where we saw the mouse. */
6791 last_mouse_window = window; 6766 last_mouse_window = window;
6792 } 6767 }
6793 if (!note_mouse_movement (f, &event.xmotion)) 6768 if (!note_mouse_movement (f, &event->xmotion))
6794 help_echo_string = previous_help_echo_string; 6769 help_echo_string = previous_help_echo_string;
6795 } 6770 }
6796 else 6771 else
6797 { 6772 {
6798#ifndef USE_TOOLKIT_SCROLL_BARS 6773#ifndef USE_TOOLKIT_SCROLL_BARS
6799 struct scroll_bar *bar 6774 struct scroll_bar *bar
6800 = x_window_to_scroll_bar (event.xmotion.display, 6775 = x_window_to_scroll_bar (event->xmotion.display,
6801 event.xmotion.window); 6776 event->xmotion.window);
6802 6777
6803 if (bar) 6778 if (bar)
6804 x_scroll_bar_note_movement (bar, &event.xmotion); 6779 x_scroll_bar_note_movement (bar, &event->xmotion);
6805#endif /* USE_TOOLKIT_SCROLL_BARS */ 6780#endif /* USE_TOOLKIT_SCROLL_BARS */
6806 6781
6807 /* If we move outside the frame, then we're 6782 /* If we move outside the frame, then we're
@@ -6818,14 +6793,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6818 } 6793 }
6819 6794
6820 case ConfigureNotify: 6795 case ConfigureNotify:
6821 f = x_top_window_to_frame (dpyinfo, event.xconfigure.window); 6796 f = x_top_window_to_frame (dpyinfo, event->xconfigure.window);
6822#ifdef USE_GTK 6797#ifdef USE_GTK
6823 if (!f 6798 if (!f
6824 && (f = any) 6799 && (f = any)
6825 && event.xconfigure.window == FRAME_X_WINDOW (f)) 6800 && event->xconfigure.window == FRAME_X_WINDOW (f))
6826 { 6801 {
6827 xg_frame_resized (f, event.xconfigure.width, 6802 xg_frame_resized (f, event->xconfigure.width,
6828 event.xconfigure.height); 6803 event->xconfigure.height);
6829 f = 0; 6804 f = 0;
6830 } 6805 }
6831#endif 6806#endif
@@ -6833,8 +6808,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6833 { 6808 {
6834#ifndef USE_X_TOOLKIT 6809#ifndef USE_X_TOOLKIT
6835#ifndef USE_GTK 6810#ifndef USE_GTK
6836 int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height); 6811 int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event->xconfigure.height);
6837 int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event.xconfigure.width); 6812 int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event->xconfigure.width);
6838 6813
6839 /* In the toolkit version, change_frame_size 6814 /* In the toolkit version, change_frame_size
6840 is called by the code that handles resizing 6815 is called by the code that handles resizing
@@ -6845,16 +6820,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6845 to check the pixel dimensions as well. */ 6820 to check the pixel dimensions as well. */
6846 if (columns != FRAME_COLS (f) 6821 if (columns != FRAME_COLS (f)
6847 || rows != FRAME_LINES (f) 6822 || rows != FRAME_LINES (f)
6848 || event.xconfigure.width != FRAME_PIXEL_WIDTH (f) 6823 || event->xconfigure.width != FRAME_PIXEL_WIDTH (f)
6849 || event.xconfigure.height != FRAME_PIXEL_HEIGHT (f)) 6824 || event->xconfigure.height != FRAME_PIXEL_HEIGHT (f))
6850 { 6825 {
6851 change_frame_size (f, rows, columns, 0, 1, 0); 6826 change_frame_size (f, rows, columns, 0, 1, 0);
6852 SET_FRAME_GARBAGED (f); 6827 SET_FRAME_GARBAGED (f);
6853 cancel_mouse_face (f); 6828 cancel_mouse_face (f);
6854 } 6829 }
6855 6830
6856 FRAME_PIXEL_WIDTH (f) = event.xconfigure.width; 6831 FRAME_PIXEL_WIDTH (f) = event->xconfigure.width;
6857 FRAME_PIXEL_HEIGHT (f) = event.xconfigure.height; 6832 FRAME_PIXEL_HEIGHT (f) = event->xconfigure.height;
6858#endif /* not USE_GTK */ 6833#endif /* not USE_GTK */
6859#endif 6834#endif
6860 6835
@@ -6885,17 +6860,17 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6885 6860
6886 memset (&compose_status, 0, sizeof (compose_status)); 6861 memset (&compose_status, 0, sizeof (compose_status));
6887 last_mouse_glyph_frame = 0; 6862 last_mouse_glyph_frame = 0;
6888 dpyinfo->last_user_time = event.xbutton.time; 6863 dpyinfo->last_user_time = event->xbutton.time;
6889 6864
6890 if (dpyinfo->grabbed 6865 if (dpyinfo->grabbed
6891 && last_mouse_frame 6866 && last_mouse_frame
6892 && FRAME_LIVE_P (last_mouse_frame)) 6867 && FRAME_LIVE_P (last_mouse_frame))
6893 f = last_mouse_frame; 6868 f = last_mouse_frame;
6894 else 6869 else
6895 f = x_window_to_frame (dpyinfo, event.xbutton.window); 6870 f = x_window_to_frame (dpyinfo, event->xbutton.window);
6896 6871
6897#ifdef USE_GTK 6872#ifdef USE_GTK
6898 if (f && xg_event_is_for_scrollbar (f, &event)) 6873 if (f && xg_event_is_for_scrollbar (f, event))
6899 f = 0; 6874 f = 0;
6900#endif 6875#endif
6901 if (f) 6876 if (f)
@@ -6906,16 +6881,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6906 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) 6881 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
6907 { 6882 {
6908 Lisp_Object window; 6883 Lisp_Object window;
6909 int x = event.xbutton.x; 6884 int x = event->xbutton.x;
6910 int y = event.xbutton.y; 6885 int y = event->xbutton.y;
6911 6886
6912 window = window_from_coordinates (f, x, y, 0, 1); 6887 window = window_from_coordinates (f, x, y, 0, 1);
6913 tool_bar_p = EQ (window, f->tool_bar_window); 6888 tool_bar_p = EQ (window, f->tool_bar_window);
6914 6889
6915 if (tool_bar_p && event.xbutton.button < 4) 6890 if (tool_bar_p && event->xbutton.button < 4)
6916 handle_tool_bar_click 6891 handle_tool_bar_click
6917 (f, x, y, event.xbutton.type == ButtonPress, 6892 (f, x, y, event->xbutton.type == ButtonPress,
6918 x_x_to_emacs_modifiers (dpyinfo, event.xbutton.state)); 6893 x_x_to_emacs_modifiers (dpyinfo, event->xbutton.state));
6919 } 6894 }
6920#endif /* !USE_GTK */ 6895#endif /* !USE_GTK */
6921 6896
@@ -6926,52 +6901,52 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6926 { 6901 {
6927 if (ignore_next_mouse_click_timeout) 6902 if (ignore_next_mouse_click_timeout)
6928 { 6903 {
6929 if (event.type == ButtonPress 6904 if (event->type == ButtonPress
6930 && (int)(event.xbutton.time - ignore_next_mouse_click_timeout) > 0) 6905 && (int)(event->xbutton.time - ignore_next_mouse_click_timeout) > 0)
6931 { 6906 {
6932 ignore_next_mouse_click_timeout = 0; 6907 ignore_next_mouse_click_timeout = 0;
6933 construct_mouse_click (&inev.ie, &event.xbutton, f); 6908 construct_mouse_click (&inev.ie, &event->xbutton, f);
6934 } 6909 }
6935 if (event.type == ButtonRelease) 6910 if (event->type == ButtonRelease)
6936 ignore_next_mouse_click_timeout = 0; 6911 ignore_next_mouse_click_timeout = 0;
6937 } 6912 }
6938 else 6913 else
6939 construct_mouse_click (&inev.ie, &event.xbutton, f); 6914 construct_mouse_click (&inev.ie, &event->xbutton, f);
6940 } 6915 }
6941 if (FRAME_X_EMBEDDED_P (f)) 6916 if (FRAME_X_EMBEDDED_P (f))
6942 xembed_send_message (f, event.xbutton.time, 6917 xembed_send_message (f, event->xbutton.time,
6943 XEMBED_REQUEST_FOCUS, 0, 0, 0); 6918 XEMBED_REQUEST_FOCUS, 0, 0, 0);
6944 } 6919 }
6945 else 6920 else
6946 { 6921 {
6947 struct scroll_bar *bar 6922 struct scroll_bar *bar
6948 = x_window_to_scroll_bar (event.xbutton.display, 6923 = x_window_to_scroll_bar (event->xbutton.display,
6949 event.xbutton.window); 6924 event->xbutton.window);
6950 6925
6951#ifdef USE_TOOLKIT_SCROLL_BARS 6926#ifdef USE_TOOLKIT_SCROLL_BARS
6952 /* Make the "Ctrl-Mouse-2 splits window" work for toolkit 6927 /* Make the "Ctrl-Mouse-2 splits window" work for toolkit
6953 scroll bars. */ 6928 scroll bars. */
6954 if (bar && event.xbutton.state & ControlMask) 6929 if (bar && event->xbutton.state & ControlMask)
6955 { 6930 {
6956 x_scroll_bar_handle_click (bar, &event, &inev.ie); 6931 x_scroll_bar_handle_click (bar, event, &inev.ie);
6957 *finish = X_EVENT_DROP; 6932 *finish = X_EVENT_DROP;
6958 } 6933 }
6959#else /* not USE_TOOLKIT_SCROLL_BARS */ 6934#else /* not USE_TOOLKIT_SCROLL_BARS */
6960 if (bar) 6935 if (bar)
6961 x_scroll_bar_handle_click (bar, &event, &inev.ie); 6936 x_scroll_bar_handle_click (bar, event, &inev.ie);
6962#endif /* not USE_TOOLKIT_SCROLL_BARS */ 6937#endif /* not USE_TOOLKIT_SCROLL_BARS */
6963 } 6938 }
6964 6939
6965 if (event.type == ButtonPress) 6940 if (event->type == ButtonPress)
6966 { 6941 {
6967 dpyinfo->grabbed |= (1 << event.xbutton.button); 6942 dpyinfo->grabbed |= (1 << event->xbutton.button);
6968 last_mouse_frame = f; 6943 last_mouse_frame = f;
6969 6944
6970 if (!tool_bar_p) 6945 if (!tool_bar_p)
6971 last_tool_bar_item = -1; 6946 last_tool_bar_item = -1;
6972 } 6947 }
6973 else 6948 else
6974 dpyinfo->grabbed &= ~(1 << event.xbutton.button); 6949 dpyinfo->grabbed &= ~(1 << event->xbutton.button);
6975 6950
6976 /* Ignore any mouse motion that happened before this event; 6951 /* Ignore any mouse motion that happened before this event;
6977 any subsequent mouse-movement Emacs events should reflect 6952 any subsequent mouse-movement Emacs events should reflect
@@ -6980,7 +6955,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6980 f->mouse_moved = 0; 6955 f->mouse_moved = 0;
6981 6956
6982#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6957#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
6983 f = x_menubar_window_to_frame (dpyinfo, &event); 6958 f = x_menubar_window_to_frame (dpyinfo, event);
6984 /* For a down-event in the menu bar, 6959 /* For a down-event in the menu bar,
6985 don't pass it to Xt right now. 6960 don't pass it to Xt right now.
6986 Instead, save it away 6961 Instead, save it away
@@ -6989,19 +6964,23 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6989 if (! popup_activated () 6964 if (! popup_activated ()
6990#ifdef USE_GTK 6965#ifdef USE_GTK
6991 /* Gtk+ menus only react to the first three buttons. */ 6966 /* Gtk+ menus only react to the first three buttons. */
6992 && event.xbutton.button < 3 6967 && event->xbutton.button < 3
6993#endif 6968#endif
6994 && f && event.type == ButtonPress 6969 && f && event->type == ButtonPress
6995 /* Verify the event is really within the menu bar 6970 /* Verify the event is really within the menu bar
6996 and not just sent to it due to grabbing. */ 6971 and not just sent to it due to grabbing. */
6997 && event.xbutton.x >= 0 6972 && event->xbutton.x >= 0
6998 && event.xbutton.x < FRAME_PIXEL_WIDTH (f) 6973 && event->xbutton.x < FRAME_PIXEL_WIDTH (f)
6999 && event.xbutton.y >= 0 6974 && event->xbutton.y >= 0
7000 && event.xbutton.y < f->output_data.x->menubar_height 6975 && event->xbutton.y < f->output_data.x->menubar_height
7001 && event.xbutton.same_screen) 6976 && event->xbutton.same_screen)
7002 { 6977 {
7003 SET_SAVED_BUTTON_EVENT; 6978 if (!f->output_data.x->saved_menu_event)
7004 *finish = X_EVENT_DROP; 6979 f->output_data.x->saved_menu_event = xmalloc (sizeof *event);
6980 *f->output_data.x->saved_menu_event = *event;
6981 inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;
6982 XSETFRAME (inev.ie.frame_or_window, f);
6983 *finish = X_EVENT_DROP;
7005 } 6984 }
7006 else 6985 else
7007 goto OTHER; 6986 goto OTHER;
@@ -7021,18 +7000,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
7021 case MappingNotify: 7000 case MappingNotify:
7022 /* Someone has changed the keyboard mapping - update the 7001 /* Someone has changed the keyboard mapping - update the
7023 local cache. */ 7002 local cache. */
7024 switch (event.xmapping.request) 7003 switch (event->xmapping.request)
7025 { 7004 {
7026 case MappingModifier: 7005 case MappingModifier:
7027 x_find_modifier_meanings (dpyinfo); 7006 x_find_modifier_meanings (dpyinfo);
7028 /* This is meant to fall through. */ 7007 /* This is meant to fall through. */
7029 case MappingKeyboard: 7008 case MappingKeyboard:
7030 XRefreshKeyboardMapping (&event.xmapping); 7009 XRefreshKeyboardMapping ((XMappingEvent *) &event->xmapping);
7031 } 7010 }
7032 goto OTHER; 7011 goto OTHER;
7033 7012
7034 case DestroyNotify: 7013 case DestroyNotify:
7035 xft_settings_event (dpyinfo, &event); 7014 xft_settings_event (dpyinfo, event);
7036 break; 7015 break;
7037 7016
7038 default: 7017 default:
@@ -7040,7 +7019,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
7040#ifdef USE_X_TOOLKIT 7019#ifdef USE_X_TOOLKIT
7041 block_input (); 7020 block_input ();
7042 if (*finish != X_EVENT_DROP) 7021 if (*finish != X_EVENT_DROP)
7043 XtDispatchEvent (&event); 7022 XtDispatchEvent ((XEvent *) event);
7044 unblock_input (); 7023 unblock_input ();
7045#endif /* USE_X_TOOLKIT */ 7024#endif /* USE_X_TOOLKIT */
7046 break; 7025 break;
@@ -7078,7 +7057,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
7078 } 7057 }
7079 7058
7080 SAFE_FREE (); 7059 SAFE_FREE ();
7081 *eventptr = event;
7082 return count; 7060 return count;
7083} 7061}
7084 7062
@@ -8568,7 +8546,7 @@ XTfullscreen_hook (struct frame *f)
8568 8546
8569 8547
8570static int 8548static int
8571x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) 8549x_handle_net_wm_state (struct frame *f, const XPropertyEvent * const event)
8572{ 8550{
8573 int value = FULLSCREEN_NONE; 8551 int value = FULLSCREEN_NONE;
8574 Lisp_Object lval; 8552 Lisp_Object lval;
diff --git a/src/xterm.h b/src/xterm.h
index 2703c743292..8dc86784b09 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -888,11 +888,6 @@ struct selection_input_event
888#define SELECTION_EVENT_TIME(eventp) \ 888#define SELECTION_EVENT_TIME(eventp) \
889 (((struct selection_input_event *) (eventp))->time) 889 (((struct selection_input_event *) (eventp))->time)
890 890
891/* From xselect.c. */
892
893void x_handle_selection_notify (XSelectionEvent *);
894void x_handle_property_notify (XPropertyEvent *);
895
896/* From xfns.c. */ 891/* From xfns.c. */
897 892
898extern void x_free_gcs (struct frame *); 893extern void x_free_gcs (struct frame *);
@@ -946,8 +941,8 @@ extern void x_wait_for_event (struct frame *, int);
946 941
947/* Defined in xselect.c */ 942/* Defined in xselect.c */
948 943
949extern void x_handle_property_notify (XPropertyEvent *); 944extern void x_handle_property_notify (const XPropertyEvent * const);
950extern void x_handle_selection_notify (XSelectionEvent *); 945extern void x_handle_selection_notify (const XSelectionEvent * const);
951extern void x_handle_selection_event (struct input_event *); 946extern void x_handle_selection_event (struct input_event *);
952extern void x_clear_frame_selections (struct frame *); 947extern void x_clear_frame_selections (struct frame *);
953 948
@@ -959,9 +954,9 @@ extern void x_send_client_event (Lisp_Object display,
959 Lisp_Object values); 954 Lisp_Object values);
960 955
961extern int x_handle_dnd_message (struct frame *, 956extern int x_handle_dnd_message (struct frame *,
962 XClientMessageEvent *, 957 const XClientMessageEvent * const,
963 struct x_display_info *, 958 struct x_display_info *,
964 struct input_event *bufp); 959 struct input_event *);
965extern int x_check_property_data (Lisp_Object); 960extern int x_check_property_data (Lisp_Object);
966extern void x_fill_property_data (Display *, 961extern void x_fill_property_data (Display *,
967 Lisp_Object, 962 Lisp_Object,