File xscreensaver-strict-aliasing.patch of Package xscreensaver

--- driver/timers.c
+++ driver/timers.c
@@ -669,7 +669,15 @@
 sleep_until_idle (saver_info *si, Bool until_idle_p)
 {
   saver_preferences *p = &si->prefs;
-  XEvent event;
+  union {
+    XEvent x_event;
+#ifdef HAVE_RANDR
+    XRRScreenChangeNotifyEvent xrr_event;
+#endif /* HAVE_RANDR */
+#ifdef HAVE_MIT_SAVER_EXTENSION
+    XScreenSaverNotifyEvent sevent;
+#endif /* HAVE_MIT_SAVER_EXTENSION */
+  } event;
 
   /* We need to select events on all windows if we're not using any extensions.
      Otherwise, we don't need to. */
@@ -713,9 +721,9 @@
 
   while (1)
     {
-      XtAppNextEvent (si->app, &event);
+      XtAppNextEvent (si->app, &event.x_event);
 
-      switch (event.xany.type) {
+      switch (event.x_event.xany.type) {
       case 0:		/* our synthetic "timeout" event has been signalled */
 	if (until_idle_p)
 	  {
@@ -803,7 +811,7 @@
 	break;
 
       case ClientMessage:
-	if (handle_clientmessage (si, &event, until_idle_p))
+	if (handle_clientmessage (si, &event.x_event, until_idle_p))
 	  goto DONE;
 	break;
 
@@ -812,7 +820,7 @@
            supposed to scan all windows for events, prepare this window. */
 	if (scanning_all_windows)
 	  {
-            Window w = event.xcreatewindow.window;
+            Window w = event.x_event.xcreatewindow.window;
 	    start_notice_events_timer (si, w, p->debug_p);
 	  }
 	break;
@@ -831,28 +839,28 @@
             Window root=0, window=0;
             int x=-1, y=-1;
             const char *type = 0;
-	    if (event.xany.type == MotionNotify)
+	    if (event.x_event.xany.type == MotionNotify)
               {
                 /*type = "MotionNotify";*/
-                root = event.xmotion.root;
-                window = event.xmotion.window;
-                x = event.xmotion.x_root;
-                y = event.xmotion.y_root;
+                root = event.x_event.xmotion.root;
+                window = event.x_event.xmotion.window;
+                x = event.x_event.xmotion.x_root;
+                y = event.x_event.xmotion.y_root;
               }
-	    else if (event.xany.type == KeyPress)
+	    else if (event.x_event.xany.type == KeyPress)
               {
                 type = "KeyPress";
-                root = event.xkey.root;
-                window = event.xkey.window;
+                root = event.x_event.xkey.root;
+                window = event.x_event.xkey.window;
                 x = y = -1;
               }
-	    else if (event.xany.type == ButtonPress)
+	    else if (event.x_event.xany.type == ButtonPress)
               {
                 type = "ButtonPress";
-                root = event.xkey.root;
-                window = event.xkey.window;
-                x = event.xmotion.x_root;
-                y = event.xmotion.y_root;
+                root = event.x_event.xkey.root;
+                window = event.x_event.xkey.window;
+                x = event.x_event.xmotion.x_root;
+                y = event.x_event.xmotion.y_root;
               }
 
             if (type)
@@ -866,13 +874,13 @@
 
                 /* Be careful never to do this unless in -debug mode, as
                    this could expose characters from the unlock password. */
-                if (p->debug_p && event.xany.type == KeyPress)
+                if (p->debug_p && event.x_event.xany.type == KeyPress)
                   {
                     KeySym keysym;
                     char c = 0;
-                    XLookupString (&event.xkey, &c, 1, &keysym, 0);
+                    XLookupString (&event.x_event.xkey, &c, 1, &keysym, 0);
                     fprintf (stderr, " (%s%s)",
-                             (event.xkey.send_event ? "synthetic " : ""),
+                             (event.x_event.xkey.send_event ? "synthetic " : ""),
                              XKeysymToString (keysym));
                   }
 
@@ -884,7 +892,7 @@
 	  }
 
 	/* If any widgets want to handle this event, let them. */
-	dispatch_event (si, &event);
+	dispatch_event (si, &event.x_event);
 
         
         /* If we got a MotionNotify event, figure out what screen it
@@ -892,11 +900,11 @@
            far enough to count as "real" motion, then ignore this
            event.
          */
-        if (event.xany.type == MotionNotify)
+        if (event.x_event.xany.type == MotionNotify)
           {
             int i;
             for (i = 0; i < si->nscreens; i++)
-              if (event.xmotion.root ==
+              if (event.x_event.xmotion.root ==
                   RootWindowOfScreen (si->screens[i].screen))
                 break;
             if (i < si->nscreens)
@@ -915,8 +923,8 @@
 	if (!until_idle_p)
 	  {
 	    if (si->demoing_p &&
-		(event.xany.type == MotionNotify ||
-		 event.xany.type == KeyRelease))
+		(event.x_event.xany.type == MotionNotify ||
+		 event.x_event.xany.type == KeyRelease))
 	      /* When we're demoing a single hack, mouse motion doesn't
 		 cause deactivation.  Only clicks and keypresses do. */
 	      ;
@@ -937,17 +945,17 @@
 	 * screen)
 	 */
 	  case MapNotify:
-	if( (si->screen_blanked_p) && event.xmap.override_redirect ) 
+	if( (si->screen_blanked_p) && event.x_event.xmap.override_redirect ) 
 	  {
 		int ii,rr=TRUE;
 		for (ii = 0; ii < si->nscreens; ii++) {
-			if (si->screens[ii].screensaver_window==event.xmap.window) {
+			if (si->screens[ii].screensaver_window==event.x_event.xmap.window) {
 				rr=FALSE;
 				break;
 			}
 		}
 		if (p->debug_p) {
-			fprintf (stderr, "MapNotify w/ override redirect from 0x%x received",event.xmap.window);
+			fprintf (stderr, "MapNotify w/ override redirect from 0x%x received",event.x_event.xmap.window);
 		}
 		if(rr==TRUE) { 
 			if (p->debug_p) { fprintf (stderr, ", raising unconditionally.\n"); }
@@ -961,17 +969,17 @@
 	break;
 
 	  case ConfigureNotify:
-	if( (si->screen_blanked_p) && event.xconfigure.override_redirect ) 
+	if( (si->screen_blanked_p) && event.x_event.xconfigure.override_redirect ) 
 	  {
 		int ii,rr=TRUE;
 		for (ii = 0; ii < si->nscreens; ii++) {
-			if(si->screens[ii].screensaver_window==event.xconfigure.window) {
+			if(si->screens[ii].screensaver_window==event.x_event.xconfigure.window) {
 				rr=FALSE;
 				break;
 			}
 		}
 		if (p->debug_p) {
-			fprintf (stderr, "ConfigureNotify event w/ override redirect from 0x%x received",event.xconfigure.window);
+			fprintf (stderr, "ConfigureNotify event w/ override redirect from 0x%x received",event.x_event.xconfigure.window);
 		}
 		if(rr==TRUE) { 
 			if (p->debug_p) { fprintf (stderr, ", raising unconditionally.\n"); }
@@ -987,16 +995,14 @@
       default:
 
 #ifdef HAVE_MIT_SAVER_EXTENSION
-	if (event.type == si->mit_saver_ext_event_number)
+	if (event.x_event.type == si->mit_saver_ext_event_number)
 	  {
             /* This event's number is that of the MIT-SCREEN-SAVER server
                extension.  This extension has one event number, and the event
                itself contains sub-codes that say what kind of event it was
                (an "idle" or "not-idle" event.)
              */
-	    XScreenSaverNotifyEvent *sevent =
-	      (XScreenSaverNotifyEvent *) &event;
-	    if (sevent->state == ScreenSaverOn)
+	    if (event.sevent.state == ScreenSaverOn)
 	      {
 		int i = 0;
 		if (p->verbose_p)
@@ -1014,7 +1020,7 @@
 		      XUnmapWindow (si->dpy, ssi->server_mit_saver_window);
 		  }
 
-		if (sevent->kind != ScreenSaverExternal)
+		if (event.sevent.kind != ScreenSaverExternal)
 		  {
 		    fprintf (stderr,
 			 "%s: ScreenSaverOn event wasn't of type External!\n",
@@ -1024,7 +1030,7 @@
 		if (until_idle_p)
 		  goto DONE;
 	      }
-	    else if (sevent->state == ScreenSaverOff)
+	    else if (event.sevent.state == ScreenSaverOff)
 	      {
 		if (p->verbose_p)
 		  fprintf (stderr, "%s: MIT ScreenSaverOff event received.\n",
@@ -1035,7 +1041,7 @@
 	    else
 	      fprintf (stderr,
 		       "%s: unknown MIT-SCREEN-SAVER event %d received!\n",
-		       blurb(), sevent->state);
+		       blurb(), event.sevent.state);
 	  }
 	else
 
@@ -1043,7 +1049,7 @@
 
 
 #ifdef HAVE_SGI_SAVER_EXTENSION
-	if (event.type == (si->sgi_saver_ext_event_number + ScreenSaverStart))
+	if (event.x_event.type == (si->sgi_saver_ext_event_number + ScreenSaverStart))
 	  {
             /* The SGI SCREEN_SAVER server extension has two event numbers,
                and this event matches the "idle" event. */
@@ -1054,7 +1060,7 @@
 	    if (until_idle_p)
 	      goto DONE;
 	  }
-	else if (event.type == (si->sgi_saver_ext_event_number +
+	else if (event.x_event.type == (si->sgi_saver_ext_event_number +
 				ScreenSaverEnd))
 	  {
             /* The SGI SCREEN_SAVER server extension has two event numbers,
@@ -1069,25 +1075,22 @@
 #endif /* HAVE_SGI_SAVER_EXTENSION */
 
 #ifdef HAVE_RANDR
-        if (event.type == (si->randr_event_number + RRScreenChangeNotify))
+        if (event.x_event.type == (si->randr_event_number + RRScreenChangeNotify))
           {
             /* The Resize and Rotate extension sends an event when the
                size, rotation, or refresh rate of any screen has changed.
              */
-            XRRScreenChangeNotifyEvent *xrr_event =
-              (XRRScreenChangeNotifyEvent *) &event;
-
             if (p->verbose_p)
               {
                 /* XRRRootToScreen is in Xrandr.h 1.4, 2001/06/07 */
-                int screen = XRRRootToScreen (si->dpy, xrr_event->window);
+                int screen = XRRRootToScreen (si->dpy, event.xrr_event.window);
                 fprintf (stderr, "%s: %d: screen change event received\n",
                          blurb(), screen);
               }
 
 # ifdef RRScreenChangeNotifyMask
             /* Inform Xlib that it's ok to update its data structures. */
-            XRRUpdateConfiguration (&event); /* Xrandr.h 1.9, 2002/09/29 */
+            XRRUpdateConfiguration (&event.x_event); /* Xrandr.h 1.9, 2002/09/29 */
 # endif /* RRScreenChangeNotifyMask */
 
             /* Resize the existing xscreensaver windows and cached ssi data. */
@@ -1105,7 +1108,7 @@
 #endif /* HAVE_RANDR */
 
           /* Just some random event.  Let the Widgets handle it, if desired. */
-	  dispatch_event (si, &event);
+	  dispatch_event (si, &event.x_event);
       }
     }
  DONE:
@@ -1120,11 +1123,11 @@
      there's only one event generated by user activity, not two.)
    */
   if (!until_idle_p && si->locked_p)
-    swallow_unlock_typeahead_events (si, &event);
+    swallow_unlock_typeahead_events (si, &event.x_event);
   else
     while (XCheckMaskEvent (si->dpy,
                             (KeyPressMask|ButtonPressMask|PointerMotionMask),
-                     &event))
+                     &event.x_event))
       ;
 
 
openSUSE Build Service is sponsored by