Subject: PRIVATE: multiple modal transients don't grab focus

From: [email-masked]
Date: Thu, 21 Sep 2000 20:36:28 -0500 (CDT)

Full_Name: Alison Winters
Version: 2.3.20
CVS_Date: 
OS: RedHat Linux 6.2
X_Server: default with redhat
Submission from: (NULL) (165.228.131.12)

We have some Java code which uses alot of modal transients
(java.awt.Dialog).  When the first transient pops up, it is given focus as
expected (Style * GrabFocusTransient).  Subsequent transients, however, do
not get focus, even if the Java code explicitly requests it.

We're using Sun's Linux JDK version 1.3.0beta_refresh.  As far as i know
it's the latest refresh (b09 JDK with b07 HotSpot).  Here is a bit of code
which shows the problem:

import java.awt.Dialog;
import java.awt.Frame;
import java.awt.TextField;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class transbug {

  private static Frame f;
  private static Dialog d1;
  private static Dialog d2;
  private static TextField tf;
  private static TextField td1;
  private static TextField td2;

  public static void main(String[] args) {

    f = new Frame("Frame");
    tf = new TextField("F1 to open Dialog 1");
    tf.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_F1)
          d1.show();
      }
    });
    f.add(tf);
    f.pack();

    d1 = new Dialog(f, "Dialog 1", true);
    td1 = new TextField("F2 to open Dialog 2");
    td1.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_F2)
          d2.show();
      }
    });
    d1.add(td1);
    d1.pack();

    d2 = new Dialog(f, "Dialog 2", true);
    td2 = new TextField("F3 to exit");
    td2.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_F3) {
          f.hide(); d1.hide(); d2.hide(); System.exit(0);
        }
      }
    });
    d2.add(td2);
    d2.pack();

    f.show();

  }

}

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]