Re: [Freeciv-Dev] ARGH my_XawScrollbarSetThumb still broken
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
At 1999/08/30 15:39 , Falk Hueffner wrote:
>Oh, I've found an old mail about this topic that the original author
>("pu") wrote to me some time ago. Perhaps it's of interest to you.
Very helpful! Thanks. (I left it intact at the end of this message.)
The point of that message is that "<X11/Xaw/Scrollbar.h> has an incorrect
prototype for the function XawScrollbarSetThumb()", and it goes on to say
that doing a "#undef NeedWidePrototypes" before including
<X11/Xaw/Scrollbar.h> will fix the problem.
It seems, however, that this is not entirely correct. The real problem is
(I think) that the Xaw library was compiled with different "#define" values
than those we are using when compiling Freeciv. The critical #define for
the XawScrollbarSetThumb() prototype is NARROWPROTO -- which controls the
value of NeedWidePrototypes (basically, NeedWidePrototypes <- !(NARROWPROTO)).
Looking further, NeedWidePrototypes is used in several places in the X
includes. I figured that it would be easier to correctly define
NARROWPROTO for our entire compilation than it would be to determine that
the only _significant_ reference to NeedWidePrototypes was the one in
<X11/Xaw/Scrollbar.h> (and, in any case, we'd have to determine the correct
value for NeedWidePrototypes, which is the same as determining the correct
value for NARROWPROTO).
So, I added NARROWPROTO (and another X function prototype define,
FUNCPROTO) to the Autoconf stuff. (This is my first venture into
Autoconf-land, so please excuse any egregious errors. Thanks!) I use
xmkmf to determine the values of these two variables, and define them
accordingly in config.h. Using these defines required adding "#include
<config.h>" to all the .c files in client/gui-xaw.
After making these changes, and replacing all my_XawScrollbarSetThumb()
calls with XawScrollbarSetThumb() calls (and, removing the
my_XawScrollbarSetThumb() routine), the scrollbars now work on my machine
(they did not when I previously had tried to call XawScrollbarSetThumb()
directly).
But, so far, this only works on one machine. I'd like to hear if it works
(or doesn't ;-) on any others -- especially those on which direct calls to
XawScrollbarSetThumb() *did* work. Also, is adding this stuff to config.h
the right way to try to fix this, or is there a better way?
Anyway, the attached patch includes all the changes described. To use it,
you'll have to do "autoheader; aclocal; autoconf" before running
"./configure --with-xaw".
By the way, I do not have Xaw3d installed, so I haven't tested this patch
with it. I'll try to get around to doing that real soon now ;-) ...
jjm
>>From pjunold@xxxxxxxxxxx Tue Feb 9 20:57:03 1999
>Return-Path: <pjunold@xxxxxxxxxxxxxxxxxx>
>Received: from mx01.uni-tuebingen.de (root@[192.168.3.11])
> by mailserv02.uni-tuebingen.de (8.8.8/8.8.8) with ESMTP id UAA06839
> for <zxmjz18@xxxxxxxxxxxxxxxxxxxxxxxxxxx>; Tue, 9 Feb 1999
20:57:06 +010
>0
>Received: from nebula.daimi.au.dk (nebula.daimi.au.dk [130.225.19.229])
> by mx01.uni-tuebingen.de (8.8.8/8.8.8) with ESMTP id UAA28415
> for <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx>; Tue, 9 Feb 1999
20:57:05 +
>0100
>Received: (from pjunold@localhost)
> by nebula.daimi.au.dk (8.9.1/8.9.1) id UAA1812638
> for falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx; Tue, 9 Feb 1999
20:57:04 +01
>00 (MET)
>From: Peter Joachim Unold <pjunold@xxxxxxxxxxx>
>Message-Id: <199902091957.UAA1812638@xxxxxxxxxxxxxxxxxx>
>Subject: Re: Strange code in Freeciv client/mapview.c
>To: falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx (Falk Hueffner)
>Date: Tue, 9 Feb 1999 20:57:03 +0100 (MET)
>In-Reply-To: <rbn22nmvxv.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> from
Falk Hue
>ffner at "Feb 9, 99 04:35:40 pm"
>X-Mailer: ELM [version 2.4ME+ PL22 (25)]
>MIME-Version: 1.0
>Content-Type: text/plain; charset=US-ASCII
>Content-Transfer-Encoding: 7bit
>Status:
>Lines: 74
>Xref: fphp16.tphys.physik.uni-tuebingen.de mail.private:11
>X-Gnus-Article-Number: 11 Wed Feb 10 13:34:21 1999
>
>Hi there
>
>I looked into the problem and in the end I ended up finding the
>answer for my own question( in the functions header). Using
>altavista i found the following at: http://meyer.fys.ku.dk/~jkut/libsx/HELP.
>----------------------------------------------------------------------------
>Q: On an SGI, scrollbars don't seem to work properly. What's a matter?
>
>A: This is because in some earlier versions of Irix (pre 5.2), the header
> file <X11/Xaw/Scrollbar.h> has an incorrect prototype for the function
> XawScrollbarSetThumb(). The arguments wind up being defined as doubles
> instead of float. You can fix this by changing the scrollbar.c file
> so that just before Scrollbar.h gets #included, you put the following
> line:
>
> #undef NeedWidePrototypes
>
> And that should take care of any problems you have with scrollbars.
>----------------------------------------------------------------------------
>
>Since 90% of my freeciv work was done under Irix, that explains.
>
>
>Anyway before I found that I found the following in the Xt FAQ:
>
>Subject: 16. How do I pass a float value to XtSetValues?
>----------------------------------------------------------------------
>
>First, what is going wrong is the structure for an Arg is (essentially)
> typdef struct
> {
> String name;
> long value;
> } Arg;
>
>and the code:
> Arg arg;
>
> XtSetArg (arg, "name", 3.2)
>
>expands to
> Arg arg;
>
> arg.name = "name";
> arg.value = 3.2;
>
>you can see that with normal C type conversions, the arg.value
>gets the integer "3" instead of the floating point value "3.2". When
>the value is copied into the widget resource, the bit pattern is
>wildly different than that required for a floating point value. So,
>how to get around this?
>
>The following macro is from the Athena widgets document and I am now
>recomending it over the previous suggestions.
>
>#define XtSetFloatArg(arg, n, d) \
> if (sizeof(float) > sizeof(XtArgVal)) { \
> XtSetArg(arg, n, &(d)); \
> } else { \
> XtArgVal *ld = (XtArgVal *)&(d); \
> XtSetArg(arg, n, *ld); \
> }
>
>-------------------------------------------------------
>
>So as you point out, on your architecture, they illegal read
>4 bytes. Apparently they're not aware of sizeof(float)<sizeof(long)
>platforms.
>
>Anyway the solution now, is of-cause to use the real XawScrollbarSetThumb.
>
> best regards
> Peter
>
x-funcproto-4.diff.gz
Description: Binary data
|
|