X coords are 16 bits!

X coords are internally 16 bits.

It is claimed to be int:
 $ man XWindowAttributes   ## or
 $ less Xlib.h:


typedef struct {
    int x, y;                   /* location of window */
    int width, height;          /* width and height of window */
} XWindowAttributes;

But they aren't! Internally, they're signed 16 bits.

$ xmessage -geometry 100x100+32768+0 -title foo "hi"
(window-position (get-window-by-name "foo")) -> (-32768, 0)

(move-window-to (get-window-by-name "foo") 65536 0) 
-> It appears at (0, 0)

But not simple. 
$ xmessage -geometry 100x100+65536+0 -title foo "hi"
(window-position (get-window-by-name "foo")) -> (0, 0)
(move-window-to (get-window-by-name "foo") 65536 0) 
(window-position (get-window-by-name "foo")) -> (65536, 0)

So, only command line args are pushed into signed 16-bits? Sawfish's
move-window-to calls some Xlib function, so the result is same, no?
No. Why???

You may know that Janek and I have been discussing a related problem
which appears when your workspace is big enough. The boundary 32767 is
not a pure imaginary case. If you've got several big screens, then the
combined screen width can be 6000 or more. And have viewport slots 7,
then it exceeds the limit.

Workaround inside of Sawfish is possible, but difficult and messy,
so I don't feel like doing it.

What should I do? Ask directly at Xorg mailing list for the fix?

Teika (Teika kazura)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]