From http://www.jwz.org/xscreensaver/xscreensaver-5.30.tar.gz
[xscreensaver] / hacks / triangle.c
index 1a93de257dd59fa4aba3d9e6cb363dec9d45e973..e8400d42c2be356ceb59c70cfb9ffee84b9fd441 100644 (file)
@@ -51,7 +51,6 @@ static const char sccsid[] = "@(#)triangle.c  4.04 97/07/28 xlockmore";
                                        "*fpsSolid: true \n" \
 
 # define SMOOTH_COLORS
-# define triangle_handle_event 0
 # include "xlockmore.h"                /* in xscreensaver distribution */
 #else /* STANDALONE */
 # include "xlock.h"                    /* in xlockmore distribution */
@@ -298,11 +297,11 @@ draw_triangle (ModeInfo * mi)
                                XClearWindow(MI_DISPLAY(mi), MI_WINDOW(mi));
                                if (!mono_p)
                                  {
-                                       free_colors(mi->dpy, mi->xgwa.colormap, mi->colors,
+                                       free_colors(mi->xgwa.screen, mi->xgwa.colormap, mi->colors,
                                                                mi->npixels);
                     mi->npixels = 
                       get_integer_resource (mi->dpy, "ncolors", "Integer");
-                                       make_smooth_colormap (mi->dpy,
+                                       make_smooth_colormap (mi->xgwa.screen,
                                                                                  mi->xgwa.visual, mi->xgwa.colormap,
                                                                                  mi->colors, &mi->npixels,
                                                                                  True, &mi->writable_p, True);
@@ -366,4 +365,16 @@ refresh_triangle (ModeInfo * mi)
        /* Do nothing, it will refresh by itself */
 }
 
+ENTRYPOINT Bool
+triangle_handle_event (ModeInfo *mi, XEvent *event)
+{
+  if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
+    {
+      reshape_triangle (mi, MI_WIDTH(mi), MI_HEIGHT(mi));
+      return True;
+    }
+  return False;
+}
+
+
 XSCREENSAVER_MODULE ("Triangle", triangle)