diff options
Diffstat (limited to 'make/config/nativewindow')
-rw-r--r-- | make/config/nativewindow/x11-CustomJavaCode.java | 16 | ||||
-rw-r--r-- | make/config/nativewindow/x11-lib.cfg | 9 |
2 files changed, 19 insertions, 6 deletions
diff --git a/make/config/nativewindow/x11-CustomJavaCode.java b/make/config/nativewindow/x11-CustomJavaCode.java index d1e011184..7b5d617b5 100644 --- a/make/config/nativewindow/x11-CustomJavaCode.java +++ b/make/config/nativewindow/x11-CustomJavaCode.java @@ -24,14 +24,20 @@ if (_res == null) return null; Buffers.nativeOrder(_res); - XVisualInfo[] _retarray = new XVisualInfo[getFirstElement(arg3, arg3_offset)]; - for (int _count = 0; _count < getFirstElement(arg3, arg3_offset); _count++) { - _res.position(_count * XVisualInfo.size()); - _res.limit ((1 + _count) * XVisualInfo.size()); + final int count = getFirstElement(arg3, arg3_offset); + if (count <= 0) return null; + final int esize = _res.capacity() / count; + if( esize < XVisualInfo.size() ) { + throw new RuntimeException("element-size "+_res.capacity()+"/"+count+"="+esize+" < "+XVisualInfo.size()); + } + XVisualInfo[] _retarray = new XVisualInfo[count]; + for (int i = 0; i < count; i++) { + _res.position(i * esize); // XVisualInfo.size()); + _res.limit ((1 + i) * esize); // XVisualInfo.size()); java.nio.ByteBuffer _tmp = _res.slice(); _res.position(0); _res.limit(_res.capacity()); - _retarray[_count] = XVisualInfo.create(_tmp); + _retarray[i] = XVisualInfo.create(_tmp); } return _retarray; } diff --git a/make/config/nativewindow/x11-lib.cfg b/make/config/nativewindow/x11-lib.cfg index 66bd19362..0bbe1c420 100644 --- a/make/config/nativewindow/x11-lib.cfg +++ b/make/config/nativewindow/x11-lib.cfg @@ -13,6 +13,7 @@ NativeOutputDir gensrc/native/X11 Import java.nio.* Import java.util.* Import com.jogamp.nativewindow.util.Point +Import com.jogamp.common.util.Bitfield # XID needs to be treated as a long for 32/64 bit compatibility Opaque long XID @@ -31,6 +32,7 @@ ReturnValueCapacity XRenderFindVisualFormat sizeof(XRenderPictFormat) # We have Custom code for the following Ignore XGetVisualInfo +Ignore XRenderFindVisualFormat ManuallyImplement XCloseDisplay ManuallyImplement XUnlockDisplay @@ -40,7 +42,12 @@ ManuallyImplement XLockDisplay CustomJavaCode X11Lib private static int getFirstElement(IntBuffer buf) { return buf.get(buf.position()); } CustomJavaCode X11Lib private static int getFirstElement(int[] arr, int offset) { return arr[offset]; } -CustomJavaCode XVisualInfo public static XVisualInfo create(XVisualInfo s) { XVisualInfo d = XVisualInfo.create(); d.getBuffer().put(s.getBuffer()); d.getBuffer().rewind(); s.getBuffer().rewind(); return d; } +CustomJavaCode XVisualInfo public static XVisualInfo create(XVisualInfo s) { final ByteBuffer bb = Buffers.newDirectByteBuffer(s.getBuffer().capacity()); final XVisualInfo d = XVisualInfo.create(bb); d.getBuffer().put(s.getBuffer()); d.getBuffer().rewind(); s.getBuffer().rewind(); return d; } +CustomJavaCode XVisualInfo public String toString() { +CustomJavaCode XVisualInfo return "XVisualInfo[size "+size()+"/"+getBuffer().capacity()+", visual 0x"+Long.toHexString(getVisual())+ +CustomJavaCode XVisualInfo ", visual-id 0x"+Long.toHexString(getVisualid())+", c-class "+getC_class()+", cmap-size "+getColormap_size()+", depth "+getDepth()+ +CustomJavaCode XVisualInfo ", rgb["+Bitfield.Util.bitCount((int)getRed_mask())+", "+Bitfield.Util.bitCount((int)getRed_mask())+", "+Bitfield.Util.bitCount((int)getRed_mask())+" - "+getBits_per_rgb()+"]]"; +CustomJavaCode XVisualInfo } CustomCCode #include <gluegen_stdint.h> CustomCCode #include <gluegen_stddef.h> |