[Sawfish] Re: odd window resize behaviour with firefox/thunderbird 17.0

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Here is my bug report from
<https://bugs.launchpad.net/ubuntu/+source/sawfish/+bug/1083260>:

Starting with version 17.0 of Firefox, it is no longer possible to
resize the browser window when using the Sawfish window manager. The bug
also applies to Thunderbird 17.0. The maximize button is missing from
the window, keyboard shortcuts to maximize are without effect, and
attempts to manually resize by dragging the window border results in an
extremely tiny window, about 1 pixel wide and a few tens of pixels high.

From "xwininfo -size" on the Firefox window:
--------------------------------------------------------------------------------
Normal window size hints:
    Program supplied minimum size: 18 by 89
    Program supplied maximum size: 1073741824 by 1073741824
--------------------------------------------------------------------------------
(1'073'741'824 = 0x40'00'00'00)

From librep-0.90.2/src/rep_lisp.h:
--------------------------------------------------------------------------------
#define rep_VALUE_IS_INT 2
#define rep_VALUE_INT_SHIFT 2
[...]
/* Convert a signed integer into a repv. */
#define rep_MAKE_INT(x) (((x) << rep_VALUE_INT_SHIFT) \
     | rep_VALUE_IS_INT)
--------------------------------------------------------------------------------

In other words, the top two bits in integers get discarded. I have a
64-bit system, but it seems 32-bit ints are used here anyway. The result
is that the maximum-window-size value will be mangled and becomes 0,
which obviously could cause problems.

Here is a fix which makes the maximum-window-size value use only 30
bits. 0x1f'ff'ff'ff is chosen as maximum value since that will keep the
top three bits to 0. The third top-most bit has to be 0 too since the
number would probably be interpreted as a negative number if it wasn't.
The fix seems to work nicely - both Firefox and Thunderbird windows can
now be resized again.

Patch for sawfish-1.5.3/src/windows.c (attachment maxsize.patch):
--------------------------------------------------------------------------------
--- a/src/windows.c 2009-11-12 21:02:10.000000000 +0100
+++ b/src/windows.c 2012-11-26 04:29:07.172933027 +0100
@@ -1307,9 +1307,9 @@
     }
     if (flags & PMaxSize)
     {
- ret = Fcons (Fcons (Qmax_width, rep_MAKE_INT(hints->max_width)),
+ ret = Fcons (Fcons (Qmax_width, rep_MAKE_INT(MIN(hints->max_width, 0x1fffffff))),
        Fcons (Fcons (Qmax_height,
- rep_MAKE_INT(hints->max_height)), ret));
+ rep_MAKE_INT(MIN(hints->max_height, 0x1fffffff))), ret));
     }
     if (flags & PResizeInc)
     {
--------------------------------------------------------------------------------

My system:
Ubuntu 12.04.1 LTS
amd64
sawfish 1:1.5.3-2build1
firefox 17.0+build2-0ubuntu0.12.04.1
thunderbird 17.0+build2-0ubuntu0.12.04.1

--
Håkon
--- a/src/windows.c	2009-11-12 21:02:10.000000000 +0100
+++ b/src/windows.c	2012-11-26 04:29:07.172933027 +0100
@@ -1307,9 +1307,9 @@
     }
     if (flags & PMaxSize)
     {
-	ret = Fcons (Fcons (Qmax_width, rep_MAKE_INT(hints->max_width)),
+	ret = Fcons (Fcons (Qmax_width, rep_MAKE_INT(MIN(hints->max_width, 0x1fffffff))),
 		     Fcons (Fcons (Qmax_height,
-				   rep_MAKE_INT(hints->max_height)), ret));
+				   rep_MAKE_INT(MIN(hints->max_height, 0x1fffffff))), ret));
     }
     if (flags & PResizeInc)
     {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/