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
|
package jogamp.nativewindow;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.ProxySurface;
import javax.media.nativewindow.UpstreamSurfaceHook;
import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
public class WrappedWindow extends WrappedSurface implements NativeWindow {
private final long windowHandle;
private final InsetsImmutable insets = new Insets(0, 0, 0, 0);
/**
* Utilizes a {@link UpstreamSurfaceHook.MutableSize} to hold the size information,
* which is being passed to the {@link ProxySurface} instance.
*
* @param cfg the {@link AbstractGraphicsConfiguration} to be used
* @param surfaceHandle the wrapped pre-existing native surface handle, maybe 0 if not yet determined
* @param initialWidth
* @param initialHeight
* @param ownsDevice <code>true</code> if this {@link ProxySurface} instance
* owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice},
* otherwise <code>false</code>. Owning the device implies closing it at {@link #destroyNotify()}.
*/
public WrappedWindow(AbstractGraphicsConfiguration cfg, long surfaceHandle, int initialWidth, int initialHeight, boolean ownsDevice, long windowHandle) {
super(cfg, surfaceHandle, initialWidth, initialHeight, ownsDevice);
this.windowHandle = windowHandle;
}
/**
* @param cfg the {@link AbstractGraphicsConfiguration} to be used
* @param surfaceHandle the wrapped pre-existing native surface handle, maybe 0 if not yet determined
* @param upstream the {@link UpstreamSurfaceHook} to be used
* @param ownsDevice <code>true</code> if this {@link ProxySurface} instance
* owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice},
* otherwise <code>false</code>.
*/
public WrappedWindow(AbstractGraphicsConfiguration cfg, long surfaceHandle, UpstreamSurfaceHook upstream, boolean ownsDevice, long windowHandle) {
super(cfg, surfaceHandle, upstream, ownsDevice);
this.windowHandle = windowHandle;
}
@Override
public void destroy() {
}
@Override
public NativeWindow getParent() {
return null;
}
@Override
public long getWindowHandle() {
return windowHandle;
}
@Override
public InsetsImmutable getInsets() {
return insets;
}
@Override
public int getX() {
return 0;
}
@Override
public int getY() {
return 0;
}
@Override
public Point getLocationOnScreen(Point point) {
if(null!=point) {
return point;
} else {
return new Point(0, 0);
}
}
@Override
public boolean hasFocus() {
return false;
}
}
|