Search in sources :

Example 1 with Point

use of com.jogamp.nativewindow.util.Point in project jmonkeyengine by jMonkeyEngine.

the class NewtMouseInput method setInputSource.

public void setInputSource(GLWindow comp) {
    if (component != null) {
        component.removeMouseListener(this);
        eventQueue.clear();
        wheelPos = 0;
        isRecentering = false;
        eventsSinceRecenter = 0;
        lastEventX = 0;
        lastEventY = 0;
        lastEventWheel = 0;
        location = new Point();
        centerLocation = new Point();
        lastKnownLocation = new Point();
        lockPosition = new Point();
    }
    component = comp;
    component.addMouseListener(this);
    component.addWindowListener(new WindowAdapter() {

        @Override
        public void windowGainedFocus(WindowEvent e) {
            setCursorVisible(visible);
        }

        @Override
        public void windowLostFocus(WindowEvent e) {
            //without those lines,
            //on Linux (OpenBox) the mouse is not restored if invisible (eg via Alt-Tab)
            component.setPointerVisible(true);
            component.confinePointer(false);
        }
    });
}
Also used : WindowEvent(com.jogamp.newt.event.WindowEvent) WindowAdapter(com.jogamp.newt.event.WindowAdapter) Point(com.jogamp.nativewindow.util.Point)

Aggregations

Point (com.jogamp.nativewindow.util.Point)1 WindowAdapter (com.jogamp.newt.event.WindowAdapter)1 WindowEvent (com.jogamp.newt.event.WindowEvent)1