Tk Source Code

View Ticket
Login
Ticket UUID: 220815
Title: Modal dialog behaves incorrectly in CDE
Type: Bug Version: final: 8.0.5
Submitter: welch Created on: 2000-11-01 00:54:31
Subsystem: 67. Unix Window Operations Assigned To: jenglish
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-04-15 09:20:50
Resolution: None Closed By: sf-robot
    Closed on: 2006-04-15 02:20:50
Description:
OriginalBugID: 1930 Bug
Version: 8.0.5
SubmitDate: '1999-04-23'
LastModified: '1999-04-23'
Severity: MED
Status: Assigned
Submitter: pat
ChangedBy: pat
OS: Solaris
OSVersion: 2.5, 7
Machine: NA
FixedInVersion: NA


 > we have encountered another problem with (pro-)wish using CDE (Solaris
 > 2.5, HP-UX 10). If the window setting (in the style manager) "Allow
 > Primary Window On Top" is true, then the modal dialogs
 > (e.g. tk_getOpenFile) aren't modal any longer. The toplevel can get
 > the focus and therefore overlap the dialog window, while the dialog
 > window keeps the grab. So the user can't see any responses of the
 > application to his mouse clicks, what is irritating very much.
 > 
 > All works fine if this option of the CDE is disabled. Other
 > applications with modal dialogs (netscape, java applications) behave
 > correct with either setting.
 > 

I did a test here using 8.0.5 and 8.1b3 on solaris 2.5 and solaris 7. The behavior is the same on all both versions of Tcl and Solaris. The only workaround is to turn off the option.
User Comments: sf-robot added on 2006-04-15 09:20:50:
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

dkf added on 2002-07-10 21:09:38:
Logged In: YES 
user_id=79902

(I include the relevant bits from the Motif headers)

/*
 * Contents of the _MWM_HINTS property.
 */

typedef struct {
    int          flags;
    int          functions;
    int          decorations;
    int          input_mode;
    int          status;
} MotifWmHints;
/* bit definitions for MwmHints.flags */
#define MWM_HINTS_FUNCTIONS     (1L << 0)
#define MWM_HINTS_DECORATIONS   (1L << 1)
#define MWM_HINTS_INPUT_MODE    (1L << 2)
#define MWM_HINTS_STATUS        (1L << 3)
/* values for MwmHints.input_mode */
#define MWM_INPUT_MODELESS                      0
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL     1
#define MWM_INPUT_SYSTEM_MODAL                  2
#define MWM_INPUT_FULL_APPLICATION_MODAL        3

Hopefully this helps!  Back to you, Joe!

dkf added on 2002-07-10 21:02:32:
Logged In: YES 
user_id=79902

The _MOTIF_WM_HINTS property is a serialized structure
consisting of 5 ints.  The first field is a set of flags
describing which of the other fields contain non-bogus data
(bit 0 (LSB) set means that the second field is valid, bit 1
set means that the third field is valid, etc.)

Now, looking at the input_mode field (i.e. when bit 2 of the
flags field is set) we get to roughly where jenglish was at
before...  :^)

Main java windows in 1.2.2 and 1.4.0 don't set that field.

Java dialogs in 1.2.2 set MWM_INPUT_FULL_APPLICATION_MODAL

Netscape 4.79 preferences window sets
MWM_INPUT_PRIMARY_APPLICATION_MODAL

Dtcm (calendar applet) main window does not set the flag,
but its (application-modal) entry editor does, setting
MWM_INPUT_MODELESS

dkf added on 2002-07-10 20:52:59:
Logged In: YES 
user_id=79902

JDK 1.2.2 under Solaris8/CDE sets the _MOTIF_WM_HINTS
property on its windows.  However, this is quite possibly
because it uses Motif inside its innards.  :/

(JDK1.4.0 also uses Motif in its innards, though that's
harder to dig out of the guts.)

More on the definition of _MOTIF_WM_HINTS in a few moments.

jenglish added on 2002-07-10 06:09:34:
Logged In: YES 
user_id=68433

Further investigation indicates that Netscape (at least) is
probably using a private, Motif-specific window manager
protocol to get this behaviour.  Don't know about the Java
applications; they might also be doing the same thing [*].

From VendorShell(3Xm):

| New Resources [...]

| XmNmwmInputMode
|     Specifies the input mode flag (application modal
|     or system modal input constraints) for the
|     _MOTIF_WM_HINTS property.  [...]
|     Following are the possible values for this
|     resource, defined in the include file
|     <Xm/MwmUtil.h>:
|       o  MWM_INPUT_MODELESS-Input goes to any window
|       o  MWM_INPUT_PRIMARY_APPLICATION_MODAL-Input
|        does not go to ancestors of this window
|       o  MWM_INPUT_SYSTEM_MODAL-Input goes only to
|        this window
|       o  MWM_INPUT_FULL_APPLICATION_MODAL-Input does
|        not go to other windows in this application

'xprop' indicates that Netscape's modal dialogs do have a
_MOTIF_WM_HINTS property; I have not yet been able to
decipher the value of the property (and editres isn't
cooperating either), but it's likely that XmNmwmInputMode is
set to one of the APPLICATION_MODAL settings.

[*] Could someone check a Java app under CDE (or any X
desktop actually), and see if it sets _MOTIF_WM_HINTS
properties?

Possible solutions:

1) Try to reverse-engineer the _MOTIF_WM_HINTS format, and
set it appropriately for Tk dialogs.

2) Modify Tk's focus management policy so that when a [grab]
is active, other toplevels within the same application
automatically redirect the keyboard focus to the [grab]ber
when they receive it. (Need to study the ICCCM some more to
see if this is actually legal.  I think it is, but am not
sure).

3) Leave Tk as it is and tell CDE users "Don't Do That".

I favor #3.

Reassigning to DKF (who has easier access to CDE).