1:
8:
9: package ;
10:
11: import ;
12:
13:
21: public final class Screen
22: {
23: static final int UNKNOWN = -1;
24:
25: Display display;
26: int screenNumber = UNKNOWN;
27: RawData structure;
28:
29: Screen(Display display, RawData screenStructure)
30: {
31: structure = screenStructure;
32: this.display = display;
33: }
34:
35: public Screen(Display display)
36: {
37: this(display, display.getDefaultScreenNumber());
38: }
39:
40: public Screen(Display display, int screenNumber)
41: {
42: this.display = display;
43: this.screenNumber = screenNumber;
44: initStructure();
45: }
46:
47: public final Display getDisplay()
48: {
49: return display;
50: }
51:
52: public Window getRootWindow()
53: {
54: int rootXID = getRootWindowXID();
55: return display.getWindow(rootXID);
56: }
57:
58: public Visual getRootVisual()
59: {
60: RawData visualStructure = getRootVisualStructure();
61: int depth = getRootDepth();
62: return new Visual(visualStructure, this, depth);
63: }
64:
65: private native RawData getRootVisualStructure();
66:
67: public native int getRootDepth();
68: public native int getRootWindowXID();
69: public native int getDefaultColormapXID();
70:
71: native void initStructure();
72:
73: public Colormap getDefaultColormap()
74: {
75: return new Colormap(this, getDefaultColormapXID());
76: }
77:
78: public final int getScreenNumber()
79: {
80: if (screenNumber == UNKNOWN)
81: screenNumber = findScreenNumber();
82: return screenNumber;
83: }
84:
85: public native int findScreenNumber();
86: }