Discussion:
Xt+callback loop question
(too old to reply)
YT
2004-06-17 05:39:01 UTC
Permalink
Hi there.
I use Xt to create and display a gif inside a window (no widgets/buttons or
anything like that, just a simple window). Anyway, the problem is that I
don't know where/how to register my main callback function, so everytime my
window gets covered and then displayed again I don't receive any EXPOSE
events and can't update the window.
With Xlib you have your own While(1) loop where you handle EXPOSE and other
events.....where/how do I do it with Xt?

YT
Michel Bardiaux
2004-06-17 08:40:49 UTC
Permalink
Post by YT
Hi there.
I use Xt to create and display a gif inside a window (no widgets/buttons or
anything like that, just a simple window). Anyway, the problem is that I
don't know where/how to register my main callback function, so everytime my
window gets covered and then displayed again I don't receive any EXPOSE
events and can't update the window.
With Xlib you have your own While(1) loop where you handle EXPOSE and other
events.....where/how do I do it with Xt?
YT
What widget class?
--
Michel Bardiaux
Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
Tel : +32 2 790.29.41
YT
2004-06-17 10:52:39 UTC
Permalink
Well, thats my whole problem.....I don't have any widgets on the window.
All I want to do is create a simple window and display an image, no buttons
or anything.
If I understand correctly you only need to create a widget class if you add
buttons/menus etc....or am I missing something?

YT
Post by Michel Bardiaux
Post by YT
Hi there.
I use Xt to create and display a gif inside a window (no widgets/buttons or
anything like that, just a simple window). Anyway, the problem is that I
don't know where/how to register my main callback function, so everytime my
window gets covered and then displayed again I don't receive any EXPOSE
events and can't update the window.
With Xlib you have your own While(1) loop where you handle EXPOSE and other
events.....where/how do I do it with Xt?
YT
What widget class?
--
Michel Bardiaux
Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
Tel : +32 2 790.29.41
Darius.Moos AT esigma-systems DOT de
2004-06-17 11:54:27 UTC
Permalink
Post by YT
Hi there.
I use Xt to create and display a gif inside a window (no widgets/buttons
or anything like that, just a simple window). Anyway, the problem is
that I don't know where/how to register my main callback function, so
everytime my window gets covered and then displayed again I don't
receive any EXPOSE events and can't update the window. With Xlib you
have your own While(1) loop where you handle EXPOSE and other
events.....where/how do I do it with Xt?
man XtAddEventHandler()
Carlos A M dos Santos
2004-06-17 13:27:11 UTC
Permalink
Post by YT
I use Xt to create and display a gif inside a window (no widgets/buttons or
anything like that, just a simple window). Anyway, the problem is that I
don't know where/how to register my main callback function, so everytime my
window gets covered and then displayed again I don't receive any EXPOSE
events and can't update the window.
With Xlib you have your own While(1) loop where you handle EXPOSE and other
events.....where/how do I do it with Xt?
If you are using Motif, use a XmDrawingArea and register XmNexposeCallback
and a XmNresizeCallback. With plain Xt or Xaw, you must register an action
and an event handler. See "X Toolkit Intrinsics Programming Manual,
Motif Edition", by Adrian Nye, chapter 4, example xbitmap3.

--- Casantos
The Ghost In The Machine
2004-06-17 16:00:06 UTC
Permalink
In comp.windows.x.intrinsics, YT
<***@SPAM_yahoo.co.uk>
wrote
on Thu, 17 Jun 2004 05:39:01 GMT
Post by YT
Hi there.
I use Xt to create and display a gif inside a window (no widgets/buttons or
anything like that, just a simple window). Anyway, the problem is that I
don't know where/how to register my main callback function, so everytime my
window gets covered and then displayed again I don't receive any EXPOSE
events and can't update the window.
With Xlib you have your own While(1) loop where you handle EXPOSE and other
events.....where/how do I do it with Xt?
YT
If you're using widgets (specifically a derivative of
Template.c) the .core_class.expose field (helpfully labelled
with an /* expose */ comment in the template code) of
the widget class rec is the proper field to initialize to
handle redrawing. (For some reason it's NULL in the template.)

The function template is declared in IntrinsicP.h and is

typedef void (*XtExposeProc)(
#if NeedFunctionPrototypes
Widget /* widget */,
XEvent* /* event */,
Region /* region */
#endif
);

and its general contract is to redraw itself; the region can
be used as a hint. Note that resizing is handled in the
.core_class.resize and has more stringent requirements.

The O'Reilly books (specifically Volume 4) might be of
some assistance.

If you're not using widgets you may have to write your own loop.
That's an ugly solution but easily enough done; see the manpage
for XtAppMainLoop.
--
#191, ***@earthlink.net
It's still legal to go .sigless.
Loading...