1
2
3
4
5 package oshi.jna.platform.mac;
6
7 import com.sun.jna.Library;
8 import com.sun.jna.Native;
9 import com.sun.jna.Structure;
10 import com.sun.jna.Structure.FieldOrder;
11 import com.sun.jna.platform.mac.CoreFoundation.CFArrayRef;
12 import com.sun.jna.platform.mac.CoreFoundation.CFDictionaryRef;
13
14 import oshi.util.Util;
15
16
17
18
19
20
21
22
23
24
25 public interface CoreGraphics extends Library {
26
27 CoreGraphics INSTANCE = Native.load("CoreGraphics", CoreGraphics.class);
28
29 int kCGNullWindowID = 0;
30
31 int kCGWindowListOptionAll = 0;
32 int kCGWindowListOptionOnScreenOnly = 1 << 0;
33 int kCGWindowListOptionOnScreenAboveWindow = 1 << 1;
34 int kCGWindowListOptionOnScreenBelowWindow = 1 << 2;
35 int kCGWindowListOptionIncludingWindow = 1 << 3;
36 int kCGWindowListExcludeDesktopElements = 1 << 4;
37
38
39
40
41 @FieldOrder({ "x", "y" })
42 class CGPoint extends Structure {
43 public double x;
44 public double y;
45
46 }
47
48
49
50
51 @FieldOrder({ "width", "height" })
52 class CGSize extends Structure {
53 public double width;
54 public double height;
55 }
56
57
58
59
60 @FieldOrder({ "origin", "size" })
61 class CGRect extends Structure implements AutoCloseable {
62 public CGPoint origin;
63 public CGSize size;
64
65 @Override
66 public void close() {
67 Util.freeMemory(getPointer());
68 }
69 }
70
71 CFArrayRef CGWindowListCopyWindowInfo(int option, int relativeToWindow);
72
73 boolean CGRectMakeWithDictionaryRepresentation(CFDictionaryRef dict, CGRect rect);
74 }