diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/gnu/gcj/xlib/Display.java | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libjava/gnu/gcj/xlib/Display.java')
-rw-r--r-- | libjava/gnu/gcj/xlib/Display.java | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/libjava/gnu/gcj/xlib/Display.java b/libjava/gnu/gcj/xlib/Display.java new file mode 100644 index 000000000..50ff1291b --- /dev/null +++ b/libjava/gnu/gcj/xlib/Display.java @@ -0,0 +1,105 @@ +/* Copyright (C) 1999, 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package gnu.gcj.xlib; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Vector; +import java.util.Enumeration; + +import gnu.gcj.RawData; + +/** + * A connection to an X11 display. + * + * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> + */ + +public class Display +{ + static + { + staticInit(); + } + + public Display() + { + init(); + } + + private static native void staticInit(); + private native void init(); + protected native void finalize(); + + RawData display = null; + + /* TODO?: Rather than storing such data here, we might consider + using the context manager facilities provided by Xlib... */ + private Dictionary xids = new Hashtable(); + + protected final void addXID(int xid, XID window) + { + xids.put(new Integer(xid), window); + } + + protected final void removeXID(int xid) + { + xids.remove(new Integer(xid)); + } + + public final Window getDefaultRootWindow() + { + int rootXID = getDefaultRootWindowXID(); + return getWindow(rootXID); + } + + public final XID getXID(int xid) + { + return (XID) xids.get(new Integer(xid)); + } + + public final Window getWindow(int xid) + { + Window window = (Window) getXID(xid); + if (window == null) + { + window = new Window(this, xid); + addXID(xid, window); + } + return window; + } + + public final Screen getDefaultScreen() + { + /* Screens objects are not cached since they are lightweight. + We just create a new object when requested. */ + return new Screen(this, getDefaultScreenNumber()); + } + + public final native int getDefaultScreenNumber(); + + private final native int getDefaultRootWindowXID(); + + private Dictionary atoms = new Hashtable(); + + public final int getAtom(String name) + { + Integer atomInt = (Integer) atoms.get(name); + if (atomInt == null) + return internAtom(name); + return atomInt.intValue(); + } + + // TODO?: cache reverse lookup too? + public final native String getAtomName(int atom); + + private final native int internAtom(String name); + + public native void flush(); +} |