From: Michael Koch Date: Sat, 17 Jul 2004 08:37:22 +0000 (+0000) Subject: 2004-07-17 Michael Koch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=316a1df4f4108959bdc5720e45818eb53bed6347;p=gcc.git 2004-07-17 Michael Koch * gnu/java/awt/EmbeddedWindow.java (static): Removed. (addNotify): Set peer via reflection. (setWindowPeer): Removed. * gnu/java/awt/natEmbeddedWindow.cc: Removed. * Makefile.am (nat_source_files): Removed gnu/java/awt/natEmbeddedWindow.cc. * Makefile.in: Regenerated. From-SVN: r84854 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index fea13dd3131..c634be84d3e 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,14 @@ +2004-07-17 Michael Koch + + * gnu/java/awt/EmbeddedWindow.java + (static): Removed. + (addNotify): Set peer via reflection. + (setWindowPeer): Removed. + * gnu/java/awt/natEmbeddedWindow.cc: Removed. + * Makefile.am (nat_source_files): + Removed gnu/java/awt/natEmbeddedWindow.cc. + * Makefile.in: Regenerated. + 2004-07-17 Richard Earnshaw * configure.in(ZIP, GCJH): Remove white space around '=' in variable diff --git a/libjava/Makefile.am b/libjava/Makefile.am index a7e79b4748e..5b1d3a635d7 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -2943,7 +2943,6 @@ gnu/gcj/runtime/natSharedLibLoader.cc \ gnu/gcj/runtime/natStackTrace.cc \ gnu/gcj/runtime/natStringBuffer.cc \ gnu/gcj/runtime/natVMClassLoader.cc \ -gnu/java/awt/natEmbeddedWindow.cc \ gnu/java/lang/natMainThread.cc \ gnu/java/net/natPlainDatagramSocketImpl.cc \ gnu/java/net/natPlainSocketImpl.cc \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index 0505da13e34..b66742359a0 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -2625,7 +2625,6 @@ gnu/gcj/runtime/natSharedLibLoader.cc \ gnu/gcj/runtime/natStackTrace.cc \ gnu/gcj/runtime/natStringBuffer.cc \ gnu/gcj/runtime/natVMClassLoader.cc \ -gnu/java/awt/natEmbeddedWindow.cc \ gnu/java/lang/natMainThread.cc \ gnu/java/net/natPlainDatagramSocketImpl.cc \ gnu/java/net/natPlainSocketImpl.cc \ @@ -2806,8 +2805,7 @@ gnu/gcj/convert/natOutput_SJIS.lo gnu/gcj/io/natSimpleSHSStream.lo \ gnu/gcj/io/shs.lo gnu/gcj/runtime/natFinalizerThread.lo \ gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \ gnu/gcj/runtime/natStackTrace.lo gnu/gcj/runtime/natStringBuffer.lo \ -gnu/gcj/runtime/natVMClassLoader.lo gnu/java/awt/natEmbeddedWindow.lo \ -gnu/java/lang/natMainThread.lo \ +gnu/gcj/runtime/natVMClassLoader.lo gnu/java/lang/natMainThread.lo \ gnu/java/net/natPlainDatagramSocketImpl.lo \ gnu/java/net/natPlainSocketImpl.lo \ gnu/java/net/protocol/core/natCoreInputStream.lo \ @@ -3171,7 +3169,6 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/gnu/java/awt/EventModifier.P \ .deps/gnu/java/awt/image/ImageDecoder.P \ .deps/gnu/java/awt/image/XBMDecoder.P \ -.deps/gnu/java/awt/natEmbeddedWindow.P \ .deps/gnu/java/awt/peer/ClasspathFontPeer.P \ .deps/gnu/java/awt/peer/EmbeddedWindowPeer.P \ .deps/gnu/java/awt/peer/GLightweightPeer.P \ diff --git a/libjava/gnu/java/awt/EmbeddedWindow.java b/libjava/gnu/java/awt/EmbeddedWindow.java index f938f55b791..5f1d71a8068 100644 --- a/libjava/gnu/java/awt/EmbeddedWindow.java +++ b/libjava/gnu/java/awt/EmbeddedWindow.java @@ -40,23 +40,20 @@ package gnu.java.awt; import gnu.classpath.Configuration; import gnu.java.awt.peer.EmbeddedWindowPeer; + +import java.awt.Component; import java.awt.Frame; import java.awt.Toolkit; +import java.lang.reflect.Field; /** * Represents an AWT window that can be embedded into another * application. * - * @author Michael Koch + * @author Michael Koch (konqueror@gmx.de) */ public class EmbeddedWindow extends Frame { - static - { - if (Configuration.INIT_LOAD_LIBRARY) - System.loadLibrary("javaawt"); - } - private long handle; /** @@ -93,14 +90,25 @@ public class EmbeddedWindow extends Frame throw new UnsupportedOperationException ("Embedded windows are not supported by the current peers: " + tk.getClass()); - setWindowPeer (((EmbeddedWindowSupport) tk).createEmbeddedWindow (this)); + // Circumvent the package-privateness of the AWT internal + // java.awt.Component.peer member variable. + try + { + Field peerField = Component.class.getDeclaredField("peer"); + peerField.set(this, ((EmbeddedWindowSupport) tk).createEmbeddedWindow (this)); + } + catch (IllegalAccessException e) + { + // This should never happen. + } + catch (NoSuchFieldException e) + { + // This should never happen. + } + super.addNotify(); } - // This method is only made native to circumvent the package-privateness of - // an AWT internal java.awt.Component.peer member variable. - native void setWindowPeer (EmbeddedWindowPeer peer); - /** * If the native peer for this embedded window has been created, * then setHandle will embed the window. If not, setHandle tells diff --git a/libjava/gnu/java/awt/natEmbeddedWindow.cc b/libjava/gnu/java/awt/natEmbeddedWindow.cc deleted file mode 100644 index 79cdd6797e0..00000000000 --- a/libjava/gnu/java/awt/natEmbeddedWindow.cc +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (C) 2003 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 -#include -#include - -void -gnu::java::awt::EmbeddedWindow::setWindowPeer (gnu::java::awt::peer::EmbeddedWindowPeer* w) -{ - if (!peer) - peer = reinterpret_cast< ::java::awt::peer::ComponentPeer *> (w); -}