From: Sven S. <ssv...@ya...> - 2000-07-25 12:58:21
|
Chris La Mantia wrote: > It's worth remembering that there's nothing > preventing you from passing a > pointer that points to a structure that holds more > data. For example, you > can create a structure that has three void pointers, > pre-load it with your > dp, dp2, and dp3 data, and pass it in dp; then, your > wrapper can use dp2 and > dp3 for whatever it wants, then use the data from > the structure when calling > the original function... I think it is also worth mentioning that some of Allegro's gui procs send new messages to themselves again recursively, eg to an MSG_DRAW message after a button has been clicked. This can cause big confusion if you don't handle it specifically, since the wrapper will treat the pointer used by the original function as its own structure. One way around this is to have a static variable that keeps track of the number of recursive calls to our dialog proc, like this: int my_d_list_proc(int MSG, DIALOG *d, int c) { static int call_stack_depth = 0; void *temp_pointer; int return_value; /* Our own drawing function. */ if(msg == MSG_DRAW) { my_draw_list(d); return D_O_K; } /* Fix up the DIALOG struct so that d_list_proc understands it. */ if(call_stack_depth == 0) { temp_pointer = d->dp; d->dp = ((MY_STRUCT *)temp_pointer)->foo; } call_stack_depth++; /* let d_list_proc() take care of normal events. */ if(msg != MSG_DRAW) return_value = d_list_proc(msg, d, c); /* reset the dp pointer. */ call_stack_depth--; if(call_stack_depth == 0) d->dp = temp_pointer; return return_value; } I hope that helps. Sven __________________________________________________ Do You Yahoo!? Get Yahoo! Mail Free email you can access from anywhere! http://mail.yahoo.com/ >From <all...@ca...> Tue Jul 25 06:06:12 2000 Received: from ss1000.ms.mff.cuni.cz [195.113.19.221] by canvaslink.com with ESMTP (SMTPD32-6.00) id A6922F600A8; Tue, 25 Jul 2000 06:06:10 -0400 Received: from u-pl5.ms.mff.cuni.cz (IDENT:ro...@u-... [195.113.16.95]) by ss1000.ms.mff.cuni.cz (8.9.3/8.8.8) with ESMTP id MAA28589 for <al...@ca...>; Tue, 25 Jul 2000 12:03:48 +0200 Received: from localhost (sroh7497@localhost) by u-pl5.ms.mff.cuni.cz (8.9.3/8.8.8) with ESMTP id MAA05756 for <al...@ca...>; Tue, 25 Jul 2000 12:03:49 +0200 X-Authentication-Warning: u-pl5.ms.mff.cuni.cz: sroh7497 owned process doing -bs Date: Tue, 25 Jul 2000 12:03:48 +0200 (CEST) From: Stepan Roh <sro...@ss...> X-Sender: sro...@u-... To: Allegro <al...@ca...> In-Reply-To: <200...@zo...> Message-ID: <Pin...@u-...> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [AL] Problem with Linux Allegro display Precedence: bulk Sender: all...@ca... Reply-To: al...@ca... X-UIDL: 261988566 Status: O Content-Length: 1086 Lines: 35 On Sun, 23 Jul 2000, Eduard Bloch wrote: > > I have a PIII, 256mb ram, Red Hat 6.2 with Kde, and an Ati Rage 128 vr with > > <wondering>strange, people take RatHead with the preinstalled GNOME desktop > and use this KDE-crap instead...</wondering> <wondering>strange, people take RatHead with the preinstalled GNOME-crap desktop and use it...</wondering> > > 8 mb vram. My Xwindows works fine but all Allegro programs refuse to work. > > Windows? Where? I know only X-Window-System, called X or X11 too. I don't know X-Window-System, snip from X(1) : The X Consortium requests that the following names be used when referring to this software: X X Window System X Version 11 X Window System, Version 11 X11 X Window System is a trademark of X Consortium, Inc. Sorry for this off-topic, I had to say that :-). I'll punish myself by making Allegro 64-bit compatible (someday). Have a nice day, Stepan Roh |