Index: src/frames.c
===================================================================
RCS file: /cvs/gnome/metacity/src/frames.c,v
retrieving revision 1.75
diff -u -r1.75 frames.c
--- src/frames.c	24 Nov 2003 18:09:47 -0000	1.75
+++ src/frames.c	20 May 2004 09:52:15 -0000
@@ -50,6 +50,8 @@
                                                    GdkEventButton      *event);
 static gboolean meta_frames_motion_notify_event   (GtkWidget           *widget,
                                                    GdkEventMotion      *event);
+static gboolean meta_frames_scroll_event          (GtkWidget           *widget,
+                                                   GdkEventScroll      *event);
 static gboolean meta_frames_destroy_event         (GtkWidget           *widget,
                                                    GdkEventAny         *event);
 static gboolean meta_frames_expose_event          (GtkWidget           *widget,
@@ -139,6 +141,7 @@
   widget_class->button_press_event = meta_frames_button_press_event;
   widget_class->button_release_event = meta_frames_button_release_event;
   widget_class->motion_notify_event = meta_frames_motion_notify_event;
+  widget_class->scroll_event = meta_frames_scroll_event;
   widget_class->enter_notify_event = meta_frames_enter_notify_event;
   widget_class->leave_notify_event = meta_frames_leave_notify_event;
 }
@@ -1666,6 +1669,40 @@
       break;
     }
       
+  return TRUE;
+}
+
+static gboolean
+meta_frames_scroll_event            (GtkWidget           *widget,
+                                     GdkEventScroll      *event)
+{
+  MetaUIFrame *frame;
+  MetaFrames *frames;
+  MetaFrameFlags flags;
+  
+  frames = META_FRAMES (widget);
+  
+  frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window));
+  if (frame == NULL)
+    return FALSE;
+
+  flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
+    
+  if (flags & META_FRAME_ALLOWS_SHADE)
+    {
+    if (flags & META_FRAME_SHADED &&
+	event->direction == GDK_SCROLL_DOWN)
+      {
+        meta_core_unshade (gdk_display,
+			   frame->xwindow);
+      }
+    else if (event->direction == GDK_SCROLL_UP)
+	meta_core_shade (gdk_display,
+			 frame->xwindow);
+    else
+	return FALSE; /* neither scrolled up nor down */
+    }
+
   return TRUE;
 }
 
