Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8231991

Mouse wheel change focus on awt/swing windows

XMLWordPrintable

    • b25
    • linux

        There is an issue with the way mouse wheel events carry focus to background components on Linux with X11, for example if we have two frames one in front and focused and the other in the background and we move the mouse cursor over the background frame and start scrolling with the mouse wheel up or down the background frame now receive focus, it is however not raised, leaving the foreground frame in an inconsistent state.

        A simple reproducer demonstrate the problem:

        import java.awt.Dimension;
        import javax.swing.JFrame;

        public class Foo {
            public static void main(String[] args) {
            JFrame w1 = new JFrame("Window 1"), w2 = new JFrame("Window 2");
            w1.setPreferredSize(new Dimension(600, 600));
            w1.pack();
            w1.setVisible(true);
            w2.setPreferredSize(new Dimension(600, 600));
            w2.pack();
            w2.setVisible(true);
            }
        }

        Slight move one of the windows and use mouse wheel. The window will gain focus, but not be raised.

        It should either get focus and be raised, or not get focus.

              neugens Mario Torre
              neugens Mario Torre
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: