Commit f34297cf authored by Benjamin Otte's avatar Benjamin Otte

x11: Constify XEvent usage

parent 8a453924
......@@ -41,7 +41,7 @@ static void gdk_x11_device_manager_event_translator_init (GdkEventTranslator
static gboolean gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
XEvent *xevent);
const XEvent *xevent);
G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerCore, gdk_x11_device_manager_core, G_TYPE_OBJECT,
......@@ -191,7 +191,7 @@ static void
translate_key_event (GdkDisplay *display,
GdkX11DeviceManagerCore *device_manager,
GdkEvent *event,
XEvent *xevent)
const XEvent *xevent)
{
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
GdkModifierType consumed, state;
......@@ -334,7 +334,7 @@ is_parent_of (GdkWindow *parent,
static GdkWindow *
get_event_window (GdkEventTranslator *translator,
XEvent *xevent)
const XEvent *xevent)
{
GdkDisplay *display;
GdkWindow *window;
......@@ -368,7 +368,7 @@ static gboolean
gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
XEvent *xevent)
const XEvent *xevent)
{
GdkWindowImplX11 *impl;
GdkX11DeviceManagerCore *device_manager;
......
......@@ -79,13 +79,13 @@ static GdkDevice * gdk_x11_device_manager_xi2_get_client_pointer (GdkX11DeviceMa
static gboolean gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
XEvent *xevent);
const XEvent *xevent);
static GdkEventMask gdk_x11_device_manager_xi2_get_handled_events (GdkEventTranslator *translator);
static void gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask event_mask);
static GdkWindow * gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
XEvent *xevent);
const XEvent *xevent);
enum {
PROP_0,
......@@ -1225,7 +1225,7 @@ static gboolean
gdk_x11_device_manager_xi2_translate_core_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
XEvent *xevent)
const XEvent *xevent)
{
GdkEventTranslatorIface *parent_iface;
gboolean keyboard = FALSE;
......@@ -1341,10 +1341,10 @@ static gboolean
gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
XEvent *xevent)
const XEvent *xevent)
{
GdkX11DeviceManagerXI2 *device_manager;
XGenericEventCookie *cookie;
const XGenericEventCookie *cookie;
GdkDevice *device, *source_device;
gboolean return_val = TRUE;
GdkWindow *window;
......@@ -1943,7 +1943,7 @@ gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
static GdkWindow *
gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
XEvent *xevent)
const XEvent *xevent)
{
GdkX11DeviceManagerXI2 *device_manager;
XIEvent *ev;
......
......@@ -102,7 +102,7 @@ static void gdk_x11_display_event_translator_init (GdkEventTranslatorIface *
static gboolean gdk_x11_display_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
XEvent *xevent);
const XEvent *xevent);
static void gdk_internal_connection_watch (Display *display,
XPointer arg,
......@@ -575,7 +575,7 @@ get_cm_atom (GdkDisplay *display)
}
static Window
get_event_xwindow (XEvent *xevent)
get_event_xwindow (const XEvent *xevent)
{
Window xwindow;
......@@ -613,7 +613,7 @@ static gboolean
gdk_x11_display_translate_event (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
XEvent *xevent)
const XEvent *xevent)
{
Window xwindow;
GdkWindow *window;
......@@ -1124,7 +1124,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
/* Let XLib know that there is a new keyboard mapping.
*/
XRefreshKeyboardMapping (&xevent->xmapping);
XRefreshKeyboardMapping ((XMappingEvent *) xevent);
_gdk_x11_keymap_keys_changed (display);
return_val = FALSE;
break;
......
......@@ -526,11 +526,10 @@ gdk_window_cache_add (GdkWindowCache *cache,
}
GdkFilterReturn
gdk_window_cache_shape_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data)
gdk_window_cache_shape_filter (const XEvent *xevent,
GdkEvent *event,
gpointer data)
{
XEvent *xevent = (XEvent *)xev;
GdkWindowCache *cache = data;
GdkX11Display *display = GDK_X11_DISPLAY (cache->display);
......@@ -561,11 +560,10 @@ gdk_window_cache_shape_filter (GdkXEvent *xev,
}
GdkFilterReturn
gdk_window_cache_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data)
gdk_window_cache_filter (const XEvent *xevent,
GdkEvent *event,
gpointer data)
{
XEvent *xevent = (XEvent *)xev;
GdkWindowCache *cache = data;
switch (xevent->type)
......@@ -574,7 +572,7 @@ gdk_window_cache_filter (GdkXEvent *xev,
break;
case ConfigureNotify:
{
XConfigureEvent *xce = &xevent->xconfigure;
const XConfigureEvent *xce = &xevent->xconfigure;
GList *node;
node = g_hash_table_lookup (cache->child_hash,
......@@ -616,7 +614,7 @@ gdk_window_cache_filter (GdkXEvent *xev,
}
case CreateNotify:
{
XCreateWindowEvent *xcwe = &xevent->xcreatewindow;
const XCreateWindowEvent *xcwe = &xevent->xcreatewindow;
if (!g_hash_table_lookup (cache->child_hash,
GUINT_TO_POINTER (xcwe->window)))
......@@ -627,7 +625,7 @@ gdk_window_cache_filter (GdkXEvent *xev,
}
case DestroyNotify:
{
XDestroyWindowEvent *xdwe = &xevent->xdestroywindow;
const XDestroyWindowEvent *xdwe = &xevent->xdestroywindow;
GList *node;
node = g_hash_table_lookup (cache->child_hash,
......@@ -647,7 +645,7 @@ gdk_window_cache_filter (GdkXEvent *xev,
}
case MapNotify:
{
XMapEvent *xme = &xevent->xmap;
const XMapEvent *xme = &xevent->xmap;
GList *node;
node = g_hash_table_lookup (cache->child_hash,
......@@ -663,7 +661,7 @@ gdk_window_cache_filter (GdkXEvent *xev,
break;
case UnmapNotify:
{
XMapEvent *xume = &xevent->xmap;
const XMapEvent *xume = &xevent->xmap;
GList *node;
node = g_hash_table_lookup (cache->child_hash,
......
......@@ -55,9 +55,9 @@ static GSourceFuncs event_funcs = {
};
static gint
gdk_event_apply_filters (XEvent *xevent,
GdkEvent *event,
GdkWindow *window)
gdk_event_apply_filters (const XEvent *xevent,
GdkEvent *event,
GdkWindow *window)
{
GList *tmp_list;
GdkFilterReturn result;
......@@ -79,7 +79,7 @@ gdk_event_apply_filters (XEvent *xevent,
}
filter->ref_count++;
result = filter->function (xevent, event, filter->data);
result = filter->function ((GdkXEvent *) xevent, event, filter->data);
/* Protect against unreffing the filter mutating the list */
node = tmp_list->next;
......@@ -97,7 +97,7 @@ gdk_event_apply_filters (XEvent *xevent,
static GdkWindow *
gdk_event_source_get_filter_window (GdkEventSource *event_source,
XEvent *xevent,
const XEvent *xevent,
GdkEventTranslator **event_translator)
{
GList *list = event_source->translators;
......
......@@ -33,7 +33,7 @@ _gdk_x11_event_translator_default_init (GdkEventTranslatorInterface *iface)
GdkEvent *
_gdk_x11_event_translator_translate (GdkEventTranslator *translator,
GdkDisplay *display,
XEvent *xevent)
const XEvent *xevent)
{
GdkEventTranslatorIface *iface;
GdkEvent *event;
......@@ -89,7 +89,7 @@ _gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator,
GdkWindow *
_gdk_x11_event_translator_get_window (GdkEventTranslator *translator,
GdkDisplay *display,
XEvent *xevent)
const XEvent *xevent)
{
GdkEventTranslatorIface *iface;
......
......@@ -41,28 +41,28 @@ struct _GdkEventTranslatorIface
gboolean (* translate_event) (GdkEventTranslator *translator,
GdkDisplay *display,
GdkEvent *event,
XEvent *xevent);
const XEvent *xevent);
GdkEventMask (* get_handled_events) (GdkEventTranslator *translator);
void (* select_window_events) (GdkEventTranslator *translator,
Window window,
GdkEventMask event_mask);
GdkWindow * (* get_window) (GdkEventTranslator *translator,
XEvent *xevent);
const XEvent *xevent);
};
GType _gdk_x11_event_translator_get_type (void) G_GNUC_CONST;
GdkEvent * _gdk_x11_event_translator_translate (GdkEventTranslator *translator,
GdkDisplay *display,
XEvent *xevent);
GdkDisplay *display,
const XEvent *xevent);
GdkEventMask _gdk_x11_event_translator_get_handled_events (GdkEventTranslator *translator);
void _gdk_x11_event_translator_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask event_mask);
GdkWindow * _gdk_x11_event_translator_get_window (GdkEventTranslator *translator,
GdkDisplay *display,
XEvent *xevent);
const XEvent *xevent);
G_END_DECLS
......
......@@ -642,11 +642,11 @@ update_lock_state (GdkX11Keymap *keymap_x11,
* call in gdk_display_open()
*/
void
_gdk_x11_keymap_state_changed (GdkDisplay *display,
XEvent *xevent)
_gdk_x11_keymap_state_changed (GdkDisplay *display,
const XEvent *xevent)
{
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
XkbEvent *xkb_event = (XkbEvent *)xevent;
const XkbEvent *xkb_event = (const XkbEvent *) xevent;
if (display_x11->keymap)
{
......
......@@ -103,7 +103,7 @@ void _gdk_x11_window_translate (GdkWindow *window,
void _gdk_x11_display_free_translate_queue (GdkDisplay *display);
void _gdk_x11_selection_window_destroyed (GdkWindow *window);
gboolean _gdk_x11_selection_filter_clear_event (XSelectionClearEvent *event);
gboolean _gdk_x11_selection_filter_clear_event (const XSelectionClearEvent *event);
cairo_region_t* _gdk_x11_xwindow_get_shape (Display *xdisplay,
Window window,
......@@ -117,12 +117,12 @@ void _gdk_x11_region_get_xrectangles (const cairo_region_t *region,
XRectangle **rects,
gint *n_rects);
gboolean _gdk_x11_moveresize_handle_event (XEvent *event);
gboolean _gdk_x11_moveresize_handle_event (const XEvent *event);
gboolean _gdk_x11_moveresize_configure_done (GdkDisplay *display,
GdkWindow *window);
void _gdk_x11_keymap_state_changed (GdkDisplay *display,
XEvent *event);
const XEvent *event);
void _gdk_x11_keymap_keys_changed (GdkDisplay *display);
void _gdk_x11_keymap_add_virt_mods (GdkKeymap *keymap,
GdkModifierType *modifiers);
......@@ -270,13 +270,13 @@ GdkWindowCache *
gdk_window_cache_get (GdkDisplay *display);
GdkFilterReturn
gdk_window_cache_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data);
gdk_window_cache_filter (const XEvent *xevent,
GdkEvent *event,
gpointer data);
GdkFilterReturn
gdk_window_cache_shape_filter (GdkXEvent *xev,
GdkEvent *event,
gpointer data);
gdk_window_cache_shape_filter (const XEvent *xevent,
GdkEvent *event,
gpointer data);
void _gdk_x11_cursor_display_finalize (GdkDisplay *display);
......
......@@ -851,7 +851,7 @@ process_monitors_change (GdkX11Screen *screen)
void
_gdk_x11_screen_size_changed (GdkX11Screen *screen,
XEvent *event)
const XEvent *event)
{
#ifdef HAVE_RANDR
GdkX11Display *display_x11;
......@@ -861,7 +861,7 @@ _gdk_x11_screen_size_changed (GdkX11Screen *screen,
if (display_x11->have_randr13 && event->type == ConfigureNotify)
return;
XRRUpdateConfiguration (event);
XRRUpdateConfiguration ((XEvent *) event);
#else
if (event->type != ConfigureNotify)
return;
......
......@@ -102,7 +102,7 @@ GdkX11Screen *_gdk_x11_screen_new (GdkDisplay *display,
void _gdk_x11_screen_update_visuals_for_gl (GdkX11Screen *screen);
void _gdk_x11_screen_window_manager_changed (GdkX11Screen *screen);
void _gdk_x11_screen_size_changed (GdkX11Screen *screen,
XEvent *event);
const XEvent *event);
void _gdk_x11_screen_get_edge_monitors (GdkX11Screen *screen,
gint *top,
gint *bottom,
......
......@@ -71,7 +71,7 @@ _gdk_x11_selection_window_destroyed (GdkWindow *window)
* reflect changes to the selection owner that we didn’t make ourself.
*/
gboolean
_gdk_x11_selection_filter_clear_event (XSelectionClearEvent *event)
_gdk_x11_selection_filter_clear_event (const XSelectionClearEvent *event)
{
GSList *tmp_list = owner_list;
GdkDisplay *display = gdk_x11_lookup_xdisplay (event->display);
......
......@@ -3933,8 +3933,8 @@ wmspec_send_message (GdkDisplay *display,
}
static void
handle_wmspec_button_release (GdkDisplay *display,
XEvent *xevent)
handle_wmspec_button_release (GdkDisplay *display,
const XEvent *xevent)
{
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
GdkWindow *window;
......@@ -4261,7 +4261,7 @@ lookahead_motion_predicate (Display *xdisplay,
static gboolean
moveresize_lookahead (MoveResizeData *mv_resize,
XEvent *event)
const XEvent *event)
{
XEvent tmp_event;
gboolean seen_release = FALSE;
......@@ -4284,7 +4284,7 @@ moveresize_lookahead (MoveResizeData *mv_resize,
}
gboolean
_gdk_x11_moveresize_handle_event (XEvent *event)
_gdk_x11_moveresize_handle_event (const XEvent *event)
{
guint button_mask = 0;
GdkDisplay *display = gdk_x11_lookup_xdisplay (event->xany.display);
......
......@@ -502,13 +502,12 @@ check_manager_window (GdkX11Screen *x11_screen,
}
GdkFilterReturn
gdk_xsettings_root_window_filter (GdkXEvent *xevent,
GdkEvent *event,
gpointer data)
gdk_xsettings_root_window_filter (const XEvent *xev,
GdkEvent *event,
gpointer data)
{
GdkX11Screen *x11_screen = data;
GdkDisplay *display = x11_screen->display;
XEvent *xev = xevent;
/* The checks here will not unlikely cause us to reread
* the properties from the manager window a number of
......@@ -527,12 +526,11 @@ gdk_xsettings_root_window_filter (GdkXEvent *xevent,
}
GdkFilterReturn
gdk_xsettings_manager_window_filter (GdkXEvent *xevent,
GdkEvent *event,
gpointer data)
gdk_xsettings_manager_window_filter (const XEvent *xev,
GdkEvent *event,
gpointer data)
{
GdkX11Screen *x11_screen = data;
XEvent *xev = xevent;
if (xev->xany.type == DestroyNotify)
{
......
......@@ -29,12 +29,12 @@ void _gdk_x11_xsettings_init (GdkX11Screen *x11_screen);
void _gdk_x11_xsettings_finish (GdkX11Screen *x11_screen);
void _gdk_x11_settings_force_reread (GdkX11Screen *x11_screen);
GdkFilterReturn gdk_xsettings_root_window_filter (GdkXEvent *xevent,
GdkEvent *event,
gpointer data);
GdkFilterReturn gdk_xsettings_manager_window_filter (GdkXEvent *xevent,
GdkEvent *event,
gpointer data);
GdkFilterReturn gdk_xsettings_root_window_filter (const XEvent *xevent,
GdkEvent *event,
gpointer data);
GdkFilterReturn gdk_xsettings_manager_window_filter (const XEvent *xevent,
GdkEvent *event,
gpointer data);
#endif /* XSETTINGS_CLIENT_H */
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