diff -X /usr/src/metacity/.diffignore -rudp -X /usr/src/metacity/.diffignore -rudp metacity-svn-shakeloose-05-maxconstraint-04/src/core.c metacity-svn-shakeloose-05-maxconstraint-04-unimaxmouse-05/src/core.c
--- metacity-svn-shakeloose-05-maxconstraint-04/src/core.c	2007-03-15 03:29:14.000000000 +0100
+++ metacity-svn-shakeloose-05-maxconstraint-04-unimaxmouse-05/src/core.c	2007-03-15 03:36:44.000000000 +0100
@@ -312,15 +312,24 @@ meta_core_minimize (Display *xdisplay,
 
 void
 meta_core_maximize (Display *xdisplay,
-                    Window   frame_xwindow)
+                    Window   frame_xwindow,
+                    gint     button)
 {
+  MetaMaximizeFlags direction;
+
   MetaWindow *window = get_window (xdisplay, frame_xwindow);
 
   if (meta_prefs_get_raise_on_click ())
     meta_window_raise (window);
 
-  meta_window_maximize (window, 
-                        META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+  if (button == 2)
+    direction = META_MAXIMIZE_VERTICAL;
+  else if (button == 3)
+    direction = META_MAXIMIZE_HORIZONTAL;
+  else
+    direction = META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL;
+
+  meta_window_maximize (window, direction);
 }
 
 void
@@ -342,15 +351,24 @@ meta_core_toggle_maximize (Display *xdis
 
 void
 meta_core_unmaximize (Display *xdisplay,
-                      Window   frame_xwindow)
+                      Window   frame_xwindow,
+                      gint     button)
 {
+  MetaMaximizeFlags direction;
+
   MetaWindow *window = get_window (xdisplay, frame_xwindow);
 
   if (meta_prefs_get_raise_on_click ())
     meta_window_raise (window);
 
-  meta_window_unmaximize (window,
-                          META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL);
+  if (button == 2)
+    direction = META_MAXIMIZE_VERTICAL;
+  else if (button == 3)
+    direction = META_MAXIMIZE_HORIZONTAL;
+  else
+    direction = META_MAXIMIZE_HORIZONTAL | META_MAXIMIZE_VERTICAL;
+
+  meta_window_unmaximize (window, direction);
 }
 
 void
diff -X /usr/src/metacity/.diffignore -rudp -X /usr/src/metacity/.diffignore -rudp metacity-svn-shakeloose-05-maxconstraint-04/src/core.h metacity-svn-shakeloose-05-maxconstraint-04-unimaxmouse-05/src/core.h
--- metacity-svn-shakeloose-05-maxconstraint-04/src/core.h	2007-03-15 03:11:27.000000000 +0100
+++ metacity-svn-shakeloose-05-maxconstraint-04-unimaxmouse-05/src/core.h	2007-03-15 03:36:44.000000000 +0100
@@ -94,9 +94,11 @@ void meta_core_minimize         (Display
 void meta_core_toggle_maximize  (Display *xdisplay,
                                  Window   frame_xwindow);
 void meta_core_unmaximize       (Display *xdisplay,
-                                 Window   frame_xwindow);
+                                 Window   frame_xwindow,
+                                 gint     button);
 void meta_core_maximize         (Display *xdisplay,
-                                 Window   frame_xwindow);
+                                 Window   frame_xwindow,
+                                 gint     button);
 void meta_core_delete           (Display *xdisplay,
                                  Window   frame_xwindow,
                                  guint32  timestamp);
diff -X /usr/src/metacity/.diffignore -rudp -X /usr/src/metacity/.diffignore -rudp metacity-svn-shakeloose-05-maxconstraint-04/src/frame.c metacity-svn-shakeloose-05-maxconstraint-04-unimaxmouse-05/src/frame.c
--- metacity-svn-shakeloose-05-maxconstraint-04/src/frame.c	2007-03-15 02:59:37.000000000 +0100
+++ metacity-svn-shakeloose-05-maxconstraint-04-unimaxmouse-05/src/frame.c	2007-03-15 03:36:44.000000000 +0100
@@ -267,10 +267,14 @@ meta_frame_get_flags (MetaFrame *frame)
   if (frame->window->on_all_workspaces)
     flags |= META_FRAME_STUCK;
 
-  /* FIXME: Should we have some kind of UI for windows that are just vertically
-   * maximized or just horizontally maximized?
+  /* Use the maximized icon in the maximize button, even for
+   * unidirectionally maximized windows. Setting this flag
+   * also causes a subsequential left-click on the maximize
+   * button to unmaximize again (and not fully maximize).
+   * That is a feature - not a bug.
    */
-  if (META_WINDOW_MAXIMIZED (frame->window))
+  if (frame->window->maximized_horizontally ||
+      frame->window->maximized_vertically)
     flags |= META_FRAME_MAXIMIZED;
 
   if (frame->window->fullscreen)
diff -X /usr/src/metacity/.diffignore -rudp -X /usr/src/metacity/.diffignore -rudp metacity-svn-shakeloose-05-maxconstraint-04/src/frames.c metacity-svn-shakeloose-05-maxconstraint-04-unimaxmouse-05/src/frames.c
--- metacity-svn-shakeloose-05-maxconstraint-04/src/frames.c	2007-03-15 03:29:14.000000000 +0100
+++ metacity-svn-shakeloose-05-maxconstraint-04-unimaxmouse-05/src/frames.c	2007-03-15 03:36:44.000000000 +0100
@@ -1342,18 +1342,19 @@ meta_frames_button_press_event (GtkWidge
       META_GRAB_OP_NONE)
     return FALSE; /* already up to something */  
 
-  if (event->button == 1 &&
-      (control == META_FRAME_CONTROL_MAXIMIZE ||
-       control == META_FRAME_CONTROL_UNMAXIMIZE ||
-       control == META_FRAME_CONTROL_MINIMIZE ||
-       control == META_FRAME_CONTROL_DELETE ||
-       control == META_FRAME_CONTROL_SHADE ||
-       control == META_FRAME_CONTROL_UNSHADE ||
-       control == META_FRAME_CONTROL_ABOVE ||
-       control == META_FRAME_CONTROL_UNABOVE ||
-       control == META_FRAME_CONTROL_STICK ||
-       control == META_FRAME_CONTROL_UNSTICK ||
-       control == META_FRAME_CONTROL_MENU))
+  if ((event->button == 1 &&
+       (control == META_FRAME_CONTROL_MINIMIZE ||
+        control == META_FRAME_CONTROL_DELETE ||
+        control == META_FRAME_CONTROL_SHADE ||
+        control == META_FRAME_CONTROL_UNSHADE ||
+        control == META_FRAME_CONTROL_ABOVE ||
+        control == META_FRAME_CONTROL_UNABOVE ||
+        control == META_FRAME_CONTROL_STICK ||
+        control == META_FRAME_CONTROL_UNSTICK ||
+        control == META_FRAME_CONTROL_MENU)) ||
+      (event->button >= 1 && event->button <= 3 &&
+       (control == META_FRAME_CONTROL_MAXIMIZE ||
+        control == META_FRAME_CONTROL_UNMAXIMIZE)))
     {
       MetaGrabOp op = META_GRAB_OP_NONE;
 
@@ -1603,14 +1604,14 @@ meta_frames_button_release_event    (Gtk
 
         case META_GRAB_OP_CLICKING_MAXIMIZE:
           if (control == META_FRAME_CONTROL_MAXIMIZE)
-            meta_core_maximize (gdk_display, frame->xwindow);
+            meta_core_maximize (gdk_display, frame->xwindow, event->button);
           
           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);
+            meta_core_unmaximize (gdk_display, frame->xwindow, event->button);
           
           meta_core_end_grab_op (gdk_display, event->time);
           break;
