? autom4te.cache
? metacity.spec
? scroll-option.diff
? scroll.diff
? stamp-h1
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/metacity/ChangeLog,v
retrieving revision 1.423
diff -u -p -r1.423 ChangeLog
--- ChangeLog	21 Aug 2002 06:47:13 -0000	1.423
+++ ChangeLog	22 Aug 2002 12:27:33 -0000
@@ -1,3 +1,27 @@
+2002-08-22  Pier Luigi Fiorini  <plfiorini@supereva.it>
+
+	* src/prefs.c: defined KEY_USE_WHEEL_SCROLL for the new
+	shade/unshade with wheel scroll feature.
+	* src/prefs.c (meta_prefs_init): get the value from gconf
+	for the use_wheel_scroll option.
+	* src/prefs.c (update_use_wheel_scroll): update the value
+	of the gconf key.
+	* src/prefs.[ch] (meta_prefs_get_use_wheel_scroll): get
+	the gconf key value.
+	* src/frames.c (meta_frames_scroll): do the code only if
+	the gconf key value is true.
+	* src/metacity.schemas.in: added the use_wheel_scroll option.
+
+2002-08-21  Gianluigi Calcaterra  <gianluigi.calcaterra@milug.org>
+
+	* src/core.c (meta_core_move_window_next_workspace) 
+	(meta_core_move_window_pre_workspace): add function
+	that move window through the workspace
+
+	* src/frames.c: 
+	(meta_frames_scroll): add function to Move window through
+	workspace and Shade/unshade window whit alt+scroll and scroll
+
 2002-08-21  Deepa Natarajan  <deepa.natarajan@wipro.com>
 
 	* src/keybindings.c, src/metacity.schemas.in, src/prefs.[ch]:
Index: src/core.c
===================================================================
RCS file: /cvs/gnome/metacity/src/core.c,v
retrieving revision 1.28
diff -u -p -r1.28 core.c
--- src/core.c	8 Aug 2002 05:08:59 -0000	1.28
+++ src/core.c	22 Aug 2002 12:27:35 -0000
@@ -666,3 +666,79 @@ meta_core_increment_event_serial (Displa
   meta_display_increment_event_serial (display);
 }
 
+gboolean
+meta_core_move_window_next_workspace(Display *xdisplay,
+				     Window frame_xwindow)
+{
+  
+  int num_workspaces;
+  int num_workspace_current;
+  int activate;
+  MetaWindow *window;
+  MetaDisplay *display;
+  MetaWorkspace *workspace;
+  
+  num_workspaces = meta_prefs_get_num_workspaces ();
+
+  if ( num_workspaces == 1 ) return FALSE;
+
+  num_workspace_current=meta_core_get_frame_workspace(xdisplay,frame_xwindow);
+  
+  display = meta_display_for_x_display (xdisplay);
+  window = meta_display_lookup_x_window (display,frame_xwindow);
+
+  if ( window->on_all_workspaces ) return FALSE;
+
+  if ( num_workspace_current == (num_workspaces-1) ) {
+    activate = 0;
+  } else {
+    activate = num_workspace_current+1;
+  }
+  
+  workspace = meta_display_get_workspace_by_screen_index (window->display,
+							  window->screen,
+							  activate);
+  meta_core_change_workspace(xdisplay,frame_xwindow,activate);
+  meta_workspace_activate(workspace);
+  
+  return TRUE;
+}
+
+gboolean
+meta_core_move_window_pre_workspace(Display *xdisplay,
+				     Window frame_xwindow)
+{
+  int num_workspaces;
+  int num_workspace_current;
+  int activate;
+  MetaWindow *window;
+  MetaDisplay *display;
+  MetaWorkspace *workspace;
+  
+  num_workspaces = meta_prefs_get_num_workspaces ();
+
+  if ( num_workspaces == 1 ) return FALSE;
+
+  num_workspace_current=meta_core_get_frame_workspace(xdisplay,frame_xwindow);
+  
+  display = meta_display_for_x_display (xdisplay);
+  window = meta_display_lookup_x_window (display,frame_xwindow);
+
+  if ( window->on_all_workspaces ) return FALSE;
+  
+  if ( num_workspace_current == 0 ) {
+    activate = num_workspaces-1;
+  } else {
+    activate = num_workspace_current-1;
+  }
+  
+  workspace = meta_display_get_workspace_by_screen_index (window->display,
+							  window->screen,
+							  activate);
+
+  meta_core_change_workspace(xdisplay,frame_xwindow,activate);
+  meta_workspace_activate(workspace);
+
+  return TRUE;
+  
+}
Index: src/core.h
===================================================================
RCS file: /cvs/gnome/metacity/src/core.h,v
retrieving revision 1.17
diff -u -p -r1.17 core.h
--- src/core.h	23 Jul 2002 20:52:22 -0000	1.17
+++ src/core.h	22 Aug 2002 12:27:35 -0000
@@ -150,6 +150,12 @@ void       meta_core_get_screen_size (Di
  */
 void meta_core_increment_event_serial (Display *display);
 
+gboolean meta_core_move_window_next_workspace(Display *xdisplay,
+					      Window frame_xwindow);
+
+gboolean meta_core_move_window_pre_workspace(Display *xdisplay,
+					     Window frame_xwindow);
+
 #endif
 
 
Index: src/frames.c
===================================================================
RCS file: /cvs/gnome/metacity/src/frames.c,v
retrieving revision 1.62
diff -u -p -r1.62 frames.c
--- src/frames.c	20 Aug 2002 20:18:18 -0000	1.62
+++ src/frames.c	22 Aug 2002 12:27:38 -0000
@@ -43,6 +43,8 @@ static void meta_frames_style_set  (GtkW
 static void meta_frames_realize    (GtkWidget       *widget);
 static void meta_frames_unrealize  (GtkWidget       *widget);
 
+static gboolean meta_frames_scroll (GtkWidget *widget,
+				    GdkEvent *event );
 static gboolean meta_frames_button_press_event    (GtkWidget           *widget,
                                                    GdkEventButton      *event);
 static gboolean meta_frames_button_release_event  (GtkWidget           *widget,
@@ -138,6 +140,7 @@ meta_frames_class_init (MetaFramesClass 
   widget_class->motion_notify_event = meta_frames_motion_notify_event;
   widget_class->enter_notify_event = meta_frames_enter_notify_event;
   widget_class->leave_notify_event = meta_frames_leave_notify_event;
+  widget_class->scroll_event = meta_frames_scroll;
 }
 
 static gint
@@ -978,6 +981,72 @@ point_in_control (MetaFrames *frames,
                   int x, int y)
 {
   return control == get_control (frames, frame, x, y);
+}
+
+static gboolean 
+meta_frames_scroll (GtkWidget *widget,
+		    GdkEvent *event)
+{
+  
+  MetaUIFrame *frame;
+  MetaFrames *frames;
+  MetaFrameControl control;
+
+  if (meta_prefs_get_use_wheel_scroll ())
+    {
+      frames = META_FRAMES (widget);
+  
+      frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->scroll.window));
+  
+      if (frame == NULL)
+        return FALSE;
+
+      clear_tip (frames);
+  
+      control = get_control (frames, frame, event->scroll.x, event->scroll.y);
+  
+      /*
+       * Move window through workspace
+       */
+      if ( control == META_FRAME_CONTROL_TITLE )      
+        {
+          MetaFrameFlags flags;
+      
+          flags = meta_core_get_frame_flags (gdk_display, frame->xwindow);
+
+          if ( flags  &
+	        event->scroll.state & Mod1Mask )
+	    {
+	       if (  event->scroll.direction == GDK_SCROLL_DOWN )
+	         {
+	           return meta_core_move_window_pre_workspace(gdk_display,frame->xwindow);
+	         } 
+	       else if ( event->scroll.direction == GDK_SCROLL_UP )
+	         {
+	           return meta_core_move_window_next_workspace(gdk_display,frame->xwindow);
+	         }
+	       return FALSE;
+	     }
+      
+          /*
+           * Shade/unshade window
+           */
+          if ( flags & META_FRAME_ALLOWS_SHADE)
+	    {
+	      if (META_FRAME_SHADED  &&
+	          event->scroll.direction == GDK_SCROLL_DOWN)
+	        meta_core_unshade (gdk_display,
+			           frame->xwindow);
+	      else if ( event->scroll.direction == GDK_SCROLL_UP )
+	        meta_core_shade (gdk_display,
+			         frame->xwindow);
+	    }
+      
+            return TRUE;
+        }
+    }
+
+  return FALSE;
 }
 
 static gboolean
Index: src/metacity.schemas.in
===================================================================
RCS file: /cvs/gnome/metacity/src/metacity.schemas.in,v
retrieving revision 1.10
diff -u -p -r1.10 metacity.schemas.in
--- src/metacity.schemas.in	21 Aug 2002 06:47:16 -0000	1.10
+++ src/metacity.schemas.in	22 Aug 2002 12:27:40 -0000
@@ -54,6 +54,20 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/metacity/general/use_wheel_scroll</key>
+      <applyto>/apps/metacity/general/use_wheel_scroll</applyto>
+      <owner>metacity</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Use wheel scroll for the title bar</short>
+         <long>
+	 If true, enable the wheel scroll for the title bar.
+	 </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/metacity/general/theme</key>
       <applyto>/apps/metacity/general/theme</applyto>
       <owner>metacity</owner>
Index: src/prefs.c
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.c,v
retrieving revision 1.22
diff -u -p -r1.22 prefs.c
--- src/prefs.c	21 Aug 2002 06:47:16 -0000	1.22
+++ src/prefs.c	22 Aug 2002 12:27:42 -0000
@@ -33,6 +33,7 @@
 #define KEY_FOCUS_MODE "/apps/metacity/general/focus_mode"
 #define KEY_AUTO_RAISE "/apps/metacity/general/auto_raise"
 #define KEY_AUTO_RAISE_DELAY "/apps/metacity/general/auto_raise_delay"
+#define KEY_USE_WHEEL_SCROLL "/apps/metacity/general/use_wheel_scroll"
 #define KEY_THEME "/apps/metacity/general/theme"
 #define KEY_USE_SYSTEM_FONT  "/apps/metacity/general/titlebar_uses_system_font"
 #define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
@@ -57,6 +58,7 @@ static gboolean application_based = FALS
 static gboolean disable_workarounds = FALSE;
 static gboolean auto_raise = FALSE;
 static gboolean auto_raise_delay = 500;
+static gboolean use_wheel_scroll;
 #define NUM_COMMANDS 12
 static char *commands[NUM_COMMANDS] = { NULL, NULL, NULL, NULL, NULL, NULL,
                                         NULL, NULL, NULL, NULL, NULL, NULL };
@@ -70,6 +72,7 @@ static gboolean update_application_based
 static gboolean update_disable_workarounds (gboolean   value);
 static gboolean update_auto_raise          (gboolean   value);
 static gboolean update_auto_raise_delay    (int        value);
+static gboolean update_use_wheel_scroll    (gboolean   value);
 static gboolean update_window_binding     (const char *name,
                                            const char *value);
 static gboolean update_screen_binding     (const char *name,
@@ -251,7 +254,11 @@ meta_prefs_init (void)
 				  &err);
   cleanup_error (&err);
   update_auto_raise_delay (int_val);
-  
+ 
+  bool_val = gconf_client_get_bool (default_client, KEY_USE_WHEEL_SCROLL,
+		  		  &err);
+  cleanup_error (&err);
+  update_use_wheel_scroll (bool_val);
 
   str_val = gconf_client_get_string (default_client, KEY_THEME,
                                      &err);
@@ -518,6 +525,22 @@ change_notify (GConfClient    *client,
         queue_changed (META_PREF_AUTO_RAISE_DELAY);
     
     }
+  else if (strcmp (key, KEY_USE_WHEEL_SCROLL) == 0)
+    {
+      gboolean b;
+
+      if (value && value->type != GCONF_VALUE_BOOL)
+        {
+	  meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
+			KEY_AUTO_RAISE);
+	  goto out;
+	}
+
+      b = value ? gconf_value_get_bool (value) : use_wheel_scroll;
+
+      if (update_use_wheel_scroll (b))
+        queue_changed (META_PREF_USE_WHEEL_SCROLL);
+    }
   else if (str_has_prefix (key, KEY_COMMAND_PREFIX))
     {
       const char *str;
@@ -731,7 +754,6 @@ meta_prefs_get_disable_workarounds (void
 {
   return disable_workarounds;
 }
-
 static gboolean
 update_auto_raise (gboolean value)
 {
@@ -762,6 +784,16 @@ update_auto_raise_delay (int value)
   return old != auto_raise_delay;
 }
 
+static gboolean
+update_use_wheel_scroll (gboolean value)
+{
+  gboolean old = use_wheel_scroll;
+
+  use_wheel_scroll = value;
+
+  return old != value;
+}
+
 const char*
 meta_preference_to_string (MetaPreference pref)
 {
@@ -797,6 +829,9 @@ meta_preference_to_string (MetaPreferenc
     case META_PREF_AUTO_RAISE_DELAY:
       return "AUTO_RAISE_DELAY";
 
+    case META_PREF_USE_WHEEL_SCROLL:
+      return "USE_WHEEL_SCROLL";
+
     case META_PREF_COMMANDS:
       return "COMMANDS";
     }
@@ -1169,6 +1204,12 @@ int
 meta_prefs_get_auto_raise_delay ()
 {
   return auto_raise_delay;
+}
+
+gboolean
+meta_prefs_get_use_wheel_scroll (void)
+{
+  return use_wheel_scroll;
 }
 
 MetaKeyBindingAction
Index: src/prefs.h
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.h,v
retrieving revision 1.18
diff -u -p -r1.18 prefs.h
--- src/prefs.h	21 Aug 2002 06:47:16 -0000	1.18
+++ src/prefs.h	22 Aug 2002 12:27:43 -0000
@@ -31,6 +31,7 @@ typedef enum
   META_PREF_FOCUS_MODE,
   META_PREF_AUTO_RAISE,
   META_PREF_AUTO_RAISE_DELAY,
+  META_PREF_USE_WHEEL_SCROLL,
   META_PREF_THEME,
   META_PREF_TITLEBAR_FONT,
   META_PREF_NUM_WORKSPACES,
@@ -62,6 +63,7 @@ gboolean                    meta_prefs_g
 gboolean                    meta_prefs_get_auto_raise         (void);
 int                         meta_prefs_get_auto_raise_delay   (void);
 
+gboolean		    meta_prefs_get_use_wheel_scroll   (void);
 const char*                 meta_prefs_get_command            (int i);
 
 char*                       meta_prefs_get_gconf_key_for_command (int i);
