diff --git a/engine/lib/niftygui/nifty-1.3-SNAPSHOT.jar b/engine/lib/niftygui/nifty-1.3-SNAPSHOT.jar index 5b107697c..757c35bd9 100644 Binary files a/engine/lib/niftygui/nifty-1.3-SNAPSHOT.jar and b/engine/lib/niftygui/nifty-1.3-SNAPSHOT.jar differ diff --git a/engine/lib/niftygui/nifty-default-controls-1.3-SNAPSHOT.jar b/engine/lib/niftygui/nifty-default-controls-1.3-SNAPSHOT.jar index 62e9c1ce8..755edf2f1 100644 Binary files a/engine/lib/niftygui/nifty-default-controls-1.3-SNAPSHOT.jar and b/engine/lib/niftygui/nifty-default-controls-1.3-SNAPSHOT.jar differ diff --git a/engine/src/desktop/com/jme3/input/awt/AwtMouseInput.java b/engine/src/desktop/com/jme3/input/awt/AwtMouseInput.java index 6b687cf84..bbd53454a 100644 --- a/engine/src/desktop/com/jme3/input/awt/AwtMouseInput.java +++ b/engine/src/desktop/com/jme3/input/awt/AwtMouseInput.java @@ -32,11 +32,6 @@ package com.jme3.input.awt; -import com.jme3.input.MouseInput; -import com.jme3.input.RawInputListener; -import com.jme3.input.event.MouseButtonEvent; -import com.jme3.input.event.MouseMotionEvent; -import de.lessvoid.nifty.input.mouse.MouseInputEvent; import java.awt.Component; import java.awt.Cursor; import java.awt.Point; @@ -49,13 +44,16 @@ import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.awt.image.BufferedImage; import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - import java.util.logging.Level; import java.util.logging.Logger; + import javax.swing.SwingUtilities; +import com.jme3.input.MouseInput; +import com.jme3.input.RawInputListener; +import com.jme3.input.event.MouseButtonEvent; +import com.jme3.input.event.MouseMotionEvent; + /** * AwtMouseInput * diff --git a/engine/src/niftygui/com/jme3/niftygui/InputSystemJme.java b/engine/src/niftygui/com/jme3/niftygui/InputSystemJme.java index 897f5431b..19b90cf9d 100644 --- a/engine/src/niftygui/com/jme3/niftygui/InputSystemJme.java +++ b/engine/src/niftygui/com/jme3/niftygui/InputSystemJme.java @@ -43,8 +43,9 @@ import com.jme3.input.event.MouseButtonEvent; import com.jme3.input.event.MouseMotionEvent; import de.lessvoid.nifty.Nifty; import de.lessvoid.nifty.NiftyInputConsumer; +import de.lessvoid.nifty.input.NiftyMouseInputEvent; import de.lessvoid.nifty.input.keyboard.KeyboardInputEvent; -import de.lessvoid.nifty.input.mouse.MouseInputEvent; +import de.lessvoid.nifty.input.mouse.MouseInputEventQueue; import de.lessvoid.nifty.spi.input.InputSystem; import java.util.ArrayList; @@ -100,11 +101,18 @@ public class InputSystemJme implements InputSystem, RawInputListener { private void onMouseMotionEventQueued(MouseMotionEvent evt, NiftyInputConsumer nic) { x = evt.getX(); y = height - evt.getY(); - MouseInputEvent niftyEvt = new MouseInputEvent(x, y, pressed); - if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){ + MouseInputEventQueue niftyEvtQueue = nifty.getMouseInputEventQueue(); + NiftyMouseInputEvent niftyEvt = new NiftyMouseInputEvent(); + if (niftyEvtQueue.hasLastMouseDownEvent()) { + niftyEvt = niftyEvtQueue.getLastMouseDownEvent(); + } + niftyEvt.initialize(x, y, evt.getDeltaWheel(), niftyEvt.isButton0Down(), niftyEvt.isButton1Down(), niftyEvt.isButton2Down()); + niftyEvtQueue.process(niftyEvt); + //MouseInputEvent niftyEvt = new MouseInputEvent(x, y, pressed); +// if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){ // Do not consume motion events //evt.setConsumed(); - } +// } } public void onMouseMotionEvent(MouseMotionEvent evt) { @@ -118,10 +126,19 @@ public class InputSystemJme implements InputSystem, RawInputListener { private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) { pressed = evt.isPressed(); - MouseInputEvent niftyEvt = new MouseInputEvent(x, y, pressed); - if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){ - evt.setConsumed(); + MouseInputEventQueue niftyEvtQueue = nifty.getMouseInputEventQueue(); + NiftyMouseInputEvent niftyEvt = new NiftyMouseInputEvent(); + if (niftyEvtQueue.hasLastMouseDownEvent()) { + niftyEvt = niftyEvtQueue.getLastMouseDownEvent(); } + niftyEvt.initialize(x, y, 0, evt.getButtonIndex() == 0 && evt.isPressed(), evt.getButtonIndex() == 1 + && evt.isPressed(), evt.getButtonIndex() == 2 && evt.isPressed()); + niftyEvtQueue.process(niftyEvt); + +// MouseInputEvent niftyEvt = new MouseInputEvent(x, y, pressed); +// if (nic.processMouseEvent(niftyEvt) /*|| nifty.getCurrentScreen().isMouseOverElement()*/){ + evt.setConsumed(); +// } } public void onMouseButtonEvent(MouseButtonEvent evt) {