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
153 lines
4.0 KiB
Java
153 lines
4.0 KiB
Java
/* 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;
|
|
|
|
/**
|
|
* A visual determines how a color is encoded into a pixel/bitfield
|
|
* value. It does not determine how the pixel/bitfield value is
|
|
* encoded into the image data.
|
|
*
|
|
* <p>This class encapsulates all three Xlib representations of a
|
|
* visual.
|
|
*
|
|
* <ul>
|
|
*
|
|
* <li>int: visual id.
|
|
*
|
|
* <li>Visual: opaque data structure used by a lot of Xlib functions.
|
|
*
|
|
* <li>VisualInfo: transparent data structure that binds the visual to
|
|
* a certain screen and depth.
|
|
*
|
|
* </ul>
|
|
*
|
|
* <p>Implementation note: This class does not examine nor manipulate
|
|
* the Visual structure, since the X manual says the structure is
|
|
* opaque, and that XVisualInfo should be used instead.</p>
|
|
*
|
|
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
|
|
*/
|
|
public final class Visual
|
|
{
|
|
public static final int VC_STATIC_GRAY = 0,
|
|
VC_GRAY_SCALE = 1,
|
|
VC_STATIC_COLOR = 2,
|
|
VC_PSEUDO_COLOR = 3,
|
|
VC_TRUE_COLOR = 4,
|
|
VC_DIRECT_COLOR = 5;
|
|
|
|
protected static final int MASK_ID = 1 << 0,
|
|
MASK_SCREEN = 1 << 1,
|
|
MASK_DEPTH = 1 << 2,
|
|
MASK_CLASS = 1 << 3,
|
|
MASK_RED = 1 << 4,
|
|
MASK_GREEN = 1 << 5,
|
|
MASK_BLUE = 1 << 6,
|
|
MASK_COLORMAP_SIZE = 1 << 7,
|
|
MASK_BITS_PER_RGB = 1 << 8;
|
|
|
|
protected static final int MASK_ALL = MASK_ID
|
|
| MASK_SCREEN
|
|
| MASK_DEPTH
|
|
| MASK_CLASS
|
|
| MASK_RED
|
|
| MASK_GREEN
|
|
| MASK_BLUE
|
|
| MASK_COLORMAP_SIZE
|
|
| MASK_BITS_PER_RGB;
|
|
|
|
private static final int MASK_VISUAL_STRUCTURE = 1 << 31;
|
|
|
|
Display display;
|
|
RawData xVisualInfo;
|
|
int infoMask;
|
|
Screen screen;
|
|
|
|
Visual(RawData structure, Screen screen, int depth )
|
|
{
|
|
this.display = screen.getDisplay();
|
|
this.screen = screen;
|
|
init(structure, depth);
|
|
}
|
|
|
|
Visual(Display display, RawData structure, int depth )
|
|
{
|
|
this.display = display;
|
|
init(structure, depth);
|
|
}
|
|
|
|
protected native void init(RawData structure, int depth);
|
|
|
|
protected native void finalize();
|
|
|
|
/**
|
|
*
|
|
* Returns the a reference to the visual structure. This method has
|
|
* package accessibility since the data visual structure is only
|
|
* useful for direct Xlib calls.
|
|
*
|
|
* @return a pointer to the visual structure.
|
|
*/
|
|
native RawData getVisualStructure();
|
|
|
|
|
|
// These methods only make sense if the visual is decomposed:
|
|
|
|
public native int getRedMask();
|
|
public native int getGreenMask();
|
|
public native int getBlueMask();
|
|
|
|
public native int getScreenNumber();
|
|
public native int getDepth();
|
|
|
|
public Screen getScreen()
|
|
{
|
|
if (screen == null)
|
|
screen = new Screen(display, getScreenNumber());
|
|
return screen;
|
|
}
|
|
|
|
public native int getVisualClass();
|
|
|
|
public boolean hasRGBSubfields()
|
|
{
|
|
switch (getVisualClass())
|
|
{
|
|
case VC_TRUE_COLOR:
|
|
case VC_DIRECT_COLOR:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
protected native void ensureXVisualInfo(int requiredMask);
|
|
|
|
|
|
public String toString()
|
|
{
|
|
int missingInfo = ~infoMask;
|
|
boolean hasSubfieldInfo =
|
|
(missingInfo & (MASK_CLASS|MASK_RED|MASK_GREEN|MASK_BLUE)) == 0;
|
|
|
|
boolean hasDepth = (missingInfo & MASK_DEPTH) == 0;
|
|
|
|
return getClass().getName() + "[" +
|
|
(hasDepth ? "depth=" + getDepth() : "") +
|
|
(hasRGBSubfields() ?
|
|
(", redMask=" + Integer.toHexString(getRedMask()) +
|
|
", greenMask=" + Integer.toHexString(getGreenMask()) +
|
|
", blueMask=" + Integer.toHexString(getBlueMask())) :
|
|
", no-subfields") + ", class=" + getVisualClass() +
|
|
"]";
|
|
}
|
|
}
|