1:
8:
9: package ;
10:
11: import ;
12: import ;
13: import ;
14: import ;
15:
16: import ;
17:
18:
23:
24: public class Display
25: {
26: static
27: {
28: staticInit();
29: }
30:
31: public Display()
32: {
33: init();
34: }
35:
36: private static native void staticInit();
37: private native void init();
38: protected native void finalize();
39:
40: RawData display = null;
41:
42:
44: private Dictionary xids = new Hashtable();
45:
46: protected final void addXID(int xid, XID window)
47: {
48: xids.put(new Integer(xid), window);
49: }
50:
51: protected final void removeXID(int xid)
52: {
53: xids.remove(new Integer(xid));
54: }
55:
56: public final Window getDefaultRootWindow()
57: {
58: int rootXID = getDefaultRootWindowXID();
59: return getWindow(rootXID);
60: }
61:
62: public final XID getXID(int xid)
63: {
64: return (XID) xids.get(new Integer(xid));
65: }
66:
67: public final Window getWindow(int xid)
68: {
69: Window window = (Window) getXID(xid);
70: if (window == null)
71: {
72: window = new Window(this, xid);
73: addXID(xid, window);
74: }
75: return window;
76: }
77:
78: public final Screen getDefaultScreen()
79: {
80:
82: return new Screen(this, getDefaultScreenNumber());
83: }
84:
85: public final native int getDefaultScreenNumber();
86:
87: private final native int getDefaultRootWindowXID();
88:
89: private Dictionary atoms = new Hashtable();
90:
91: public final int getAtom(String name)
92: {
93: Integer atomInt = (Integer) atoms.get(name);
94: if (atomInt == null)
95: return internAtom(name);
96: return atomInt.intValue();
97: }
98:
99:
100: public final native String getAtomName(int atom);
101:
102: private final native int internAtom(String name);
103:
104: public native void flush();
105: }