-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathX11FFM.java
More file actions
122 lines (94 loc) · 6.53 KB
/
Copy pathX11FFM.java
File metadata and controls
122 lines (94 loc) · 6.53 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
114
115
116
117
118
119
120
121
122
package javaforce.ffm;
import java.awt.*;
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.*;
/** X11API FFM implementation.
*
* Generated by GenFFM - DO NOT EDIT
*/
public class X11FFM implements X11API {
private FFM ffm;
private static X11FFM instance;
public static synchronized X11FFM getInstance() {
if (instance == null) {
instance = new X11FFM();
if (!instance.ffm_init()) {
JFLog.log("X11FFM init failed!");
instance = null;
}
}
return instance;
}
private MethodHandle x11_send_event;
public boolean x11_send_event(int a1,boolean a2) { try { boolean _ret_value_ = (boolean)x11_send_event.invokeExact(a1,a2);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return false;} }
private MethodHandle x11_send_event_id;
public boolean x11_send_event_id(long a1,int a2,boolean a3) { try { boolean _ret_value_ = (boolean)x11_send_event_id.invokeExact(a1,a2,a3);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return false;} }
private MethodHandle x11_keysym_to_keycode;
public int x11_keysym_to_keycode(char a1) { try { int _ret_value_ = (int)x11_keysym_to_keycode.invokeExact(a1);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle x11_tray_width;
public int x11_tray_width() { try { int _ret_value_ = (int)x11_tray_width.invokeExact();return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle x11_get_id;
public long x11_get_id(java.awt.Window a1) { try { long _ret_value_ = (long)x11_get_id.invokeExact(a1);return _ret_value_; } catch (Throwable t) { JFLog.log(t); return -1;} }
private MethodHandle x11_map_window;
public void x11_map_window(long a1) { try { x11_map_window.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_minimize_all;
public void x11_minimize_all() { try { x11_minimize_all.invokeExact(); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_raise_window;
public void x11_raise_window(long a1) { try { x11_raise_window.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_set_desktop;
public void x11_set_desktop(long a1) { try { x11_set_desktop.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_set_dock;
public void x11_set_dock(long a1) { try { x11_set_dock.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_set_listener;
public void x11_set_listener(javaforce.linux.X11Listener a1) { try { FFM.setX11Listener(a1);x11_set_listener.invokeExact(FFM.upcall_X11Listener); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_set_strut;
public void x11_set_strut(long a1,int a2,int a3,int a4,int a5,int a6) { try { x11_set_strut.invokeExact(a1,a2,a3,a4,a5,a6); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_tray_main;
public void x11_tray_main(long a1,int a2,int a3,int a4) { try { x11_tray_main.invokeExact(a1,a2,a3,a4); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_tray_reposition;
public void x11_tray_reposition(int a1,int a2,int a3) { try { x11_tray_reposition.invokeExact(a1,a2,a3); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_tray_stop;
public void x11_tray_stop() { try { x11_tray_stop.invokeExact(); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_unmap_window;
public void x11_unmap_window(long a1) { try { x11_unmap_window.invokeExact(a1); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_window_list_main;
public void x11_window_list_main() { try { x11_window_list_main.invokeExact(); } catch (Throwable t) { JFLog.log(t); } }
private MethodHandle x11_window_list_stop;
public void x11_window_list_stop() { try { x11_window_list_stop.invokeExact(); } catch (Throwable t) { JFLog.log(t); } }
private boolean ffm_init() {
if (FFM.debug) JFLog.log("X11FFM init started");
MethodHandle init;
ffm = FFM.getInstance();
Library[] libs = new Library[] {new Library("X11")};
Library.findLibraries(null, libs);
Arena arena = Arena.ofAuto();
init = ffm.getFunction("X11APIinit", ffm.getFunctionDesciptor(ValueLayout.JAVA_BOOLEAN,ADDRESS));
if (init == null) return false;
try {if (!(boolean)init.invokeExact(libs[0].getPath(arena))) return false;} catch (Throwable t) {JFLog.log(t); return false;}
x11_send_event = ffm.getFunctionPtr("_x11_send_event", ffm.getFunctionDesciptor(JAVA_BOOLEAN,JAVA_INT,JAVA_BOOLEAN));
x11_send_event_id = ffm.getFunctionPtr("_x11_send_event_id", ffm.getFunctionDesciptor(JAVA_BOOLEAN,JAVA_LONG,JAVA_INT,JAVA_BOOLEAN));
x11_keysym_to_keycode = ffm.getFunctionPtr("_x11_keysym_to_keycode", ffm.getFunctionDesciptor(JAVA_INT,JAVA_CHAR));
x11_tray_width = ffm.getFunctionPtr("_x11_tray_width", ffm.getFunctionDesciptor(JAVA_INT));
x11_get_id = ffm.getFunctionPtr("_x11_get_id", ffm.getFunctionDesciptor(JAVA_LONG,ADDRESS));
x11_map_window = ffm.getFunctionPtr("_x11_map_window", ffm.getFunctionDesciptorVoid(JAVA_LONG));
x11_minimize_all = ffm.getFunctionPtr("_x11_minimize_all", ffm.getFunctionDesciptorVoid());
x11_raise_window = ffm.getFunctionPtr("_x11_raise_window", ffm.getFunctionDesciptorVoid(JAVA_LONG));
x11_set_desktop = ffm.getFunctionPtr("_x11_set_desktop", ffm.getFunctionDesciptorVoid(JAVA_LONG));
x11_set_dock = ffm.getFunctionPtr("_x11_set_dock", ffm.getFunctionDesciptorVoid(JAVA_LONG));
x11_set_listener = ffm.getFunctionPtr("_x11_set_listener", ffm.getFunctionDesciptorVoid(ADDRESS));
x11_set_strut = ffm.getFunctionPtr("_x11_set_strut", ffm.getFunctionDesciptorVoid(JAVA_LONG,JAVA_INT,JAVA_INT,JAVA_INT,JAVA_INT,JAVA_INT));
x11_tray_main = ffm.getFunctionPtr("_x11_tray_main", ffm.getFunctionDesciptorVoid(JAVA_LONG,JAVA_INT,JAVA_INT,JAVA_INT));
x11_tray_reposition = ffm.getFunctionPtr("_x11_tray_reposition", ffm.getFunctionDesciptorVoid(JAVA_INT,JAVA_INT,JAVA_INT));
x11_tray_stop = ffm.getFunctionPtr("_x11_tray_stop", ffm.getFunctionDesciptorVoid());
x11_unmap_window = ffm.getFunctionPtr("_x11_unmap_window", ffm.getFunctionDesciptorVoid(JAVA_LONG));
x11_window_list_main = ffm.getFunctionPtr("_x11_window_list_main", ffm.getFunctionDesciptorVoid());
x11_window_list_stop = ffm.getFunctionPtr("_x11_window_list_stop", ffm.getFunctionDesciptorVoid());
if (FFM.debug) JFLog.log("X11FFM init complete");
return true;
}
}