|
From: Sam S. <sd...@gn...> - 2011-04-27 22:32:41
|
> * Shawn Betts <fn...@tz...> [2009-08-25 21:07:31 -0700]: > > A user reports that mplayer 1.3 crashes stumpwm. The backtrace > revealed a problem in decode-wm-size-hints. Here's the call, taken > from that backtrace, that breaks new-clx. > > (xlib::decode-wm-size-hints #(924 0 528 0 349 0 624 0 352 0 4 0 4 0 0 0 0 0)) > > It seems mplayer uses 0,0 for the max aspect ratio to mean that there > is no max aspect ratio. cf bug https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3292605&group_id=1355 I suspect that Ben Spencer is right and, indeed, we need to fix XLIB:GET-PROPERTY. Alas, the appended patch bombs with bad gravity: 6587458 when I try to get window size hints for _all_ windows with (xlib:with-open-display (dpy) (dolist (screen (xlib:display-roots dpy)) (dolist (window (xlib:query-tree (xlib:screen-root screen))) (multiple-value-bind (data type format bytes-after) (xlib:get-property window :WM_NORMAL_HINTS) (when data (assert (eq type :WM_SIZE_HINTS)) (assert (= format 32)) (assert (= bytes-after 0)) (assert (= (length data) 18)) (print (list (xlib:wm-name window) data)) (print (xlib:wm-normal-hints window))))))) which means that somehow gravity is specified incorrectly. Any insights? -- Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 11.0.60900031 http://memri.org http://truepeace.org http://iris.org.il http://mideasttruth.com http://ffii.org http://thereligionofpeace.com Genius is immortal, but morons live longer. diff -r c0d8b51788b8 modules/clx/new-clx/clx.f --- a/modules/clx/new-clx/clx.f Tue Apr 26 00:21:41 2011 -0700 +++ b/modules/clx/new-clx/clx.f Wed Apr 27 18:21:12 2011 -0400 @@ -415,6 +415,7 @@ For further for grepability I use the fo #include "clisp.h" #include <X11/Xlib.h> #include <X11/Xutil.h> /* XGetVisualInfo */ +#include <X11/Xatom.h> #include <X11/Xcms.h> /* forXcmsCCCOfColormap() & XcmsVisualOfCCC() */ #include <X11/Xauth.h> /* #include <X11/Xresource.h> */ @@ -5509,10 +5510,15 @@ DEFUN(XLIB:GET-PROPERTY,window property if (boundp(*transform_f)) pushSTACK(*transform_f); /* transform function .. */ + /* http://www.x.org/releases/X11R7.6/doc/man/man3/XChangeProperty.3.xhtml */ switch (actual_format_return) { - case 8: pushSTACK(make_uint8(prop_return[i])); break; - case 16: pushSTACK(make_uint16(((uint16*)prop_return)[i])); break; - case 32: pushSTACK(make_uint32(((uint32*)prop_return)[i])); break; + case 8: /* the returned data is represented as a char array */ + pushSTACK(fixnum(((char*)prop_return)[i])); break; + case 16: /* array of short int type and should be cast to that type */ + pushSTACK(fixnum(((short*)prop_return)[i])); break; + case 32: /* array of longs (which in a 64-bit application will be + 64-bit values that are padded in the upper 4 bytes). */ + pushSTACK(L_to_I(((long*)prop_return)[i])); break; default: NOTREACHED; } @@ -5526,6 +5532,50 @@ DEFUN(XLIB:GET-PROPERTY,window property pushSTACK(value1); } + if (actual_type_return == XA_WM_SIZE_HINTS) { + XSizeHints h; + long supplied_return = 0; + memset(&h,0,sizeof(h)); + Status s = XGetWMSizeHints(display,w,&h,&supplied_return,property); + if (actual_format_return != 32) { + fprintf(stderr,"\nbad actual_format_return=%d\n",actual_format_return); + abort(); + } + if (s == 0) { + fprintf(stderr,"\nXGetWMSizeHints failed\n"); + abort(); + } + if (nitems_return != 18) { + fprintf(stderr,"\nnitems_return=%d\n",nitems_return); + abort(); + } + fprintf(stderr,"\nflags=%d supplied_return=%d\n",h.flags,supplied_return); fflush(stderr); + ASSERT(h.flags == ((long*)prop_return)[0]); + ASSERT(h.x == ((long*)prop_return)[1]); + ASSERT(h.y == ((long*)prop_return)[2]); + ASSERT(h.width == ((long*)prop_return)[3]); + ASSERT(h.height == ((long*)prop_return)[4]); + ASSERT(h.min_width == ((long*)prop_return)[5]); + ASSERT(h.min_height == ((long*)prop_return)[6]); + ASSERT(h.max_width == ((long*)prop_return)[7]); + ASSERT(h.max_height == ((long*)prop_return)[8]); + ASSERT(h.width_inc == ((long*)prop_return)[9]); + ASSERT(h.height_inc == ((long*)prop_return)[10]); + ASSERT(h.min_aspect.x == ((long*)prop_return)[11]); + ASSERT(h.min_aspect.y == ((long*)prop_return)[12]); + ASSERT(h.max_aspect.x == ((long*)prop_return)[13]); + ASSERT(h.max_aspect.y == ((long*)prop_return)[14]); + ASSERT(h.base_width == ((long*)prop_return)[15]); + ASSERT(h.base_height == ((long*)prop_return)[16]); + ASSERT(h.win_gravity == ((long*)prop_return)[17]); + if (h.flags & PWinGravity + && (h.win_gravity > StaticGravity + || h.win_gravity < ForgetGravity)) { + fprintf(stderr,"\nbad gravity: %d\n",h.win_gravity); + abort(); + } + } + if (prop_return) X_CALL(XFree (prop_return)); |