🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #37120

Re: Widget Client data (info request)

#37120
From: Steve Jacobson
Date: Wed, 21 Feb 1990 18:05
42 lines
2521 bytes
In article <9002202051.AA24345@expo.lcs.mit.edu> kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) writes:
>
>> 	I was under the impression that one could associate a client data
>> field with a widget (ala Suntools). Is there such a thing?
>
>There is no way to do this directly.  You can, however, use the X Context
>Manager to associated data with a widget id.  Kind of a hack, but it will work.
>
>See Gettys, Scheifler and Newman section 10.12.
>
>
>						Chris D. Peterson     
>						MIT X Consortium 
>
>Net:	 kit@expo.lcs.mit.edu
>Phone:   (617) 253 - 9608	
>Address: MIT - Room NE43-213

Wait a second - we're talking about "client" data; not "server" data!

This is a little bit more than "kind of a hack" :-). Clearly, client data
belongs in the client, and not in the server. It probably wouldn't work,
anyway, since programmers may wish to associate client data with unrealized
widgets that don't have windows yet.

A more reasonable hack uses the closure member of the callback structure to
store client data. It is always possible to add a noop destroy callback
to a widget and put the client data in the closure stucture member. As of
X11R4, the intrinsic callback routines work correctly. You can use
XtAddCallback() to set the client data value, XtGetValues() to retrieve the
callback list (that you must then search to find the specific callback
structure you're looking for) to look at the client data, and a XtGetValues()
call, followed by a XtRemoveCallback() call, followed by a XtAddCallback()
call to reset the client data.

This is still a hack. It's more complicated than a hypothetical XtNclientData
resource would be, and you have to be careful when you mess around with
callbacks - one sloppy coding tactic and it's core dump city.

I've never understood why the core widget class doesn't have a client data
resource. I guess every X programmer who wants to use clent data can subclass
all the widgets and do it themselves :-(.
Technical Details
Message-ID: <1990Feb21.180509.21801@agate.berkeley.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!agate!garnet.berkeley.edu!csvsj
References: <8395@shlump.nac.dec.com> <9002202051.AA24345@expo.lcs.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!agate!garnet.berkeley.edu!csvsj
From: csvsj@garnet.berkeley.edu (Steve Jacobson)
Newsgroups: comp.windows.x
Subject: Re: Widget Client data (info request)
Message-ID: <1990Feb21.180509.21801@agate.berkeley.edu>
Date: 21 Feb 90 18:05:09 GMT
References: <8395@shlump.nac.dec.com> <9002202051.AA24345@expo.lcs.mit.edu>
Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44)
Organization: University of California, Berkeley
Lines: 42