Re: [Sawfish] Re: odd window resize behaviour with firefox/thunderbird 17.0 |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/sawfish Archives
]
On 2012-11-27 14:16, teika@xxxxxxxxxxx wrote:
> Thanks, but I doubt your reasoning be exact. On 64-bit system, librep uses
> 62-bit int. The result of
> (format nil "%x" (lsh 1 60))
> is correct, being "1000000000000000" on my PC (lsh is a "left-shift"), but
> it suffered from the same symptom.
>
> Since it's already fixed, you don't have to go deeper, (I don't think I
> will help more; I'm a retired dev. ;-) but if you're curious; you can
> report the result of
> (window-size-hints (get-window-by-name "Mozilla" #:regex t))
> with the unpatched Sawfish. It contains a line like: (max-width . 2000) I
> guess it returns the same value as xprop/xwininfo, and the true obstacle
> is hidden elsewhere.
Good point. I should have investigated the unexpected 32-bit behaviour
on my 64-bit system more thoroughly. I knew this, though:
Unpatched sawfish: (max-width . 0)
Sawfish with my patch: (max-width . 536870911)
These results were retrieved by using this command:
sawfish-client -c '(format standard-error "Sawfish: %s\n"
(window-size-hints (select-window)))'
It seems I was (by some luck) right anyway, though, because it turns out
that ints are actually 32-bit on 64-bit systems:
------------------------------------------------------------
$ dpkg --print-architecture
amd64
$ cat prog.c
#include <stdio.h>
int main() {
int i;
long l;
char *p;
printf("Int size: %ld\n", sizeof(i));
printf("Long size: %ld\n", sizeof(l));
printf("Pointer size: %ld\n", sizeof(p));
return 0;
}
$ gcc -ansi -pedantic -W -Wall prog.c -o prog; ./prog
Int size: 4
Long size: 8
Pointer size: 8
------------------------------------------------------------
From <http://en.wikipedia.org/wiki/Integer_%28computer_science%29>:
On 64-bit Linux, int is 32-bits, while long and long long are 64-bits.
So when the left-shift operation in rep_MAKE_INT() is performed on an
int, before any conversion to 64-bit, bits 31 and 30 of the value will
be discarded:
------------------------------------------------------------
From /usr/include/X11/Xutil.h:
typedef struct {
[...]
int max_width, max_height;
[...]
} XSizeHints;
From librep-0.90.2/src/rep_lisp.h:
#define rep_VALUE_IS_INT 2
#define rep_VALUE_INT_SHIFT 2
[...]
#define rep_MAKE_INT(x) (((x) << rep_VALUE_INT_SHIFT) \
| rep_VALUE_IS_INT)
From sawfish-1.5.3/src/windows.c:
XSizeHints *hints;
[...]
...rep_MAKE_INT(hints->max_width)...
------------------------------------------------------------
--
Håkon
--
Sawfish ML