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/Window.java | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.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/Window.java')
-rw-r--r-- | libjava/gnu/gcj/xlib/Window.java | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/libjava/gnu/gcj/xlib/Window.java b/libjava/gnu/gcj/xlib/Window.java new file mode 100644 index 000000000..3ff3657c4 --- /dev/null +++ b/libjava/gnu/gcj/xlib/Window.java @@ -0,0 +1,106 @@ +/* Copyright (C) 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 gnu.gcj.RawData; +import java.awt.Rectangle; + +/** + * An X11 window. + * + * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> + */ +public class Window extends Drawable +{ + // Must correspond with X.h definitions: + public static final int COPY_FROM_PARENT = 0; + public static final int INPUT_OUTPUT = 1; + public static final int INPUT_ONLY = 2; + + public Window(Window parent, Rectangle bounds, + WindowAttributes attributes) + { + this(parent, bounds, attributes, null); + } + + public Window(Window parent, Rectangle bounds, + WindowAttributes attributes, Visual visual) + { + this(parent, bounds, 0, attributes, COPY_FROM_PARENT, visual); + } + + public Window(Window parent, Rectangle bounds, int borderWidth, + WindowAttributes attributes, int windowIOClass, + Visual visual) + { + this(parent.display, + parent.createChildXID(bounds, borderWidth, attributes, + windowIOClass, visual)); + this.owned = true; + } + + protected Window(Display display, int xid) + { + super(display, xid); + display.addXID(xid, this); + } + + protected void finalize() + { + display.removeXID(xid); + if (owned) + { + destroy(); + owned = false; + } + } + + protected native void destroy(); + + protected native int createChildXID(Rectangle bounds, + int borderWidth, + WindowAttributes attributes, + int windowIOClass, + Visual visual); + + public native void setAttributes(WindowAttributes attributes); + + public native void map(); + public native void unmap(); + public native void toFront(); + public native void toBack(); + + protected boolean owned = false; + + public native void setProperty(int nameAtom, int typeAtom, byte[] data); + + public void setProperty(int nameAtom, int typeAtom, String data) + { + int length = data.length(); + byte[] byteData = new byte[length]; + + for (int i=0; i<length; i++) + byteData[i] = (byte) data.charAt(i); + + setProperty(nameAtom, typeAtom, byteData); + } + + public native void setWMProtocols(int[] atoms); + public native int[] getWMProtocols(); + + public void setProperty(String nameAtom, String typeAtom, String data) + { + int xaName = display.getAtom(nameAtom); + int xaType = display.getAtom(typeAtom); + + setProperty(xaName, xaType, data); + } + + public native void setBounds(int x, int y, int width, int height); +} |