Index: src/prefs.c
===================================================================
--- src/prefs.c	(revisione 3327)
+++ src/prefs.c	(copia locale)
@@ -1678,6 +1678,10 @@ action_titlebar_from_string (const char 
     return META_ACTION_TITLEBAR_TOGGLE_SHADE;
   else if (strcmp (str, "toggle_maximize") == 0)
     return META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE;
+  else if (strcmp (str, "toggle_maximize_horiz") == 0)
+    return META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY;
+  else if (strcmp (str, "toggle_maximize_vert") == 0)
+    return META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY;
   else if (strcmp (str, "minimize") == 0)
     return META_ACTION_TITLEBAR_MINIMIZE;
   else if (strcmp (str, "none") == 0)
Index: src/frames.c
===================================================================
--- src/frames.c	(revisione 3327)
+++ src/frames.c	(copia locale)
@@ -1250,6 +1250,32 @@ meta_frame_titlebar_event (MetaUIFrame  
       }
       break;
 
+    case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY:
+      {
+        meta_core_get (gdk_display, frame->xwindow,
+                       META_CORE_GET_FRAME_FLAGS, &flags,
+                       META_CORE_GET_END);
+        
+        if (flags & META_FRAME_ALLOWS_MAXIMIZE)
+          {
+            meta_core_toggle_maximize_horizontally (gdk_display, frame->xwindow);
+          }
+      }
+      break;
+
+    case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY:
+      {
+        meta_core_get (gdk_display, frame->xwindow,
+                       META_CORE_GET_FRAME_FLAGS, &flags,
+                       META_CORE_GET_END);
+        
+        if (flags & META_FRAME_ALLOWS_MAXIMIZE)
+          {
+            meta_core_toggle_maximize_vertically (gdk_display, frame->xwindow);
+          }
+      }
+      break;
+
     case META_ACTION_TITLEBAR_MINIMIZE:
       {
         meta_core_get (gdk_display, frame->xwindow,
Index: src/core.c
===================================================================
--- src/core.c	(revisione 3327)
+++ src/core.c	(copia locale)
@@ -329,6 +329,40 @@ meta_core_maximize (Display *xdisplay,
 }
 
 void
+meta_core_toggle_maximize_vertically (Display *xdisplay,
+				      Window   frame_xwindow)
+{
+  MetaWindow *window = get_window (xdisplay, frame_xwindow);
+
+  if (meta_prefs_get_raise_on_click ())
+    meta_window_raise (window);
+
+  if (META_WINDOW_MAXIMIZED_VERTICALLY (window))
+    meta_window_unmaximize (window, 
+                            META_MAXIMIZE_VERTICAL);
+  else
+    meta_window_maximize (window,
+    			    META_MAXIMIZE_VERTICAL);
+}
+
+void
+meta_core_toggle_maximize_horizontally (Display *xdisplay,
+				        Window   frame_xwindow)
+{
+  MetaWindow *window = get_window (xdisplay, frame_xwindow);
+
+  if (meta_prefs_get_raise_on_click ())
+    meta_window_raise (window);
+
+  if (META_WINDOW_MAXIMIZED_HORIZONTALLY (window))
+    meta_window_unmaximize (window, 
+                            META_MAXIMIZE_HORIZONTAL);
+  else
+    meta_window_maximize (window,
+    			    META_MAXIMIZE_HORIZONTAL);
+}
+
+void
 meta_core_toggle_maximize (Display *xdisplay,
                            Window   frame_xwindow)
 {
Index: src/core.h
===================================================================
--- src/core.h	(revisione 3327)
+++ src/core.h	(copia locale)
@@ -120,6 +120,10 @@ void meta_core_minimize         (Display
                                  Window   frame_xwindow);
 void meta_core_toggle_maximize  (Display *xdisplay,
                                  Window   frame_xwindow);
+void meta_core_toggle_maximize_horizontally  (Display *xdisplay,
+                                              Window   frame_xwindow);
+void meta_core_toggle_maximize_vertically    (Display *xdisplay,
+                                              Window   frame_xwindow);
 void meta_core_unmaximize       (Display *xdisplay,
                                  Window   frame_xwindow);
 void meta_core_maximize         (Display *xdisplay,
Index: src/window.h
===================================================================
--- src/window.h	(revisione 3327)
+++ src/window.h	(copia locale)
@@ -362,6 +362,8 @@ struct _MetaWindow
  */
 #define META_WINDOW_MAXIMIZED(w)       ((w)->maximized_horizontally && \
                                         (w)->maximized_vertically)
+#define META_WINDOW_MAXIMIZED_VERTICALLY(w)    ((w)->maximized_vertically)
+#define META_WINDOW_MAXIMIZED_HORIZONTALLY(w)  ((w)->maximized_horizontally)
 #define META_WINDOW_ALLOWS_MOVE(w)     ((w)->has_move_func && !(w)->fullscreen)
 #define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w)   ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded)
 #define META_WINDOW_ALLOWS_RESIZE(w)   (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) &&                \
Index: src/common.h
===================================================================
--- src/common.h	(revisione 3327)
+++ src/common.h	(copia locale)
@@ -174,6 +174,8 @@ typedef enum
 {
   META_ACTION_TITLEBAR_TOGGLE_SHADE,
   META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE,
+  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY,
+  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY,
   META_ACTION_TITLEBAR_MINIMIZE,
   META_ACTION_TITLEBAR_NONE,
   META_ACTION_TITLEBAR_LOWER,
