Skip to content

Commit 8f17bdd

Browse files
lafoletcmatthiasblaesing
authored andcommitted
Add XGetEventData and XFreeEventData methods
1 parent 0a0e44d commit 8f17bdd

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Features
1313
* [#1242](https://github.com/java-native-access/jna/pull/1242): Add CallWindowProc to User32 - [@heldplayer](https://github.com/heldplayer).
1414
* [#1239](https://github.com/java-native-access/jna/pull/1239): Improve performance of allocation of `c.s.j.Memory` objects - [@joerg1985](https://github.com/joerg1985).
1515
* [#1246](https://github.com/java-native-access/jna/pull/1246): Improve performance of `c.s.j.Structure#read` and `c.s.j.Structure#write` - [@joerg1985](https://github.com/joerg1985).
16+
* [#1260](https://github.com/java-native-access/jna/pull/1260): Add mapping for X11 generic events - [@lafoletc](https://github.com/lafoletc).
1617

1718
Bug Fixes
1819
---------

contrib/platform/src/com/sun/jna/platform/unix/X11.java

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,8 @@ class passed to CreateWindow */
978978
int ColormapNotify = 32;
979979
int ClientMessage = 33;
980980
int MappingNotify = 34;
981-
int LASTEvent = 35; // must be bigger than any event #
981+
int GenericEvent = 35;
982+
int LASTEvent = 36; // must be bigger than any event #
982983

983984
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
984985
state in various key-, mouse-, and button-related events. */
@@ -1466,6 +1467,8 @@ public static class XEvent extends Union {
14661467
public XMappingEvent xmapping;
14671468
public XErrorEvent xerror;
14681469
public XKeymapEvent xkeymap;
1470+
public XGenericEvent xgeneric;
1471+
public XGenericEventCookie xcookie;
14691472
public NativeLong[] pad = new NativeLong[24];
14701473
}
14711474

@@ -1893,6 +1896,31 @@ class XKeymapEvent extends Structure {
18931896
public byte key_vector[] = new byte[32];
18941897
}
18951898

1899+
/**
1900+
* This event is the standard event for all newer extensions.
1901+
*/
1902+
@FieldOrder({"type", "serial", "send_event", "display", "extension", "evtype"})
1903+
class XGenericEvent extends Structure {
1904+
public int type; // of event. Always GenericEvent
1905+
public NativeLong serial; // # of last request processed by server
1906+
public int send_event; // true if this came from a SendEvent request
1907+
public Display display; // Display the event was read from
1908+
public int extension; // major opcode of extension that caused the event
1909+
public int evtype; // actual event type
1910+
}
1911+
1912+
@FieldOrder({"type", "serial", "send_event", "display", "extension", "evtype", "cookie", "data"})
1913+
class XGenericEventCookie extends Structure {
1914+
public int type; // of event. Always GenericEvent
1915+
public NativeLong serial; // # of last request processed by server
1916+
public int send_event; // true if this came from a SendEvent request
1917+
public Display display; // Display the event was read from
1918+
public int extension; // major opcode of extension that caused the event
1919+
public int evtype; // actual event type
1920+
public int cookie;
1921+
public Pointer data;
1922+
}
1923+
18961924
int XSelectInput(Display display, Window window, NativeLong eventMask);
18971925
int XSendEvent(Display display, Window w, int propagate, NativeLong event_mask, XEvent event_send);
18981926

@@ -1906,6 +1934,9 @@ class XKeymapEvent extends Structure {
19061934
boolean XCheckTypedEvent(Display display, int event_type, XEvent event_return);
19071935
boolean XCheckTypedWindowEvent(Display display, Window w, int event_type, XEvent event_return);
19081936

1937+
boolean XGetEventData(Display display, XGenericEventCookie cookie);
1938+
void XFreeEventData(Display display, XGenericEventCookie cookie);
1939+
19091940
/** Returns an {@link XWMHints} which must be freed by {@link #XFree}.
19101941
* @param display target Display
19111942
* @param window target Window

0 commit comments

Comments
 (0)