You would prefer if you avoid duplicating

if (d->button_states[BUTTON_MAX] == BUTTON_EVENT_ACTION_STATE)
{

and

d->button_states[BUTTON_MAX] &= ~PRESSED_EVENT_WINDOW;


Do you think we should be concerned about making this optional or do you
think it's functionality that everyone wants, even grandma?

- David



Here a new version, i think it's  good but may be wrong. Not sure if testing
d->button_states[BUTTON_MAX] before xevent->xbutton.button can introduce
some issues...

Why making this optional?
From a user point of view, it doesn't affect how normal maximization work.

But if you think we should add this as an option, i will change my patch.

Cedric
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index fe2efde..5d5706b 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -4102,20 +4102,33 @@ max_button_event (WnckWindow *win,
 
     switch (xevent->type) {
     case ButtonPress:
-	if (xevent->xbutton.button == 1)
+	if (xevent->xbutton.button <= 3)
 	    d->button_states[BUTTON_MAX] |= PRESSED_EVENT_WINDOW;
 	break;
     case ButtonRelease:
-	if (xevent->xbutton.button == 1)
+	if (d->button_states[BUTTON_MAX] == BUTTON_EVENT_ACTION_STATE)
 	{
-	    if (d->button_states[BUTTON_MAX] == BUTTON_EVENT_ACTION_STATE)
+	    if (xevent->xbutton.button == 1)
 	    {
 		if (wnck_window_is_maximized (win))
 		    wnck_window_unmaximize (win);
 		else
 		    wnck_window_maximize (win);
 	    }
-
+	    else if (xevent->xbutton.button == 2)
+	    {
+		if (wnck_window_is_maximized_vertically (win))
+		    wnck_window_unmaximize_vertically (win);
+		else
+		    wnck_window_maximize_vertically (win);
+	    }
+	    else if (xevent->xbutton.button == 3)
+	    {
+		if (wnck_window_is_maximized_horizontally (win))
+		    wnck_window_unmaximize_horizontally (win);
+		else
+		    wnck_window_maximize_horizontally (win);
+	    }
 	    d->button_states[BUTTON_MAX] &= ~PRESSED_EVENT_WINDOW;
 	}
 	break;
_______________________________________________
compiz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/compiz

Reply via email to