gcc/libjava/gnu/gcj/xlib/natWindowAttributes.cc
Rolf W. Rasmussen 2622c79d2d Makefile.am: Added rules for libgcjx library.
* 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
2000-10-22 17:46:09 +00:00

110 lines
2.8 KiB
C++

/* 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. */
#include <X11/Xlib.h>
#include <gcj/cni.h>
#include <gnu/gcj/RawData.h>
#include <gnu/gcj/xlib/Display.h>
#include <gnu/gcj/xlib/Window.h>
#include <gnu/gcj/xlib/WindowAttributes.h>
#include <gnu/gcj/xlib/Pixmap.h>
#include <gnu/gcj/xlib/XException.h>
#include <gnu/gcj/xlib/Screen.h>
#include <gnu/gcj/xlib/Visual.h>
void gnu::gcj::xlib::WindowAttributes::initFromWindow(Window* from)
{
display = from->getDisplay();
::Display* dpy = (::Display*) display->display;
::Window win = from->getXID();
XWindowAttributes* attributesIn = new XWindowAttributes;
in = reinterpret_cast<gnu::gcj::RawData*>(attributesIn);
Status status = XGetWindowAttributes(dpy, win, attributesIn);
if ((status == BadDrawable) | (status == BadWindow))
JvThrow(new XException(display, status));
}
void gnu::gcj::xlib::WindowAttributes::init(WindowAttributes* copyFrom)
{
XSetWindowAttributes* attributes = new XSetWindowAttributes;
if (copyFrom != 0)
{
XSetWindowAttributes* from =
(XSetWindowAttributes*) copyFrom->out;
(*attributes) = (*from);
}
out = reinterpret_cast<gnu::gcj::RawData*>(attributes);
}
void gnu::gcj::xlib::WindowAttributes::finalize()
{
delete in; in = 0;
delete out; out = 0;
}
void gnu::gcj::xlib::WindowAttributes::setBackground(jlong pixel)
{
XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
attributes->background_pixel = pixel;
mask = mask | CWBackPixel;
}
void gnu::gcj::xlib::WindowAttributes::setBackground(Pixmap* pixmap)
{
XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
attributes->background_pixmap = pixmap->getXID();
mask = mask | CWBackPixmap;
}
void gnu::gcj::xlib::WindowAttributes::setEventMask(jlong eventMask)
{
XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
attributes->event_mask = eventMask;
mask = mask | CWEventMask;
}
gnu::gcj::xlib::Visual* gnu::gcj::xlib::WindowAttributes::getVisual()
{
if (in == 0)
return 0;
XWindowAttributes* attributesIn = (XWindowAttributes*) in;
gnu::gcj::RawData* screenRef =
reinterpret_cast<gnu::gcj::RawData*>(attributesIn->screen);
Screen* screen = new Screen(display, screenRef);
gnu::gcj::RawData* visualRef =
reinterpret_cast<gnu::gcj::RawData*>(attributesIn->visual);
return new gnu::gcj::xlib::Visual(visualRef, screen, attributesIn->depth);
}
void gnu::gcj::xlib::WindowAttributes::apply(Window* window)
{
::Display* dpy = (::Display*) window->getDisplay()->display;
::Window win = window->getXID();
XSetWindowAttributes* attributes = (XSetWindowAttributes*) out;
XChangeWindowAttributes(dpy, win, mask, attributes);
}