Minimize and maximize handlers - Motif
This is a discussion on Minimize and maximize handlers - Motif ; Hi,
I'm new to Motif programming. I have a small app, that I need a way to get
a signal when the user minimizes and maximizes the application.
Could someone please provide me with some code snippet on how to ...
-
Minimize and maximize handlers
Hi,
I'm new to Motif programming. I have a small app, that I need a way to get
a signal when the user minimizes and maximizes the application.
Could someone please provide me with some code snippet on how to do it?
Thanks,
MrZammler
-
Re: Minimize and maximize handlers
MrZammler wrote:
> Hi,
>
> I'm new to Motif programming. I have a small app, that I need a way to get
> a signal when the user minimizes and maximizes the application.
>
> Could someone please provide me with some code snippet on how to do it?
>
> Thanks,
> MrZammler
>
I dont have a code snippet ready, but here are a few pointers: basically
you need
XtAddEventHandler(w, PropertyChangeMask, 0, yourhandler, youropaquedata)
w will be one of your widgets, I dont know whether it is necessary to
specify the topmost shell widget.
Your handler will look like:
static void
yourhandler(Widget w, XtPointer client_data, XEvent *event,
Boolean *cont)
{
/* Here, interact with your data */
*cont = True;
}
You will probably need to check that the property that *did* change was
WM_STATE and that the change is the one you want. Get the sources of
X11R6 and look in xev.c
PS: it comes as a great surprise to any newbie Xt/Motif programmer that
the shell widget does NOT come with easy callbacks for the most obvious
WM interactions!
--
Michel Bardiaux
Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
Tel : +32 2 790.29.41
-
Re: Minimize and maximize handlers
Michel Bardiaux wrote:
>
> MrZammler wrote:
> > Hi,
> >
> > I'm new to Motif programming. I have a small app, that I need a way to get
> > a signal when the user minimizes and maximizes the application.
> >
> > Could someone please provide me with some code snippet on how to do it?
> >
> > Thanks,
> > MrZammler
> >
> I dont have a code snippet ready, but here are a few pointers: basically
> you need
>
> XtAddEventHandler(w, PropertyChangeMask, 0, yourhandler, youropaquedata)
>
> w will be one of your widgets, I dont know whether it is necessary to
> specify the topmost shell widget.
>
> Your handler will look like:
>
> static void
> yourhandler(Widget w, XtPointer client_data, XEvent *event,
> Boolean *cont)
> {
> /* Here, interact with your data */
> *cont = True;
> }
>
> You will probably need to check that the property that *did* change was
> WM_STATE and that the change is the one you want. Get the sources of
> X11R6 and look in xev.c
>
> PS: it comes as a great surprise to any newbie Xt/Motif programmer that
> the shell widget does NOT come with easy callbacks for the most obvious
> WM interactions!
> --
> Michel Bardiaux
> Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
> Tel : +32 2 790.29.41
There is no absolute guarantee that a WM_STATE property change event
will be fired.
Another way is to register an event handler for StrucureNotifyMask, and
in the event handler check for event->type equal to MapNotify
(un-iconizing) and UnmapNotify (iconifying).
These methods will not tell you about maximizing the window. For that,
you need to use a ConfigureNotify mask, and check the new width and
height. You cannot just check if they equal the screen size, since the
window manager decorations also come into play...
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225