--- src/core/prefs.c	2008-03-01 11:05:21.845491539 +0100
+++ src/core/prefs.c.new	2008-03-01 11:07:59.810479256 +0100
@@ -205,6 +205,8 @@
     { META_ACTION_TITLEBAR_LOWER,           "lower" },
     { META_ACTION_TITLEBAR_MENU,            "menu" },
     { META_ACTION_TITLEBAR_TOGGLE_SHADE,    "toggle_shade" },
+    { META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZ, "toggle_maximize_horiz"},
+    { META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERT, "toggle_maximize_vert"},
     { 0, NULL },
   };
 
--- src/ui/frames.c	2008-03-01 11:05:21.793501458 +0100
+++ src/ui/frames.c.new	2008-03-01 10:45:08.170167836 +0100
@@ -1249,6 +1249,32 @@
       }
       break;
 
+    case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZ:
+      {
+        meta_core_get (gdk_display, frame->xwindow,
+                       META_CORE_GET_FRAME_FLAGS, &flags,
+                       META_CORE_GET_END);
+
+        if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
+          {
+            meta_core_toggle_maximize_horiz (gdk_display, frame->xwindow);
+          }
+      }
+      break;
+
+    case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERT:
+      {
+        meta_core_get (gdk_display, frame->xwindow,
+                       META_CORE_GET_FRAME_FLAGS, &flags,
+                       META_CORE_GET_END);
+
+        if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
+          {
+            meta_core_toggle_maximize_vert (gdk_display, frame->xwindow);
+          }
+      }
+      break;
+
     case META_ACTION_TITLEBAR_MINIMIZE:
       {
         meta_core_get (gdk_display, frame->xwindow,
--- src/core/core.c	2008-03-01 11:12:29.139964996 +0100
+++ src/core/core.c.new	2008-03-01 11:12:42.785330596 +0100
@@ -345,6 +345,40 @@
                           META_MAXIMIZE_HORIZONTAL | 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_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_unmaximize (Display *xdisplay,
                       Window   frame_xwindow)
--- src/include/core.h	2008-03-01 11:05:06.028507587 +0100
+++ src/include/core.h.new	2008-03-01 11:09:57.170151253 +0100
@@ -124,6 +124,10 @@
                                  Window   frame_xwindow);
 void meta_core_maximize         (Display *xdisplay,
                                  Window   frame_xwindow);
+void meta_core_toggle_maximize_horiz  (Display *xdisplay,
+                                 Window   frame_xwindow);
+void meta_core_toggle_maximize_vert  (Display *xdisplay,
+                                 Window   frame_xwindow);
 void meta_core_delete           (Display *xdisplay,
                                  Window   frame_xwindow,
                                  guint32  timestamp);
--- src/include/common.h	2008-03-01 11:05:06.002512541 +0100
+++ src/include/common.h.new	2008-03-01 10:48:41.331450790 +0100
@@ -177,6 +177,8 @@
   META_ACTION_TITLEBAR_MINIMIZE,
   META_ACTION_TITLEBAR_NONE,
   META_ACTION_TITLEBAR_LOWER,
+  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZ,
+  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERT,
   META_ACTION_TITLEBAR_MENU,
   META_ACTION_TITLEBAR_LAST
 } MetaActionTitlebar;
