* c-ubsan.c (ubsan_instrument_bounds): Don't skip instrumenting
[official-gcc.git] / libjava / gnu / gcj / xlib / Window.java
blob3ff3657c45c95da4e1ff7615ff3538cc59f30f19
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
7 details. */
9 package gnu.gcj.xlib;
11 import gnu.gcj.RawData;
12 import java.awt.Rectangle;
14 /**
15 * An X11 window.
17 * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
19 public class Window extends Drawable
21 // Must correspond with X.h definitions:
22 public static final int COPY_FROM_PARENT = 0;
23 public static final int INPUT_OUTPUT = 1;
24 public static final int INPUT_ONLY = 2;
26 public Window(Window parent, Rectangle bounds,
27 WindowAttributes attributes)
29 this(parent, bounds, attributes, null);
32 public Window(Window parent, Rectangle bounds,
33 WindowAttributes attributes, Visual visual)
35 this(parent, bounds, 0, attributes, COPY_FROM_PARENT, visual);
38 public Window(Window parent, Rectangle bounds, int borderWidth,
39 WindowAttributes attributes, int windowIOClass,
40 Visual visual)
42 this(parent.display,
43 parent.createChildXID(bounds, borderWidth, attributes,
44 windowIOClass, visual));
45 this.owned = true;
48 protected Window(Display display, int xid)
50 super(display, xid);
51 display.addXID(xid, this);
54 protected void finalize()
56 display.removeXID(xid);
57 if (owned)
59 destroy();
60 owned = false;
64 protected native void destroy();
66 protected native int createChildXID(Rectangle bounds,
67 int borderWidth,
68 WindowAttributes attributes,
69 int windowIOClass,
70 Visual visual);
72 public native void setAttributes(WindowAttributes attributes);
74 public native void map();
75 public native void unmap();
76 public native void toFront();
77 public native void toBack();
79 protected boolean owned = false;
81 public native void setProperty(int nameAtom, int typeAtom, byte[] data);
83 public void setProperty(int nameAtom, int typeAtom, String data)
85 int length = data.length();
86 byte[] byteData = new byte[length];
88 for (int i=0; i<length; i++)
89 byteData[i] = (byte) data.charAt(i);
91 setProperty(nameAtom, typeAtom, byteData);
94 public native void setWMProtocols(int[] atoms);
95 public native int[] getWMProtocols();
97 public void setProperty(String nameAtom, String typeAtom, String data)
99 int xaName = display.getAtom(nameAtom);
100 int xaType = display.getAtom(typeAtom);
102 setProperty(xaName, xaType, data);
105 public native void setBounds(int x, int y, int width, int height);