aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-08 02:47:23 +0200
committerSven Gothel <[email protected]>2013-04-08 02:47:23 +0200
commited596d9a329f1788979e148a4d09df7815ada527 (patch)
tree63d66f0ceda9db2d9c09954ac6aed27cf27c063c /src/newt/classes/jogamp
parent4934f1801ba44d20353652f9ee3686a13323fb74 (diff)
Bug 641 NEWT: X11 Deliver keyCode layout independent, keySym layout dependent and UTF-16 keyChar value
On X11, the layout dependent keySym was not delivered [1], as well as the UTF-8 to UTF-16 translation was missing [2]. [1] is solved using XLookupString w/o ShiftMask [2] is solved using JNI's NewStringUTF, which takes UTF-8.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java16
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java16
2 files changed, 21 insertions, 11 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
index f3a548a08..4fe025ec4 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
@@ -91,9 +91,10 @@ public class DisplayDriver extends DisplayImpl {
@Override
protected void closeNativeImpl() {
- DisplayRelease0(aDevice.getHandle(), javaObjectAtom, windowDeleteAtom);
+ DisplayRelease0(aDevice.getHandle(), javaObjectAtom, windowDeleteAtom /*, kbdHandle */); // XKB disabled for now
javaObjectAtom = 0;
windowDeleteAtom = 0;
+ // kbdHandle = 0;
aDevice.close(); // closes X11 display
}
@@ -103,7 +104,7 @@ public class DisplayDriver extends DisplayImpl {
try {
final long handle = aDevice.getHandle();
if(0 != handle) {
- DispatchMessages0(handle, javaObjectAtom, windowDeleteAtom);
+ DispatchMessages0(handle, javaObjectAtom, windowDeleteAtom /*, kbdHandle */); // XKB disabled for now
}
} finally {
if(null != aDevice) { // could be pulled by destroy event
@@ -114,6 +115,7 @@ public class DisplayDriver extends DisplayImpl {
protected long getJavaObjectAtom() { return javaObjectAtom; }
protected long getWindowDeleteAtom() { return windowDeleteAtom; }
+ // protected long getKbdHandle() { return kbdHandle; } // XKB disabled for now
/** Returns <code>null</code> if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */
protected Boolean isXineramaEnabled() { return isNativeValid() ? Boolean.valueOf(((X11GraphicsDevice)aDevice).isXineramaEnabled()) : null; }
@@ -126,18 +128,22 @@ public class DisplayDriver extends DisplayImpl {
private native void CompleteDisplay0(long handle);
- private void displayCompleted(long javaObjectAtom, long windowDeleteAtom) {
+ private void displayCompleted(long javaObjectAtom, long windowDeleteAtom /*, long kbdHandle */) {
this.javaObjectAtom=javaObjectAtom;
this.windowDeleteAtom=windowDeleteAtom;
+ // this.kbdHandle = kbdHandle; // XKB disabled for now
}
- private native void DisplayRelease0(long handle, long javaObjectAtom, long windowDeleteAtom);
+ private native void DisplayRelease0(long handle, long javaObjectAtom, long windowDeleteAtom /*, long kbdHandle */); // XKB disabled for now
- private native void DispatchMessages0(long display, long javaObjectAtom, long windowDeleteAtom);
+ private native void DispatchMessages0(long display, long javaObjectAtom, long windowDeleteAtom /* , long kbdHandle */); // XKB disabled for now
/** X11 Window delete atom marker used on EDT */
private long windowDeleteAtom;
/** X11 Window java object property used on EDT */
private long javaObjectAtom;
+
+ /** X11 Keyboard handle used on EDT */
+ // private long kbdHandle; // XKB disabled for now
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 8d33d4d73..666d0cb5b 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -116,7 +116,7 @@ public class WindowDriver extends WindowImpl {
edtDevice.lock();
try {
CloseWindow0(edtDevice.getHandle(), windowHandleClose,
- display.getJavaObjectAtom(), display.getWindowDeleteAtom());
+ display.getJavaObjectAtom(), display.getWindowDeleteAtom() /* , display.getKbdHandle() */); // XKB disabled for now
} catch (Throwable t) {
if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
@@ -271,13 +271,13 @@ public class WindowDriver extends WindowImpl {
super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotation);
}
- @Override
- public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
+ protected final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar0, String keyString) {
// handleKeyEvent(true, false, eventType, modifiers, keyCode, keyChar);
final boolean isModifierKey = KeyEvent.isModifierKey(keyCode);
final boolean isAutoRepeat = 0 != ( KeyEvent.AUTOREPEAT_MASK & modifiers );
- // System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar+">, mods "+toHexString(modifiers)+
- // ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", repeat "+isAutoRepeat+", [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
+ final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0;
+ // System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar0+">/<"+keyChar+">, keyString "+keyString+", mods "+toHexString(modifiers)+
+ // ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", repeat "+isAutoRepeat+", [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
if( !isAutoRepeat || !isModifierKey ) { // ! ( isModifierKey && isAutoRepeat )
switch(eventType) {
@@ -296,6 +296,10 @@ public class WindowDriver extends WindowImpl {
}
@Override
+ public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
+ throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
+ }
+ @Override
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
@@ -315,7 +319,7 @@ public class WindowDriver extends WindowImpl {
private native long CreateWindow0(long parentWindowHandle, long display, int screen_index,
int visualID, long javaObjectAtom, long windowDeleteAtom,
int x, int y, int width, int height, boolean autoPosition, int flags);
- private native void CloseWindow0(long display, long windowHandle, long javaObjectAtom, long windowDeleteAtom);
+ private native void CloseWindow0(long display, long windowHandle, long javaObjectAtom, long windowDeleteAtom /*, long kbdHandle*/ ); // XKB disabled for now
private native void reconfigureWindow0(long display, int screen_index, long parentWindowHandle, long windowHandle,
long windowDeleteAtom, int x, int y, int width, int height, int flags);
private native void requestFocus0(long display, long windowHandle, boolean force);