diff -Eru metacity-2.20.0.orig/src/core.c metacity-2.20.0/src/core.c
--- metacity-2.20.0.orig/src/core.c	2007-11-11 23:05:10.000000000 +0000
+++ metacity-2.20.0/src/core.c	2007-11-11 23:11:33.000000000 +0000
@@ -345,6 +345,34 @@
                           META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
 }
 
+void meta_core_toggle_maximize_vert (Display *xdisplay,
+                                     Window   frame_xwindow)
+{
+  MetaWindow *window = get_window (xdisplay, frame_xwindow);
+
+  if (meta_prefs_get_raise_on_click ())
+    meta_window_raise (window);
+
+  if (window->maximized_vertically)
+    meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);
+  else
+    meta_window_maximize (window, META_MAXIMIZE_VERTICAL);
+}
+
+void meta_core_toggle_maximize_horiz (Display *xdisplay,
+                                      Window   frame_xwindow)
+{
+  MetaWindow *window = get_window (xdisplay, frame_xwindow);
+
+  if (meta_prefs_get_raise_on_click ())
+    meta_window_raise (window);
+
+  if (window->maximized_horizontally)
+    meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
+  else
+    meta_window_maximize (window, META_MAXIMIZE_HORIZONTAL);
+}
+
 void
 meta_core_unmaximize (Display *xdisplay,
                       Window   frame_xwindow)
diff -Eru metacity-2.20.0.orig/src/core.h metacity-2.20.0/src/core.h
--- metacity-2.20.0.orig/src/core.h	2007-11-11 23:05:10.000000000 +0000
+++ metacity-2.20.0/src/core.h	2007-11-11 23:11:33.000000000 +0000
@@ -120,6 +120,10 @@
                                  Window   frame_xwindow);
 void meta_core_toggle_maximize  (Display *xdisplay,
                                  Window   frame_xwindow);
+void meta_core_toggle_maximize_vert  (Display *xdisplay,
+                                      Window   frame_xwindow);
+void meta_core_toggle_maximize_horiz (Display *xdisplay,
+                                      Window   frame_xwindow);
 void meta_core_unmaximize       (Display *xdisplay,
                                  Window   frame_xwindow);
 void meta_core_maximize         (Display *xdisplay,
diff -Eru metacity-2.20.0.orig/src/frames.c metacity-2.20.0/src/frames.c
--- metacity-2.20.0.orig/src/frames.c	2007-11-11 23:05:10.000000000 +0000
+++ metacity-2.20.0/src/frames.c	2007-11-11 23:12:43.000000000 +0000
@@ -1370,7 +1370,7 @@
       META_GRAB_OP_NONE)
     return FALSE; /* already up to something */  
 
-  if (event->button == 1 &&
+  if ((event->button == 1 &&
       (control == META_FRAME_CONTROL_MAXIMIZE ||
        control == META_FRAME_CONTROL_UNMAXIMIZE ||
        control == META_FRAME_CONTROL_MINIMIZE ||
@@ -1381,7 +1381,10 @@
        control == META_FRAME_CONTROL_UNABOVE ||
        control == META_FRAME_CONTROL_STICK ||
        control == META_FRAME_CONTROL_UNSTICK ||
-       control == META_FRAME_CONTROL_MENU))
+       control == META_FRAME_CONTROL_MENU)) ||
+      ((event->button == 2 || event->button == 3) &&
+      (control == META_FRAME_CONTROL_MAXIMIZE ||
+       control == META_FRAME_CONTROL_UNMAXIMIZE)))
     {
       MetaGrabOp op = META_GRAB_OP_NONE;
 
@@ -1629,6 +1632,7 @@
       
       switch (op)
         {
+
         case META_GRAB_OP_CLICKING_MINIMIZE:
           if (control == META_FRAME_CONTROL_MINIMIZE)
             meta_core_minimize (gdk_display, frame->xwindow);
@@ -1643,15 +1647,28 @@
             meta_core_user_focus (gdk_display,
                             frame->xwindow,
                             event->time);      
-            meta_core_maximize (gdk_display, frame->xwindow);
+
+            if (event->button == 2)
+              meta_core_toggle_maximize_vert (gdk_display, frame->xwindow);
+            else if (event->button == 3)
+              meta_core_toggle_maximize_horiz (gdk_display, frame->xwindow);
+            else
+              meta_core_maximize (gdk_display, frame->xwindow);
           }
           meta_core_end_grab_op (gdk_display, event->time);
           break;
 
         case META_GRAB_OP_CLICKING_UNMAXIMIZE:
           if (control == META_FRAME_CONTROL_UNMAXIMIZE)
-            meta_core_unmaximize (gdk_display, frame->xwindow);
-          
+            {
+              if (event->button == 2)
+                meta_core_toggle_maximize_vert (gdk_display, frame->xwindow);
+              else if (event->button == 3)
+                meta_core_toggle_maximize_horiz (gdk_display, frame->xwindow);
+              else
+                meta_core_unmaximize (gdk_display, frame->xwindow);
+            }
+
           meta_core_end_grab_op (gdk_display, event->time);
           break;
           
