1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 import gnu
.gcj
.RawData
;
14 * A flyweight class that denotes an X11 screen. Display and screen
15 * number is the only data kept by this class. The real screen
16 * structure is stored in the display. There may exist several
17 * objects denoting the same screen.
19 * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
21 public final class Screen
23 static final int UNKNOWN
= -1;
26 int screenNumber
= UNKNOWN
;
29 Screen(Display display
, RawData screenStructure
)
31 structure
= screenStructure
;
32 this.display
= display
;
35 public Screen(Display display
)
37 this(display
, display
.getDefaultScreenNumber());
40 public Screen(Display display
, int screenNumber
)
42 this.display
= display
;
43 this.screenNumber
= screenNumber
;
47 public final Display
getDisplay()
52 public Window
getRootWindow()
54 int rootXID
= getRootWindowXID();
55 return display
.getWindow(rootXID
);
58 public Visual
getRootVisual()
60 RawData visualStructure
= getRootVisualStructure();
61 int depth
= getRootDepth();
62 return new Visual(visualStructure
, this, depth
);
65 private native RawData
getRootVisualStructure();
67 public native int getRootDepth();
68 public native int getRootWindowXID();
69 public native int getDefaultColormapXID();
71 native void initStructure();
73 public Colormap
getDefaultColormap()
75 return new Colormap(this, getDefaultColormapXID());
78 public final int getScreenNumber()
80 if (screenNumber
== UNKNOWN
)
81 screenNumber
= findScreenNumber();
85 public native int findScreenNumber();