diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 21 | ||||
| -rw-r--r-- | src/gtkutil.c | 4 | ||||
| -rw-r--r-- | src/gtkutil.h | 4 | ||||
| -rw-r--r-- | src/xselect.c | 6 | ||||
| -rw-r--r-- | src/xsettings.c | 2 | ||||
| -rw-r--r-- | src/xsettings.h | 5 | ||||
| -rw-r--r-- | src/xterm.c | 404 | ||||
| -rw-r--r-- | src/xterm.h | 13 |
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 @@ | |||
| 1 | 2013-09-16 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2013-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 | |||
| 22 | 2013-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 | ||
| 3411 | bool | 3411 | bool |
| 3412 | xg_event_is_for_menubar (struct frame *f, XEvent *event) | 3412 | xg_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 | ||
| 3863 | bool | 3863 | bool |
| 3864 | xg_event_is_for_scrollbar (struct frame *f, XEvent *event) | 3864 | xg_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 | ||
| 106 | extern void xg_update_frame_menubar (struct frame *f); | 106 | extern void xg_update_frame_menubar (struct frame *f); |
| 107 | 107 | ||
| 108 | extern bool xg_event_is_for_menubar (struct frame *f, XEvent *event); | 108 | extern bool xg_event_is_for_menubar (struct frame *, const XEvent * const); |
| 109 | 109 | ||
| 110 | extern bool xg_have_tear_offs (void); | 110 | extern 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); |
| 132 | extern bool xg_event_is_for_scrollbar (struct frame *f, XEvent *event); | 132 | extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent * const); |
| 133 | extern int xg_get_default_scrollbar_width (void); | 133 | extern int xg_get_default_scrollbar_width (void); |
| 134 | 134 | ||
| 135 | extern void update_frame_tool_bar (struct frame *f); | 135 | extern 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 | ||
| 1143 | void | 1143 | void |
| 1144 | x_handle_property_notify (XPropertyEvent *event) | 1144 | x_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 | ||
| 1890 | void | 1890 | void |
| 1891 | x_handle_selection_notify (XSelectionEvent *event) | 1891 | x_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 | ||
| 2490 | int | 2490 | int |
| 2491 | x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, | 2491 | x_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 | ||
| 756 | void | 756 | void |
| 757 | xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) | 757 | xft_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 | ||
| 23 | extern void xsettings_initialize (struct x_display_info *dpyinfo); | 23 | extern void xsettings_initialize (struct x_display_info *); |
| 24 | extern void xft_settings_event (struct x_display_info *dpyinfo, | 24 | extern void xft_settings_event (struct x_display_info *, const XEvent * const); |
| 25 | XEvent *); | ||
| 26 | extern const char *xsettings_get_system_font (void); | 25 | extern const char *xsettings_get_system_font (void); |
| 27 | #ifdef USE_LUCID | 26 | #ifdef USE_LUCID |
| 28 | extern const char *xsettings_get_system_normal_font (void); | 27 | extern const char *xsettings_get_system_normal_font (void); |
diff --git a/src/xterm.c b/src/xterm.c index ea75df11048..830fe05e3b8 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -302,12 +302,13 @@ static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, | |||
| 302 | enum scroll_bar_part *, | 302 | enum scroll_bar_part *, |
| 303 | Lisp_Object *, Lisp_Object *, | 303 | Lisp_Object *, Lisp_Object *, |
| 304 | Time *); | 304 | Time *); |
| 305 | static int x_handle_net_wm_state (struct frame *, XPropertyEvent *); | 305 | static int x_handle_net_wm_state (struct frame *, const XPropertyEvent * const); |
| 306 | static void x_check_fullscreen (struct frame *); | 306 | static void x_check_fullscreen (struct frame *); |
| 307 | static void x_check_expected_move (struct frame *, int, int); | 307 | static void x_check_expected_move (struct frame *, int, int); |
| 308 | static void x_sync_with_move (struct frame *, int, int, int); | 308 | static void x_sync_with_move (struct frame *, int, int, int); |
| 309 | static int handle_one_xevent (struct x_display_info *, XEvent *, | 309 | static int handle_one_xevent (struct x_display_info *, |
| 310 | int *, struct input_event *); | 310 | const XEvent * const, int *, |
| 311 | struct input_event *); | ||
| 311 | #ifdef USE_GTK | 312 | #ifdef USE_GTK |
| 312 | static int x_dispatch_event (XEvent *, Display *); | 313 | static int x_dispatch_event (XEvent *, Display *); |
| 313 | #endif | 314 | #endif |
| @@ -3459,7 +3460,8 @@ x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc) | |||
| 3459 | /* Likewise, but consider only the menu bar widget. */ | 3460 | /* Likewise, but consider only the menu bar widget. */ |
| 3460 | 3461 | ||
| 3461 | static struct frame * | 3462 | static struct frame * |
| 3462 | x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event) | 3463 | x_menubar_window_to_frame (struct x_display_info *dpyinfo, |
| 3464 | const XEvent * const event) | ||
| 3463 | { | 3465 | { |
| 3464 | Window wdesc = event->xany.window; | 3466 | Window wdesc = event->xany.window; |
| 3465 | Lisp_Object tail, frame; | 3467 | Lisp_Object tail, frame; |
| @@ -3541,7 +3543,7 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc) | |||
| 3541 | 3543 | ||
| 3542 | static void | 3544 | static void |
| 3543 | x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, | 3545 | x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, |
| 3544 | XEvent *event, struct input_event *bufp) | 3546 | const XEvent * const event, struct input_event *bufp) |
| 3545 | { | 3547 | { |
| 3546 | if (!frame) | 3548 | if (!frame) |
| 3547 | return; | 3549 | return; |
| @@ -3831,7 +3833,9 @@ x_get_keysym_name (int keysym) | |||
| 3831 | the mouse. */ | 3833 | the mouse. */ |
| 3832 | 3834 | ||
| 3833 | static Lisp_Object | 3835 | static Lisp_Object |
| 3834 | construct_mouse_click (struct input_event *result, XButtonEvent *event, struct frame *f) | 3836 | construct_mouse_click (struct input_event *result, |
| 3837 | const XButtonEvent * const event, | ||
| 3838 | struct frame *f) | ||
| 3835 | { | 3839 | { |
| 3836 | /* Make the event type NO_EVENT; we'll change that when we decide | 3840 | /* Make the event type NO_EVENT; we'll change that when we decide |
| 3837 | otherwise. */ | 3841 | otherwise. */ |
| @@ -3863,7 +3867,7 @@ static XMotionEvent last_mouse_motion_event; | |||
| 3863 | static Lisp_Object last_mouse_motion_frame; | 3867 | static Lisp_Object last_mouse_motion_frame; |
| 3864 | 3868 | ||
| 3865 | static int | 3869 | static int |
| 3866 | note_mouse_movement (struct frame *frame, XMotionEvent *event) | 3870 | note_mouse_movement (struct frame *frame, const XMotionEvent * const event) |
| 3867 | { | 3871 | { |
| 3868 | last_mouse_movement_time = event->time; | 3872 | last_mouse_movement_time = event->time; |
| 3869 | last_mouse_motion_event = *event; | 3873 | last_mouse_motion_event = *event; |
| @@ -4207,13 +4211,7 @@ x_window_to_menu_bar (Window window) | |||
| 4207 | 4211 | ||
| 4208 | #ifdef USE_TOOLKIT_SCROLL_BARS | 4212 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 4209 | 4213 | ||
| 4210 | static void x_scroll_bar_to_input_event (XEvent *, struct input_event *); | ||
| 4211 | static void x_send_scroll_bar_event (Lisp_Object, int, int, int); | 4214 | static void x_send_scroll_bar_event (Lisp_Object, int, int, int); |
| 4212 | static void x_create_toolkit_scroll_bar (struct frame *, | ||
| 4213 | struct scroll_bar *); | ||
| 4214 | static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *, | ||
| 4215 | int, int, int); | ||
| 4216 | |||
| 4217 | 4215 | ||
| 4218 | /* Lisp window being scrolled. Set when starting to interact with | 4216 | /* Lisp window being scrolled. Set when starting to interact with |
| 4219 | a toolkit scroll bar, reset to nil when ending the interaction. */ | 4217 | a toolkit scroll bar, reset to nil when ending the interaction. */ |
| @@ -4360,7 +4358,8 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) | |||
| 4360 | in *IEVENT. */ | 4358 | in *IEVENT. */ |
| 4361 | 4359 | ||
| 4362 | static void | 4360 | static void |
| 4363 | x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent) | 4361 | x_scroll_bar_to_input_event (const XEvent * const event, |
| 4362 | struct input_event *ievent) | ||
| 4364 | { | 4363 | { |
| 4365 | XClientMessageEvent *ev = (XClientMessageEvent *) event; | 4364 | XClientMessageEvent *ev = (XClientMessageEvent *) event; |
| 4366 | Lisp_Object window; | 4365 | Lisp_Object window; |
| @@ -5504,7 +5503,7 @@ XTjudge_scroll_bars (struct frame *f) | |||
| 5504 | mark bits. */ | 5503 | mark bits. */ |
| 5505 | 5504 | ||
| 5506 | static void | 5505 | static void |
| 5507 | x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) | 5506 | x_scroll_bar_expose (struct scroll_bar *bar, const XEvent * const event) |
| 5508 | { | 5507 | { |
| 5509 | Window w = bar->x_window; | 5508 | Window w = bar->x_window; |
| 5510 | struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5509 | struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| @@ -5542,7 +5541,9 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) | |||
| 5542 | 5541 | ||
| 5543 | 5542 | ||
| 5544 | static void | 5543 | static void |
| 5545 | x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_event *emacs_event) | 5544 | x_scroll_bar_handle_click (struct scroll_bar *bar, |
| 5545 | const XEvent * const event, | ||
| 5546 | struct input_event *emacs_event) | ||
| 5546 | { | 5547 | { |
| 5547 | if (! WINDOWP (bar->window)) | 5548 | if (! WINDOWP (bar->window)) |
| 5548 | emacs_abort (); | 5549 | emacs_abort (); |
| @@ -5599,7 +5600,8 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e | |||
| 5599 | mark bits. */ | 5600 | mark bits. */ |
| 5600 | 5601 | ||
| 5601 | static void | 5602 | static void |
| 5602 | x_scroll_bar_note_movement (struct scroll_bar *bar, XMotionEvent *event) | 5603 | x_scroll_bar_note_movement (struct scroll_bar *bar, |
| 5604 | const XMotionEvent * const event) | ||
| 5603 | { | 5605 | { |
| 5604 | struct frame *f = XFRAME (XWINDOW (bar->window)->frame); | 5606 | struct frame *f = XFRAME (XWINDOW (bar->window)->frame); |
| 5605 | 5607 | ||
| @@ -5751,20 +5753,6 @@ static struct x_display_info *XTread_socket_fake_io_error; | |||
| 5751 | 5753 | ||
| 5752 | static struct x_display_info *next_noop_dpyinfo; | 5754 | static struct x_display_info *next_noop_dpyinfo; |
| 5753 | 5755 | ||
| 5754 | #if defined USE_X_TOOLKIT || defined USE_GTK | ||
| 5755 | #define SET_SAVED_BUTTON_EVENT \ | ||
| 5756 | do \ | ||
| 5757 | { \ | ||
| 5758 | if (f->output_data.x->saved_menu_event == 0) \ | ||
| 5759 | f->output_data.x->saved_menu_event = \ | ||
| 5760 | xmalloc (sizeof (XEvent)); \ | ||
| 5761 | *f->output_data.x->saved_menu_event = event; \ | ||
| 5762 | inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \ | ||
| 5763 | XSETFRAME (inev.ie.frame_or_window, f); \ | ||
| 5764 | } \ | ||
| 5765 | while (0) | ||
| 5766 | #endif | ||
| 5767 | |||
| 5768 | enum | 5756 | enum |
| 5769 | { | 5757 | { |
| 5770 | X_EVENT_NORMAL, | 5758 | X_EVENT_NORMAL, |
| @@ -5858,11 +5846,13 @@ static void xembed_send_message (struct frame *f, Time, | |||
| 5858 | *FINISH is X_EVENT_GOTO_OUT if caller should stop reading events. | 5846 | *FINISH is X_EVENT_GOTO_OUT if caller should stop reading events. |
| 5859 | *FINISH is zero if caller should continue reading events. | 5847 | *FINISH is zero if caller should continue reading events. |
| 5860 | *FINISH is X_EVENT_DROP if event should not be passed to the toolkit. | 5848 | *FINISH is X_EVENT_DROP if event should not be passed to the toolkit. |
| 5849 | *EVENT is unchanged unless we're processing KeyPress event. | ||
| 5861 | 5850 | ||
| 5862 | We return the number of characters stored into the buffer. */ | 5851 | We return the number of characters stored into the buffer. */ |
| 5863 | 5852 | ||
| 5864 | static int | 5853 | static int |
| 5865 | handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | 5854 | handle_one_xevent (struct x_display_info *dpyinfo, |
| 5855 | const XEvent * const event, | ||
| 5866 | int *finish, struct input_event *hold_quit) | 5856 | int *finish, struct input_event *hold_quit) |
| 5867 | { | 5857 | { |
| 5868 | union { | 5858 | union { |
| @@ -5874,7 +5864,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 5874 | ptrdiff_t nbytes = 0; | 5864 | ptrdiff_t nbytes = 0; |
| 5875 | struct frame *any, *f = NULL; | 5865 | struct frame *any, *f = NULL; |
| 5876 | struct coding_system coding; | 5866 | struct coding_system coding; |
| 5877 | XEvent event = *eventptr; | ||
| 5878 | Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; | 5867 | Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; |
| 5879 | /* This holds the state XLookupString needs to implement dead keys | 5868 | /* This holds the state XLookupString needs to implement dead keys |
| 5880 | and other tricks known as "compose processing". _X Window System_ | 5869 | and other tricks known as "compose processing". _X Window System_ |
| @@ -5890,21 +5879,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 5890 | inev.ie.kind = NO_EVENT; | 5879 | inev.ie.kind = NO_EVENT; |
| 5891 | inev.ie.arg = Qnil; | 5880 | inev.ie.arg = Qnil; |
| 5892 | 5881 | ||
| 5893 | any = x_any_window_to_frame (dpyinfo, event.xany.window); | 5882 | any = x_any_window_to_frame (dpyinfo, event->xany.window); |
| 5894 | 5883 | ||
| 5895 | if (any && any->wait_event_type == event.type) | 5884 | if (any && any->wait_event_type == event->type) |
| 5896 | any->wait_event_type = 0; /* Indicates we got it. */ | 5885 | any->wait_event_type = 0; /* Indicates we got it. */ |
| 5897 | 5886 | ||
| 5898 | switch (event.type) | 5887 | switch (event->type) |
| 5899 | { | 5888 | { |
| 5900 | case ClientMessage: | 5889 | case ClientMessage: |
| 5901 | { | 5890 | { |
| 5902 | if (event.xclient.message_type | 5891 | if (event->xclient.message_type == dpyinfo->Xatom_wm_protocols |
| 5903 | == dpyinfo->Xatom_wm_protocols | 5892 | && event->xclient.format == 32) |
| 5904 | && event.xclient.format == 32) | ||
| 5905 | { | 5893 | { |
| 5906 | if (event.xclient.data.l[0] | 5894 | if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_take_focus) |
| 5907 | == dpyinfo->Xatom_wm_take_focus) | ||
| 5908 | { | 5895 | { |
| 5909 | /* Use the value returned by x_any_window_to_frame | 5896 | /* Use the value returned by x_any_window_to_frame |
| 5910 | because this could be the shell widget window | 5897 | because this could be the shell widget window |
| @@ -5933,15 +5920,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 5933 | since that might be an event for a deleted frame. */ | 5920 | since that might be an event for a deleted frame. */ |
| 5934 | if (f) | 5921 | if (f) |
| 5935 | { | 5922 | { |
| 5936 | Display *d = event.xclient.display; | 5923 | Display *d = event->xclient.display; |
| 5937 | /* Catch and ignore errors, in case window has been | 5924 | /* Catch and ignore errors, in case window has been |
| 5938 | iconified by a window manager such as GWM. */ | 5925 | iconified by a window manager such as GWM. */ |
| 5939 | x_catch_errors (d); | 5926 | x_catch_errors (d); |
| 5940 | XSetInputFocus (d, event.xclient.window, | 5927 | XSetInputFocus (d, event->xclient.window, |
| 5941 | /* The ICCCM says this is | 5928 | /* The ICCCM says this is |
| 5942 | the only valid choice. */ | 5929 | the only valid choice. */ |
| 5943 | RevertToParent, | 5930 | RevertToParent, |
| 5944 | event.xclient.data.l[1]); | 5931 | event->xclient.data.l[1]); |
| 5945 | /* This is needed to detect the error | 5932 | /* This is needed to detect the error |
| 5946 | if there is an error. */ | 5933 | if there is an error. */ |
| 5947 | XSync (d, False); | 5934 | XSync (d, False); |
| @@ -5952,8 +5939,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 5952 | goto done; | 5939 | goto done; |
| 5953 | } | 5940 | } |
| 5954 | 5941 | ||
| 5955 | if (event.xclient.data.l[0] | 5942 | if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_save_yourself) |
| 5956 | == dpyinfo->Xatom_wm_save_yourself) | ||
| 5957 | { | 5943 | { |
| 5958 | /* Save state modify the WM_COMMAND property to | 5944 | /* Save state modify the WM_COMMAND property to |
| 5959 | something which can reinstate us. This notifies | 5945 | something which can reinstate us. This notifies |
| @@ -5968,23 +5954,22 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 5968 | #endif | 5954 | #endif |
| 5969 | { | 5955 | { |
| 5970 | f = x_top_window_to_frame (dpyinfo, | 5956 | f = x_top_window_to_frame (dpyinfo, |
| 5971 | event.xclient.window); | 5957 | event->xclient.window); |
| 5972 | /* This is just so we only give real data once | 5958 | /* This is just so we only give real data once |
| 5973 | for a single Emacs process. */ | 5959 | for a single Emacs process. */ |
| 5974 | if (f == SELECTED_FRAME ()) | 5960 | if (f == SELECTED_FRAME ()) |
| 5975 | XSetCommand (FRAME_X_DISPLAY (f), | 5961 | XSetCommand (FRAME_X_DISPLAY (f), |
| 5976 | event.xclient.window, | 5962 | event->xclient.window, |
| 5977 | initial_argv, initial_argc); | 5963 | initial_argv, initial_argc); |
| 5978 | else if (f) | 5964 | else if (f) |
| 5979 | XSetCommand (FRAME_X_DISPLAY (f), | 5965 | XSetCommand (FRAME_X_DISPLAY (f), |
| 5980 | event.xclient.window, | 5966 | event->xclient.window, |
| 5981 | 0, 0); | 5967 | 0, 0); |
| 5982 | } | 5968 | } |
| 5983 | goto done; | 5969 | goto done; |
| 5984 | } | 5970 | } |
| 5985 | 5971 | ||
| 5986 | if (event.xclient.data.l[0] | 5972 | if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_delete_window) |
| 5987 | == dpyinfo->Xatom_wm_delete_window) | ||
| 5988 | { | 5973 | { |
| 5989 | f = any; | 5974 | f = any; |
| 5990 | if (!f) | 5975 | if (!f) |
| @@ -5998,20 +5983,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 5998 | goto done; | 5983 | goto done; |
| 5999 | } | 5984 | } |
| 6000 | 5985 | ||
| 6001 | if (event.xclient.message_type | 5986 | if (event->xclient.message_type == dpyinfo->Xatom_wm_configure_denied) |
| 6002 | == dpyinfo->Xatom_wm_configure_denied) | 5987 | goto done; |
| 6003 | { | ||
| 6004 | goto done; | ||
| 6005 | } | ||
| 6006 | 5988 | ||
| 6007 | if (event.xclient.message_type | 5989 | if (event->xclient.message_type == dpyinfo->Xatom_wm_window_moved) |
| 6008 | == dpyinfo->Xatom_wm_window_moved) | ||
| 6009 | { | 5990 | { |
| 6010 | int new_x, new_y; | 5991 | int new_x, new_y; |
| 6011 | f = x_window_to_frame (dpyinfo, event.xclient.window); | 5992 | f = x_window_to_frame (dpyinfo, event->xclient.window); |
| 6012 | 5993 | ||
| 6013 | new_x = event.xclient.data.s[0]; | 5994 | new_x = event->xclient.data.s[0]; |
| 6014 | new_y = event.xclient.data.s[1]; | 5995 | new_y = event->xclient.data.s[1]; |
| 6015 | 5996 | ||
| 6016 | if (f) | 5997 | if (f) |
| 6017 | { | 5998 | { |
| @@ -6022,28 +6003,25 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6022 | } | 6003 | } |
| 6023 | 6004 | ||
| 6024 | #ifdef HACK_EDITRES | 6005 | #ifdef HACK_EDITRES |
| 6025 | if (event.xclient.message_type | 6006 | if (event->xclient.message_type == dpyinfo->Xatom_editres) |
| 6026 | == dpyinfo->Xatom_editres) | ||
| 6027 | { | 6007 | { |
| 6028 | f = any; | 6008 | f = any; |
| 6029 | if (f) | 6009 | if (f) |
| 6030 | _XEditResCheckMessages (f->output_data.x->widget, NULL, | 6010 | _XEditResCheckMessages (f->output_data.x->widget, |
| 6031 | &event, NULL); | 6011 | NULL, (XEvent *) event, NULL); |
| 6032 | goto done; | 6012 | goto done; |
| 6033 | } | 6013 | } |
| 6034 | #endif /* HACK_EDITRES */ | 6014 | #endif /* HACK_EDITRES */ |
| 6035 | 6015 | ||
| 6036 | if ((event.xclient.message_type | 6016 | if (event->xclient.message_type == dpyinfo->Xatom_DONE |
| 6037 | == dpyinfo->Xatom_DONE) | 6017 | || event->xclient.message_type == dpyinfo->Xatom_PAGE) |
| 6038 | || (event.xclient.message_type | ||
| 6039 | == dpyinfo->Xatom_PAGE)) | ||
| 6040 | { | 6018 | { |
| 6041 | /* Ghostview job completed. Kill it. We could | 6019 | /* Ghostview job completed. Kill it. We could |
| 6042 | reply with "Next" if we received "Page", but we | 6020 | reply with "Next" if we received "Page", but we |
| 6043 | currently never do because we are interested in | 6021 | currently never do because we are interested in |
| 6044 | images, only, which should have 1 page. */ | 6022 | images, only, which should have 1 page. */ |
| 6045 | Pixmap pixmap = (Pixmap) event.xclient.data.l[1]; | 6023 | Pixmap pixmap = (Pixmap) event->xclient.data.l[1]; |
| 6046 | f = x_window_to_frame (dpyinfo, event.xclient.window); | 6024 | f = x_window_to_frame (dpyinfo, event->xclient.window); |
| 6047 | if (!f) | 6025 | if (!f) |
| 6048 | goto OTHER; | 6026 | goto OTHER; |
| 6049 | x_kill_gs_process (pixmap, f); | 6027 | x_kill_gs_process (pixmap, f); |
| @@ -6054,54 +6032,52 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6054 | #ifdef USE_TOOLKIT_SCROLL_BARS | 6032 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 6055 | /* Scroll bar callbacks send a ClientMessage from which | 6033 | /* Scroll bar callbacks send a ClientMessage from which |
| 6056 | we construct an input_event. */ | 6034 | we construct an input_event. */ |
| 6057 | if (event.xclient.message_type | 6035 | if (event->xclient.message_type == dpyinfo->Xatom_Scrollbar) |
| 6058 | == dpyinfo->Xatom_Scrollbar) | ||
| 6059 | { | 6036 | { |
| 6060 | x_scroll_bar_to_input_event (&event, &inev.ie); | 6037 | x_scroll_bar_to_input_event (event, &inev.ie); |
| 6061 | *finish = X_EVENT_GOTO_OUT; | 6038 | *finish = X_EVENT_GOTO_OUT; |
| 6062 | goto done; | 6039 | goto done; |
| 6063 | } | 6040 | } |
| 6064 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | 6041 | #endif /* USE_TOOLKIT_SCROLL_BARS */ |
| 6065 | 6042 | ||
| 6066 | /* XEmbed messages from the embedder (if any). */ | 6043 | /* XEmbed messages from the embedder (if any). */ |
| 6067 | if (event.xclient.message_type | 6044 | if (event->xclient.message_type == dpyinfo->Xatom_XEMBED) |
| 6068 | == dpyinfo->Xatom_XEMBED) | ||
| 6069 | { | 6045 | { |
| 6070 | enum xembed_message msg = event.xclient.data.l[1]; | 6046 | enum xembed_message msg = event->xclient.data.l[1]; |
| 6071 | if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT) | 6047 | if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT) |
| 6072 | x_detect_focus_change (dpyinfo, any, &event, &inev.ie); | 6048 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 6073 | 6049 | ||
| 6074 | *finish = X_EVENT_GOTO_OUT; | 6050 | *finish = X_EVENT_GOTO_OUT; |
| 6075 | goto done; | 6051 | goto done; |
| 6076 | } | 6052 | } |
| 6077 | 6053 | ||
| 6078 | xft_settings_event (dpyinfo, &event); | 6054 | xft_settings_event (dpyinfo, event); |
| 6079 | 6055 | ||
| 6080 | f = any; | 6056 | f = any; |
| 6081 | if (!f) | 6057 | if (!f) |
| 6082 | goto OTHER; | 6058 | goto OTHER; |
| 6083 | if (x_handle_dnd_message (f, &event.xclient, dpyinfo, &inev.ie)) | 6059 | if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev.ie)) |
| 6084 | *finish = X_EVENT_DROP; | 6060 | *finish = X_EVENT_DROP; |
| 6085 | } | 6061 | } |
| 6086 | break; | 6062 | break; |
| 6087 | 6063 | ||
| 6088 | case SelectionNotify: | 6064 | case SelectionNotify: |
| 6089 | dpyinfo->last_user_time = event.xselection.time; | 6065 | dpyinfo->last_user_time = event->xselection.time; |
| 6090 | #ifdef USE_X_TOOLKIT | 6066 | #ifdef USE_X_TOOLKIT |
| 6091 | if (! x_window_to_frame (dpyinfo, event.xselection.requestor)) | 6067 | if (! x_window_to_frame (dpyinfo, event->xselection.requestor)) |
| 6092 | goto OTHER; | 6068 | goto OTHER; |
| 6093 | #endif /* not USE_X_TOOLKIT */ | 6069 | #endif /* not USE_X_TOOLKIT */ |
| 6094 | x_handle_selection_notify (&event.xselection); | 6070 | x_handle_selection_notify (&event->xselection); |
| 6095 | break; | 6071 | break; |
| 6096 | 6072 | ||
| 6097 | case SelectionClear: /* Someone has grabbed ownership. */ | 6073 | case SelectionClear: /* Someone has grabbed ownership. */ |
| 6098 | dpyinfo->last_user_time = event.xselectionclear.time; | 6074 | dpyinfo->last_user_time = event->xselectionclear.time; |
| 6099 | #ifdef USE_X_TOOLKIT | 6075 | #ifdef USE_X_TOOLKIT |
| 6100 | if (! x_window_to_frame (dpyinfo, event.xselectionclear.window)) | 6076 | if (! x_window_to_frame (dpyinfo, event->xselectionclear.window)) |
| 6101 | goto OTHER; | 6077 | goto OTHER; |
| 6102 | #endif /* USE_X_TOOLKIT */ | 6078 | #endif /* USE_X_TOOLKIT */ |
| 6103 | { | 6079 | { |
| 6104 | XSelectionClearEvent *eventp = &(event.xselectionclear); | 6080 | const XSelectionClearEvent * const eventp = &event->xselectionclear; |
| 6105 | 6081 | ||
| 6106 | inev.ie.kind = SELECTION_CLEAR_EVENT; | 6082 | inev.ie.kind = SELECTION_CLEAR_EVENT; |
| 6107 | SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; | 6083 | SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; |
| @@ -6111,29 +6087,29 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6111 | break; | 6087 | break; |
| 6112 | 6088 | ||
| 6113 | case SelectionRequest: /* Someone wants our selection. */ | 6089 | case SelectionRequest: /* Someone wants our selection. */ |
| 6114 | dpyinfo->last_user_time = event.xselectionrequest.time; | 6090 | dpyinfo->last_user_time = event->xselectionrequest.time; |
| 6115 | #ifdef USE_X_TOOLKIT | 6091 | #ifdef USE_X_TOOLKIT |
| 6116 | if (!x_window_to_frame (dpyinfo, event.xselectionrequest.owner)) | 6092 | if (!x_window_to_frame (dpyinfo, event->xselectionrequest.owner)) |
| 6117 | goto OTHER; | 6093 | goto OTHER; |
| 6118 | #endif /* USE_X_TOOLKIT */ | 6094 | #endif /* USE_X_TOOLKIT */ |
| 6119 | { | 6095 | { |
| 6120 | XSelectionRequestEvent *eventp = &(event.xselectionrequest); | 6096 | const XSelectionRequestEvent * const eventp = &event->xselectionrequest; |
| 6121 | 6097 | ||
| 6122 | inev.ie.kind = SELECTION_REQUEST_EVENT; | 6098 | inev.ie.kind = SELECTION_REQUEST_EVENT; |
| 6123 | SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; | 6099 | SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; |
| 6124 | SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor; | 6100 | SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor; |
| 6125 | SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection; | 6101 | SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection; |
| 6126 | SELECTION_EVENT_TARGET (&inev.sie) = eventp->target; | 6102 | SELECTION_EVENT_TARGET (&inev.sie) = eventp->target; |
| 6127 | SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property; | 6103 | SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property; |
| 6128 | SELECTION_EVENT_TIME (&inev.sie) = eventp->time; | 6104 | SELECTION_EVENT_TIME (&inev.sie) = eventp->time; |
| 6129 | } | 6105 | } |
| 6130 | break; | 6106 | break; |
| 6131 | 6107 | ||
| 6132 | case PropertyNotify: | 6108 | case PropertyNotify: |
| 6133 | dpyinfo->last_user_time = event.xproperty.time; | 6109 | dpyinfo->last_user_time = event->xproperty.time; |
| 6134 | f = x_top_window_to_frame (dpyinfo, event.xproperty.window); | 6110 | f = x_top_window_to_frame (dpyinfo, event->xproperty.window); |
| 6135 | if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state) | 6111 | if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state) |
| 6136 | if (x_handle_net_wm_state (f, &event.xproperty) | 6112 | if (x_handle_net_wm_state (f, &event->xproperty) |
| 6137 | && FRAME_ICONIFIED_P (f) | 6113 | && FRAME_ICONIFIED_P (f) |
| 6138 | && f->output_data.x->net_wm_state_hidden_seen) | 6114 | && f->output_data.x->net_wm_state_hidden_seen) |
| 6139 | { | 6115 | { |
| @@ -6148,16 +6124,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6148 | XSETFRAME (inev.ie.frame_or_window, f); | 6124 | XSETFRAME (inev.ie.frame_or_window, f); |
| 6149 | } | 6125 | } |
| 6150 | 6126 | ||
| 6151 | x_handle_property_notify (&event.xproperty); | 6127 | x_handle_property_notify (&event->xproperty); |
| 6152 | xft_settings_event (dpyinfo, &event); | 6128 | xft_settings_event (dpyinfo, event); |
| 6153 | goto OTHER; | 6129 | goto OTHER; |
| 6154 | 6130 | ||
| 6155 | case ReparentNotify: | 6131 | case ReparentNotify: |
| 6156 | f = x_top_window_to_frame (dpyinfo, event.xreparent.window); | 6132 | f = x_top_window_to_frame (dpyinfo, event->xreparent.window); |
| 6157 | if (f) | 6133 | if (f) |
| 6158 | { | 6134 | { |
| 6159 | int x, y; | 6135 | int x, y; |
| 6160 | f->output_data.x->parent_desc = event.xreparent.parent; | 6136 | f->output_data.x->parent_desc = event->xreparent.parent; |
| 6161 | x_real_positions (f, &x, &y); | 6137 | x_real_positions (f, &x, &y); |
| 6162 | f->left_pos = x; | 6138 | f->left_pos = x; |
| 6163 | f->top_pos = y; | 6139 | f->top_pos = y; |
| @@ -6171,15 +6147,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6171 | goto OTHER; | 6147 | goto OTHER; |
| 6172 | 6148 | ||
| 6173 | case Expose: | 6149 | case Expose: |
| 6174 | f = x_window_to_frame (dpyinfo, event.xexpose.window); | 6150 | f = x_window_to_frame (dpyinfo, event->xexpose.window); |
| 6175 | if (f) | 6151 | if (f) |
| 6176 | { | 6152 | { |
| 6177 | #ifdef USE_GTK | 6153 | #ifdef USE_GTK |
| 6178 | /* This seems to be needed for GTK 2.6. */ | 6154 | /* This seems to be needed for GTK 2.6. */ |
| 6179 | x_clear_area (event.xexpose.display, | 6155 | x_clear_area (event->xexpose.display, |
| 6180 | event.xexpose.window, | 6156 | event->xexpose.window, |
| 6181 | event.xexpose.x, event.xexpose.y, | 6157 | event->xexpose.x, event->xexpose.y, |
| 6182 | event.xexpose.width, event.xexpose.height); | 6158 | event->xexpose.width, event->xexpose.height); |
| 6183 | #endif | 6159 | #endif |
| 6184 | if (!FRAME_VISIBLE_P (f)) | 6160 | if (!FRAME_VISIBLE_P (f)) |
| 6185 | { | 6161 | { |
| @@ -6189,9 +6165,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6189 | SET_FRAME_GARBAGED (f); | 6165 | SET_FRAME_GARBAGED (f); |
| 6190 | } | 6166 | } |
| 6191 | else | 6167 | else |
| 6192 | expose_frame (f, | 6168 | expose_frame (f, event->xexpose.x, event->xexpose.y, |
| 6193 | event.xexpose.x, event.xexpose.y, | 6169 | event->xexpose.width, event->xexpose.height); |
| 6194 | event.xexpose.width, event.xexpose.height); | ||
| 6195 | } | 6170 | } |
| 6196 | else | 6171 | else |
| 6197 | { | 6172 | { |
| @@ -6203,8 +6178,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6203 | themselves, so there's no way to dispatch events | 6178 | themselves, so there's no way to dispatch events |
| 6204 | to them. Recognize this case separately. */ | 6179 | to them. Recognize this case separately. */ |
| 6205 | { | 6180 | { |
| 6206 | Widget widget | 6181 | Widget widget = x_window_to_menu_bar (event->xexpose.window); |
| 6207 | = x_window_to_menu_bar (event.xexpose.window); | ||
| 6208 | if (widget) | 6182 | if (widget) |
| 6209 | xlwmenu_redisplay (widget); | 6183 | xlwmenu_redisplay (widget); |
| 6210 | } | 6184 | } |
| @@ -6214,11 +6188,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6214 | /* Dispatch event to the widget. */ | 6188 | /* Dispatch event to the widget. */ |
| 6215 | goto OTHER; | 6189 | goto OTHER; |
| 6216 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 6190 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 6217 | bar = x_window_to_scroll_bar (event.xexpose.display, | 6191 | bar = x_window_to_scroll_bar (event->xexpose.display, |
| 6218 | event.xexpose.window); | 6192 | event->xexpose.window); |
| 6219 | 6193 | ||
| 6220 | if (bar) | 6194 | if (bar) |
| 6221 | x_scroll_bar_expose (bar, &event); | 6195 | x_scroll_bar_expose (bar, event); |
| 6222 | #ifdef USE_X_TOOLKIT | 6196 | #ifdef USE_X_TOOLKIT |
| 6223 | else | 6197 | else |
| 6224 | goto OTHER; | 6198 | goto OTHER; |
| @@ -6230,14 +6204,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6230 | case GraphicsExpose: /* This occurs when an XCopyArea's | 6204 | case GraphicsExpose: /* This occurs when an XCopyArea's |
| 6231 | source area was obscured or not | 6205 | source area was obscured or not |
| 6232 | available. */ | 6206 | available. */ |
| 6233 | f = x_window_to_frame (dpyinfo, event.xgraphicsexpose.drawable); | 6207 | f = x_window_to_frame (dpyinfo, event->xgraphicsexpose.drawable); |
| 6234 | if (f) | 6208 | if (f) |
| 6235 | { | 6209 | expose_frame (f, event->xgraphicsexpose.x, |
| 6236 | expose_frame (f, | 6210 | event->xgraphicsexpose.y, |
| 6237 | event.xgraphicsexpose.x, event.xgraphicsexpose.y, | 6211 | event->xgraphicsexpose.width, |
| 6238 | event.xgraphicsexpose.width, | 6212 | event->xgraphicsexpose.height); |
| 6239 | event.xgraphicsexpose.height); | ||
| 6240 | } | ||
| 6241 | #ifdef USE_X_TOOLKIT | 6213 | #ifdef USE_X_TOOLKIT |
| 6242 | else | 6214 | else |
| 6243 | goto OTHER; | 6215 | goto OTHER; |
| @@ -6251,13 +6223,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6251 | 6223 | ||
| 6252 | case UnmapNotify: | 6224 | case UnmapNotify: |
| 6253 | /* Redo the mouse-highlight after the tooltip has gone. */ | 6225 | /* Redo the mouse-highlight after the tooltip has gone. */ |
| 6254 | if (event.xunmap.window == tip_window) | 6226 | if (event->xunmap.window == tip_window) |
| 6255 | { | 6227 | { |
| 6256 | tip_window = 0; | 6228 | tip_window = 0; |
| 6257 | redo_mouse_highlight (); | 6229 | redo_mouse_highlight (); |
| 6258 | } | 6230 | } |
| 6259 | 6231 | ||
| 6260 | f = x_top_window_to_frame (dpyinfo, event.xunmap.window); | 6232 | f = x_top_window_to_frame (dpyinfo, event->xunmap.window); |
| 6261 | if (f) /* F may no longer exist if | 6233 | if (f) /* F may no longer exist if |
| 6262 | the frame was deleted. */ | 6234 | the frame was deleted. */ |
| 6263 | { | 6235 | { |
| @@ -6282,7 +6254,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6282 | goto OTHER; | 6254 | goto OTHER; |
| 6283 | 6255 | ||
| 6284 | case MapNotify: | 6256 | case MapNotify: |
| 6285 | if (event.xmap.window == tip_window) | 6257 | if (event->xmap.window == tip_window) |
| 6286 | /* The tooltip has been drawn already. Avoid | 6258 | /* The tooltip has been drawn already. Avoid |
| 6287 | the SET_FRAME_GARBAGED below. */ | 6259 | the SET_FRAME_GARBAGED below. */ |
| 6288 | goto OTHER; | 6260 | goto OTHER; |
| @@ -6290,7 +6262,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6290 | /* We use x_top_window_to_frame because map events can | 6262 | /* We use x_top_window_to_frame because map events can |
| 6291 | come for sub-windows and they don't mean that the | 6263 | come for sub-windows and they don't mean that the |
| 6292 | frame is visible. */ | 6264 | frame is visible. */ |
| 6293 | f = x_top_window_to_frame (dpyinfo, event.xmap.window); | 6265 | f = x_top_window_to_frame (dpyinfo, event->xmap.window); |
| 6294 | if (f) | 6266 | if (f) |
| 6295 | { | 6267 | { |
| 6296 | bool iconified = FRAME_ICONIFIED_P (f); | 6268 | bool iconified = FRAME_ICONIFIED_P (f); |
| @@ -6330,7 +6302,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6330 | 6302 | ||
| 6331 | case KeyPress: | 6303 | case KeyPress: |
| 6332 | 6304 | ||
| 6333 | dpyinfo->last_user_time = event.xkey.time; | 6305 | dpyinfo->last_user_time = event->xkey.time; |
| 6334 | ignore_next_mouse_click_timeout = 0; | 6306 | ignore_next_mouse_click_timeout = 0; |
| 6335 | 6307 | ||
| 6336 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 6308 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| @@ -6359,7 +6331,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6359 | /* Scroll bars consume key events, but we want | 6331 | /* Scroll bars consume key events, but we want |
| 6360 | the keys to go to the scroll bar's frame. */ | 6332 | the keys to go to the scroll bar's frame. */ |
| 6361 | Widget widget = XtWindowToWidget (dpyinfo->display, | 6333 | Widget widget = XtWindowToWidget (dpyinfo->display, |
| 6362 | event.xkey.window); | 6334 | event->xkey.window); |
| 6363 | if (widget && XmIsScrollBar (widget)) | 6335 | if (widget && XmIsScrollBar (widget)) |
| 6364 | { | 6336 | { |
| 6365 | widget = XtParent (widget); | 6337 | widget = XtParent (widget); |
| @@ -6388,6 +6360,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6388 | int modifiers; | 6360 | int modifiers; |
| 6389 | Lisp_Object coding_system = Qlatin_1; | 6361 | Lisp_Object coding_system = Qlatin_1; |
| 6390 | Lisp_Object c; | 6362 | Lisp_Object c; |
| 6363 | /* Event will be modified. */ | ||
| 6364 | XKeyEvent xkey = event->xkey; | ||
| 6391 | 6365 | ||
| 6392 | #ifdef USE_GTK | 6366 | #ifdef USE_GTK |
| 6393 | /* Don't pass keys to GTK. A Tab will shift focus to the | 6367 | /* Don't pass keys to GTK. A Tab will shift focus to the |
| @@ -6397,20 +6371,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6397 | *finish = X_EVENT_DROP; | 6371 | *finish = X_EVENT_DROP; |
| 6398 | #endif | 6372 | #endif |
| 6399 | 6373 | ||
| 6400 | event.xkey.state | 6374 | xkey.state |= x_emacs_to_x_modifiers (FRAME_DISPLAY_INFO (f), |
| 6401 | |= x_emacs_to_x_modifiers (FRAME_DISPLAY_INFO (f), | 6375 | extra_keyboard_modifiers); |
| 6402 | extra_keyboard_modifiers); | 6376 | modifiers = xkey.state; |
| 6403 | modifiers = event.xkey.state; | ||
| 6404 | 6377 | ||
| 6405 | /* This will have to go some day... */ | 6378 | /* This will have to go some day... */ |
| 6406 | 6379 | ||
| 6407 | /* make_lispy_event turns chars into control chars. | 6380 | /* make_lispy_event turns chars into control chars. |
| 6408 | Don't do it here because XLookupString is too eager. */ | 6381 | Don't do it here because XLookupString is too eager. */ |
| 6409 | event.xkey.state &= ~ControlMask; | 6382 | xkey.state &= ~ControlMask; |
| 6410 | event.xkey.state &= ~(dpyinfo->meta_mod_mask | 6383 | xkey.state &= ~(dpyinfo->meta_mod_mask |
| 6411 | | dpyinfo->super_mod_mask | 6384 | | dpyinfo->super_mod_mask |
| 6412 | | dpyinfo->hyper_mod_mask | 6385 | | dpyinfo->hyper_mod_mask |
| 6413 | | dpyinfo->alt_mod_mask); | 6386 | | dpyinfo->alt_mod_mask); |
| 6414 | 6387 | ||
| 6415 | /* In case Meta is ComposeCharacter, | 6388 | /* In case Meta is ComposeCharacter, |
| 6416 | clear its status. According to Markus Ehrnsperger | 6389 | clear its status. According to Markus Ehrnsperger |
| @@ -6427,7 +6400,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6427 | 6400 | ||
| 6428 | coding_system = Vlocale_coding_system; | 6401 | coding_system = Vlocale_coding_system; |
| 6429 | nbytes = XmbLookupString (FRAME_XIC (f), | 6402 | nbytes = XmbLookupString (FRAME_XIC (f), |
| 6430 | &event.xkey, (char *) copy_bufptr, | 6403 | &xkey, (char *) copy_bufptr, |
| 6431 | copy_bufsiz, &keysym, | 6404 | copy_bufsiz, &keysym, |
| 6432 | &status_return); | 6405 | &status_return); |
| 6433 | if (status_return == XBufferOverflow) | 6406 | if (status_return == XBufferOverflow) |
| @@ -6435,7 +6408,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6435 | copy_bufsiz = nbytes + 1; | 6408 | copy_bufsiz = nbytes + 1; |
| 6436 | copy_bufptr = alloca (copy_bufsiz); | 6409 | copy_bufptr = alloca (copy_bufsiz); |
| 6437 | nbytes = XmbLookupString (FRAME_XIC (f), | 6410 | nbytes = XmbLookupString (FRAME_XIC (f), |
| 6438 | &event.xkey, (char *) copy_bufptr, | 6411 | &xkey, (char *) copy_bufptr, |
| 6439 | copy_bufsiz, &keysym, | 6412 | copy_bufsiz, &keysym, |
| 6440 | &status_return); | 6413 | &status_return); |
| 6441 | } | 6414 | } |
| @@ -6452,11 +6425,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6452 | emacs_abort (); | 6425 | emacs_abort (); |
| 6453 | } | 6426 | } |
| 6454 | else | 6427 | else |
| 6455 | nbytes = XLookupString (&event.xkey, (char *) copy_bufptr, | 6428 | nbytes = XLookupString (&xkey, (char *) copy_bufptr, |
| 6456 | copy_bufsiz, &keysym, | 6429 | copy_bufsiz, &keysym, |
| 6457 | &compose_status); | 6430 | &compose_status); |
| 6458 | #else | 6431 | #else |
| 6459 | nbytes = XLookupString (&event.xkey, (char *) copy_bufptr, | 6432 | nbytes = XLookupString (&xkey, (char *) copy_bufptr, |
| 6460 | copy_bufsiz, &keysym, | 6433 | copy_bufsiz, &keysym, |
| 6461 | &compose_status); | 6434 | &compose_status); |
| 6462 | #endif | 6435 | #endif |
| @@ -6473,7 +6446,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6473 | XSETFRAME (inev.ie.frame_or_window, f); | 6446 | XSETFRAME (inev.ie.frame_or_window, f); |
| 6474 | inev.ie.modifiers | 6447 | inev.ie.modifiers |
| 6475 | = x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), modifiers); | 6448 | = x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), modifiers); |
| 6476 | inev.ie.timestamp = event.xkey.time; | 6449 | inev.ie.timestamp = xkey.time; |
| 6477 | 6450 | ||
| 6478 | /* First deal with keysyms which have defined | 6451 | /* First deal with keysyms which have defined |
| 6479 | translations to characters. */ | 6452 | translations to characters. */ |
| @@ -6649,6 +6622,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6649 | if (keysym == NoSymbol) | 6622 | if (keysym == NoSymbol) |
| 6650 | break; | 6623 | break; |
| 6651 | } | 6624 | } |
| 6625 | /* FIXME: check side effects and remove this. */ | ||
| 6626 | ((XEvent *) event)->xkey = xkey; | ||
| 6652 | } | 6627 | } |
| 6653 | done_keysym: | 6628 | done_keysym: |
| 6654 | #ifdef HAVE_X_I18N | 6629 | #ifdef HAVE_X_I18N |
| @@ -6661,7 +6636,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6661 | #endif | 6636 | #endif |
| 6662 | 6637 | ||
| 6663 | case KeyRelease: | 6638 | case KeyRelease: |
| 6664 | dpyinfo->last_user_time = event.xkey.time; | 6639 | dpyinfo->last_user_time = event->xkey.time; |
| 6665 | #ifdef HAVE_X_I18N | 6640 | #ifdef HAVE_X_I18N |
| 6666 | /* Don't dispatch this event since XtDispatchEvent calls | 6641 | /* Don't dispatch this event since XtDispatchEvent calls |
| 6667 | XFilterEvent, and two calls in a row may freeze the | 6642 | XFilterEvent, and two calls in a row may freeze the |
| @@ -6672,35 +6647,35 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6672 | #endif | 6647 | #endif |
| 6673 | 6648 | ||
| 6674 | case EnterNotify: | 6649 | case EnterNotify: |
| 6675 | dpyinfo->last_user_time = event.xcrossing.time; | 6650 | dpyinfo->last_user_time = event->xcrossing.time; |
| 6676 | x_detect_focus_change (dpyinfo, any, &event, &inev.ie); | 6651 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 6677 | 6652 | ||
| 6678 | f = any; | 6653 | f = any; |
| 6679 | 6654 | ||
| 6680 | if (f && x_mouse_click_focus_ignore_position) | 6655 | if (f && x_mouse_click_focus_ignore_position) |
| 6681 | ignore_next_mouse_click_timeout = event.xmotion.time + 200; | 6656 | ignore_next_mouse_click_timeout = event->xmotion.time + 200; |
| 6682 | 6657 | ||
| 6683 | /* EnterNotify counts as mouse movement, | 6658 | /* EnterNotify counts as mouse movement, |
| 6684 | so update things that depend on mouse position. */ | 6659 | so update things that depend on mouse position. */ |
| 6685 | if (f && !f->output_data.x->hourglass_p) | 6660 | if (f && !f->output_data.x->hourglass_p) |
| 6686 | note_mouse_movement (f, &event.xmotion); | 6661 | note_mouse_movement (f, &event->xmotion); |
| 6687 | #ifdef USE_GTK | 6662 | #ifdef USE_GTK |
| 6688 | /* We may get an EnterNotify on the buttons in the toolbar. In that | 6663 | /* We may get an EnterNotify on the buttons in the toolbar. In that |
| 6689 | case we moved out of any highlighted area and need to note this. */ | 6664 | case we moved out of any highlighted area and need to note this. */ |
| 6690 | if (!f && last_mouse_glyph_frame) | 6665 | if (!f && last_mouse_glyph_frame) |
| 6691 | note_mouse_movement (last_mouse_glyph_frame, &event.xmotion); | 6666 | note_mouse_movement (last_mouse_glyph_frame, &event->xmotion); |
| 6692 | #endif | 6667 | #endif |
| 6693 | goto OTHER; | 6668 | goto OTHER; |
| 6694 | 6669 | ||
| 6695 | case FocusIn: | 6670 | case FocusIn: |
| 6696 | x_detect_focus_change (dpyinfo, any, &event, &inev.ie); | 6671 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 6697 | goto OTHER; | 6672 | goto OTHER; |
| 6698 | 6673 | ||
| 6699 | case LeaveNotify: | 6674 | case LeaveNotify: |
| 6700 | dpyinfo->last_user_time = event.xcrossing.time; | 6675 | dpyinfo->last_user_time = event->xcrossing.time; |
| 6701 | x_detect_focus_change (dpyinfo, any, &event, &inev.ie); | 6676 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 6702 | 6677 | ||
| 6703 | f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); | 6678 | f = x_top_window_to_frame (dpyinfo, event->xcrossing.window); |
| 6704 | if (f) | 6679 | if (f) |
| 6705 | { | 6680 | { |
| 6706 | if (f == hlinfo->mouse_face_mouse_frame) | 6681 | if (f == hlinfo->mouse_face_mouse_frame) |
| @@ -6721,17 +6696,17 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6721 | #ifdef USE_GTK | 6696 | #ifdef USE_GTK |
| 6722 | /* See comment in EnterNotify above */ | 6697 | /* See comment in EnterNotify above */ |
| 6723 | else if (last_mouse_glyph_frame) | 6698 | else if (last_mouse_glyph_frame) |
| 6724 | note_mouse_movement (last_mouse_glyph_frame, &event.xmotion); | 6699 | note_mouse_movement (last_mouse_glyph_frame, &event->xmotion); |
| 6725 | #endif | 6700 | #endif |
| 6726 | goto OTHER; | 6701 | goto OTHER; |
| 6727 | 6702 | ||
| 6728 | case FocusOut: | 6703 | case FocusOut: |
| 6729 | x_detect_focus_change (dpyinfo, any, &event, &inev.ie); | 6704 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 6730 | goto OTHER; | 6705 | goto OTHER; |
| 6731 | 6706 | ||
| 6732 | case MotionNotify: | 6707 | case MotionNotify: |
| 6733 | { | 6708 | { |
| 6734 | dpyinfo->last_user_time = event.xmotion.time; | 6709 | dpyinfo->last_user_time = event->xmotion.time; |
| 6735 | previous_help_echo_string = help_echo_string; | 6710 | previous_help_echo_string = help_echo_string; |
| 6736 | help_echo_string = Qnil; | 6711 | help_echo_string = Qnil; |
| 6737 | 6712 | ||
| @@ -6739,7 +6714,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6739 | && FRAME_LIVE_P (last_mouse_frame)) | 6714 | && FRAME_LIVE_P (last_mouse_frame)) |
| 6740 | f = last_mouse_frame; | 6715 | f = last_mouse_frame; |
| 6741 | else | 6716 | else |
| 6742 | f = x_window_to_frame (dpyinfo, event.xmotion.window); | 6717 | f = x_window_to_frame (dpyinfo, event->xmotion.window); |
| 6743 | 6718 | ||
| 6744 | if (hlinfo->mouse_face_hidden) | 6719 | if (hlinfo->mouse_face_hidden) |
| 6745 | { | 6720 | { |
| @@ -6748,7 +6723,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6748 | } | 6723 | } |
| 6749 | 6724 | ||
| 6750 | #ifdef USE_GTK | 6725 | #ifdef USE_GTK |
| 6751 | if (f && xg_event_is_for_scrollbar (f, &event)) | 6726 | if (f && xg_event_is_for_scrollbar (f, event)) |
| 6752 | f = 0; | 6727 | f = 0; |
| 6753 | #endif | 6728 | #endif |
| 6754 | if (f) | 6729 | if (f) |
| @@ -6760,7 +6735,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6760 | { | 6735 | { |
| 6761 | static Lisp_Object last_mouse_window; | 6736 | static Lisp_Object last_mouse_window; |
| 6762 | Lisp_Object window = window_from_coordinates | 6737 | Lisp_Object window = window_from_coordinates |
| 6763 | (f, event.xmotion.x, event.xmotion.y, 0, 0); | 6738 | (f, event->xmotion.x, event->xmotion.y, 0, 0); |
| 6764 | 6739 | ||
| 6765 | /* Window will be selected only when it is not selected now and | 6740 | /* Window will be selected only when it is not selected now and |
| 6766 | last mouse movement event was not in it. Minibuffer window | 6741 | last mouse movement event was not in it. Minibuffer window |
| @@ -6781,18 +6756,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6781 | /* Remember the last window where we saw the mouse. */ | 6756 | /* Remember the last window where we saw the mouse. */ |
| 6782 | last_mouse_window = window; | 6757 | last_mouse_window = window; |
| 6783 | } | 6758 | } |
| 6784 | if (!note_mouse_movement (f, &event.xmotion)) | 6759 | if (!note_mouse_movement (f, &event->xmotion)) |
| 6785 | help_echo_string = previous_help_echo_string; | 6760 | help_echo_string = previous_help_echo_string; |
| 6786 | } | 6761 | } |
| 6787 | else | 6762 | else |
| 6788 | { | 6763 | { |
| 6789 | #ifndef USE_TOOLKIT_SCROLL_BARS | 6764 | #ifndef USE_TOOLKIT_SCROLL_BARS |
| 6790 | struct scroll_bar *bar | 6765 | struct scroll_bar *bar |
| 6791 | = x_window_to_scroll_bar (event.xmotion.display, | 6766 | = x_window_to_scroll_bar (event->xmotion.display, |
| 6792 | event.xmotion.window); | 6767 | event->xmotion.window); |
| 6793 | 6768 | ||
| 6794 | if (bar) | 6769 | if (bar) |
| 6795 | x_scroll_bar_note_movement (bar, &event.xmotion); | 6770 | x_scroll_bar_note_movement (bar, &event->xmotion); |
| 6796 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | 6771 | #endif /* USE_TOOLKIT_SCROLL_BARS */ |
| 6797 | 6772 | ||
| 6798 | /* If we move outside the frame, then we're | 6773 | /* If we move outside the frame, then we're |
| @@ -6809,14 +6784,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6809 | } | 6784 | } |
| 6810 | 6785 | ||
| 6811 | case ConfigureNotify: | 6786 | case ConfigureNotify: |
| 6812 | f = x_top_window_to_frame (dpyinfo, event.xconfigure.window); | 6787 | f = x_top_window_to_frame (dpyinfo, event->xconfigure.window); |
| 6813 | #ifdef USE_GTK | 6788 | #ifdef USE_GTK |
| 6814 | if (!f | 6789 | if (!f |
| 6815 | && (f = any) | 6790 | && (f = any) |
| 6816 | && event.xconfigure.window == FRAME_X_WINDOW (f)) | 6791 | && event->xconfigure.window == FRAME_X_WINDOW (f)) |
| 6817 | { | 6792 | { |
| 6818 | xg_frame_resized (f, event.xconfigure.width, | 6793 | xg_frame_resized (f, event->xconfigure.width, |
| 6819 | event.xconfigure.height); | 6794 | event->xconfigure.height); |
| 6820 | f = 0; | 6795 | f = 0; |
| 6821 | } | 6796 | } |
| 6822 | #endif | 6797 | #endif |
| @@ -6824,8 +6799,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6824 | { | 6799 | { |
| 6825 | #ifndef USE_X_TOOLKIT | 6800 | #ifndef USE_X_TOOLKIT |
| 6826 | #ifndef USE_GTK | 6801 | #ifndef USE_GTK |
| 6827 | int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height); | 6802 | int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event->xconfigure.height); |
| 6828 | int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event.xconfigure.width); | 6803 | int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event->xconfigure.width); |
| 6829 | 6804 | ||
| 6830 | /* In the toolkit version, change_frame_size | 6805 | /* In the toolkit version, change_frame_size |
| 6831 | is called by the code that handles resizing | 6806 | is called by the code that handles resizing |
| @@ -6836,16 +6811,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6836 | to check the pixel dimensions as well. */ | 6811 | to check the pixel dimensions as well. */ |
| 6837 | if (columns != FRAME_COLS (f) | 6812 | if (columns != FRAME_COLS (f) |
| 6838 | || rows != FRAME_LINES (f) | 6813 | || rows != FRAME_LINES (f) |
| 6839 | || event.xconfigure.width != FRAME_PIXEL_WIDTH (f) | 6814 | || event->xconfigure.width != FRAME_PIXEL_WIDTH (f) |
| 6840 | || event.xconfigure.height != FRAME_PIXEL_HEIGHT (f)) | 6815 | || event->xconfigure.height != FRAME_PIXEL_HEIGHT (f)) |
| 6841 | { | 6816 | { |
| 6842 | change_frame_size (f, rows, columns, 0, 1, 0); | 6817 | change_frame_size (f, rows, columns, 0, 1, 0); |
| 6843 | SET_FRAME_GARBAGED (f); | 6818 | SET_FRAME_GARBAGED (f); |
| 6844 | cancel_mouse_face (f); | 6819 | cancel_mouse_face (f); |
| 6845 | } | 6820 | } |
| 6846 | 6821 | ||
| 6847 | FRAME_PIXEL_WIDTH (f) = event.xconfigure.width; | 6822 | FRAME_PIXEL_WIDTH (f) = event->xconfigure.width; |
| 6848 | FRAME_PIXEL_HEIGHT (f) = event.xconfigure.height; | 6823 | FRAME_PIXEL_HEIGHT (f) = event->xconfigure.height; |
| 6849 | #endif /* not USE_GTK */ | 6824 | #endif /* not USE_GTK */ |
| 6850 | #endif | 6825 | #endif |
| 6851 | 6826 | ||
| @@ -6876,17 +6851,17 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6876 | 6851 | ||
| 6877 | memset (&compose_status, 0, sizeof (compose_status)); | 6852 | memset (&compose_status, 0, sizeof (compose_status)); |
| 6878 | last_mouse_glyph_frame = 0; | 6853 | last_mouse_glyph_frame = 0; |
| 6879 | dpyinfo->last_user_time = event.xbutton.time; | 6854 | dpyinfo->last_user_time = event->xbutton.time; |
| 6880 | 6855 | ||
| 6881 | if (dpyinfo->grabbed | 6856 | if (dpyinfo->grabbed |
| 6882 | && last_mouse_frame | 6857 | && last_mouse_frame |
| 6883 | && FRAME_LIVE_P (last_mouse_frame)) | 6858 | && FRAME_LIVE_P (last_mouse_frame)) |
| 6884 | f = last_mouse_frame; | 6859 | f = last_mouse_frame; |
| 6885 | else | 6860 | else |
| 6886 | f = x_window_to_frame (dpyinfo, event.xbutton.window); | 6861 | f = x_window_to_frame (dpyinfo, event->xbutton.window); |
| 6887 | 6862 | ||
| 6888 | #ifdef USE_GTK | 6863 | #ifdef USE_GTK |
| 6889 | if (f && xg_event_is_for_scrollbar (f, &event)) | 6864 | if (f && xg_event_is_for_scrollbar (f, event)) |
| 6890 | f = 0; | 6865 | f = 0; |
| 6891 | #endif | 6866 | #endif |
| 6892 | if (f) | 6867 | if (f) |
| @@ -6897,16 +6872,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6897 | && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) | 6872 | && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) |
| 6898 | { | 6873 | { |
| 6899 | Lisp_Object window; | 6874 | Lisp_Object window; |
| 6900 | int x = event.xbutton.x; | 6875 | int x = event->xbutton.x; |
| 6901 | int y = event.xbutton.y; | 6876 | int y = event->xbutton.y; |
| 6902 | 6877 | ||
| 6903 | window = window_from_coordinates (f, x, y, 0, 1); | 6878 | window = window_from_coordinates (f, x, y, 0, 1); |
| 6904 | tool_bar_p = EQ (window, f->tool_bar_window); | 6879 | tool_bar_p = EQ (window, f->tool_bar_window); |
| 6905 | 6880 | ||
| 6906 | if (tool_bar_p && event.xbutton.button < 4) | 6881 | if (tool_bar_p && event->xbutton.button < 4) |
| 6907 | handle_tool_bar_click | 6882 | handle_tool_bar_click |
| 6908 | (f, x, y, event.xbutton.type == ButtonPress, | 6883 | (f, x, y, event->xbutton.type == ButtonPress, |
| 6909 | x_x_to_emacs_modifiers (dpyinfo, event.xbutton.state)); | 6884 | x_x_to_emacs_modifiers (dpyinfo, event->xbutton.state)); |
| 6910 | } | 6885 | } |
| 6911 | #endif /* !USE_GTK */ | 6886 | #endif /* !USE_GTK */ |
| 6912 | 6887 | ||
| @@ -6917,52 +6892,52 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6917 | { | 6892 | { |
| 6918 | if (ignore_next_mouse_click_timeout) | 6893 | if (ignore_next_mouse_click_timeout) |
| 6919 | { | 6894 | { |
| 6920 | if (event.type == ButtonPress | 6895 | if (event->type == ButtonPress |
| 6921 | && (int)(event.xbutton.time - ignore_next_mouse_click_timeout) > 0) | 6896 | && (int)(event->xbutton.time - ignore_next_mouse_click_timeout) > 0) |
| 6922 | { | 6897 | { |
| 6923 | ignore_next_mouse_click_timeout = 0; | 6898 | ignore_next_mouse_click_timeout = 0; |
| 6924 | construct_mouse_click (&inev.ie, &event.xbutton, f); | 6899 | construct_mouse_click (&inev.ie, &event->xbutton, f); |
| 6925 | } | 6900 | } |
| 6926 | if (event.type == ButtonRelease) | 6901 | if (event->type == ButtonRelease) |
| 6927 | ignore_next_mouse_click_timeout = 0; | 6902 | ignore_next_mouse_click_timeout = 0; |
| 6928 | } | 6903 | } |
| 6929 | else | 6904 | else |
| 6930 | construct_mouse_click (&inev.ie, &event.xbutton, f); | 6905 | construct_mouse_click (&inev.ie, &event->xbutton, f); |
| 6931 | } | 6906 | } |
| 6932 | if (FRAME_X_EMBEDDED_P (f)) | 6907 | if (FRAME_X_EMBEDDED_P (f)) |
| 6933 | xembed_send_message (f, event.xbutton.time, | 6908 | xembed_send_message (f, event->xbutton.time, |
| 6934 | XEMBED_REQUEST_FOCUS, 0, 0, 0); | 6909 | XEMBED_REQUEST_FOCUS, 0, 0, 0); |
| 6935 | } | 6910 | } |
| 6936 | else | 6911 | else |
| 6937 | { | 6912 | { |
| 6938 | struct scroll_bar *bar | 6913 | struct scroll_bar *bar |
| 6939 | = x_window_to_scroll_bar (event.xbutton.display, | 6914 | = x_window_to_scroll_bar (event->xbutton.display, |
| 6940 | event.xbutton.window); | 6915 | event->xbutton.window); |
| 6941 | 6916 | ||
| 6942 | #ifdef USE_TOOLKIT_SCROLL_BARS | 6917 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 6943 | /* Make the "Ctrl-Mouse-2 splits window" work for toolkit | 6918 | /* Make the "Ctrl-Mouse-2 splits window" work for toolkit |
| 6944 | scroll bars. */ | 6919 | scroll bars. */ |
| 6945 | if (bar && event.xbutton.state & ControlMask) | 6920 | if (bar && event->xbutton.state & ControlMask) |
| 6946 | { | 6921 | { |
| 6947 | x_scroll_bar_handle_click (bar, &event, &inev.ie); | 6922 | x_scroll_bar_handle_click (bar, event, &inev.ie); |
| 6948 | *finish = X_EVENT_DROP; | 6923 | *finish = X_EVENT_DROP; |
| 6949 | } | 6924 | } |
| 6950 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 6925 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 6951 | if (bar) | 6926 | if (bar) |
| 6952 | x_scroll_bar_handle_click (bar, &event, &inev.ie); | 6927 | x_scroll_bar_handle_click (bar, event, &inev.ie); |
| 6953 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 6928 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 6954 | } | 6929 | } |
| 6955 | 6930 | ||
| 6956 | if (event.type == ButtonPress) | 6931 | if (event->type == ButtonPress) |
| 6957 | { | 6932 | { |
| 6958 | dpyinfo->grabbed |= (1 << event.xbutton.button); | 6933 | dpyinfo->grabbed |= (1 << event->xbutton.button); |
| 6959 | last_mouse_frame = f; | 6934 | last_mouse_frame = f; |
| 6960 | 6935 | ||
| 6961 | if (!tool_bar_p) | 6936 | if (!tool_bar_p) |
| 6962 | last_tool_bar_item = -1; | 6937 | last_tool_bar_item = -1; |
| 6963 | } | 6938 | } |
| 6964 | else | 6939 | else |
| 6965 | dpyinfo->grabbed &= ~(1 << event.xbutton.button); | 6940 | dpyinfo->grabbed &= ~(1 << event->xbutton.button); |
| 6966 | 6941 | ||
| 6967 | /* Ignore any mouse motion that happened before this event; | 6942 | /* Ignore any mouse motion that happened before this event; |
| 6968 | any subsequent mouse-movement Emacs events should reflect | 6943 | any subsequent mouse-movement Emacs events should reflect |
| @@ -6971,7 +6946,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6971 | f->mouse_moved = 0; | 6946 | f->mouse_moved = 0; |
| 6972 | 6947 | ||
| 6973 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 6948 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 6974 | f = x_menubar_window_to_frame (dpyinfo, &event); | 6949 | f = x_menubar_window_to_frame (dpyinfo, event); |
| 6975 | /* For a down-event in the menu bar, | 6950 | /* For a down-event in the menu bar, |
| 6976 | don't pass it to Xt right now. | 6951 | don't pass it to Xt right now. |
| 6977 | Instead, save it away | 6952 | Instead, save it away |
| @@ -6980,19 +6955,23 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6980 | if (! popup_activated () | 6955 | if (! popup_activated () |
| 6981 | #ifdef USE_GTK | 6956 | #ifdef USE_GTK |
| 6982 | /* Gtk+ menus only react to the first three buttons. */ | 6957 | /* Gtk+ menus only react to the first three buttons. */ |
| 6983 | && event.xbutton.button < 3 | 6958 | && event->xbutton.button < 3 |
| 6984 | #endif | 6959 | #endif |
| 6985 | && f && event.type == ButtonPress | 6960 | && f && event->type == ButtonPress |
| 6986 | /* Verify the event is really within the menu bar | 6961 | /* Verify the event is really within the menu bar |
| 6987 | and not just sent to it due to grabbing. */ | 6962 | and not just sent to it due to grabbing. */ |
| 6988 | && event.xbutton.x >= 0 | 6963 | && event->xbutton.x >= 0 |
| 6989 | && event.xbutton.x < FRAME_PIXEL_WIDTH (f) | 6964 | && event->xbutton.x < FRAME_PIXEL_WIDTH (f) |
| 6990 | && event.xbutton.y >= 0 | 6965 | && event->xbutton.y >= 0 |
| 6991 | && event.xbutton.y < f->output_data.x->menubar_height | 6966 | && event->xbutton.y < f->output_data.x->menubar_height |
| 6992 | && event.xbutton.same_screen) | 6967 | && event->xbutton.same_screen) |
| 6993 | { | 6968 | { |
| 6994 | SET_SAVED_BUTTON_EVENT; | 6969 | if (!f->output_data.x->saved_menu_event) |
| 6995 | *finish = X_EVENT_DROP; | 6970 | f->output_data.x->saved_menu_event = xmalloc (sizeof *event); |
| 6971 | *f->output_data.x->saved_menu_event = *event; | ||
| 6972 | inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; | ||
| 6973 | XSETFRAME (inev.ie.frame_or_window, f); | ||
| 6974 | *finish = X_EVENT_DROP; | ||
| 6996 | } | 6975 | } |
| 6997 | else | 6976 | else |
| 6998 | goto OTHER; | 6977 | goto OTHER; |
| @@ -7012,18 +6991,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 7012 | case MappingNotify: | 6991 | case MappingNotify: |
| 7013 | /* Someone has changed the keyboard mapping - update the | 6992 | /* Someone has changed the keyboard mapping - update the |
| 7014 | local cache. */ | 6993 | local cache. */ |
| 7015 | switch (event.xmapping.request) | 6994 | switch (event->xmapping.request) |
| 7016 | { | 6995 | { |
| 7017 | case MappingModifier: | 6996 | case MappingModifier: |
| 7018 | x_find_modifier_meanings (dpyinfo); | 6997 | x_find_modifier_meanings (dpyinfo); |
| 7019 | /* This is meant to fall through. */ | 6998 | /* This is meant to fall through. */ |
| 7020 | case MappingKeyboard: | 6999 | case MappingKeyboard: |
| 7021 | XRefreshKeyboardMapping (&event.xmapping); | 7000 | XRefreshKeyboardMapping ((XMappingEvent *) &event->xmapping); |
| 7022 | } | 7001 | } |
| 7023 | goto OTHER; | 7002 | goto OTHER; |
| 7024 | 7003 | ||
| 7025 | case DestroyNotify: | 7004 | case DestroyNotify: |
| 7026 | xft_settings_event (dpyinfo, &event); | 7005 | xft_settings_event (dpyinfo, event); |
| 7027 | break; | 7006 | break; |
| 7028 | 7007 | ||
| 7029 | default: | 7008 | default: |
| @@ -7031,7 +7010,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 7031 | #ifdef USE_X_TOOLKIT | 7010 | #ifdef USE_X_TOOLKIT |
| 7032 | block_input (); | 7011 | block_input (); |
| 7033 | if (*finish != X_EVENT_DROP) | 7012 | if (*finish != X_EVENT_DROP) |
| 7034 | XtDispatchEvent (&event); | 7013 | XtDispatchEvent ((XEvent *) event); |
| 7035 | unblock_input (); | 7014 | unblock_input (); |
| 7036 | #endif /* USE_X_TOOLKIT */ | 7015 | #endif /* USE_X_TOOLKIT */ |
| 7037 | break; | 7016 | break; |
| @@ -7069,7 +7048,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 7069 | } | 7048 | } |
| 7070 | 7049 | ||
| 7071 | SAFE_FREE (); | 7050 | SAFE_FREE (); |
| 7072 | *eventptr = event; | ||
| 7073 | return count; | 7051 | return count; |
| 7074 | } | 7052 | } |
| 7075 | 7053 | ||
| @@ -8554,7 +8532,7 @@ XTfullscreen_hook (struct frame *f) | |||
| 8554 | 8532 | ||
| 8555 | 8533 | ||
| 8556 | static int | 8534 | static int |
| 8557 | x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) | 8535 | x_handle_net_wm_state (struct frame *f, const XPropertyEvent * const event) |
| 8558 | { | 8536 | { |
| 8559 | int value = FULLSCREEN_NONE; | 8537 | int value = FULLSCREEN_NONE; |
| 8560 | Lisp_Object lval; | 8538 | 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 | |||
| 893 | void x_handle_selection_notify (XSelectionEvent *); | ||
| 894 | void x_handle_property_notify (XPropertyEvent *); | ||
| 895 | |||
| 896 | /* From xfns.c. */ | 891 | /* From xfns.c. */ |
| 897 | 892 | ||
| 898 | extern void x_free_gcs (struct frame *); | 893 | extern 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 | ||
| 949 | extern void x_handle_property_notify (XPropertyEvent *); | 944 | extern void x_handle_property_notify (const XPropertyEvent * const); |
| 950 | extern void x_handle_selection_notify (XSelectionEvent *); | 945 | extern void x_handle_selection_notify (const XSelectionEvent * const); |
| 951 | extern void x_handle_selection_event (struct input_event *); | 946 | extern void x_handle_selection_event (struct input_event *); |
| 952 | extern void x_clear_frame_selections (struct frame *); | 947 | extern 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 | ||
| 961 | extern int x_handle_dnd_message (struct frame *, | 956 | extern 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 *); |
| 965 | extern int x_check_property_data (Lisp_Object); | 960 | extern int x_check_property_data (Lisp_Object); |
| 966 | extern void x_fill_property_data (Display *, | 961 | extern void x_fill_property_data (Display *, |
| 967 | Lisp_Object, | 962 | Lisp_Object, |