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

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);
......
This diff is collapsed.
......@@ -888,11 +888,6 @@ struct selection_input_event
#define SELECTION_EVENT_TIME(eventp) \
(((struct selection_input_event *) (eventp))->time)
/* From xselect.c. */
void x_handle_selection_notify (XSelectionEvent *);
void x_handle_property_notify (XPropertyEvent *);
/* From xfns.c. */
extern void x_free_gcs (struct frame *);
......@@ -946,8 +941,8 @@ extern void x_wait_for_event (struct frame *, int);
/* Defined in xselect.c */
extern void x_handle_property_notify (XPropertyEvent *);
extern void x_handle_selection_notify (XSelectionEvent *);
extern void x_handle_property_notify (const XPropertyEvent * const);
extern void x_handle_selection_notify (const XSelectionEvent * const);
extern void x_handle_selection_event (struct input_event *);
extern void x_clear_frame_selections (struct frame *);
......@@ -959,9 +954,9 @@ extern void x_send_client_event (Lisp_Object display,
Lisp_Object values);
extern int x_handle_dnd_message (struct frame *,
XClientMessageEvent *,
const XClientMessageEvent * const,
struct x_display_info *,
struct input_event *bufp);
struct input_event *);
extern int x_check_property_data (Lisp_Object);
extern void x_fill_property_data (Display *,
Lisp_Object,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment