blob: 76809f3982e184dca65effb95aa3308e3e6c9bbc (
plain)
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
|
/*
* @(#) MSWin32HandleAccess.java
*/
package gl4java.jau.awt.windows;
import java.awt.Component;
import com.ms.awt.GraphicsX;
/**
* The ms-windows implementation for accessing the native window handle
*
* This class has no user servicable parts inside. It is
* used internally by GLFrame and by our package spoofed
* sun.awt classes that give us internal access to window
* variables that we need to set up the OpenGL drawing
* ontext
*
* @see WinHandleAccess
* @version 0.1, 3. JULY 1999
* @author Ron Cemer
*
*/
public class MSWin32HandleAccess
implements gl4java.jau.awt.WinHandleAccess
{
protected long window;
protected int depth;
/**
* @dll.import("USER32",auto)
*/
private static native int WindowFromDC(int hdc);
protected void achieveData(java.awt.Component c, java.awt.Graphics g)
{
window = (long) WindowFromDC(((GraphicsX)g).gdc.pGetDC());
depth = c.getColorModel().getPixelSize();
}
/**
*
* get the window handle
*/
public long getWinHandle(java.awt.Component c, java.awt.Graphics g)
{
achieveData(c, g);
return window;
}
/**
*
* get the color depth
*/
public int getWinDepth(java.awt.Component c, java.awt.Graphics g)
{
achieveData(c, g);
return depth;
}
}
|