Bug 977

Summary: NEWT OSX MouseListener does not receive move events if windows is maximized
Product: [JogAmp] Jogl Reporter: johan
Component: macosxAssignee: Sven Gothel <sgothel>
Status: RESOLVED DUPLICATE    
Severity: normal CC: gouessej
Priority: ---    
Version: 2.3.2   
Hardware: All   
OS: all   
Type: DEFECT SCM Refs:
Workaround: ---

Description johan 2014-02-16 20:01:07 CET
A GLWindow is created and a mouse listener registered. The listener receives public void mouseMoved(MouseEvent e)
If the window is maximized (pressing the green "plus" button on the window decoration) the move events aren't received. Draggable events are sent if you keep the mouse button pressed.
Un-maximizing and the resizing the window the move events are again sent.

Using JogAmp 2.1.4, JDK 1.8.0-ea-b121, OSX 10.9.
This seems a regression, it did not happen in 2.1.4-rc-20131224

The following test class can be used to illustrate the problem.

import com.jogamp.newt.event.MouseAdapter;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.Animator;
import java.io.IOException;
import javax.media.nativewindow.WindowClosingProtocol;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;

public class MouseListenerBug {

	public static void main(String... args) {
		MouseListenerBug app = new MouseListenerBug();
		app.run();
	}

	private void run() {
		final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL4));
		caps.setBackgroundOpaque(true);
		caps.setDoubleBuffered(true);
		caps.setDepthBits(8);
		GLWindow glWindow = GLWindow.create(caps);
		glWindow.setTitle("Corridors");
		glWindow.setSize(1024, 768);
		glWindow.setUndecorated(false);
		glWindow.setPointerVisible(true);
		glWindow.setVisible(true);
		glWindow.setFullscreen(false);
		glWindow.setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE);

		glWindow.addGLEventListener(new GLEventListener() {
			@Override
			public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
				System.out.println("Reshape <" + width + "," + height + ">");
			}

			@Override
			public void init(GLAutoDrawable drawable) {
			}

			@Override
			public void dispose(GLAutoDrawable drawable) {
			}

			@Override
			public void display(GLAutoDrawable drawable) {
			}
		});

		glWindow.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseMoved(MouseEvent e) {
				short x = (short) e.getX();
				short y = (short) e.getY();
				System.out.println("Mouse moved <" + x + "," + y + ">");
			}

			@Override
			public void mouseDragged(MouseEvent e) {
				short x = (short) e.getX();
				short y = (short) e.getY();
				System.out.println("Mouse dragged <" + x + "," + y + ">");
			}

			@Override
			public void mousePressed(MouseEvent e) {

				if (!e.isAutoRepeat()) {
					System.out.println("Mouse button pressed" + e);
				}
			}

			@Override
			public void mouseReleased(MouseEvent e) {

				if (!e.isAutoRepeat()) {
					System.out.println("Mouse button pressed" + e);
				}

			}
		});

		Animator animator = new Animator(glWindow);
		animator.start();

	}
}
Comment 1 Julien Gouesse 2014-02-16 20:35:40 CET
Have you checked whether the fix for the bug 970 causes this regression?
Comment 2 johan 2014-02-16 21:02:41 CET
(In reply to comment #1)
> Have you checked whether the fix for the bug 970 causes this regression?

No, I'm a bit lost when it comes to building/debugging jogl from source :) I just updated from rc-20131224 to 2.1.4 release and noticed that my mouse listener did not get any events.
Comment 3 johan 2014-03-12 19:38:41 CET
Just tested with 2.1.5-01 release. The behaviour is not exactly the same. Now when maximizing the window there are no mouse events, but if I click once on the window frame or inside the window mouse move events are registered. It feels like when maximizing the window looses focus. When you click somewhere on it it regains focus and mouse move events are sent as expected.
Comment 4 Sven Gothel 2015-10-05 09:02:12 CEST
duplicate

*** This bug has been marked as a duplicate of bug 1223 ***