2622c79d2d
* Makefile.am: Added rules for libgcjx library. * Makefile.in: Rebuilt. * configure.in: Added check for X. * configure: Rebuilt. * gnu/awt/LightweightRedirector.java: New file. * gnu/awt/j2d/AbstractGraphicsState.java: New file. * gnu/awt/j2d/DirectRasterGraphics.java: New file. * gnu/awt/j2d/Graphics2DImpl.java: New file. * gnu/awt/j2d/IntegerGraphicsState.java: New file. * gnu/awt/j2d/MappedRaster.java: New file. * gnu/awt/xlib/XCanvasPeer.java: New file. * gnu/awt/xlib/XEventLoop.java: New file. * gnu/awt/xlib/XEventQueue.java: New file. * gnu/awt/xlib/XFontMetrics.java: New file. * gnu/awt/xlib/XFramePeer.java: New file. * gnu/awt/xlib/XGraphics.java: New file. * gnu/awt/xlib/XGraphicsConfiguration.java: New file. * gnu/awt/xlib/XPanelPeer.java: New file. * gnu/awt/xlib/XToolkit.java: New file. * gnu/gcj/xlib/Clip.java: New file. * gnu/gcj/xlib/Colormap.java: New file. * gnu/gcj/xlib/Display.java: New file. * gnu/gcj/xlib/Drawable.java: New file. * gnu/gcj/xlib/Font.java: New file. * gnu/gcj/xlib/GC.java: New file. * gnu/gcj/xlib/Pixmap.java: New file. * gnu/gcj/xlib/Screen.java: New file. * gnu/gcj/xlib/Visual.java: New file. * gnu/gcj/xlib/WMSizeHints.java: New file. * gnu/gcj/xlib/Window.java: New file. * gnu/gcj/xlib/WindowAttributes.java: New file. * gnu/gcj/xlib/XAnyEvent.java: New file. * gnu/gcj/xlib/XButtonEvent.java: New file. * gnu/gcj/xlib/XColor.java: New file. * gnu/gcj/xlib/XConfigureEvent.java: New file. * gnu/gcj/xlib/XConnectException.java: New file. * gnu/gcj/xlib/XEvent.java: New file. * gnu/gcj/xlib/XException.java: New file. * gnu/gcj/xlib/XExposeEvent.java: New file. * gnu/gcj/xlib/XID.java: New file. * gnu/gcj/xlib/XImage.java: New file. * gnu/gcj/xlib/XUnmapEvent.java: New file. * gnu/gcj/xlib/natClip.cc: New file. * gnu/gcj/xlib/natColormap.cc: New file. * gnu/gcj/xlib/natDisplay.cc: New file. * gnu/gcj/xlib/natDrawable.cc: New file. * gnu/gcj/xlib/natFont.cc: New file. * gnu/gcj/xlib/natGC.cc: New file. * gnu/gcj/xlib/natPixmap.cc: New file. * gnu/gcj/xlib/natScreen.cc: New file. * gnu/gcj/xlib/natVisual.cc: New file. * gnu/gcj/xlib/natWMSizeHints.cc: New file. * gnu/gcj/xlib/natWindow.cc: New file. * gnu/gcj/xlib/natWindowAttributes.cc: New file. * gnu/gcj/xlib/natXAnyEvent.cc: New file. * gnu/gcj/xlib/natXButtonEvent.cc: New file. * gnu/gcj/xlib/natXColor.cc: New file. * gnu/gcj/xlib/natXConfigureEvent.cc: New file. * gnu/gcj/xlib/natXException.cc: New file. * gnu/gcj/xlib/natXExposeEvent.cc: New file. * gnu/gcj/xlib/natXImage.cc: New file. * gnu/gcj/xlib/natXUnmapEvent.cc: New file. * java/awt/EventDispatchThread.java: Start thead on creation. From-SVN: r37005
106 lines
2.2 KiB
Java
106 lines
2.2 KiB
Java
/* 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();
|
|
}
|