Skip to content

Commit

Permalink
Merge pull request #4 from umjammer/2.0.14v
Browse files Browse the repository at this point in the history
2.0.14v
  • Loading branch information
umjammer authored Jan 21, 2024
2 parents c0ce825 + ac5af15 commit f01518e
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 107 deletions.
2 changes: 1 addition & 1 deletion coreAPI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
</parent>

<artifactId>coreapi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
</parent>

<artifactId>examples</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/OSX/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
</parent>

<artifactId>osx-plugin</artifactId>
Expand Down
139 changes: 42 additions & 97 deletions plugins/OSX/src/main/java/vavix/rococoa/corefoundation/CFLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.sun.jna.Callback;
import com.sun.jna.CallbackReference;
import com.sun.jna.Library;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import com.sun.jna.NativeLong;
Expand Down Expand Up @@ -69,32 +70,46 @@ public interface CFLib extends Library {
//#region CFArray

class CFArrayCallBacks extends Structure {

public interface RetqinCallback extends Callback {
void fn(Pointer a, Pointer b);
}

public interface ReleaseCallback extends Callback {
void fn(Pointer a, Pointer b);
}

public interface CopyDescriptionCallback extends Callback {
Pointer fn(Pointer a);
}

public interface EqualCallback extends Callback {
boolean fn(Pointer a, Pointer b);
}

public NativeLong version;
public RetqinCallback retain;
public ReleaseCallback release;
public CopyDescriptionCallback copyDescription;
public EqualCallback equal;

Memory memory;

public CFArrayCallBacks() {
setAutoWrite(false);
memory = new Memory(8 * 5);
useMemory(memory);
}

public CFArrayCallBacks(Pointer p) {
super(p);
this();
version = getPointer().getNativeLong(0);
retain = (RetqinCallback) CallbackReference.getCallback(RetqinCallback.class, p.getPointer(0x08));
release = (ReleaseCallback) CallbackReference.getCallback(ReleaseCallback.class, p.getPointer(0x10));
copyDescription = (CopyDescriptionCallback) CallbackReference.getCallback(CopyDescriptionCallback.class, p.getPointer(0x18));
equal = (EqualCallback) CallbackReference.getCallback(EqualCallback.class, p.getPointer(0x20));
log.fine(this.toString());
write();
log.fine(this.toString());
}

@Override
Expand All @@ -103,8 +118,7 @@ protected List<String> getFieldOrder() {
}
}

CFArrayCallBacks kCFTypeArrayCallBacks = new CFArrayCallBacks(NATIVE_LIBRARY
.getGlobalVariableAddress("kCFTypeArrayCallBacks"));
CFArrayCallBacks kCFTypeArrayCallBacks = new CFArrayCallBacks(NATIVE_LIBRARY.getGlobalVariableAddress("kCFTypeArrayCallBacks"));

/** Creates a new immutable array with the given values. */
CFArray CFArrayCreate(CFAllocator allocator, Pointer[] values, CFIndex numValues, CFArrayCallBacks callBacks);
Expand Down Expand Up @@ -290,6 +304,9 @@ interface CFNumberType {

//#region CFDictionary

// https://opensource.apple.com/source/CF/CF-635/CFDictionary.h.auto.html
// https://github.com/code-orchestra/code-orchestra-core/blob/master/core/actionScript/source/com/semaphore/jna/cf/CFLibrary.java

interface CFDictionaryRetainCallBack extends Callback {

Pointer invoke(CFAllocator allocator, CFType value);
Expand Down Expand Up @@ -324,66 +341,30 @@ interface CFDictionaryApplierFunction extends Callback {

class CFDictionaryKeyCallBacks extends Structure {

public NativeLong version;
public CFIndex version;
public CFDictionaryRetainCallBack retain;
public CFDictionaryReleaseCallBack release;
public CFDictionaryCopyDescriptionCallBack copyDescription;
public CFDictionaryEqualCallBack equal;
public CFDictionaryHashCallBack hash;

Memory memory;

public CFDictionaryKeyCallBacks() {
setAutoWrite(false);
memory = new Memory(8 * 6);
useMemory(memory);
}

public CFDictionaryKeyCallBacks(Pointer p) {
super(p);

version = getPointer().getNativeLong(0);
this();
version = CFIndex.of(p.getNativeLong(0));
retain = (CFDictionaryRetainCallBack) CallbackReference.getCallback(CFDictionaryRetainCallBack.class, p.getPointer(0x08));
release = (CFDictionaryReleaseCallBack) CallbackReference.getCallback(CFDictionaryReleaseCallBack.class, p.getPointer(0x10));
copyDescription = (CFDictionaryCopyDescriptionCallBack) CallbackReference.getCallback(CFDictionaryCopyDescriptionCallBack.class, p.getPointer(0x18));
equal = (CFDictionaryEqualCallBack) CallbackReference.getCallback(CFDictionaryEqualCallBack.class, p.getPointer(0x20));
hash = (CFDictionaryHashCallBack) CallbackReference.getCallback(CFDictionaryHashCallBack.class, p.getPointer(0x28));
}

public CFDictionaryKeyCallBacks(NativeLong version, CFDictionaryRetainCallBack retain, CFDictionaryReleaseCallBack release, CFDictionaryCopyDescriptionCallBack copyDescription, CFDictionaryEqualCallBack equal, CFDictionaryHashCallBack hash) {
this.version = version;
this.retain = retain;
this.release = release;
this.copyDescription = copyDescription;
this.equal = equal;
this.hash = hash;
}

protected ByReference newByReference() {
ByReference s = new ByReference();
s.useMemory(getPointer());
write();
s.read();
return s;
}

protected ByValue newByValue() {
ByValue s = new ByValue();
s.useMemory(getPointer());
write();
s.read();
return s;
}

protected CFDictionaryKeyCallBacks newInstance() {
CFDictionaryKeyCallBacks s = new CFDictionaryKeyCallBacks();
s.useMemory(getPointer());
write();
s.read();
return s;
}

public static class ByReference extends CFDictionaryKeyCallBacks implements Structure.ByReference {

}

public static class ByValue extends CFDictionaryKeyCallBacks implements Structure.ByValue {

}

@Override
Expand All @@ -394,64 +375,28 @@ protected List<String> getFieldOrder() {

class CFDictionaryValueCallBacks extends Structure {

public NativeLong version;
public CFIndex version;
public CFDictionaryRetainCallBack retain;
public CFDictionaryReleaseCallBack release;
public CFDictionaryCopyDescriptionCallBack copyDescription;
public CFDictionaryEqualCallBack equal;

Memory memory;

public CFDictionaryValueCallBacks() {
setAutoWrite(false);
memory = new Memory(8 * 5);
useMemory(memory);
}

public CFDictionaryValueCallBacks(Pointer p) {
super(p);

version = getPointer().getNativeLong(0);
this();
version = CFIndex.of(p.getNativeLong(0));
retain = (CFDictionaryRetainCallBack) CallbackReference.getCallback(CFDictionaryRetainCallBack.class, p.getPointer(0x08));
release = (CFDictionaryReleaseCallBack) CallbackReference.getCallback(CFDictionaryReleaseCallBack.class, p.getPointer(0x10));
copyDescription = (CFDictionaryCopyDescriptionCallBack) CallbackReference.getCallback(CFDictionaryCopyDescriptionCallBack.class, p.getPointer(0x18));
equal = (CFDictionaryEqualCallBack) CallbackReference.getCallback(CFDictionaryEqualCallBack.class, p.getPointer(0x20));
}

public CFDictionaryValueCallBacks(NativeLong version, CFDictionaryRetainCallBack retain, CFDictionaryReleaseCallBack release, CFDictionaryCopyDescriptionCallBack copyDescription, CFDictionaryEqualCallBack equal) {
super();
this.version = version;
this.retain = retain;
this.release = release;
this.copyDescription = copyDescription;
this.equal = equal;
}

protected ByReference newByReference() {
ByReference s = new ByReference();
s.useMemory(getPointer());
write();
s.read();
return s;
}

protected ByValue newByValue() {
ByValue s = new ByValue();
s.useMemory(getPointer());
write();
s.read();
return s;
}

protected CFDictionaryValueCallBacks newInstance() {
CFDictionaryValueCallBacks s = new CFDictionaryValueCallBacks();
s.useMemory(getPointer());
write();
s.read();
return s;
}

public static class ByReference extends CFDictionaryValueCallBacks implements Structure.ByReference {

}

public static class ByValue extends CFDictionaryValueCallBacks implements Structure.ByValue {

}

@Override
Expand All @@ -462,15 +407,17 @@ protected List<String> getFieldOrder() {

CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks = new CFDictionaryKeyCallBacks(NATIVE_LIBRARY.getGlobalVariableAddress("kCFTypeDictionaryKeyCallBacks"));

CFDictionaryKeyCallBacks kCFCopyStringDictionaryKeyCallBacks = new CFDictionaryKeyCallBacks(NATIVE_LIBRARY.getGlobalVariableAddress("kCFCopyStringDictionaryKeyCallBacks"));

CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks = new CFDictionaryValueCallBacks(NATIVE_LIBRARY.getGlobalVariableAddress("kCFTypeDictionaryValueCallBacks"));

CFDictionary CFDictionaryCreate(CFAllocator allocator, CFString[] keys, CFType[] values, NativeLong numValues, CFDictionaryKeyCallBacks keyCallBacks, CFDictionaryValueCallBacks valueCallBacks);
CFDictionary CFDictionaryCreate(CFAllocator allocator, CFString[] keys, CFType[] values, CFIndex numValues, CFDictionaryKeyCallBacks keyCallBacks, CFDictionaryValueCallBacks valueCallBacks);

CFDictionary CFDictionaryCreateCopy(CFAllocator allocator, CFDictionary theDict);

CFDictionary CFDictionaryCreateMutable(CFAllocator allocator, NativeLong capacity, CFDictionaryKeyCallBacks keyCallBacks, CFDictionaryValueCallBacks valueCallBacks);
CFDictionary CFDictionaryCreateMutable(CFAllocator allocator, CFIndex capacity, CFDictionaryKeyCallBacks keyCallBacks, CFDictionaryValueCallBacks valueCallBacks);

CFDictionary CFDictionaryCreateMutableCopy(CFAllocator allocator, NativeLong capacity, CFDictionary theDict);
CFDictionary CFDictionaryCreateMutableCopy(CFAllocator allocator, CFIndex capacity, CFDictionary theDict);

NativeLong CFDictionaryGetCount(CFDictionary theDict);

Expand Down Expand Up @@ -500,8 +447,6 @@ protected List<String> getFieldOrder() {

void CFDictionaryRemoveAllValues(CFDictionary theDict);

Pointer /* CFMutableDictionaryRef */ CFDictionaryCreateMutable(CFAllocator allocator, CFIndex capacity, CFDictionaryKeyCallBacks keyCallBacks, CFDictionaryValueCallBacks valueCallBacks);

//#endregion CFDictionary

//#region CFDate
Expand Down
2 changes: 1 addition & 1 deletion plugins/awt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
</parent>

<artifactId>awt-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/linux/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
</parent>

<artifactId>linux-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
</parent>

<artifactId>plugins</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/windows/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
</parent>

<artifactId>windows-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/wintab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>

<packaging>pom</packaging>
<name>JInput</name>
Expand Down
2 changes: 1 addition & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>jinput-parent</artifactId>
<version>2.0.13v</version>
<version>2.0.14v</version>
</parent>

<artifactId>tests</artifactId>
Expand Down

0 comments on commit f01518e

Please sign in to comment.