[gtk+] gdkevents-x11: Do not break strict-aliasing rules



commit 5917eba911616a6a3b7967e807e786307c01a559
Author: Javier Jardón <jjardon gnome org>
Date:   Sat May 22 22:42:00 2010 +0200

    gdkevents-x11: Do not break strict-aliasing rules
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=619385

 gdk/x11/gdkevents-x11.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 2c06474..c50c82a 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -68,6 +68,8 @@ typedef struct _GdkIOClosure GdkIOClosure;
 typedef struct _GdkDisplaySource GdkDisplaySource;
 typedef struct _GdkEventTypeX11 GdkEventTypeX11;
 
+typedef union  _GdkNotifyEvent GdkNotifyEvent;
+
 struct _GdkIOClosure
 {
   GdkInputFunction function;
@@ -90,6 +92,13 @@ struct _GdkEventTypeX11
   gint n_events;
 };
 
+union _GdkNotifyEvent
+{
+  XEvent xevent;
+  XFixesSelectionNotifyEvent selection_notify;
+  XDamageNotifyEvent damage_event;
+};
+
 /* 
  * Private function declarations
  */
@@ -845,7 +854,7 @@ gdk_event_translate (GdkDisplay *display,
 		     XEvent     *xevent,
 		     gboolean    return_exposes)
 {
-  
+  GdkNotifyEvent *notify_event;
   GdkWindow *window;
   GdkWindowObject *window_private;
   GdkWindow *filter_window;
@@ -2020,6 +2029,13 @@ gdk_event_translate (GdkDisplay *display,
       break;
 
     default:
+      notify_event = (GdkNotifyEvent *) xevent;
+#ifdef HAVE_XFIXES
+      XFixesSelectionNotifyEvent *selection_notify = &(notify_event->selection_notify);
+#endif
+#ifdef HAVE_XDAMAGE
+      XDamageNotifyEvent *damage_event = &(notify_event->damage_event);
+#endif
 #ifdef HAVE_XKB
       if (xevent->type == display_x11->xkb_event_type)
 	{
@@ -2044,8 +2060,6 @@ gdk_event_translate (GdkDisplay *display,
 #ifdef HAVE_XFIXES
       if (xevent->type - display_x11->xfixes_event_base == XFixesSelectionNotify)
 	{
-	  XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)xevent;
-
 	  _gdk_x11_screen_process_owner_change (screen, xevent);
 	  
 	  event->owner_change.type = GDK_OWNER_CHANGE;
@@ -2074,9 +2088,8 @@ gdk_event_translate (GdkDisplay *display,
 #if defined(HAVE_XCOMPOSITE) && defined (HAVE_XDAMAGE) && defined (HAVE_XFIXES)
       if (display_x11->have_xdamage && window_private && window_private->composited &&
 	  xevent->type == display_x11->xdamage_event_base + XDamageNotify &&
-	  ((XDamageNotifyEvent *) xevent)->damage == window_impl->damage)
+	  damage_event->damage == window_impl->damage)
 	{
-	  XDamageNotifyEvent *damage_event = (XDamageNotifyEvent *) xevent;
 	  XserverRegion repair;
 	  GdkRectangle rect;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]