Commit 61582e6a authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

Do not copy X event in handle_one_xevent except KeyPress case.

Wnen XEvent is processed, it is unlikely to be changed except
KeyPress case, so we can avoid copying and use const pointer to
const data to make sure that an event is not changed elsewhere.
* xterm.c (handle_one_xevent): Change 2nd arg to 'const XEvent *
const' and do not create local copy except for the KeyPress event.
Use casts to avoid a few glitches.  Adjust formatting.  Add comments.
(SET_SAVED_BUTTON_EVENT): Remove and move the code to the only user.
(x_handle_net_wm_state, x_menubar_window_to_frame)
(x_detect_focus_change, construct_mouse_click, note_mouse_movement)
(x_scroll_bar_to_input_event, x_scroll_bar_expose)
(x_scroll_bar_handle_click, x_scroll_bar_note_movement):
* gtkutil.c (xg_event_is_for_menubar, xg_event_is_for_scrollbar):
* xselect.c (x_handle_property_notify, x_handle_selection_notify)
(x_handle_dnd_message):
* xsettings.c (xft_settings_event):
Use 'const XEvent * const' where appropriate.
* xterm.h, gtkutil.h, xsettngs.h: Adjust related prototypes.
parent c6ad9bca
2013-09-16 Dmitry Antipov <dmantipov@yandex.ru>
Do not copy X event in handle_one_xevent except KeyPress case.
Wnen XEvent is processed, it is unlikely to be changed except
KeyPress case, so we can avoid copying and use const pointer to
const data to make sure that an event is not changed elsewhere.
* xterm.c (handle_one_xevent): Change 2nd arg to 'const XEvent *
const' and do not create local copy except for the KeyPress event.
Use casts to avoid a few glitches. Adjust formatting. Add comments.
(SET_SAVED_BUTTON_EVENT): Remove and move the code to the only user.
(x_handle_net_wm_state, x_menubar_window_to_frame)
(x_detect_focus_change, construct_mouse_click, note_mouse_movement)
(x_scroll_bar_to_input_event, x_scroll_bar_expose)
(x_scroll_bar_handle_click, x_scroll_bar_note_movement):
* gtkutil.c (xg_event_is_for_menubar, xg_event_is_for_scrollbar):
* xselect.c (x_handle_property_notify, x_handle_selection_notify)
(x_handle_dnd_message):
* xsettings.c (xft_settings_event):
Use 'const XEvent * const' where appropriate.
* xterm.h, gtkutil.h, xsettngs.h: Adjust related prototypes.
2013-09-16 Dmitry Antipov <dmantipov@yandex.ru>
Fix X event waiting to handle multiple frames.
......
......@@ -3409,7 +3409,7 @@ free_frame_menubar (struct frame *f)
}
bool
xg_event_is_for_menubar (struct frame *f, XEvent *event)
xg_event_is_for_menubar (struct frame *f, const XEvent * const event)
{
struct x_output *x = f->output_data.x;
GList *iter;
......@@ -3861,7 +3861,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
frame. This function does additional checks. */
bool
xg_event_is_for_scrollbar (struct frame *f, XEvent *event)
xg_event_is_for_scrollbar (struct frame *f, const XEvent * const event)
{
bool retval = 0;
......
......@@ -105,7 +105,7 @@ extern void xg_modify_menubar_widgets (GtkWidget *menubar,
extern void xg_update_frame_menubar (struct frame *f);
extern bool xg_event_is_for_menubar (struct frame *f, XEvent *event);
extern bool xg_event_is_for_menubar (struct frame *, const XEvent * const);
extern bool xg_have_tear_offs (void);
......@@ -129,7 +129,7 @@ extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
int portion,
int position,
int whole);
extern bool xg_event_is_for_scrollbar (struct frame *f, XEvent *event);
extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent * const);
extern int xg_get_default_scrollbar_width (void);
extern void update_frame_tool_bar (struct frame *f);
......
......@@ -1141,7 +1141,7 @@ wait_for_property_change (struct prop_location *location)
/* Called from XTread_socket in response to a PropertyNotify event. */
void
x_handle_property_notify (XPropertyEvent *event)
x_handle_property_notify (const XPropertyEvent * const event)
{
struct prop_location *rest;
......@@ -1888,7 +1888,7 @@ clean_local_selection_data (Lisp_Object obj)
We store t there if the reply is successful, lambda if not. */
void
x_handle_selection_notify (XSelectionEvent *event)
x_handle_selection_notify (const XSelectionEvent * const event)
{
if (event->requestor != reading_selection_window)
return;
......@@ -2488,7 +2488,7 @@ FRAME is on. If FRAME is nil, the selected frame is used. */)
/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */
int
x_handle_dnd_message (struct frame *f, XClientMessageEvent *event,
x_handle_dnd_message (struct frame *f, const XClientMessageEvent * const event,
struct x_display_info *dpyinfo, struct input_event *bufp)
{
Lisp_Object vec;
......
......@@ -754,7 +754,7 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
/* Check if EVENT for the display in DPYINFO is XSettings related. */
void
xft_settings_event (struct x_display_info *dpyinfo, XEvent *event)
xft_settings_event (struct x_display_info *dpyinfo, const XEvent * const event)
{
bool check_window_p = 0, apply_settings_p = 0;
......
......@@ -20,9 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef XSETTINGS_H
#define XSETTINGS_H
extern void xsettings_initialize (struct x_display_info *dpyinfo);
extern void xft_settings_event (struct x_display_info *dpyinfo,
XEvent *);
extern void xsettings_initialize (struct x_display_info *);
extern void xft_settings_event (struct x_display_info *, const XEvent * const);
extern const char *xsettings_get_system_font (void);
#ifdef USE_LUCID
extern const char *xsettings_get_system_normal_font (void);
......
......@@ -302,12 +302,13 @@ static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
enum scroll_bar_part *,
Lisp_Object *, Lisp_Object *,
Time *);
static int x_handle_net_wm_state (struct frame *, XPropertyEvent *);
static int x_handle_net_wm_state (struct frame *, const XPropertyEvent * const);
static void x_check_fullscreen (struct frame *);
static void x_check_expected_move (struct frame *, int, int);
static void x_sync_with_move (struct frame *, int, int, int);
static int handle_one_xevent (struct x_display_info *, XEvent *,
int *, struct input_event *);
static int handle_one_xevent (struct x_display_info *,
const XEvent * const, int *,
struct input_event *);
#ifdef USE_GTK
static int x_dispatch_event (XEvent *, Display *);
#endif
......@@ -3459,7 +3460,8 @@ x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
/* Likewise, but consider only the menu bar widget. */
static struct frame *
x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event)
x_menubar_window_to_frame (struct x_display_info *dpyinfo,
const XEvent * const event)
{
Window wdesc = event->xany.window;
Lisp_Object tail, frame;
......@@ -3541,7 +3543,7 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
static void
x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame,
XEvent *event, struct input_event *bufp)
const XEvent * const event, struct input_event *bufp)
{
if (!frame)
return;
......@@ -3831,7 +3833,9 @@ x_get_keysym_name (int keysym)
the mouse. */
static Lisp_Object
construct_mouse_click (struct input_event *result, XButtonEvent *event, struct frame *f)
construct_mouse_click (struct input_event *result,
const XButtonEvent * const event,
struct frame *f)
{
/* Make the event type NO_EVENT; we'll change that when we decide
otherwise. */
......@@ -3863,7 +3867,7 @@ static XMotionEvent last_mouse_motion_event;
static Lisp_Object last_mouse_motion_frame;
static int
note_mouse_movement (struct frame *frame, XMotionEvent *event)
note_mouse_movement (struct frame *frame, const XMotionEvent * const event)
{
last_mouse_movement_time = event->time;
last_mouse_motion_event = *event;
......@@ -4207,13 +4211,7 @@ x_window_to_menu_bar (Window window)
#ifdef USE_TOOLKIT_SCROLL_BARS
static void x_scroll_bar_to_input_event (XEvent *, struct input_event *);
static void x_send_scroll_bar_event (Lisp_Object, int, int, int);
static void x_create_toolkit_scroll_bar (struct frame *,
struct scroll_bar *);
static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *,
int, int, int);
/* Lisp window being scrolled. Set when starting to interact with
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)
in *IEVENT. */
static void
x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent)
x_scroll_bar_to_input_event (const XEvent * const event,
struct input_event *ievent)
{
XClientMessageEvent *ev = (XClientMessageEvent *) event;
Lisp_Object window;
......@@ -5504,7 +5503,7 @@ XTjudge_scroll_bars (struct frame *f)
mark bits. */
static void
x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
x_scroll_bar_expose (struct scroll_bar *bar, const XEvent * const event)
{
Window w = bar->x_window;
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
......@@ -5542,7 +5541,9 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
static void
x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_event *emacs_event)
x_scroll_bar_handle_click (struct scroll_bar *bar,
const XEvent * const event,
struct input_event *emacs_event)
{
if (! WINDOWP (bar->window))
emacs_abort ();
......@@ -5599,7 +5600,8 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e
mark bits. */
static void
x_scroll_bar_note_movement (struct scroll_bar *bar, XMotionEvent *event)
x_scroll_bar_note_movement (struct scroll_bar *bar,
const XMotionEvent * const event)
{
struct frame *f = XFRAME (XWINDOW (bar->window)->frame);
......@@ -5751,20 +5753,6 @@ static struct x_display_info *XTread_socket_fake_io_error;
static struct x_display_info *next_noop_dpyinfo;
#if defined USE_X_TOOLKIT || defined USE_GTK
#define SET_SAVED_BUTTON_EVENT \
do \
{ \
if (f->output_data.x->saved_menu_event == 0) \
f->output_data.x->saved_menu_event = \
xmalloc (sizeof (XEvent)); \
*f->output_data.x->saved_menu_event = event; \
inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \
XSETFRAME (inev.ie.frame_or_window, f); \
} \
while (0)
#endif
enum
{
X_EVENT_NORMAL,
......@@ -5858,11 +5846,13 @@ static void xembed_send_message (struct frame *f, Time,
*FINISH is X_EVENT_GOTO_OUT if caller should stop reading events.
*FINISH is zero if caller should continue reading events.
*FINISH is X_EVENT_DROP if event should not be passed to the toolkit.
*EVENT is unchanged unless we're processing KeyPress event.
We return the number of characters stored into the buffer. */
static int
handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
handle_one_xevent (struct x_display_info *dpyinfo,
const XEvent * const event,
int *finish, struct input_event *hold_quit)
{
union {
......@@ -5874,7 +5864,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
ptrdiff_t nbytes = 0;
struct frame *any, *f = NULL;
struct coding_system coding;
XEvent event = *eventptr;
Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
/* This holds the state XLookupString needs to implement dead keys
and other tricks known as "compose processing". _X Window System_
......@@ -5890,21 +5879,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
inev.ie.kind = NO_EVENT;
inev.ie.arg = Qnil;
any = x_any_window_to_frame (dpyinfo, event.xany.window);
any = x_any_window_to_frame (dpyinfo, event->xany.window);
if (any && any->wait_event_type == event.type)
if (any && any->wait_event_type == event->type)
any->wait_event_type = 0; /* Indicates we got it. */
switch (event.type)
switch (event->type)
{
case ClientMessage:
{
if (event.xclient.message_type
== dpyinfo->Xatom_wm_protocols
&& event.xclient.format == 32)
if (event->xclient.message_type == dpyinfo->Xatom_wm_protocols
&& event->xclient.format == 32)
{
if (event.xclient.data.l[0]
== dpyinfo->Xatom_wm_take_focus)
if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_take_focus)
{
/* Use the value returned by x_any_window_to_frame
because this could be the shell widget window
......@@ -5933,15 +5920,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
since that might be an event for a deleted frame. */
if (f)
{
Display *d = event.xclient.display;
Display *d = event->xclient.display;
/* Catch and ignore errors, in case window has been
iconified by a window manager such as GWM. */
x_catch_errors (d);
XSetInputFocus (d, event.xclient.window,
XSetInputFocus (d, event->xclient.window,
/* The ICCCM says this is
the only valid choice. */
RevertToParent,
event.xclient.data.l[1]);
event->xclient.data.l[1]);
/* This is needed to detect the error
if there is an error. */
XSync (d, False);
......@@ -5952,8 +5939,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
goto done;
}
if (event.xclient.data.l[0]
== dpyinfo->Xatom_wm_save_yourself)
if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_save_yourself)
{
/* Save state modify the WM_COMMAND property to
something which can reinstate us. This notifies
......@@ -5968,23 +5954,22 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
#endif
{
f = x_top_window_to_frame (dpyinfo,
event.xclient.window);
event->xclient.window);
/* This is just so we only give real data once
for a single Emacs process. */
if (f == SELECTED_FRAME ())
XSetCommand (FRAME_X_DISPLAY (f),
event.xclient.window,
event->xclient.window,
initial_argv, initial_argc);
else if (f)
XSetCommand (FRAME_X_DISPLAY (f),
event.xclient.window,
event->xclient.window,
0, 0);
}
goto done;
}
if (event.xclient.data.l[0]
== dpyinfo->Xatom_wm_delete_window)
if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_delete_window)
{
f = any;
if (!f)
......@@ -5998,20 +5983,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
goto done;
}
if (event.xclient.message_type
== dpyinfo->Xatom_wm_configure_denied)
{
goto done;
}
if (event->xclient.message_type == dpyinfo->Xatom_wm_configure_denied)
goto done;
if (event.xclient.message_type
== dpyinfo->Xatom_wm_window_moved)
if (event->xclient.message_type == dpyinfo->Xatom_wm_window_moved)
{
int new_x, new_y;
f = x_window_to_frame (dpyinfo, event.xclient.window);
f = x_window_to_frame (dpyinfo, event->xclient.window);
new_x = event.xclient.data.s[0];
new_y = event.xclient.data.s[1];
new_x = event->xclient.data.s[0];
new_y = event->xclient.data.s[1];
if (f)
{
......@@ -6022,28 +6003,25 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
}
#ifdef HACK_EDITRES
if (event.xclient.message_type
== dpyinfo->Xatom_editres)
if (event->xclient.message_type == dpyinfo->Xatom_editres)
{
f = any;
if (f)
_XEditResCheckMessages (f->output_data.x->widget, NULL,
&event, NULL);
_XEditResCheckMessages (f->output_data.x->widget,
NULL, (XEvent *) event, NULL);
goto done;
}
#endif /* HACK_EDITRES */
if ((event.xclient.message_type
== dpyinfo->Xatom_DONE)
|| (event.xclient.message_type
== dpyinfo->Xatom_PAGE))
if (event->xclient.message_type == dpyinfo->Xatom_DONE
|| event->xclient.message_type == dpyinfo->Xatom_PAGE)
{
/* Ghostview job completed. Kill it. We could
reply with "Next" if we received "Page", but we
currently never do because we are interested in
images, only, which should have 1 page. */
Pixmap pixmap = (Pixmap) event.xclient.data.l[1];
f = x_window_to_frame (dpyinfo, event.xclient.window);
Pixmap pixmap = (Pixmap) event->xclient.data.l[1];
f = x_window_to_frame (dpyinfo, event->xclient.window);
if (!f)
goto OTHER;
x_kill_gs_process (pixmap, f);
......@@ -6054,54 +6032,52 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
#ifdef USE_TOOLKIT_SCROLL_BARS
/* Scroll bar callbacks send a ClientMessage from which
we construct an input_event. */
if (event.xclient.message_type
== dpyinfo->Xatom_Scrollbar)
if (event->xclient.message_type == dpyinfo->Xatom_Scrollbar)
{
x_scroll_bar_to_input_event (&event, &inev.ie);
x_scroll_bar_to_input_event (event, &inev.ie);
*finish = X_EVENT_GOTO_OUT;
goto done;
}
#endif /* USE_TOOLKIT_SCROLL_BARS */
/* XEmbed messages from the embedder (if any). */
if (event.xclient.message_type
== dpyinfo->Xatom_XEMBED)
if (event->xclient.message_type == dpyinfo->Xatom_XEMBED)
{
enum xembed_message msg = event.xclient.data.l[1];
enum xembed_message msg = event->xclient.data.l[1];
if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT)
x_detect_focus_change (dpyinfo, any, &event, &inev.ie);
x_detect_focus_change (dpyinfo, any, event, &inev.ie);
*finish = X_EVENT_GOTO_OUT;
goto done;
}
xft_settings_event (dpyinfo, &event);
xft_settings_event (dpyinfo, event);
f = any;
if (!f)
goto OTHER;
if (x_handle_dnd_message (f, &event.xclient, dpyinfo, &inev.ie))
if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev.ie))
*finish = X_EVENT_DROP;
}
break;
case SelectionNotify:
dpyinfo->last_user_time = event.xselection.time;
dpyinfo->last_user_time = event->xselection.time;
#ifdef USE_X_TOOLKIT
if (! x_window_to_frame (dpyinfo, event.xselection.requestor))
if (! x_window_to_frame (dpyinfo, event->xselection.requestor))
goto OTHER;
#endif /* not USE_X_TOOLKIT */
x_handle_selection_notify (&event.xselection);
x_handle_selection_notify (&event->xselection);
break;
case SelectionClear: /* Someone has grabbed ownership. */
dpyinfo->last_user_time = event.xselectionclear.time;
dpyinfo->last_user_time = event->xselectionclear.time;
#ifdef USE_X_TOOLKIT
if (! x_window_to_frame (dpyinfo, event.xselectionclear.window))
if (! x_window_to_frame (dpyinfo, event->xselectionclear.window))
goto OTHER;
#endif /* USE_X_TOOLKIT */
{
XSelectionClearEvent *eventp = &(event.xselectionclear);
const XSelectionClearEvent * const eventp = &event->xselectionclear;
inev.ie.kind = SELECTION_CLEAR_EVENT;
SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;
......@@ -6111,29 +6087,29 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
break;
case SelectionRequest: /* Someone wants our selection. */
dpyinfo->last_user_time = event.xselectionrequest.time;
dpyinfo->last_user_time = event->xselectionrequest.time;
#ifdef USE_X_TOOLKIT
if (!x_window_to_frame (dpyinfo, event.xselectionrequest.owner))
if (!x_window_to_frame (dpyinfo, event->xselectionrequest.owner))
goto OTHER;
#endif /* USE_X_TOOLKIT */
{
XSelectionRequestEvent *eventp = &(event.xselectionrequest);
inev.ie.kind = SELECTION_REQUEST_EVENT;
SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;
SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor;
SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection;
SELECTION_EVENT_TARGET (&inev.sie) = eventp->target;
SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property;
SELECTION_EVENT_TIME (&inev.sie) = eventp->time;
const XSelectionRequestEvent * const eventp = &event->xselectionrequest;
inev.ie.kind = SELECTION_REQUEST_EVENT;
SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;
SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor;
SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection;
SELECTION_EVENT_TARGET (&inev.sie) = eventp->target;
SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property;
SELECTION_EVENT_TIME (&inev.sie) = eventp->time;
}
break;
case PropertyNotify:
dpyinfo->last_user_time = event.xproperty.time;
f = x_top_window_to_frame (dpyinfo, event.xproperty.window);
if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state)
if (x_handle_net_wm_state (f, &event.xproperty)
dpyinfo->last_user_time = event->xproperty.time;
f = x_top_window_to_frame (dpyinfo, event->xproperty.window);
if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state)
if (x_handle_net_wm_state (f, &event->xproperty)
&& FRAME_ICONIFIED_P (f)
&& f->output_data.x->net_wm_state_hidden_seen)
{
......@@ -6148,16 +6124,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
XSETFRAME (inev.ie.frame_or_window, f);
}
x_handle_property_notify (&event.xproperty);
xft_settings_event (dpyinfo, &event);
x_handle_property_notify (&event->xproperty);
xft_settings_event (dpyinfo, event);
goto OTHER;
case ReparentNotify:
f = x_top_window_to_frame (dpyinfo, event.xreparent.window);
f = x_top_window_to_frame (dpyinfo, event->xreparent.window);
if (f)
{
int x, y;
f->output_data.x->parent_desc = event.xreparent.parent;
f->output_data.x->parent_desc = event->xreparent.parent;
x_real_positions (f, &x, &y);
f->left_pos = x;
f->top_pos = y;
......@@ -6171,15 +6147,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
goto OTHER;
case Expose:
f = x_window_to_frame (dpyinfo, event.xexpose.window);
f = x_window_to_frame (dpyinfo, event->xexpose.window);
if (f)
{
#ifdef USE_GTK
/* This seems to be needed for GTK 2.6. */
x_clear_area (event.xexpose.display,
event.xexpose.window,
event.xexpose.x, event.xexpose.y,
event.xexpose.width, event.xexpose.height);
x_clear_area (event->xexpose.display,
event->xexpose.window,
event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
#endif
if (!FRAME_VISIBLE_P (f))
{
......@@ -6189,9 +6165,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
SET_FRAME_GARBAGED (f);
}
else
expose_frame (f,
event.xexpose.x, event.xexpose.y,
event.xexpose.width, event.xexpose.height);
expose_frame (f, event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
}
else
{
......@@ -6203,8 +6178,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
themselves, so there's no way to dispatch events
to them. Recognize this case separately. */
{
Widget widget
= x_window_to_menu_bar (event.xexpose.window);
Widget widget = x_window_to_menu_bar (event->xexpose.window);
if (widget)
xlwmenu_redisplay (widget);
}
......@@ -6214,11 +6188,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
/* Dispatch event to the widget. */
goto OTHER;
#else /* not USE_TOOLKIT_SCROLL_BARS */
bar = x_window_to_scroll_bar (event.xexpose.display,
event.xexpose.window);
bar = x_window_to_scroll_bar (event->xexpose.display,
event->xexpose.window);
if (bar)
x_scroll_bar_expose (bar, &event);
x_scroll_bar_expose (bar, event);
#ifdef USE_X_TOOLKIT
else
goto OTHER;
......@@ -6230,14 +6204,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
case GraphicsExpose: /* This occurs when an XCopyArea's
source area was obscured or not
available. */
f = x_window_to_frame (dpyinfo, event.xgraphicsexpose.drawable);
f = x_window_to_frame (dpyinfo, event->xgraphicsexpose.drawable);
if (f)
{
expose_frame (f,
event.xgraphicsexpose.x, event.xgraphicsexpose.y,
event.xgraphicsexpose.width,
event.xgraphicsexpose.height);
}
expose_frame (f, event->xgraphicsexpose.x,
event->xgraphicsexpose.y,
event->xgraphicsexpose.width,
event->xgraphicsexpose.height);
#ifdef USE_X_TOOLKIT
else
goto OTHER;
......@@ -6251,13 +6223,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
case UnmapNotify:
/* Redo the mouse-highlight after the tooltip has gone. */
if (event.xunmap.window == tip_window)
if (event->xunmap.window == tip_window)
{
tip_window = 0;
redo_mouse_highlight ();
}
f = x_top_window_to_frame (dpyinfo, event.xunmap.window);
f = x_top_window_to_frame (dpyinfo, event->xunmap.window);
if (f) /* F may no longer exist if
the frame was deleted. */
{
......@@ -6282,7 +6254,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
goto OTHER;
case MapNotify:
if (event.xmap.window == tip_window)
if (event->xmap.window == tip_window)
/* The tooltip has been drawn already. Avoid
the SET_FRAME_GARBAGED below. */
goto OTHER;
......@@ -6290,7 +6262,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
/* We use x_top_window_to_frame because map events can
come for sub-windows and they don't mean that the
frame is visible. */
f = x_top_window_to_frame (dpyinfo, event.xmap.window);
f = x_top_window_to_frame (dpyinfo, event->xmap.window);
if (f)
{
bool iconified = FRAME_ICONIFIED_P (f);
......@@ -6330,7 +6302,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
case KeyPress:
dpyinfo->last_user_time = event.xkey.time;
dpyinfo->last_user_time = event->xkey.time;
ignore_next_mouse_click_timeout = 0;
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
......@@ -6359,7 +6331,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
/* Scroll bars consume key events, but we want
the keys to go to the scroll bar's frame. */
Widget widget = XtWindowToWidget (dpyinfo->display,
event.xkey.window);
event->xkey.window);
if (widget && XmIsScrollBar (widget))
{
widget = XtParent (widget);
......@@ -6388,6 +6360,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
int modifiers;
Lisp_Object coding_system = Qlatin_1;
Lisp_Object c;