[comp.windows.x.motif] Dialog Unmap/'Close' Question and Problem

pjp@sloth.mlb.semi.harris.com (Pat J. Pinchera) (03/29/91)

Dialog Unmap/'Close' Question:

When I create 3 Form dialogs, with the hierarchy described below, I attach
UnmapCallbacks to them which takes care of some cleaning up for the window
when it is unmapped. (Form Dialog inherits behavior from the Bulletin Board 
class, hence the UnmapCallback capability). This callback is activated when 
I select the 'Close' option (Alt+F4) from the Window Menu Button 
(the 'Dash' button in the upper left corner of each window). 
For example, if I select 'Close' for "dialog3", then the UnmapCallback is 
executed for the window "dialog3" and the window disappears.

The problem is when I 'Close' a dialog that has 1 or more children dialogs,
(i.e. "dialog1" or "dialog2"); the UnmapCallback *DOES NOT GET CALLED* for
the children dialogs, even though they disappear. For example, 'Close'
dialog2, then dialog2 and dialog3 disappear, and dialog2 UnmapCallback gets 
called but dialog3 UnmapCallback does *NOT*.
I tried the DestroyCallback, but that doesn't seem to get activated for the
children either.

               +---------+
               | dialog1 |
               | +---------+        Widget Hierarchy:
               | | dialog2 |                   dialog1 is parent of dialog2
               | | +---------+                 dialog2 is parent of dialog3
               | | | dialog3 |
               +-| |         |
                 | |         |
                 +-|         |
                   |         |
                   +---------+

What can I do so that the children callbacks get activated as well, even though
I didn't explicitly 'Close' them? (They need to do some cleaning up too!)

What is actually happening when I select the 'Close' option from the
Window Menu Button?

In Motif 1.0, I could double click on the Window Menu Button to activate
'Close'. Now that I've upgraded to 1.1, this double click doesn't work.
How can I restore this feature?

I'm running X11R4, Motif 1.1 on a DECstation 3100. Reply either e-mail or
this conference (comp.windows.x.motif). Thanks in advance.

Patrick Pinchera
Interface & Control Systems, Inc.
Melbourne, FL

nazgul@alfalfa.com (Kee Hinckley) (03/30/91)

> The problem is when I 'Close' a dialog that has 1 or more children dialogs,
> (i.e. "dialog1" or "dialog2"); the UnmapCallback *DOES NOT GET CALLED* for
> the children dialogs, even though they disappear. For example, 'Close'
> dialog2, then dialog2 and dialog3 disappear, and dialog2 UnmapCallback gets 
> called but dialog3 UnmapCallback does *NOT*.
> I tried the DestroyCallback, but that doesn't seem to get activated for the
> children either.

Beware.  I recently discovered (and this is probably related indirectly to
your problem) that the feature of closing a parent window and having its
child windows go away to is specific to Mwm.  In particular Olwm does not
do this - which means that it's going to be your responsibility to clean
up the child dialogs.  This *might* be fixable by putting them in the same
group or hand setting transient_for - I'm not sure, I haven't tried yet.
If anyone has any advice I'd appreciate it.

(Note that the same problem exists on iconicizing windows too.  Olwm is a
pretty stupid window manager.)

Alfalfa Software, Inc.          |       Poste:  The EMail for Unix
nazgul@alfalfa.com              |       Send Anything... Anywhere
617/646-7703 (voice/fax)        |       info@alfalfa.com

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

keith@hpcvlx.cv.hp.com (Keith Taylor) (04/02/91)

>What can I do so that the children callbacks get activated as well, even though
>I didn't explicitly 'Close' them? (They need to do some cleaning up too!)

I'm not sure if the unmap callback will get called in this case. I know
if you select for UnmapNotify on your top-level (shell) windows, you 
will get that event (This is Xlib level stuff, though).

(Things can get confused when you have a hierarchy of transient windows
withdrawn by the window manager.)

>What is actually happening when I select the 'Close' option from the
>Window Menu Button?

It depends. If your client has requested the WM_DELETE_WINDOW protocol,
the window manager will send the WM_DELETE_WINDOW message to the client
(and nothing else). This is what you want. Check out
XmAddWmProtocolCallback and VendorShell (XmNdeleteResponse).

>In Motif 1.0, I could double click on the Window Menu Button to activate
>'Close'. Now that I've upgraded to 1.1, this double click doesn't work.
>How can I restore this feature?

This still works for me. On thing that changed was the default time to 
recognize a double-click. Mwm 1.1 dynamically defaults to the value of
multiClickTime which has a shorter default value than mwm's old
doubleClickTime resource.


Keith M. Taylor		keith@cv.hp.com	
Hewlett-Packard
Corvallis, Oregon