-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathWaylandFFM.java
More file actions
113 lines (87 loc) · 6.85 KB
/
Copy pathWaylandFFM.java
File metadata and controls
113 lines (87 loc) · 6.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package javaforce.ffm;
import java.lang.foreign.*;
import java.lang.invoke.*;
import static java.lang.foreign.ValueLayout.*;
import javaforce.*;
import javaforce.ffm.*;
import javaforce.api.linux.*;
import javaforce.linux.*;
/** WaylandAPI FFM implementation.
*
* Generated by GenFFM - DO NOT EDIT
*/
public class WaylandFFM implements WaylandAPI {
private FFM ffm;
private static WaylandFFM instance;
public static synchronized WaylandFFM getInstance() {
if (instance == null) {
instance = new WaylandFFM();
if (!instance.ffm_init()) {
JFLog.log("WaylandFFM init failed!");
instance = null;
}
}
return instance;
}
private MethodHandle wl_display_destroy;
public boolean wl_display_destroy(long a1) { try { boolean _ret_value_ = (boolean)wl_display_destroy.invokeExact(a1);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return false;} }
private MethodHandle wl_display_add_socket_auto;
public java.lang.String wl_display_add_socket_auto(long a1) { try { String _ret_value_ = FFM.getString((MemorySegment)wl_display_add_socket_auto.invokeExact(a1));return _ret_value_; } catch (Throwable t) { JFLog.log(t); return null;} }
private MethodHandle wl_display_create;
public long wl_display_create() { try { long _ret_value_ = (long)wl_display_create.invokeExact();return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wl_display_get_event_loop;
public long wl_display_get_event_loop(long a1) { try { long _ret_value_ = (long)wl_display_get_event_loop.invokeExact(a1);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wl_event_loop_add_signal;
public long wl_event_loop_add_signal(long a1,int a2,long a3,long a4) { try { long _ret_value_ = (long)wl_event_loop_add_signal.invokeExact(a1,a2,a3,a4);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wl_event_loop_create;
public long wl_event_loop_create() { try { long _ret_value_ = (long)wl_event_loop_create.invokeExact();return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wlr_backend_autocreate;
public long wlr_backend_autocreate(long a1,long a2) { try { long _ret_value_ = (long)wlr_backend_autocreate.invokeExact(a1,a2);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wlr_compositor_create;
public long wlr_compositor_create(long a1,int a2,long a3) { try { long _ret_value_ = (long)wlr_compositor_create.invokeExact(a1,a2,a3);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wlr_fixes_create;
public long wlr_fixes_create(long a1,int a2) { try { long _ret_value_ = (long)wlr_fixes_create.invokeExact(a1,a2);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wlr_renderer_autocreate;
public long wlr_renderer_autocreate(long a1) { try { long _ret_value_ = (long)wlr_renderer_autocreate.invokeExact(a1);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wlr_session_create;
public long wlr_session_create(long a1) { try { long _ret_value_ = (long)wlr_session_create.invokeExact(a1);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wlr_xwayland_create;
public long wlr_xwayland_create(long a1,long a2,boolean a3) { try { long _ret_value_ = (long)wlr_xwayland_create.invokeExact(a1,a2,a3);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle wl_display_run;
public void wl_display_run(long a1) { try { wl_display_run.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle wlr_backend_destroy;
public void wlr_backend_destroy(long a1) { try { wlr_backend_destroy.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle wlr_backend_start;
public void wlr_backend_start(long a1) { try { wlr_backend_start.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle wlr_xwayland_destroy;
public void wlr_xwayland_destroy(long a1) { try { wlr_xwayland_destroy.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private boolean ffm_init() {
if (FFM.debug) JFLog.log("WaylandFFM init started");
MethodHandle init;
ffm = FFM.getInstance();
Library[] libs = new Library[] {new Library("wayland-server"),new Library("wayland-client"),new Library("wlroots")};
Library.findLibraries(null, libs);
Arena arena = Arena.ofAuto();
init = ffm.getFunction("WaylandAPIinit", ffm.getFunctionDesciptor(ValueLayout.JAVA_BOOLEAN,ADDRESS,ADDRESS,ADDRESS));
if (init == null) return false;
try {if (!(boolean)init.invokeExact(libs[0].getPath(arena),libs[1].getPath(arena),libs[2].getPath(arena))) return false;} catch (Throwable t) {JFLog.log(t); return false;}
wl_display_destroy = ffm.getFunctionPtr("_wl_display_destroy", ffm.getFunctionDesciptor(JAVA_BOOLEAN,JAVA_LONG));
wl_display_add_socket_auto = ffm.getFunctionPtr("_wl_display_add_socket_auto", ffm.getFunctionDesciptor(ADDRESS,JAVA_LONG));
wl_display_create = ffm.getFunctionPtr("_wl_display_create", ffm.getFunctionDesciptor(JAVA_LONG));
wl_display_get_event_loop = ffm.getFunctionPtr("_wl_display_get_event_loop", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG));
wl_event_loop_add_signal = ffm.getFunctionPtr("_wl_event_loop_add_signal", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG,JAVA_INT,JAVA_LONG,JAVA_LONG));
wl_event_loop_create = ffm.getFunctionPtr("_wl_event_loop_create", ffm.getFunctionDesciptor(JAVA_LONG));
wlr_backend_autocreate = ffm.getFunctionPtr("_wlr_backend_autocreate", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG,JAVA_LONG));
wlr_compositor_create = ffm.getFunctionPtr("_wlr_compositor_create", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG,JAVA_INT,JAVA_LONG));
wlr_fixes_create = ffm.getFunctionPtr("_wlr_fixes_create", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG,JAVA_INT));
wlr_renderer_autocreate = ffm.getFunctionPtr("_wlr_renderer_autocreate", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG));
wlr_session_create = ffm.getFunctionPtr("_wlr_session_create", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG));
wlr_xwayland_create = ffm.getFunctionPtr("_wlr_xwayland_create", ffm.getFunctionDesciptor(JAVA_LONG,JAVA_LONG,JAVA_LONG,JAVA_BOOLEAN));
wl_display_run = ffm.getFunctionPtr("_wl_display_run", ffm.getFunctionDesciptorVoid(JAVA_LONG));
wlr_backend_destroy = ffm.getFunctionPtr("_wlr_backend_destroy", ffm.getFunctionDesciptorVoid(JAVA_LONG));
wlr_backend_start = ffm.getFunctionPtr("_wlr_backend_start", ffm.getFunctionDesciptorVoid(JAVA_LONG));
wlr_xwayland_destroy = ffm.getFunctionPtr("_wlr_xwayland_destroy", ffm.getFunctionDesciptorVoid(JAVA_LONG));
if (FFM.debug) JFLog.log("WaylandFFM init complete");
return true;
}
}