problem evaluating window resize hints under 64 bit

Jon TURNEY jon.turney@dronecode.org.uk
Thu Jun 19 21:44:00 GMT 2014


On 19/06/2014 13:22, Oliver Schmidt wrote:
> The current cygwin x server 1.15.1-2 under 64-bit cygwin seems to have a
> problem correctly evaluating the window resize hints.
>
> In hw/xwin/winmultiwindowwndproc.c the function ValidateSizing calls
> winMultiWindowGetWMNormalHints and gets wrong values in
> sizeHints.width_inc and sizeHints.height_inc.
>
> In function winMultiWindowGetWMNormalHints in file
> hw/xwin/winmultiwindowclass.c you can see that a memcpy occurs from
> prop->data with sizeof(WinXSizeHints).
>
> As it turns out, everything is correct if you modify the typedef of
> WinXSizeHints in hw/xwin/winmultiwindowclass.h so that long type becomes
> int:
>
> --- a/cygwin/hw/xwin/winmultiwindowclass.h
> +++ b/cygwin/hw/xwin/winmultiwindowclass.h
> @@ -63,7 +63,7 @@ typedef struct {
>    * used with WM_NORMAL_HINTS.
>    */
>   typedef struct {
> -    long flags;                 /* marks which fields in this structure
> are defined */
> +    int flags;                 /* marks which fields in this structure
> are defined */
>       int x, y;                   /* obsolete for new window mgrs, but
> clients */
>       int width, height;          /* should set so old wm's don't mess
> up */

Thanks for pointing this out and the patch.

The same problem also occurs with WM_HINTS a few lines above.

> I can only guess why this works: in the X11 message protocol all int and
> long types are mapped to 32 bit integers. It seems that the memcpy in
> winMultiWindowGetWMNormalHints has source data that has memory layout as
> in the X11 message protocol.

Yes.  For historical reasons, 'long' is used for the CARD32 type in the 
libX11 API (which this structure has been copied from), but because that 
has a different size on x86 and x86_64, so libX11 marshalls that into a 
32-bit quantity before storing it into the window property.

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/



More information about the Cygwin-xfree mailing list