On Thu, Nov 22, 2012 at 01:56:15PM +0100, Amadeusz Sławiński wrote:
> Actually 2, but related to window resizing
> 
> 1.
> Maximize window right click title
> It has 'Unmaximize' option
> 
> Resize window
> It still has 'Unmaximize' option
> 
> It should lose it maximized status and show 'Maximize'
> 
> 2.
> After clicking 'Unmaximize' (which should be 'Maximize') after steps from 1.)
> it either maximizes/restores size
> (on my machine firefox maximizes, urxvt restores)
> 
> It should maximize?
> 
I looked into it and it looks like it used overwritten variables when
performing check, I added separate variables keeping original window
size, and now it works good.
>From 15043321fd86953b6add1a32e1affa9ad366260d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= <[email protected]>
Date: Fri, 23 Nov 2012 20:16:59 +0100
Subject: [PATCH] Fix Maximize/Unmaximize in window menu

Add variable to track window startup size and use it when checking for changes
---
 src/moveres.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git b/src/moveres.c a/src/moveres.c
index 59dd0d2..44ddefa 100644
--- b/src/moveres.c
+++ a/src/moveres.c
@@ -1211,6 +1211,8 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
 	int vert_border = wwin->frame->top_width + wwin->frame->bottom_width;
 	int src_x = wwin->frame_x;
 	int src_y = wwin->frame_y;
+	int original_w = w;
+	int original_h = h;
 	int done, off_x, off_y, ww, wh;
 	int kspeed = _KS;
 	int opaqueMoveResize = wPreferences.opaque_move_resize_keyboard;
@@ -1517,10 +1519,10 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
 						}
 					}
 				} else {
-					if (wwin->client.width != ww)
+					if (ww != original_w)
 						wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_MAXIMUS);
 
-					if (wwin->client.height != wh - vert_border)
+					if (wh != original_h)
 						wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
 
 					wWindowConfigure(wwin, src_x + off_x, src_y + off_y, ww, wh - vert_border);
@@ -1877,6 +1879,8 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev)
 	int orig_fy = fy;
 	int orig_fw = fw;
 	int orig_fh = fh;
+	int original_fw = fw;
+	int original_fh = fh;
 	int head = ((wPreferences.auto_arrange_icons && wXineramaHeads(scr) > 1)
 		    ? wGetHeadForWindow(wwin)
 		    : scr->xine_info.primary_head);
@@ -2072,10 +2076,10 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev)
 				WMUnmapWidget(scr->gview);
 				XUngrabServer(dpy);
 
-				if (wwin->client.width != fw)
+				if (fw != original_fw)
 					wwin->flags.maximized &= ~(MAX_HORIZONTAL | MAX_MAXIMUS);
 
-				if (wwin->client.height != fh - vert_border)
+				if (fh != original_fh)
 					wwin->flags.maximized &= ~(MAX_VERTICAL | MAX_LEFTHALF | MAX_RIGHTHALF | MAX_MAXIMUS);
 
 				wWindowConfigure(wwin, fx, fy, fw, fh - vert_border);
-- 
1.8.0

Reply via email to