Andy Piper <andyp(a)bea.com> wrote:
I didn't write this code and I don't understand it :)
andy
At 02:56 PM 11/18/00 +0900, Martin Buchholz wrote:
>In lwlib/lwlib-Xlw.c:xlw_update_one_widget, we have
>
>#ifdef LWLIB_MENUBARS_LUCID
> else if (class == xlwMenuWidgetClass)
> {
> XlwMenuWidget mw;
> Arg al [1];
> if (XtIsShell (widget))
> mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children
> [0];
> else
> mw = (XlwMenuWidget)widget;
> XtSetArg (al [0], XtNmenu, val);
> XtSetValues (widget, al, 1);
> }
>#endif
>
>
>Note how the code carefully creates a mw widget, and then ignores it.
>
>Perhaps the XtSetValues call should be
>
>XtSetValues (mw, al, 1);
I think you're right. Under X, all Xt derived widgets that create X
windows outside the main application's window tree (this is the case for
menus, dialogs and the like) are actually wrapped in Shell widgets. Some
toolkits (Motif for instance) make this transparent to the programmer[1]. I
think that this code just tries to find the real widget concerned by the
update.
Footnotes:
[1] This has nasty drawbacks. Functions like XmCreate*Dialog return the
real dialog widget, not the shell in which it is wrapped. This leads to nasty
bugs when novice programmers try to work on the shell while believing they
already know it.
--
/ / _ _ Didier Verna
http://www.inf.enst.fr/~verna/
- / / - / / /_/ / EPITA / LRDE mailto:didier@lrde.epita.fr
/_/ / /_/ / /__ / 14-16 rue Voltaire Tel. +33 (1) 53 14 59 47
94276 Kremlin-Bicêtre cedex Fax. +33 (1) 44 08 01 99