Window.java (Window(Window,GraphicsConfiguration)): Don't try to find graphics configuration.
* java/awt/Window.java (Window(Window,GraphicsConfiguration)): Don't try to find graphics configuration. * java/awt/Toolkit.java (default_toolkit_name): Use new Configuration entry. * gnu/classpath/Configuration.java.in (default_awt_peer_toolkit): New global. * configure: Rebuilt. * configure.in (TOOLKIT): New subst. (--enable-java-awt) [xlib, gtk]: Set TOOLKIT if required. Do AWT tests much earlier. Run Gtk tests. Make jniinclude directory. Make output directories for .c files. * Makefile.in: Rebuilt. * Makefile.am (lib_gnu_java_awt_peer_gtk_la_SOURCES): New macro. (toolexeclib_LTLIBRARIES): Added cond_gtk_ltlibrary. (all_java_source_files): Added new sources. ($(lib_gnu_java_awt_peer_gtk_la_OBJECTS)): New target. (gtk_c_files): New macro. (gtk_c_source_files): New macro. (cond_gtk_ltlibrary): New macro. ($(gtk_c_files)): New target. (lib_gnu_java_awt_peer_gtk_la_LIBADD): New macro. (gtk_awt_peer_sources): New macro. (gtk_c_headers): New macro. ($(gtk_c_headers)): New target. (ACLOCAL_AMFLAGS): New macro. * gtk.m4, glib.m4, libart.m4: New files. * gnu/java/awt/peer/gtk/GdkFontMetrics.java, gnu/java/awt/peer/gtk/GdkGraphics.java, gnu/java/awt/peer/gtk/GtkArg.java, gnu/java/awt/peer/gtk/GtkArgList.java, gnu/java/awt/peer/gtk/GtkButtonPeer.java, gnu/java/awt/peer/gtk/GtkCanvasPeer.java, gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java, gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java, gnu/java/awt/peer/gtk/GtkCheckboxPeer.java, gnu/java/awt/peer/gtk/GtkChoicePeer.java, gnu/java/awt/peer/gtk/GtkClipboard.java, gnu/java/awt/peer/gtk/GtkComponentPeer.java, gnu/java/awt/peer/gtk/GtkContainerPeer.java, gnu/java/awt/peer/gtk/GtkDialogPeer.java, gnu/java/awt/peer/gtk/GtkFileDialogPeer.java, gnu/java/awt/peer/gtk/GtkFontPeer.java, gnu/java/awt/peer/gtk/GtkFramePeer.java, gnu/java/awt/peer/gtk/GtkGenericPeer.java, gnu/java/awt/peer/gtk/GtkImage.java, gnu/java/awt/peer/gtk/GtkImagePainter.java, gnu/java/awt/peer/gtk/GtkLabelPeer.java, gnu/java/awt/peer/gtk/GtkListPeer.java, gnu/java/awt/peer/gtk/GtkMainThread.java, gnu/java/awt/peer/gtk/GtkMenuBarPeer.java, gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java, gnu/java/awt/peer/gtk/GtkMenuItemPeer.java, gnu/java/awt/peer/gtk/GtkMenuPeer.java, gnu/java/awt/peer/gtk/GtkOffScreenImage.java, gnu/java/awt/peer/gtk/GtkPanelPeer.java, gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java, gnu/java/awt/peer/gtk/GtkScrollbarPeer.java, gnu/java/awt/peer/gtk/GtkScrollPanePeer.java, gnu/java/awt/peer/gtk/GtkTextAreaPeer.java, gnu/java/awt/peer/gtk/GtkTextComponentPeer.java, gnu/java/awt/peer/gtk/GtkTextFieldPeer.java, gnu/java/awt/peer/gtk/GtkToolkit.java, gnu/java/awt/peer/gtk/GtkWindowPeer.java, gnu/java/awt/peer/gtk/TestAWT.java, gnu/java/awt/peer/gtk/Test.java: New files from Classpath. * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c, jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c, jni/gtk-peer/gthread-jni.c, jni/gtk-peer/gthread-jni.h, jni/gtk-peer/gtkpeer.h, jni/classpath/jcl.c, jni/classpath/jcl.h, jni/classpath/jnilink.c, jni/classpath/jnilink.h, jni/classpath/native_state.c, jni/classpath/native_state.h, jni/classpath/primlib.c, jni/classpath/primlib.h: Likewise. From-SVN: r62187
This commit is contained in:
parent
371ac72558
commit
5aac1dac62
@ -1,3 +1,103 @@
|
||||
2003-01-31 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* java/awt/Window.java (Window(Window,GraphicsConfiguration)):
|
||||
Don't try to find graphics configuration.
|
||||
* java/awt/Toolkit.java (default_toolkit_name): Use new
|
||||
Configuration entry.
|
||||
* gnu/classpath/Configuration.java.in (default_awt_peer_toolkit):
|
||||
New global.
|
||||
* configure: Rebuilt.
|
||||
* configure.in (TOOLKIT): New subst.
|
||||
(--enable-java-awt) [xlib, gtk]: Set TOOLKIT if required.
|
||||
Do AWT tests much earlier. Run Gtk tests. Make jniinclude
|
||||
directory. Make output directories for .c files.
|
||||
* Makefile.in: Rebuilt.
|
||||
* Makefile.am (lib_gnu_java_awt_peer_gtk_la_SOURCES): New macro.
|
||||
(toolexeclib_LTLIBRARIES): Added cond_gtk_ltlibrary.
|
||||
(all_java_source_files): Added new sources.
|
||||
($(lib_gnu_java_awt_peer_gtk_la_OBJECTS)): New target.
|
||||
(gtk_c_files): New macro.
|
||||
(gtk_c_source_files): New macro.
|
||||
(cond_gtk_ltlibrary): New macro.
|
||||
($(gtk_c_files)): New target.
|
||||
(lib_gnu_java_awt_peer_gtk_la_LIBADD): New macro.
|
||||
(gtk_awt_peer_sources): New macro.
|
||||
(gtk_c_headers): New macro.
|
||||
($(gtk_c_headers)): New target.
|
||||
(ACLOCAL_AMFLAGS): New macro.
|
||||
* gtk.m4, glib.m4, libart.m4: New files.
|
||||
* gnu/java/awt/peer/gtk/GdkFontMetrics.java,
|
||||
gnu/java/awt/peer/gtk/GdkGraphics.java,
|
||||
gnu/java/awt/peer/gtk/GtkArg.java,
|
||||
gnu/java/awt/peer/gtk/GtkArgList.java,
|
||||
gnu/java/awt/peer/gtk/GtkButtonPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkCanvasPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkChoicePeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkClipboard.java,
|
||||
gnu/java/awt/peer/gtk/GtkComponentPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkContainerPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkDialogPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkFontPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkFramePeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkGenericPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkImage.java,
|
||||
gnu/java/awt/peer/gtk/GtkImagePainter.java,
|
||||
gnu/java/awt/peer/gtk/GtkLabelPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkListPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkMainThread.java,
|
||||
gnu/java/awt/peer/gtk/GtkMenuBarPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkMenuPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkOffScreenImage.java,
|
||||
gnu/java/awt/peer/gtk/GtkPanelPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkScrollbarPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkScrollPanePeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkTextComponentPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkTextFieldPeer.java,
|
||||
gnu/java/awt/peer/gtk/GtkToolkit.java,
|
||||
gnu/java/awt/peer/gtk/GtkWindowPeer.java,
|
||||
gnu/java/awt/peer/gtk/TestAWT.java,
|
||||
gnu/java/awt/peer/gtk/Test.java: New files from Classpath.
|
||||
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c,
|
||||
jni/gtk-peer/gthread-jni.c, jni/gtk-peer/gthread-jni.h,
|
||||
jni/gtk-peer/gtkpeer.h, jni/classpath/jcl.c, jni/classpath/jcl.h,
|
||||
jni/classpath/jnilink.c, jni/classpath/jnilink.h,
|
||||
jni/classpath/native_state.c, jni/classpath/native_state.h,
|
||||
jni/classpath/primlib.c, jni/classpath/primlib.h: Likewise.
|
||||
|
||||
2003-01-31 Julian Dolby <dolby@us.ibm.com>
|
||||
|
||||
* java/util/Properties.java (load): Ignore backslash before EOF.
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
ACLOCAL_AMFLAGS = -I .
|
||||
|
||||
if TESTSUBDIR
|
||||
SUBDIRS = $(DIRLTDL) testsuite gcj include
|
||||
else
|
||||
@ -23,7 +25,14 @@ cond_x_ltlibrary =
|
||||
xlib_includes =
|
||||
endif
|
||||
|
||||
toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary)
|
||||
if GTK_AWT
|
||||
cond_gtk_ltlibrary = lib-gnu-java-awt-peer-gtk.la
|
||||
else
|
||||
cond_gtk_ltlibrary =
|
||||
endif
|
||||
|
||||
toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la \
|
||||
$(cond_gtk_ltlibrary) $(cond_x_ltlibrary)
|
||||
toolexecmainlib_DATA = libgcj.spec
|
||||
|
||||
jardir = $(datadir)/java
|
||||
@ -115,6 +124,8 @@ nat_files = $(nat_source_files:.cc=.lo)
|
||||
x_nat_files = $(x_nat_source_files:.cc=.lo)
|
||||
## Objects from C sources in subdirs.
|
||||
c_files = $(c_source_files:.c=.lo)
|
||||
## Objects from gtk-related C sources in subdirs.
|
||||
gtk_c_files = $(gtk_c_source_files:.c=.lo)
|
||||
## Objects from Java sources in subdirs.
|
||||
javao_files = $(java_source_files:.java=.lo) \
|
||||
$(built_java_source_files:.java=.lo)
|
||||
@ -140,6 +151,102 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(THREADLIBS) \
|
||||
-version-info `grep -v '^\#' $(srcdir)/libtool-version`
|
||||
libgcj_la_LINK = $(LIBLINK)
|
||||
|
||||
## Gtk JNI sources.
|
||||
gtk_c_source_files = \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c \
|
||||
jni/gtk-peer/gthread-jni.c \
|
||||
jni/classpath/jcl.c \
|
||||
jni/classpath/jnilink.c \
|
||||
jni/classpath/native_state.c \
|
||||
jni/classpath/primlib.c
|
||||
|
||||
## Java sources for Gtk peers.
|
||||
gtk_awt_peer_sources = \
|
||||
gnu/java/awt/peer/gtk/GdkFontMetrics.java \
|
||||
gnu/java/awt/peer/gtk/GdkGraphics.java \
|
||||
gnu/java/awt/peer/gtk/GtkArg.java \
|
||||
gnu/java/awt/peer/gtk/GtkArgList.java \
|
||||
gnu/java/awt/peer/gtk/GtkButtonPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkCanvasPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkChoicePeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkClipboard.java \
|
||||
gnu/java/awt/peer/gtk/GtkComponentPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkContainerPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkDialogPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkFileDialogPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkFontPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkFramePeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkGenericPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkImage.java \
|
||||
gnu/java/awt/peer/gtk/GtkImagePainter.java \
|
||||
gnu/java/awt/peer/gtk/GtkLabelPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkListPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkMainThread.java \
|
||||
gnu/java/awt/peer/gtk/GtkMenuBarPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkMenuItemPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkMenuPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkOffScreenImage.java \
|
||||
gnu/java/awt/peer/gtk/GtkPanelPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkScrollPanePeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkScrollbarPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkTextAreaPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkTextComponentPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkTextFieldPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkToolkit.java \
|
||||
gnu/java/awt/peer/gtk/GtkWindowPeer.java
|
||||
|
||||
## FIXME: GNU make.
|
||||
gtk_c_headers = $(patsubst %.java,jniinclude/%.h,$(subst /,_,$(gtk_awt_peer_sources)))
|
||||
|
||||
$(gtk_c_headers): $(gtk_awt_peer_sources)
|
||||
## FIXME: GNU make.
|
||||
@input=`echo $@ | sed -e 's,jniinclude,,' -e 's,_,.,g' -e 's,.h$$,,'`; \
|
||||
echo "$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input"; \
|
||||
$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input
|
||||
|
||||
lib_gnu_java_awt_peer_gtk_la_SOURCES = \
|
||||
$(gtk_awt_peer_sources) \
|
||||
$(gtk_c_source_files) \
|
||||
jni/gtk-peer/gthread-jni.h \
|
||||
jni/gtk-peer/gtkpeer.h \
|
||||
jni/classpath/jcl.h \
|
||||
jni/classpath/jnilink.h \
|
||||
jni/classpath/native_state.h \
|
||||
jni/classpath/primlib.h
|
||||
|
||||
lib_gnu_java_awt_peer_gtk_la_LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(LIBART_LIBS)
|
||||
|
||||
lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \
|
||||
org/w3c/dom/CDATASection.java \
|
||||
org/w3c/dom/CharacterData.java \
|
||||
@ -220,6 +327,7 @@ all_java_source_files = \
|
||||
$(built_java_source_files) \
|
||||
$(lib_org_xml_sax_la_SOURCES) \
|
||||
$(lib_org_w3c_dom_la_SOURCES) \
|
||||
$(gtk_awt_peer_sources) \
|
||||
$(x_java_source_files)
|
||||
|
||||
all_java_class_files = $(all_java_source_files:.java=.class)
|
||||
@ -269,10 +377,19 @@ $(c_files): %.lo: %.c
|
||||
|
||||
$(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
|
||||
|
||||
## FIXME: GNU make.
|
||||
$(gtk_c_files): %.lo: %.c
|
||||
$(LTCOMPILE) -c -Ijniinclude -I$(srcdir)/jni/classpath -I$(srcdir)/jni/gtk-peer $(GTK_CFLAGS) $(LIBART_CFLAGS) -o $@ $<
|
||||
|
||||
$(gtk_c_files): $(gtk_c_headers)
|
||||
|
||||
## FIXME: GNU make.
|
||||
$(javao_files) $(x_javao_files) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS): %.lo: %.java
|
||||
$(GCJCOMPILE) -o $@ $<
|
||||
|
||||
$(gtk_awt_peer_sources:.java=.lo): %.lo: %.java
|
||||
$(GCJCOMPILE) -fjni -o $@ $<
|
||||
|
||||
## Pass the list of object files to libtool in a temporary file to
|
||||
## avoid tripping platform command line length limits.
|
||||
libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
|
||||
|
@ -84,10 +84,19 @@ GCLIBS = @GCLIBS@
|
||||
GCOBJS = @GCOBJS@
|
||||
GCSPEC = @GCSPEC@
|
||||
GCTESTSPEC = @GCTESTSPEC@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_CONFIG = @GLIB_CONFIG@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_CONFIG = @GTK_CONFIG@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
|
||||
INCLTDL = @INCLTDL@
|
||||
INTERPRETER = @INTERPRETER@
|
||||
JC1GCSPEC = @JC1GCSPEC@
|
||||
LIBART_CFLAGS = @LIBART_CFLAGS@
|
||||
LIBART_CONFIG = @LIBART_CONFIG@
|
||||
LIBART_LIBS = @LIBART_LIBS@
|
||||
LIBFFI = @LIBFFI@
|
||||
LIBGCJDEBUG = @LIBGCJDEBUG@
|
||||
LIBGCJTESTSPEC = @LIBGCJTESTSPEC@
|
||||
@ -116,6 +125,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
|
||||
THREADLIBS = @THREADLIBS@
|
||||
THREADOBJS = @THREADOBJS@
|
||||
THREADSPEC = @THREADSPEC@
|
||||
TOOLKIT = @TOOLKIT@
|
||||
VERSION = @VERSION@
|
||||
ZINCS = @ZINCS@
|
||||
ZLIBS = @ZLIBS@
|
||||
@ -132,14 +142,20 @@ toolexeclibdir = @toolexeclibdir@
|
||||
toolexecmainlibdir = @toolexecmainlibdir@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
ACLOCAL_AMFLAGS = -I .
|
||||
@TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
|
||||
@TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
|
||||
@XLIB_AWT_TRUE@cond_x_ltlibrary = @XLIB_AWT_TRUE@libgcjx.la
|
||||
@XLIB_AWT_FALSE@cond_x_ltlibrary =
|
||||
@XLIB_AWT_TRUE@xlib_includes = @XLIB_AWT_TRUE@-I../libstdc++-v3/include -I../libstdc++-v3/include/$(target_alias) -I$(srcdir)/../libstdc++-v3/libsupc++
|
||||
@XLIB_AWT_FALSE@xlib_includes =
|
||||
@GTK_AWT_TRUE@cond_gtk_ltlibrary = @GTK_AWT_TRUE@lib-gnu-java-awt-peer-gtk.la
|
||||
@GTK_AWT_FALSE@cond_gtk_ltlibrary =
|
||||
|
||||
toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la \
|
||||
$(cond_gtk_ltlibrary) $(cond_x_ltlibrary)
|
||||
|
||||
toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary)
|
||||
toolexecmainlib_DATA = libgcj.spec
|
||||
|
||||
jardir = $(datadir)/java
|
||||
@ -191,6 +207,7 @@ INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
|
||||
nat_files = $(nat_source_files:.cc=.lo)
|
||||
x_nat_files = $(x_nat_source_files:.cc=.lo)
|
||||
c_files = $(c_source_files:.c=.lo)
|
||||
gtk_c_files = $(gtk_c_source_files:.c=.lo)
|
||||
javao_files = $(java_source_files:.java=.lo) \
|
||||
$(built_java_source_files:.java=.lo)
|
||||
|
||||
@ -220,6 +237,96 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(THREADLIBS) \
|
||||
|
||||
libgcj_la_LINK = $(LIBLINK)
|
||||
|
||||
gtk_c_source_files = \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c \
|
||||
jni/gtk-peer/gthread-jni.c \
|
||||
jni/classpath/jcl.c \
|
||||
jni/classpath/jnilink.c \
|
||||
jni/classpath/native_state.c \
|
||||
jni/classpath/primlib.c
|
||||
|
||||
|
||||
gtk_awt_peer_sources = \
|
||||
gnu/java/awt/peer/gtk/GdkFontMetrics.java \
|
||||
gnu/java/awt/peer/gtk/GdkGraphics.java \
|
||||
gnu/java/awt/peer/gtk/GtkArg.java \
|
||||
gnu/java/awt/peer/gtk/GtkArgList.java \
|
||||
gnu/java/awt/peer/gtk/GtkButtonPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkCanvasPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkChoicePeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkClipboard.java \
|
||||
gnu/java/awt/peer/gtk/GtkComponentPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkContainerPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkDialogPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkFileDialogPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkFontPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkFramePeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkGenericPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkImage.java \
|
||||
gnu/java/awt/peer/gtk/GtkImagePainter.java \
|
||||
gnu/java/awt/peer/gtk/GtkLabelPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkListPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkMainThread.java \
|
||||
gnu/java/awt/peer/gtk/GtkMenuBarPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkMenuItemPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkMenuPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkOffScreenImage.java \
|
||||
gnu/java/awt/peer/gtk/GtkPanelPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkScrollPanePeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkScrollbarPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkTextAreaPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkTextComponentPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkTextFieldPeer.java \
|
||||
gnu/java/awt/peer/gtk/GtkToolkit.java \
|
||||
gnu/java/awt/peer/gtk/GtkWindowPeer.java
|
||||
|
||||
|
||||
gtk_c_headers = $(patsubst %.java,jniinclude/%.h,$(subst /,_,$(gtk_awt_peer_sources)))
|
||||
|
||||
lib_gnu_java_awt_peer_gtk_la_SOURCES = \
|
||||
$(gtk_awt_peer_sources) \
|
||||
$(gtk_c_source_files) \
|
||||
jni/gtk-peer/gthread-jni.h \
|
||||
jni/gtk-peer/gtkpeer.h \
|
||||
jni/classpath/jcl.h \
|
||||
jni/classpath/jnilink.h \
|
||||
jni/classpath/native_state.h \
|
||||
jni/classpath/primlib.h
|
||||
|
||||
|
||||
lib_gnu_java_awt_peer_gtk_la_LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(LIBART_LIBS)
|
||||
|
||||
lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \
|
||||
org/w3c/dom/CDATASection.java \
|
||||
org/w3c/dom/CharacterData.java \
|
||||
@ -294,6 +401,7 @@ all_java_source_files = \
|
||||
$(built_java_source_files) \
|
||||
$(lib_org_xml_sax_la_SOURCES) \
|
||||
$(lib_org_w3c_dom_la_SOURCES) \
|
||||
$(gtk_awt_peer_sources) \
|
||||
$(x_java_source_files)
|
||||
|
||||
|
||||
@ -2309,6 +2417,75 @@ org/w3c/dom/traversal/DocumentTraversal.lo \
|
||||
org/w3c/dom/traversal/NodeFilter.lo \
|
||||
org/w3c/dom/traversal/NodeIterator.lo \
|
||||
org/w3c/dom/traversal/TreeWalker.lo
|
||||
lib_gnu_java_awt_peer_gtk_la_LDFLAGS =
|
||||
lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES =
|
||||
lib_gnu_java_awt_peer_gtk_la_OBJECTS = \
|
||||
gnu/java/awt/peer/gtk/GdkFontMetrics.lo \
|
||||
gnu/java/awt/peer/gtk/GdkGraphics.lo gnu/java/awt/peer/gtk/GtkArg.lo \
|
||||
gnu/java/awt/peer/gtk/GtkArgList.lo \
|
||||
gnu/java/awt/peer/gtk/GtkButtonPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkCanvasPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkCheckboxPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkChoicePeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkClipboard.lo \
|
||||
gnu/java/awt/peer/gtk/GtkComponentPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkContainerPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkDialogPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkFileDialogPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkFontPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkFramePeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkGenericPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkImage.lo \
|
||||
gnu/java/awt/peer/gtk/GtkImagePainter.lo \
|
||||
gnu/java/awt/peer/gtk/GtkLabelPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkListPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkMainThread.lo \
|
||||
gnu/java/awt/peer/gtk/GtkMenuBarPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkMenuComponentPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkMenuItemPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkMenuPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkOffScreenImage.lo \
|
||||
gnu/java/awt/peer/gtk/GtkPanelPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkPopupMenuPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkScrollPanePeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkScrollbarPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkTextAreaPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkTextComponentPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkTextFieldPeer.lo \
|
||||
gnu/java/awt/peer/gtk/GtkToolkit.lo \
|
||||
gnu/java/awt/peer/gtk/GtkWindowPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.lo \
|
||||
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.lo \
|
||||
jni/gtk-peer/gthread-jni.lo jni/classpath/jcl.lo \
|
||||
jni/classpath/jnilink.lo jni/classpath/native_state.lo \
|
||||
jni/classpath/primlib.lo
|
||||
libgcjx_la_OBJECTS = gnu/gcj/xlib/natClip.lo \
|
||||
gnu/gcj/xlib/natColormap.lo gnu/gcj/xlib/natDisplay.lo \
|
||||
gnu/gcj/xlib/natDrawable.lo gnu/gcj/xlib/natFont.lo \
|
||||
@ -2346,9 +2523,8 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DATA = $(jar_DATA) $(toolexecmainlib_DATA)
|
||||
|
||||
DIST_COMMON = README COPYING ChangeLog Makefile.am Makefile.in NEWS \
|
||||
THANKS acconfig.h acinclude.m4 aclocal.m4 configure configure.in \
|
||||
gcj/libgcj-config.h.in gcj/stamp-h2.in include/config.h.in \
|
||||
include/stamp-h1.in libgcj-test.spec.in libgcj.spec.in
|
||||
THANKS acinclude.m4 aclocal.m4 configure configure.in \
|
||||
libgcj-test.spec.in libgcj.spec.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@ -2448,6 +2624,43 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
||||
.deps/gnu/java/awt/GLightweightPeer.P \
|
||||
.deps/gnu/java/awt/image/ImageDecoder.P \
|
||||
.deps/gnu/java/awt/image/XBMDecoder.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GdkFontMetrics.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GdkGraphics.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkArg.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkArgList.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkButtonPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkCanvasPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkCheckboxPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkChoicePeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkClipboard.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkComponentPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkContainerPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkDialogPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkFileDialogPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkFontPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkFramePeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkGenericPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkImage.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkImagePainter.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkLabelPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkListPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkMainThread.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkMenuBarPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkMenuItemPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkMenuPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkOffScreenImage.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkPanelPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkScrollPanePeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkScrollbarPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkTextAreaPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkTextComponentPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkTextFieldPeer.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkToolkit.P \
|
||||
.deps/gnu/java/awt/peer/gtk/GtkWindowPeer.P \
|
||||
.deps/gnu/java/beans/BeanInfoEmbryo.P \
|
||||
.deps/gnu/java/beans/EmptyBeanInfo.P \
|
||||
.deps/gnu/java/beans/ExplicitBeanInfo.P \
|
||||
@ -3724,8 +3937,38 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
||||
.deps/javax/transaction/UserTransaction.P \
|
||||
.deps/javax/transaction/xa/XAException.P \
|
||||
.deps/javax/transaction/xa/XAResource.P \
|
||||
.deps/javax/transaction/xa/Xid.P .deps/jni.P .deps/no-threads.P \
|
||||
.deps/nogc.P .deps/org/w3c/dom/Attr.P .deps/org/w3c/dom/CDATASection.P \
|
||||
.deps/javax/transaction/xa/Xid.P .deps/jni.P .deps/jni/classpath/jcl.P \
|
||||
.deps/jni/classpath/jnilink.P .deps/jni/classpath/native_state.P \
|
||||
.deps/jni/classpath/primlib.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.P \
|
||||
.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.P \
|
||||
.deps/jni/gtk-peer/gthread-jni.P .deps/no-threads.P .deps/nogc.P \
|
||||
.deps/org/w3c/dom/Attr.P .deps/org/w3c/dom/CDATASection.P \
|
||||
.deps/org/w3c/dom/CharacterData.P .deps/org/w3c/dom/Comment.P \
|
||||
.deps/org/w3c/dom/DOMException.P .deps/org/w3c/dom/DOMImplementation.P \
|
||||
.deps/org/w3c/dom/Document.P .deps/org/w3c/dom/DocumentFragment.P \
|
||||
@ -3765,8 +4008,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
|
||||
.deps/org/xml/sax/helpers/XMLReaderFactory.P .deps/posix-threads.P \
|
||||
.deps/posix.P .deps/prims.P .deps/resolve.P .deps/verify.P \
|
||||
.deps/win32-threads.P .deps/win32.P
|
||||
SOURCES = $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(lib_org_xml_sax_la_SOURCES) $(lib_org_w3c_dom_la_SOURCES) $(libgcjx_la_SOURCES) $(EXTRA_libgcjx_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(rmic_SOURCES) $(EXTRA_rmic_SOURCES) $(rmiregistry_SOURCES) $(EXTRA_rmiregistry_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
|
||||
OBJECTS = $(libgcj_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS) $(lib_org_w3c_dom_la_OBJECTS) $(libgcjx_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(rmic_OBJECTS) $(rmiregistry_OBJECTS) $(gen_from_JIS_OBJECTS)
|
||||
SOURCES = $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(lib_org_xml_sax_la_SOURCES) $(lib_org_w3c_dom_la_SOURCES) $(lib_gnu_java_awt_peer_gtk_la_SOURCES) $(libgcjx_la_SOURCES) $(EXTRA_libgcjx_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(rmic_SOURCES) $(EXTRA_rmic_SOURCES) $(rmiregistry_SOURCES) $(EXTRA_rmiregistry_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
|
||||
OBJECTS = $(libgcj_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS) $(lib_org_w3c_dom_la_OBJECTS) $(lib_gnu_java_awt_peer_gtk_la_OBJECTS) $(libgcjx_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(rmic_OBJECTS) $(rmiregistry_OBJECTS) $(gen_from_JIS_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
@ -3778,60 +4021,15 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4 \
|
||||
./acinclude.m4 ./aclocal.m4 ./glib.m4 ./gtk.m4 \
|
||||
./libart.m4
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
include/config.h: include/stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f include/stamp-h1; \
|
||||
$(MAKE) include/stamp-h1; \
|
||||
else :; fi
|
||||
include/stamp-h1: $(srcdir)/include/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=include/config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > include/stamp-h1 2> /dev/null
|
||||
$(srcdir)/include/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/include/stamp-h1.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/include/stamp-h1.in; \
|
||||
$(MAKE) $(srcdir)/include/stamp-h1.in; \
|
||||
else :; fi
|
||||
$(srcdir)/include/stamp-h1.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/include/stamp-h1.in 2> /dev/null
|
||||
|
||||
gcj/libgcj-config.h: gcj/stamp-h2
|
||||
@if test ! -f $@; then \
|
||||
rm -f gcj/stamp-h2; \
|
||||
$(MAKE) gcj/stamp-h2; \
|
||||
else :; fi
|
||||
gcj/stamp-h2: $(srcdir)/gcj/libgcj-config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=gcj/libgcj-config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > gcj/stamp-h2 2> /dev/null
|
||||
$(srcdir)/gcj/libgcj-config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/gcj/stamp-h2.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/gcj/stamp-h2.in; \
|
||||
$(MAKE) $(srcdir)/gcj/stamp-h2.in; \
|
||||
else :; fi
|
||||
$(srcdir)/gcj/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/gcj/stamp-h2.in 2> /dev/null
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f include/config.h gcj/libgcj-config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
libgcj.spec: $(top_builddir)/config.status libgcj.spec.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
libgcj-test.spec: $(top_builddir)/config.status libgcj-test.spec.in
|
||||
@ -3906,6 +4104,9 @@ lib-org-xml-sax.la: $(lib_org_xml_sax_la_OBJECTS) $(lib_org_xml_sax_la_DEPENDENC
|
||||
lib-org-w3c-dom.la: $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_w3c_dom_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(toolexeclibdir) $(lib_org_w3c_dom_la_LDFLAGS) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_w3c_dom_la_LIBADD) $(LIBS)
|
||||
|
||||
lib-gnu-java-awt-peer-gtk.la: $(lib_gnu_java_awt_peer_gtk_la_OBJECTS) $(lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(toolexeclibdir) $(lib_gnu_java_awt_peer_gtk_la_LDFLAGS) $(lib_gnu_java_awt_peer_gtk_la_OBJECTS) $(lib_gnu_java_awt_peer_gtk_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@ -4272,32 +4473,29 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-toolexeclibLTLIBRARIES \
|
||||
mostlyclean-compile mostlyclean-libtool \
|
||||
mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \
|
||||
mostlyclean-tags mostlyclean-depend mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-toolexeclibLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-binPROGRAMS \
|
||||
mostlyclean-noinstPROGRAMS mostlyclean-tags \
|
||||
mostlyclean-depend mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
clean-am: clean-hdr clean-toolexeclibLTLIBRARIES clean-compile \
|
||||
clean-libtool clean-binPROGRAMS clean-noinstPROGRAMS \
|
||||
clean-tags clean-depend clean-generic mostlyclean-am \
|
||||
clean-local
|
||||
clean-am: clean-toolexeclibLTLIBRARIES clean-compile clean-libtool \
|
||||
clean-binPROGRAMS clean-noinstPROGRAMS clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am clean-local
|
||||
|
||||
clean: clean-recursive
|
||||
|
||||
distclean-am: distclean-hdr distclean-toolexeclibLTLIBRARIES \
|
||||
distclean-compile distclean-libtool \
|
||||
distclean-binPROGRAMS distclean-noinstPROGRAMS \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
distclean-am: distclean-toolexeclibLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-binPROGRAMS \
|
||||
distclean-noinstPROGRAMS distclean-tags \
|
||||
distclean-depend distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr \
|
||||
maintainer-clean-toolexeclibLTLIBRARIES \
|
||||
maintainer-clean-am: maintainer-clean-toolexeclibLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-noinstPROGRAMS maintainer-clean-tags \
|
||||
@ -4309,9 +4507,9 @@ maintainer-clean-am: maintainer-clean-hdr \
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-toolexeclibLTLIBRARIES distclean-toolexeclibLTLIBRARIES \
|
||||
clean-toolexeclibLTLIBRARIES maintainer-clean-toolexeclibLTLIBRARIES \
|
||||
.PHONY: mostlyclean-toolexeclibLTLIBRARIES \
|
||||
distclean-toolexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES \
|
||||
maintainer-clean-toolexeclibLTLIBRARIES \
|
||||
uninstall-toolexeclibLTLIBRARIES install-toolexeclibLTLIBRARIES \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
||||
@ -4337,6 +4535,11 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(gtk_c_headers): $(gtk_awt_peer_sources)
|
||||
@input=`echo $@ | sed -e 's,jniinclude,,' -e 's,_,.,g' -e 's,.h$$,,'`; \
|
||||
echo "$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input"; \
|
||||
$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input
|
||||
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(libdir) && \
|
||||
if test -f libgcjx.la; then \
|
||||
@ -4377,9 +4580,17 @@ $(c_files): %.lo: %.c
|
||||
|
||||
$(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
|
||||
|
||||
$(gtk_c_files): %.lo: %.c
|
||||
$(LTCOMPILE) -c -Ijniinclude -I$(srcdir)/jni/classpath -I$(srcdir)/jni/gtk-peer $(GTK_CFLAGS) $(LIBART_CFLAGS) -o $@ $<
|
||||
|
||||
$(gtk_c_files): $(gtk_c_headers)
|
||||
|
||||
$(javao_files) $(x_javao_files) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS): %.lo: %.java
|
||||
$(GCJCOMPILE) -o $@ $<
|
||||
|
||||
$(gtk_awt_peer_sources:.java=.lo): %.lo: %.java
|
||||
$(GCJCOMPILE) -fjni -o $@ $<
|
||||
|
||||
libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
|
||||
@: $(shell echo Creating list of files to link...) $(shell rm -f libgcj.objectlist || :) $(shell touch libgcj.objectlist) $(foreach object,$(libgcj_la_OBJECTS) $(libgcj_la_LIBADD),$(shell echo $(object) >> libgcj.objectlist))
|
||||
$(libgcj_la_LINK) -objectlist libgcj.objectlist \
|
||||
|
574
libjava/aclocal.m4
vendored
574
libjava/aclocal.m4
vendored
@ -1,6 +1,6 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4-p5
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
@ -271,7 +271,7 @@ AC_DEFUN([AM_LC_MESSAGES],
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
@ -299,7 +299,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
@ -340,7 +340,7 @@ AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
@ -359,7 +359,7 @@ AC_SUBST($1)])
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN([AM_MAINTAINER_MODE],
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
@ -376,7 +376,7 @@ AC_DEFUN([AM_MAINTAINER_MODE],
|
||||
|
||||
# Define a conditional.
|
||||
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
AC_DEFUN(AM_CONDITIONAL,
|
||||
[AC_SUBST($1_TRUE)
|
||||
AC_SUBST($1_FALSE)
|
||||
if $2; then
|
||||
@ -389,7 +389,7 @@ fi])
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN([AM_CONFIG_HEADER],
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
@ -410,3 +410,561 @@ for am_file in <<$1>>; do
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
# Configure paths for GTK+
|
||||
# Owen Taylor 97-11-3
|
||||
|
||||
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_GTK,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the gtk-config script
|
||||
dnl
|
||||
AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
|
||||
gtk_config_prefix="$withval", gtk_config_prefix="")
|
||||
AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
|
||||
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
|
||||
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
|
||||
, enable_gtktest=yes)
|
||||
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gthread)
|
||||
gtk_config_args="$gtk_config_args gthread"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test x$gtk_config_exec_prefix != x ; then
|
||||
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
|
||||
if test x${GTK_CONFIG+set} != xset ; then
|
||||
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
|
||||
fi
|
||||
fi
|
||||
if test x$gtk_config_prefix != x ; then
|
||||
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
|
||||
if test x${GTK_CONFIG+set} != xset ; then
|
||||
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
|
||||
min_gtk_version=ifelse([$1], ,0.99.7,$1)
|
||||
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
|
||||
no_gtk=""
|
||||
if test "$GTK_CONFIG" = "no" ; then
|
||||
no_gtk=yes
|
||||
else
|
||||
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
|
||||
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
|
||||
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_gtktest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$GTK_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GTK is sufficiently new. (Also sanity
|
||||
dnl checks the results of gtk-config to some extent
|
||||
dnl
|
||||
rm -f conf.gtktest
|
||||
AC_TRY_RUN([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.gtktest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_gtk_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_gtk_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((gtk_major_version != $gtk_config_major_version) ||
|
||||
(gtk_minor_version != $gtk_config_minor_version) ||
|
||||
(gtk_micro_version != $gtk_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
|
||||
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf ("*** was found! If gtk-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
|
||||
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
|
||||
printf("*** before re-running configure\n");
|
||||
}
|
||||
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
|
||||
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
|
||||
(gtk_minor_version != GTK_MINOR_VERSION) ||
|
||||
(gtk_micro_version != GTK_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
|
||||
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
}
|
||||
#endif /* defined (GTK_MAJOR_VERSION) ... */
|
||||
else
|
||||
{
|
||||
if ((gtk_major_version > major) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of gtk-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_gtk" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$GTK_CONFIG" = "no" ; then
|
||||
echo "*** The gtk-config script installed by GTK could not be found"
|
||||
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the GTK_CONFIG environment variable to the"
|
||||
echo "*** full path to gtk-config."
|
||||
else
|
||||
if test -f conf.gtktest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GTK test program, checking why..."
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$LIBS $GTK_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GTK or finding the wrong"
|
||||
echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||
echo "***"
|
||||
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
|
||||
echo "*** came with the system with the command"
|
||||
echo "***"
|
||||
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GTK was incorrectly installed"
|
||||
echo "*** or that you have moved GTK since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GTK_CFLAGS=""
|
||||
GTK_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
rm -f conf.gtktest
|
||||
])
|
||||
|
||||
# Configure paths for GLIB
|
||||
# Owen Taylor 97-11-3
|
||||
|
||||
dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
|
||||
dnl gthread is specified in MODULES, pass to glib-config
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_GLIB,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the glib-config script
|
||||
dnl
|
||||
AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
|
||||
glib_config_prefix="$withval", glib_config_prefix="")
|
||||
AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
|
||||
glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
|
||||
AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
|
||||
, enable_glibtest=yes)
|
||||
|
||||
if test x$glib_config_exec_prefix != x ; then
|
||||
glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
|
||||
if test x${GLIB_CONFIG+set} != xset ; then
|
||||
GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
|
||||
fi
|
||||
fi
|
||||
if test x$glib_config_prefix != x ; then
|
||||
glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
|
||||
if test x${GLIB_CONFIG+set} != xset ; then
|
||||
GLIB_CONFIG=$glib_config_prefix/bin/glib-config
|
||||
fi
|
||||
fi
|
||||
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gmodule)
|
||||
glib_config_args="$glib_config_args gmodule"
|
||||
;;
|
||||
gthread)
|
||||
glib_config_args="$glib_config_args gthread"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
|
||||
min_glib_version=ifelse([$1], ,0.99.7,$1)
|
||||
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
|
||||
no_glib=""
|
||||
if test "$GLIB_CONFIG" = "no" ; then
|
||||
no_glib=yes
|
||||
else
|
||||
GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
|
||||
GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
|
||||
glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_glibtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$GLIB_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
|
||||
dnl checks the results of glib-config to some extent
|
||||
dnl
|
||||
rm -f conf.glibtest
|
||||
AC_TRY_RUN([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.glibtest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_glib_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_glib_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((glib_major_version != $glib_config_major_version) ||
|
||||
(glib_minor_version != $glib_config_minor_version) ||
|
||||
(glib_micro_version != $glib_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
|
||||
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf ("*** was found! If glib-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
|
||||
printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
|
||||
printf("*** before re-running configure\n");
|
||||
}
|
||||
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
|
||||
(glib_minor_version != GLIB_MINOR_VERSION) ||
|
||||
(glib_micro_version != GLIB_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
|
||||
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((glib_major_version > major) ||
|
||||
((glib_major_version == major) && (glib_minor_version > minor)) ||
|
||||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the glib-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of glib-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_glib" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$GLIB_CONFIG" = "no" ; then
|
||||
echo "*** The glib-config script installed by GLIB could not be found"
|
||||
echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the GLIB_CONFIG environment variable to the"
|
||||
echo "*** full path to glib-config."
|
||||
else
|
||||
if test -f conf.glibtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GLIB test program, checking why..."
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$LIBS $GLIB_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
|
||||
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||
echo "***"
|
||||
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
|
||||
echo "*** came with the system with the command"
|
||||
echo "***"
|
||||
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
|
||||
echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GLIB_CFLAGS=""
|
||||
GLIB_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
rm -f conf.glibtest
|
||||
])
|
||||
|
||||
# Configure paths for LIBART
|
||||
# Raph Levien 98-11-18
|
||||
# stolen from Manish Singh 98-9-30
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
dnl AM_PATH_LIBART([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for LIBART, and define LIBART_CFLAGS and LIBART_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_LIBART,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the libart-config script
|
||||
dnl
|
||||
AC_ARG_WITH(libart-prefix,[ --with-libart-prefix=PFX Prefix where LIBART is installed (optional)],
|
||||
libart_prefix="$withval", libart_prefix="")
|
||||
AC_ARG_WITH(libart-exec-prefix,[ --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)],
|
||||
libart_exec_prefix="$withval", libart_exec_prefix="")
|
||||
AC_ARG_ENABLE(libarttest, [ --disable-libarttest Do not try to compile and run a test LIBART program],
|
||||
, enable_libarttest=yes)
|
||||
|
||||
if test x$libart_exec_prefix != x ; then
|
||||
libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
|
||||
if test x${LIBART_CONFIG+set} != xset ; then
|
||||
LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
|
||||
fi
|
||||
fi
|
||||
if test x$libart_prefix != x ; then
|
||||
libart_args="$libart_args --prefix=$libart_prefix"
|
||||
if test x${LIBART_CONFIG+set} != xset ; then
|
||||
LIBART_CONFIG=$libart_prefix/bin/libart-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(LIBART_CONFIG, libart-config, no)
|
||||
min_libart_version=ifelse([$1], ,0.2.5,$1)
|
||||
AC_MSG_CHECKING(for LIBART - version >= $min_libart_version)
|
||||
no_libart=""
|
||||
if test "$LIBART_CONFIG" = "no" ; then
|
||||
no_libart=yes
|
||||
else
|
||||
LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
|
||||
LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
|
||||
|
||||
libart_major_version=`$LIBART_CONFIG $libart_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_libarttest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $LIBART_CFLAGS"
|
||||
LIBS="$LIBS $LIBART_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed LIBART is sufficiently new. (Also sanity
|
||||
dnl checks the results of libart-config to some extent
|
||||
dnl
|
||||
rm -f conf.libarttest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libart_lgpl/libart.h>
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.libarttest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_libart_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_libart_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($libart_major_version > major) ||
|
||||
(($libart_major_version == major) && ($libart_minor_version > minor)) ||
|
||||
(($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
|
||||
printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
|
||||
printf("*** to point to the correct copy of libart-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
],, no_libart=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_libart" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$LIBART_CONFIG" = "no" ; then
|
||||
echo "*** The libart-config script installed by LIBART could not be found"
|
||||
echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the LIBART_CONFIG environment variable to the"
|
||||
echo "*** full path to libart-config."
|
||||
else
|
||||
if test -f conf.libarttest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run LIBART test program, checking why..."
|
||||
CFLAGS="$CFLAGS $LIBART_CFLAGS"
|
||||
LIBS="$LIBS $LIBART_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <libart_lgpl/libart.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding LIBART or finding the wrong"
|
||||
echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
|
||||
echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the libart-config script: $LIBART_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
LIBART_CFLAGS=""
|
||||
LIBART_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(LIBART_CFLAGS)
|
||||
AC_SUBST(LIBART_LIBS)
|
||||
rm -f conf.libarttest
|
||||
])
|
||||
|
||||
|
3167
libjava/configure
vendored
3167
libjava/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -289,6 +289,59 @@ AC_SUBST(ZLIBSPEC)
|
||||
ZLIBTESTSPEC=
|
||||
AC_SUBST(ZLIBTESTSPEC)
|
||||
|
||||
AC_PATH_XTRA
|
||||
|
||||
dnl Determine which AWT peer libraries to build
|
||||
AC_ARG_ENABLE(java-awt,
|
||||
[ --enable-java-awt list of AWT peer implementations to be built])
|
||||
|
||||
peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
|
||||
use_xlib_awt=""
|
||||
use_gtk_awt=""
|
||||
# The default toolkit to use is the first one specified.
|
||||
TOOLKIT=
|
||||
AC_SUBST(TOOLKIT)
|
||||
|
||||
for peer in $peerlibs ; do
|
||||
case $peer in
|
||||
xlib)
|
||||
if test "$no_x" = yes; then
|
||||
echo "*** xlib peers requested but no X library available" 1>&2
|
||||
exit 1
|
||||
else
|
||||
use_xlib_awt="yes"
|
||||
if test -z "$TOOLKIT"; then
|
||||
TOOLKIT=gnu.gnu.awt.xlib.XToolkit
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
gtk)
|
||||
if test "$no_x" = yes; then
|
||||
echo "*** xlib peers requested but no X library available" 1>&2
|
||||
exit 1
|
||||
else
|
||||
use_gtk_awt=yes
|
||||
if test -z "$TOOLKIT"; then
|
||||
TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
|
||||
fi
|
||||
test -d jniinclude || mkdir jniinclude
|
||||
fi
|
||||
;;
|
||||
no)
|
||||
use_xlib_awt=
|
||||
use_gtk_awt=
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
|
||||
AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
|
||||
|
||||
|
||||
dnl FIXME: this should be _libs on some hosts.
|
||||
libsubdir=.libs
|
||||
|
||||
@ -721,6 +774,15 @@ else
|
||||
AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=)
|
||||
fi
|
||||
|
||||
# Test for Gtk stuff, if asked for.
|
||||
if test "$use_gtk_awt" = yes; then
|
||||
AM_PATH_GTK(1.2.4,,exit 1)
|
||||
AM_PATH_GLIB(1.2.4,,exit 1,gthread)
|
||||
dnl XXX Fix me when libart.m4 has the compile test fixed!
|
||||
enable_libarttest=no
|
||||
AM_PATH_LIBART(2.1.0,,exit 1)
|
||||
fi
|
||||
|
||||
# On Solaris, and maybe other architectures, the Boehm collector
|
||||
# requires -ldl.
|
||||
if test "$GC" = boehm; then
|
||||
@ -757,7 +819,8 @@ CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
|
||||
if test ! -f gnu/classpath/Configuration.java; then
|
||||
test -d gnu || mkdir gnu
|
||||
test -d gnu/classpath || mkdir gnu/classpath
|
||||
sed 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
|
||||
sed -e 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
|
||||
-e 's,@TOOLKIT@,$TOOLKIT,' \
|
||||
< $srcdir/gnu/classpath/Configuration.java.in \
|
||||
> gnu/classpath/Configuration.java
|
||||
# We do not want to redirect the output of the grep below to /dev/null,
|
||||
@ -966,42 +1029,6 @@ else
|
||||
multilib_arg=
|
||||
fi
|
||||
|
||||
AC_PATH_XTRA
|
||||
|
||||
dnl Determine which AWT peer libraries to build
|
||||
AC_ARG_ENABLE(java-awt,
|
||||
[ --enable-java-awt list of AWT peer implementations to be built])
|
||||
|
||||
peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
|
||||
use_xlib_awt=""
|
||||
use_gtk_awt=""
|
||||
|
||||
for peer in $peerlibs ; do
|
||||
case $peer in
|
||||
xlib)
|
||||
if [test "$no_x" = yes]; then
|
||||
echo "*** xlib peers requested but no X library available" 1>&2
|
||||
exit 1
|
||||
else
|
||||
use_xlib_awt="yes"
|
||||
fi
|
||||
;;
|
||||
gtk)
|
||||
# Nothing, yet...
|
||||
;;
|
||||
no)
|
||||
use_xlib_awt=
|
||||
use_gtk_awt=
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
|
||||
AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
|
||||
|
||||
|
||||
here=`${PWDCMD-pwd}`
|
||||
@ -1023,10 +1050,10 @@ esac
|
||||
# builddir for the .java files.
|
||||
h=`${PWDCMD-pwd}`
|
||||
: > deps.mk
|
||||
( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' \) -print) ;
|
||||
find . \( -name '*.java' -o -name '*.cc' \) -print) | \
|
||||
( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) ;
|
||||
find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) | \
|
||||
fgrep -v testsuite | \
|
||||
sed -e 's/\.java/.d/'\;'s/\.cc/.d/' | \
|
||||
sed -e 's/\.java/.d/'\;'s/\.cc/.d/'\;'s/\.c/.d/' | \
|
||||
while read f; do
|
||||
echo "include $f" >> deps.mk
|
||||
test -f $f || {
|
||||
|
@ -85,10 +85,19 @@ GCLIBS = @GCLIBS@
|
||||
GCOBJS = @GCOBJS@
|
||||
GCSPEC = @GCSPEC@
|
||||
GCTESTSPEC = @GCTESTSPEC@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_CONFIG = @GLIB_CONFIG@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_CONFIG = @GTK_CONFIG@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
|
||||
INCLTDL = @INCLTDL@
|
||||
INTERPRETER = @INTERPRETER@
|
||||
JC1GCSPEC = @JC1GCSPEC@
|
||||
LIBART_CFLAGS = @LIBART_CFLAGS@
|
||||
LIBART_CONFIG = @LIBART_CONFIG@
|
||||
LIBART_LIBS = @LIBART_LIBS@
|
||||
LIBFFI = @LIBFFI@
|
||||
LIBFFIINCS = @LIBFFIINCS@
|
||||
LIBGCJDEBUG = @LIBGCJDEBUG@
|
||||
@ -118,6 +127,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
|
||||
THREADLIBS = @THREADLIBS@
|
||||
THREADOBJS = @THREADOBJS@
|
||||
THREADSPEC = @THREADSPEC@
|
||||
TOOLKIT = @TOOLKIT@
|
||||
VERSION = @VERSION@
|
||||
ZINCS = @ZINCS@
|
||||
ZLIBS = @ZLIBS@
|
||||
@ -129,6 +139,9 @@ here = @here@
|
||||
libgcj_basedir = @libgcj_basedir@
|
||||
mkinstalldirs = @mkinstalldirs@
|
||||
tool_include_dir = @tool_include_dir@
|
||||
toolexecdir = @toolexecdir@
|
||||
toolexeclibdir = @toolexeclibdir@
|
||||
toolexecmainlibdir = @toolexecmainlibdir@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
|
196
libjava/glib.m4
Normal file
196
libjava/glib.m4
Normal file
@ -0,0 +1,196 @@
|
||||
# Configure paths for GLIB
|
||||
# Owen Taylor 97-11-3
|
||||
|
||||
dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
|
||||
dnl gthread is specified in MODULES, pass to glib-config
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_GLIB,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the glib-config script
|
||||
dnl
|
||||
AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
|
||||
glib_config_prefix="$withval", glib_config_prefix="")
|
||||
AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
|
||||
glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
|
||||
AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
|
||||
, enable_glibtest=yes)
|
||||
|
||||
if test x$glib_config_exec_prefix != x ; then
|
||||
glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
|
||||
if test x${GLIB_CONFIG+set} != xset ; then
|
||||
GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
|
||||
fi
|
||||
fi
|
||||
if test x$glib_config_prefix != x ; then
|
||||
glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
|
||||
if test x${GLIB_CONFIG+set} != xset ; then
|
||||
GLIB_CONFIG=$glib_config_prefix/bin/glib-config
|
||||
fi
|
||||
fi
|
||||
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gmodule)
|
||||
glib_config_args="$glib_config_args gmodule"
|
||||
;;
|
||||
gthread)
|
||||
glib_config_args="$glib_config_args gthread"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
|
||||
min_glib_version=ifelse([$1], ,0.99.7,$1)
|
||||
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
|
||||
no_glib=""
|
||||
if test "$GLIB_CONFIG" = "no" ; then
|
||||
no_glib=yes
|
||||
else
|
||||
GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
|
||||
GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
|
||||
glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_glibtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$GLIB_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
|
||||
dnl checks the results of glib-config to some extent
|
||||
dnl
|
||||
rm -f conf.glibtest
|
||||
AC_TRY_RUN([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.glibtest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_glib_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_glib_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((glib_major_version != $glib_config_major_version) ||
|
||||
(glib_minor_version != $glib_config_minor_version) ||
|
||||
(glib_micro_version != $glib_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
|
||||
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf ("*** was found! If glib-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
|
||||
printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
|
||||
printf("*** before re-running configure\n");
|
||||
}
|
||||
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
|
||||
(glib_minor_version != GLIB_MINOR_VERSION) ||
|
||||
(glib_micro_version != GLIB_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
|
||||
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((glib_major_version > major) ||
|
||||
((glib_major_version == major) && (glib_minor_version > minor)) ||
|
||||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the glib-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of glib-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_glib" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$GLIB_CONFIG" = "no" ; then
|
||||
echo "*** The glib-config script installed by GLIB could not be found"
|
||||
echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the GLIB_CONFIG environment variable to the"
|
||||
echo "*** full path to glib-config."
|
||||
else
|
||||
if test -f conf.glibtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GLIB test program, checking why..."
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$LIBS $GLIB_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
|
||||
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||
echo "***"
|
||||
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
|
||||
echo "*** came with the system with the command"
|
||||
echo "***"
|
||||
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
|
||||
echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GLIB_CFLAGS=""
|
||||
GLIB_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
rm -f conf.glibtest
|
||||
])
|
@ -1,5 +1,5 @@
|
||||
/* gnu.classpath.Configuration
|
||||
Copyright (C) 1998, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@ -56,4 +56,7 @@ public interface Configuration
|
||||
boolean HAVE_NATIVE_GET_PROXY_DATA = false;
|
||||
boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
|
||||
boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
|
||||
|
||||
// Name of default AWT peer library.
|
||||
String default_awt_peer_toolkit = "@TOOLKIT@";
|
||||
}
|
||||
|
108
libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
Normal file
108
libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
Normal file
@ -0,0 +1,108 @@
|
||||
/* GdkFontMetrics.java
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GdkFontMetrics extends FontMetrics
|
||||
{
|
||||
private final int native_state = GtkGenericPeer.getUniqueInteger();
|
||||
|
||||
private static final int ASCENT = 0, MAX_ASCENT = 1,
|
||||
DESCENT = 2, MAX_DESCENT = 3,
|
||||
MAX_ADVANCE = 4;
|
||||
|
||||
private int[] metrics;
|
||||
private native int[] initState (String xlfd, int pts);
|
||||
|
||||
public GdkFontMetrics (Font font)
|
||||
{
|
||||
super (font);
|
||||
metrics = initState (((GtkFontPeer)font.getPeer ()).getXLFD (),
|
||||
font.getSize ());
|
||||
}
|
||||
|
||||
native public int stringWidth (String str);
|
||||
|
||||
public int charWidth (char ch)
|
||||
{
|
||||
return stringWidth (new String (new char[] { ch }));
|
||||
}
|
||||
|
||||
public int charsWidth (char data[], int off, int len)
|
||||
{
|
||||
return stringWidth (new String (data, off, len));
|
||||
}
|
||||
|
||||
/*
|
||||
Sun's Motif implementation always returns 0 or 1 here (???), but
|
||||
going by the X11 man pages, it seems as though we should return
|
||||
font.ascent + font.descent.
|
||||
*/
|
||||
public int getLeading ()
|
||||
{
|
||||
return 1;
|
||||
// return metrics[ASCENT] + metrics[DESCENT];
|
||||
}
|
||||
|
||||
public int getAscent ()
|
||||
{
|
||||
return metrics[ASCENT];
|
||||
}
|
||||
|
||||
public int getMaxAscent ()
|
||||
{
|
||||
return metrics[MAX_ASCENT];
|
||||
}
|
||||
|
||||
public int getDescent ()
|
||||
{
|
||||
return metrics[DESCENT];
|
||||
}
|
||||
|
||||
public int getMaxDescent ()
|
||||
{
|
||||
return metrics[MAX_DESCENT];
|
||||
}
|
||||
|
||||
public int getMaxAdvance ()
|
||||
{
|
||||
return metrics[MAX_ADVANCE];
|
||||
}
|
||||
}
|
322
libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
Normal file
322
libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
Normal file
@ -0,0 +1,322 @@
|
||||
/* GdkGraphics.java
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
|
||||
public class GdkGraphics extends Graphics
|
||||
{
|
||||
private final int native_state = GtkGenericPeer.getUniqueInteger();
|
||||
|
||||
Color color, xorColor;
|
||||
GtkComponentPeer component;
|
||||
Font font;
|
||||
Rectangle clip;
|
||||
|
||||
int xOffset = 0;
|
||||
int yOffset = 0;
|
||||
|
||||
static final int GDK_COPY = 0, GDK_XOR = 2;
|
||||
|
||||
native int[] initState (GtkComponentPeer component);
|
||||
native void initState (int width, int height);
|
||||
native void copyState (GdkGraphics g);
|
||||
|
||||
GdkGraphics (GdkGraphics g)
|
||||
{
|
||||
color = g.color;
|
||||
xorColor = g.xorColor;
|
||||
font = g.font;
|
||||
clip = new Rectangle (g.clip);
|
||||
component = g.component;
|
||||
|
||||
copyState (g);
|
||||
}
|
||||
|
||||
GdkGraphics (int width, int height)
|
||||
{
|
||||
initState (width, height);
|
||||
color = Color.black;
|
||||
clip = new Rectangle (0, 0, width, height);
|
||||
font = new Font ("Dialog", Font.PLAIN, 10);
|
||||
}
|
||||
|
||||
GdkGraphics (GtkComponentPeer component)
|
||||
{
|
||||
this.component = component;
|
||||
int rgb[] = initState (component);
|
||||
color = new Color (rgb[0], rgb[1], rgb[2]);
|
||||
font = new Font ("Dialog", Font.PLAIN, 10);
|
||||
Dimension d = component.awtComponent.getSize ();
|
||||
clip = new Rectangle (0, 0, d.width, d.height);
|
||||
}
|
||||
|
||||
public native void clearRect (int x, int y, int width, int height);
|
||||
|
||||
public void clipRect (int x, int y, int width, int height)
|
||||
{
|
||||
clip = clip.intersection (new Rectangle (x, y, width, height));
|
||||
setClipRectangle (clip.x, clip.y, clip.width, clip.height);
|
||||
}
|
||||
|
||||
native public void copyArea (int x, int y, int width, int height,
|
||||
int dx, int dy);
|
||||
|
||||
public Graphics create ()
|
||||
{
|
||||
return new GdkGraphics (this);
|
||||
}
|
||||
|
||||
// public Graphics create (int x, int y, int width, int height)
|
||||
// {
|
||||
// GdkGraphics g = new GdkGraphics (this);
|
||||
// System.out.println ("translating by: " + x +" " + y);
|
||||
// g.translate (x, y);
|
||||
// g.clipRect (0, 0, width, height);
|
||||
|
||||
// return g;
|
||||
// }
|
||||
|
||||
native public void dispose ();
|
||||
|
||||
native void copyPixmap (Graphics g, int x, int y, int width, int height);
|
||||
public boolean drawImage (Image img, int x, int y,
|
||||
Color bgcolor, ImageObserver observer)
|
||||
{
|
||||
if (img instanceof GtkOffScreenImage)
|
||||
{
|
||||
copyPixmap (img.getGraphics (),
|
||||
x, y, img.getWidth (null), img.getHeight (null));
|
||||
return true;
|
||||
}
|
||||
|
||||
GtkImage image = (GtkImage) img;
|
||||
new GtkImagePainter (image, this, x, y, -1, -1, bgcolor);
|
||||
return image.isLoaded ();
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int x, int y, ImageObserver observer)
|
||||
{
|
||||
if (img instanceof GtkOffScreenImage)
|
||||
{
|
||||
copyPixmap (img.getGraphics (),
|
||||
x, y, img.getWidth (null), img.getHeight (null));
|
||||
return true;
|
||||
}
|
||||
|
||||
return drawImage (img, x, y, component.getBackground (), observer);
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int x, int y, int width, int height,
|
||||
Color bgcolor, ImageObserver observer)
|
||||
{
|
||||
if (img instanceof GtkOffScreenImage)
|
||||
{
|
||||
throw new RuntimeException ();
|
||||
}
|
||||
|
||||
GtkImage image = (GtkImage) img;
|
||||
new GtkImagePainter (image, this, x, y, width, height, bgcolor);
|
||||
return image.isLoaded ();
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int x, int y, int width, int height,
|
||||
ImageObserver observer)
|
||||
{
|
||||
return drawImage (img, x, y, width, height, component.getBackground (),
|
||||
observer);
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
|
||||
int sx1, int sy1, int sx2, int sy2,
|
||||
Color bgcolor, ImageObserver observer)
|
||||
{
|
||||
if (img instanceof GtkOffScreenImage)
|
||||
{
|
||||
throw new RuntimeException ();
|
||||
}
|
||||
|
||||
GtkImage image = (GtkImage) img;
|
||||
new GtkImagePainter (image, this, dx1, dy1, dx2, dy2,
|
||||
sx1, sy1, sx2, sy2, bgcolor);
|
||||
return image.isLoaded ();
|
||||
}
|
||||
|
||||
public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
|
||||
int sx1, int sy1, int sx2, int sy2,
|
||||
ImageObserver observer)
|
||||
{
|
||||
return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,
|
||||
component.getBackground (), observer);
|
||||
}
|
||||
|
||||
native public void drawLine (int x1, int y1, int x2, int y2);
|
||||
|
||||
native public void drawArc (int x, int y, int width, int height,
|
||||
int startAngle, int arcAngle);
|
||||
native public void fillArc (int x, int y, int width, int height,
|
||||
int startAngle, int arcAngle);
|
||||
native public void drawOval(int x, int y, int width, int height);
|
||||
native public void fillOval(int x, int y, int width, int height);
|
||||
|
||||
native public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints);
|
||||
native public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints);
|
||||
|
||||
native public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints);
|
||||
|
||||
native public void drawRect(int x, int y, int width, int height);
|
||||
native public void fillRect (int x, int y, int width, int height);
|
||||
|
||||
native void drawString (String str, int x, int y, String fname, int size);
|
||||
public void drawString (String str, int x, int y)
|
||||
{
|
||||
drawString (str, x, y,
|
||||
((GtkFontPeer)font.getPeer ()).getXLFD (), font.getSize ());
|
||||
}
|
||||
|
||||
public void drawRoundRect(int x, int y, int width, int height,
|
||||
int arcWidth, int arcHeight)
|
||||
{
|
||||
// System.out.println ("drawRoundRect called [UNIMPLEMENTED]");
|
||||
}
|
||||
|
||||
public void fillRoundRect (int x, int y, int width, int height,
|
||||
int arcWidth, int arcHeight)
|
||||
{
|
||||
// System.out.println ("fillRoundRect called [UNIMPLEMENTED]");
|
||||
}
|
||||
|
||||
public Shape getClip ()
|
||||
{
|
||||
return getClipBounds ();
|
||||
}
|
||||
|
||||
public Rectangle getClipBounds ()
|
||||
{
|
||||
// System.out.println ("returning CLIP: " + clip);
|
||||
return new Rectangle (clip.x, clip.y, clip.width, clip.height);
|
||||
}
|
||||
|
||||
public Color getColor ()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
public Font getFont ()
|
||||
{
|
||||
return font;
|
||||
}
|
||||
|
||||
public FontMetrics getFontMetrics (Font font)
|
||||
{
|
||||
return new GdkFontMetrics (font);
|
||||
}
|
||||
|
||||
native void setClipRectangle (int x, int y, int width, int height);
|
||||
|
||||
public void setClip (int x, int y, int width, int height)
|
||||
{
|
||||
clip.x = x;
|
||||
clip.y = y;
|
||||
clip.width = width;
|
||||
clip.height = height;
|
||||
|
||||
setClipRectangle (x, y, width, height);
|
||||
}
|
||||
|
||||
public void setClip (Rectangle clip)
|
||||
{
|
||||
setClip (clip.x, clip.y, clip.width, clip.height);
|
||||
}
|
||||
|
||||
public void setClip (Shape clip)
|
||||
{
|
||||
setClip (clip.getBounds ());
|
||||
}
|
||||
|
||||
native private void setFGColor (int red, int green, int blue);
|
||||
|
||||
public void setColor (Color c)
|
||||
{
|
||||
color = c;
|
||||
|
||||
if (xorColor == null) /* paint mode */
|
||||
setFGColor (color.getRed (), color.getGreen (), color.getBlue ());
|
||||
else /* xor mode */
|
||||
setFGColor (color.getRed () ^ xorColor.getRed (),
|
||||
color.getGreen () ^ xorColor.getGreen (),
|
||||
color.getBlue () ^ xorColor.getBlue ());
|
||||
}
|
||||
|
||||
public void setFont (Font font)
|
||||
{
|
||||
this.font = font;
|
||||
}
|
||||
|
||||
native void setFunction (int gdk_func);
|
||||
|
||||
public void setPaintMode ()
|
||||
{
|
||||
xorColor = null;
|
||||
|
||||
setFunction (GDK_COPY);
|
||||
setFGColor (color.getRed (), color.getGreen (), color.getBlue ());
|
||||
}
|
||||
|
||||
public void setXORMode (Color c)
|
||||
{
|
||||
xorColor = c;
|
||||
|
||||
setFunction (GDK_XOR);
|
||||
setFGColor (color.getRed () ^ xorColor.getRed (),
|
||||
color.getGreen () ^ xorColor.getGreen (),
|
||||
color.getBlue () ^ xorColor.getBlue ());
|
||||
}
|
||||
|
||||
native public void translateNative (int x, int y);
|
||||
|
||||
public void translate (int x, int y)
|
||||
{
|
||||
clip.x -= x;
|
||||
clip.y -= y;
|
||||
|
||||
translateNative (x, y);
|
||||
}
|
||||
}
|
61
libjava/gnu/java/awt/peer/gtk/GtkArg.java
Normal file
61
libjava/gnu/java/awt/peer/gtk/GtkArg.java
Normal file
@ -0,0 +1,61 @@
|
||||
/* GtkArg.java
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
public class GtkArg
|
||||
{
|
||||
String name;
|
||||
Object value;
|
||||
|
||||
public GtkArg (String name, Object value)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName ()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public Object getValue ()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
75
libjava/gnu/java/awt/peer/gtk/GtkArgList.java
Normal file
75
libjava/gnu/java/awt/peer/gtk/GtkArgList.java
Normal file
@ -0,0 +1,75 @@
|
||||
/* GtkArgList.java
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GtkArgList extends Vector
|
||||
{
|
||||
void add (GtkArg arg)
|
||||
{
|
||||
addElement (arg);
|
||||
}
|
||||
|
||||
void add (String name, boolean value)
|
||||
{
|
||||
addElement (new GtkArg (name, new Boolean (value)));
|
||||
}
|
||||
|
||||
void add (String name, int value)
|
||||
{
|
||||
addElement (new GtkArg (name, new Integer (value)));
|
||||
}
|
||||
|
||||
void add (String name, float value)
|
||||
{
|
||||
addElement (new GtkArg (name, new Float (value)));
|
||||
}
|
||||
|
||||
void add (String name, Object value)
|
||||
{
|
||||
addElement (new GtkArg (name, value));
|
||||
}
|
||||
|
||||
synchronized void setArgs (GtkComponentPeer cp)
|
||||
{
|
||||
for (int i = 0; i < elementCount; i++)
|
||||
cp.set ((GtkArg)elementData[i]);
|
||||
}
|
||||
}
|
||||
|
89
libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
Normal file
89
libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
Normal file
@ -0,0 +1,89 @@
|
||||
/* GtkButtonPeer.java -- Implements ButtonPeer with GTK
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.peer.*;
|
||||
|
||||
public class GtkButtonPeer extends GtkComponentPeer
|
||||
implements ButtonPeer
|
||||
{
|
||||
native void create ();
|
||||
|
||||
public GtkButtonPeer (Button b)
|
||||
{
|
||||
super (b);
|
||||
}
|
||||
|
||||
public void setLabel (String label)
|
||||
{
|
||||
set ("label", label);
|
||||
}
|
||||
|
||||
public void handleEvent (AWTEvent e)
|
||||
{
|
||||
if (e.getID () == MouseEvent.MOUSE_CLICKED && isEnabled ()
|
||||
&& !modalHasGrab ())
|
||||
{
|
||||
MouseEvent me = (MouseEvent) e;
|
||||
if (!me.isConsumed ()
|
||||
&& (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0)
|
||||
postActionEvent (((Button)awtComponent).getActionCommand (),
|
||||
me.getModifiers ());
|
||||
}
|
||||
|
||||
if (e.getID () == KeyEvent.KEY_PRESSED)
|
||||
{
|
||||
KeyEvent ke = (KeyEvent) e;
|
||||
if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_SPACE)
|
||||
postActionEvent (((Button)awtComponent).getActionCommand (),
|
||||
ke.getModifiers ());
|
||||
}
|
||||
|
||||
super.handleEvent (e);
|
||||
}
|
||||
|
||||
public void getArgs (Component component, GtkArgList args)
|
||||
{
|
||||
super.getArgs (component, args);
|
||||
|
||||
args.add ("label", ((Button)component).getLabel ());
|
||||
}
|
||||
}
|
92
libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java
Normal file
92
libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java
Normal file
@ -0,0 +1,92 @@
|
||||
/* GtkCanvasPeer.java
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.event.PaintEvent;
|
||||
import java.awt.peer.*;
|
||||
|
||||
public class GtkCanvasPeer extends GtkComponentPeer implements CanvasPeer
|
||||
{
|
||||
native void create ();
|
||||
|
||||
public GtkCanvasPeer (Canvas c)
|
||||
{
|
||||
super (c);
|
||||
}
|
||||
|
||||
public Graphics getGraphics ()
|
||||
{
|
||||
return new GdkGraphics (this);
|
||||
}
|
||||
|
||||
public void handleEvent (AWTEvent event)
|
||||
{
|
||||
int id = event.getID();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case PaintEvent.PAINT:
|
||||
case PaintEvent.UPDATE:
|
||||
{
|
||||
try
|
||||
{
|
||||
Graphics g = getGraphics ();
|
||||
g.setClip (((PaintEvent)event).getUpdateRect());
|
||||
|
||||
if (id == PaintEvent.PAINT)
|
||||
awtComponent.paint (g);
|
||||
else
|
||||
awtComponent.update (g);
|
||||
|
||||
g.dispose ();
|
||||
}
|
||||
catch (InternalError e)
|
||||
{
|
||||
System.err.println (e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Preferred size for a drawing widget is always what the user requested */
|
||||
public Dimension getPreferredSize ()
|
||||
{
|
||||
return awtComponent.getSize ();
|
||||
}
|
||||
}
|
86
libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java
Normal file
86
libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java
Normal file
@ -0,0 +1,86 @@
|
||||
/* GtkCheckboxGroupPeer.java - Wrap a CheckboxGroup
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
|
||||
// Note that there is no peer interface for a CheckboxGroup. We
|
||||
// introduce our own in order to make it easier to keep a piece of
|
||||
// native state for each one.
|
||||
public class GtkCheckboxGroupPeer extends GtkGenericPeer
|
||||
{
|
||||
// This maps from a CheckboxGroup to the native peer.
|
||||
private static WeakHashMap map = new WeakHashMap ();
|
||||
|
||||
// Find the native peer corresponding to a CheckboxGroup.
|
||||
public static synchronized GtkCheckboxGroupPeer
|
||||
getCheckboxGroupPeer (CheckboxGroup group)
|
||||
{
|
||||
if (group == null)
|
||||
return null;
|
||||
GtkCheckboxGroupPeer nat = (GtkCheckboxGroupPeer) map.get (group);
|
||||
if (nat == null)
|
||||
{
|
||||
nat = new GtkCheckboxGroupPeer ();
|
||||
map.put (group, nat);
|
||||
}
|
||||
return nat;
|
||||
}
|
||||
|
||||
private GtkCheckboxGroupPeer ()
|
||||
{
|
||||
// We don't need any special state here. Note that we can't store
|
||||
// a reference to the java-side CheckboxGroup. That would mean
|
||||
// they could never be collected.
|
||||
super (null);
|
||||
}
|
||||
|
||||
// Dispose of our native resources.
|
||||
public native void dispose ();
|
||||
|
||||
// Remove a given checkbox from this group.
|
||||
public native void remove (GtkCheckboxPeer box);
|
||||
|
||||
// When collected, clean up the native state.
|
||||
protected void finalize ()
|
||||
{
|
||||
dispose ();
|
||||
}
|
||||
}
|
56
libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java
Normal file
56
libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java
Normal file
@ -0,0 +1,56 @@
|
||||
/* GtkCheckboxMenuItemPeer.java -- Implements CheckboxMenuItemPeer with GTK+
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.CheckboxMenuItemPeer;
|
||||
import java.awt.peer.MenuItemPeer;
|
||||
|
||||
public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer
|
||||
implements CheckboxMenuItemPeer
|
||||
{
|
||||
native void create (String label);
|
||||
|
||||
public GtkCheckboxMenuItemPeer (CheckboxMenuItem menu)
|
||||
{
|
||||
super (menu);
|
||||
setState (menu.getState ());
|
||||
}
|
||||
|
||||
native public void setState (boolean t);
|
||||
}
|
114
libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
Normal file
114
libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
Normal file
@ -0,0 +1,114 @@
|
||||
/* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class GtkCheckboxPeer extends GtkComponentPeer
|
||||
implements CheckboxPeer
|
||||
{
|
||||
// Group from last time it was set.
|
||||
public GtkCheckboxGroupPeer old_group;
|
||||
|
||||
public native void nativeCreate (GtkCheckboxGroupPeer group);
|
||||
public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
|
||||
public native void connectHooks ();
|
||||
|
||||
public GtkCheckboxPeer (Checkbox c)
|
||||
{
|
||||
super (c);
|
||||
}
|
||||
|
||||
// We can't fully use the ordinary getArgs code here, due to
|
||||
// oddities of this particular widget. In particular we must be
|
||||
// able to switch between a checkbutton and a radiobutton
|
||||
// dynamically.
|
||||
public void create ()
|
||||
{
|
||||
CheckboxGroup g = ((Checkbox) awtComponent).getCheckboxGroup ();
|
||||
old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g);
|
||||
nativeCreate (old_group);
|
||||
}
|
||||
|
||||
public void setState (boolean state)
|
||||
{
|
||||
set ("active", state);
|
||||
}
|
||||
|
||||
public void setLabel (String label)
|
||||
{
|
||||
set ("label", label);
|
||||
}
|
||||
|
||||
public void setCheckboxGroup (CheckboxGroup group)
|
||||
{
|
||||
GtkCheckboxGroupPeer gp
|
||||
= GtkCheckboxGroupPeer.getCheckboxGroupPeer (group);
|
||||
if (gp != old_group)
|
||||
{
|
||||
if (old_group != null)
|
||||
old_group.remove (this);
|
||||
nativeSetCheckboxGroup (gp);
|
||||
old_group = gp;
|
||||
}
|
||||
}
|
||||
|
||||
public void getArgs (Component component, GtkArgList args)
|
||||
{
|
||||
super.getArgs (component, args);
|
||||
args.add ("active", ((Checkbox) component).getState ());
|
||||
args.add ("label", ((Checkbox) component).getLabel ());
|
||||
}
|
||||
|
||||
// Override the superclass postItemEvent so that the peer doesn't
|
||||
// need information that we have.
|
||||
public void postItemEvent (Object item, int stateChange)
|
||||
{
|
||||
super.postItemEvent (awtComponent, stateChange);
|
||||
}
|
||||
|
||||
public void dispose ()
|
||||
{
|
||||
// Notify the group so that the native state can be cleaned up
|
||||
// appropriately.
|
||||
if (old_group != null)
|
||||
old_group.remove (this);
|
||||
super.dispose ();
|
||||
}
|
||||
}
|
90
libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
Normal file
90
libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
Normal file
@ -0,0 +1,90 @@
|
||||
/* GtkChoicePeer.java -- Implements ChoicePeer with GTK
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class GtkChoicePeer extends GtkComponentPeer
|
||||
implements ChoicePeer
|
||||
{
|
||||
native void create ();
|
||||
|
||||
public GtkChoicePeer (Choice c)
|
||||
{
|
||||
super (c);
|
||||
|
||||
int count = c.getItemCount ();
|
||||
if (count > 0)
|
||||
{
|
||||
String items[] = new String[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
items[i] = c.getItem (i);
|
||||
|
||||
append (items);
|
||||
}
|
||||
}
|
||||
|
||||
native void append (String items[]);
|
||||
|
||||
native public void add (String item, int index);
|
||||
native public void remove (int index);
|
||||
native public void select (int position);
|
||||
|
||||
public void addItem (String item, int position)
|
||||
{
|
||||
add (item, position);
|
||||
}
|
||||
|
||||
/*
|
||||
public void handleEvent (AWTEvent event)
|
||||
{
|
||||
if (event instanceof ItemEvent)
|
||||
((Choice) awtComponent).select ((String) ((ItemEvent)event).getItem ());
|
||||
super.handleEvent (event);
|
||||
}
|
||||
*/
|
||||
|
||||
protected void postItemEvent (Object item, int stateChange)
|
||||
{
|
||||
if (stateChange == ItemEvent.SELECTED)
|
||||
((Choice) awtComponent).select ((String) item);
|
||||
super.postItemEvent (item, stateChange);
|
||||
}
|
||||
}
|
167
libjava/gnu/java/awt/peer/gtk/GtkClipboard.java
Normal file
167
libjava/gnu/java/awt/peer/gtk/GtkClipboard.java
Normal file
@ -0,0 +1,167 @@
|
||||
/* GtkClipboard.java
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.awt.datatransfer.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.peer.*;
|
||||
|
||||
public class GtkClipboard extends Clipboard
|
||||
{
|
||||
/* the number of milliseconds that we'll wait around for the
|
||||
owner of the GDK_SELECTION_PRIMARY selection to convert
|
||||
the requested data */
|
||||
final static int SELECTION_RECEIVED_TIMEOUT = 5000;
|
||||
|
||||
/* We currently only support transferring of text between applications */
|
||||
static String selection;
|
||||
static Object selectionLock = new Object ();
|
||||
|
||||
static boolean hasSelection = false;
|
||||
|
||||
protected
|
||||
GtkClipboard ()
|
||||
{
|
||||
super ("System Clipboard");
|
||||
initNativeState ();
|
||||
}
|
||||
|
||||
public Transferable
|
||||
getContents (Object requestor)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
if (hasSelection)
|
||||
return contents;
|
||||
}
|
||||
|
||||
/* Java doesn't own the selection, so we need to ask X11 */
|
||||
synchronized (selectionLock)
|
||||
{
|
||||
requestStringConversion ();
|
||||
try
|
||||
{
|
||||
selectionLock.wait (SELECTION_RECEIVED_TIMEOUT);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (selection == null) ? null : new StringSelection (selection);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
stringSelectionReceived (String newSelection)
|
||||
{
|
||||
synchronized (selectionLock)
|
||||
{
|
||||
selection = newSelection;
|
||||
selectionLock.notify ();
|
||||
}
|
||||
}
|
||||
|
||||
/* convert Java clipboard data into a String suitable for sending
|
||||
to another application */
|
||||
synchronized String
|
||||
stringSelectionHandler () throws IOException
|
||||
{
|
||||
String selection = null;
|
||||
|
||||
try {
|
||||
if (contents.isDataFlavorSupported (DataFlavor.stringFlavor))
|
||||
selection = (String)contents.getTransferData (DataFlavor.stringFlavor);
|
||||
else if (contents.isDataFlavorSupported (DataFlavor.plainTextFlavor))
|
||||
{
|
||||
StringBuffer sbuf = new StringBuffer ();
|
||||
InputStreamReader reader;
|
||||
char readBuf[] = new char[512];
|
||||
int numChars;
|
||||
|
||||
reader = new InputStreamReader
|
||||
((InputStream)
|
||||
contents.getTransferData (DataFlavor.plainTextFlavor), "UNICODE");
|
||||
|
||||
while (true)
|
||||
{
|
||||
numChars = reader.read (readBuf);
|
||||
if (numChars == -1)
|
||||
break;
|
||||
sbuf.append (readBuf, 0, numChars);
|
||||
}
|
||||
|
||||
selection = new String (sbuf);
|
||||
}
|
||||
} catch (Exception e) { }
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
setContents (Transferable contents, ClipboardOwner owner)
|
||||
{
|
||||
selectionGet ();
|
||||
|
||||
this.contents = contents;
|
||||
this.owner = owner;
|
||||
|
||||
hasSelection = true;
|
||||
}
|
||||
|
||||
synchronized
|
||||
void selectionClear ()
|
||||
{
|
||||
hasSelection = false;
|
||||
|
||||
if (owner != null)
|
||||
{
|
||||
owner.lostOwnership (this, contents);
|
||||
owner = null;
|
||||
contents = null;
|
||||
}
|
||||
}
|
||||
|
||||
native void initNativeState ();
|
||||
native static void requestStringConversion ();
|
||||
native static void selectionGet ();
|
||||
}
|
391
libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
Normal file
391
libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
Normal file
@ -0,0 +1,391 @@
|
||||
/* GtkComponentPeer.java -- Implements ComponentPeer with GTK
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
|
||||
public class GtkComponentPeer extends GtkGenericPeer
|
||||
implements ComponentPeer
|
||||
{
|
||||
Component awtComponent;
|
||||
|
||||
/* this isEnabled differs from Component.isEnabled, in that it
|
||||
knows if a parent is disabled. In that case Component.isEnabled
|
||||
may return true, but our isEnabled will always return false */
|
||||
native boolean isEnabled ();
|
||||
native static boolean modalHasGrab ();
|
||||
|
||||
native int[] gtkWidgetGetForeground ();
|
||||
native int[] gtkWidgetGetBackground ();
|
||||
native void gtkWidgetSetVisible (boolean b);
|
||||
native void gtkWidgetGetDimensions(int[] dim);
|
||||
native void gtkWidgetGetLocationOnScreen(int[] point);
|
||||
native void gtkWidgetSetCursor (int type);
|
||||
|
||||
void create ()
|
||||
{
|
||||
throw new RuntimeException ();
|
||||
}
|
||||
|
||||
native void connectHooks ();
|
||||
|
||||
protected GtkComponentPeer (Component awtComponent)
|
||||
{
|
||||
super (awtComponent);
|
||||
this.awtComponent = awtComponent;
|
||||
|
||||
/* temporary try/catch block until all peers use this creation method */
|
||||
try {
|
||||
create ();
|
||||
|
||||
GtkArgList args = new GtkArgList ();
|
||||
getArgs (awtComponent, args);
|
||||
args.setArgs (this);
|
||||
|
||||
connectHooks ();
|
||||
|
||||
if (awtComponent.getForeground () == null)
|
||||
awtComponent.setForeground (getForeground ());
|
||||
if (awtComponent.getBackground () == null)
|
||||
awtComponent.setBackground (getBackground ());
|
||||
// if (c.getFont () == null)
|
||||
// c.setFont (cp.getFont ());
|
||||
|
||||
if (! (awtComponent instanceof Window))
|
||||
{
|
||||
setCursor (awtComponent.getCursor ());
|
||||
Rectangle bounds = awtComponent.getBounds ();
|
||||
setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
}
|
||||
} catch (RuntimeException ex) { ; }
|
||||
}
|
||||
|
||||
public int checkImage (Image image, int width, int height,
|
||||
ImageObserver observer)
|
||||
{
|
||||
GtkImage i = (GtkImage) image;
|
||||
return i.checkImage ();
|
||||
}
|
||||
|
||||
public Image createImage (ImageProducer producer)
|
||||
{
|
||||
return new GtkImage (producer, null);
|
||||
}
|
||||
|
||||
public Image createImage (int width, int height)
|
||||
{
|
||||
GdkGraphics g = new GdkGraphics (width, height);
|
||||
return new GtkOffScreenImage (null, g, width, height);
|
||||
}
|
||||
|
||||
public void disable ()
|
||||
{
|
||||
setEnabled (false);
|
||||
}
|
||||
|
||||
public void enable ()
|
||||
{
|
||||
setEnabled (true);
|
||||
}
|
||||
|
||||
public ColorModel getColorModel ()
|
||||
{
|
||||
return ColorModel.getRGBdefault ();
|
||||
}
|
||||
|
||||
public FontMetrics getFontMetrics (Font font)
|
||||
{
|
||||
return new GdkFontMetrics (font);
|
||||
}
|
||||
|
||||
public Graphics getGraphics ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Point getLocationOnScreen ()
|
||||
{
|
||||
int point[] = new int[2];
|
||||
gtkWidgetGetLocationOnScreen (point);
|
||||
return new Point (point[0], point[1]);
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize ()
|
||||
{
|
||||
int dim[]=new int[2];
|
||||
gtkWidgetGetDimensions (dim);
|
||||
Dimension d = new Dimension (dim[0],dim[1]);
|
||||
return (d);
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize ()
|
||||
{
|
||||
int dim[]=new int[2];
|
||||
gtkWidgetGetDimensions (dim);
|
||||
Dimension d = new Dimension (dim[0],dim[1]);
|
||||
return (d);
|
||||
}
|
||||
|
||||
public Toolkit getToolkit ()
|
||||
{
|
||||
return Toolkit.getDefaultToolkit();
|
||||
}
|
||||
|
||||
public void handleEvent (AWTEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
public boolean isFocusTraversable ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public Dimension minimumSize ()
|
||||
{
|
||||
return getMinimumSize();
|
||||
}
|
||||
|
||||
public void paint (Graphics g)
|
||||
{
|
||||
awtComponent.paint (g);
|
||||
}
|
||||
|
||||
public Dimension preferredSize()
|
||||
{
|
||||
return getPreferredSize();
|
||||
}
|
||||
|
||||
public boolean prepareImage (Image image, int width, int height,
|
||||
ImageObserver observer)
|
||||
{
|
||||
GtkImage i = (GtkImage) image;
|
||||
|
||||
if (i.isLoaded ()) return true;
|
||||
|
||||
class PrepareImage extends Thread
|
||||
{
|
||||
GtkImage image;
|
||||
ImageObserver observer;
|
||||
|
||||
PrepareImage (GtkImage image, ImageObserver observer)
|
||||
{
|
||||
this.image = image;
|
||||
this.observer = observer;
|
||||
}
|
||||
|
||||
public void run ()
|
||||
{
|
||||
// XXX: need to return data to image observer
|
||||
image.source.startProduction (null);
|
||||
}
|
||||
}
|
||||
|
||||
new PrepareImage (i, observer).start ();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void print (Graphics g)
|
||||
{
|
||||
throw new RuntimeException ();
|
||||
}
|
||||
|
||||
public void repaint (long tm, int x, int y, int width, int height)
|
||||
{
|
||||
q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
|
||||
new Rectangle (x, y, width, height)));
|
||||
}
|
||||
|
||||
native public void requestFocus ();
|
||||
|
||||
public void reshape (int x, int y, int width, int height)
|
||||
{
|
||||
setBounds (x, y, width, height);
|
||||
}
|
||||
|
||||
public void setBackground (Color c)
|
||||
{
|
||||
// System.out.println ("setBackground [UNIMPLEMENTED");
|
||||
}
|
||||
|
||||
native public void setNativeBounds (int x, int y, int width, int height);
|
||||
|
||||
public void setBounds (int x, int y, int width, int height)
|
||||
{
|
||||
Component parent = awtComponent.getParent ();
|
||||
|
||||
if (parent instanceof Frame)
|
||||
{
|
||||
Insets insets = ((Frame)parent).getInsets ();
|
||||
/* convert Java's coordinate space into GTK+'s coordinate space */
|
||||
setNativeBounds (x-insets.left, y-insets.top, width, height);
|
||||
}
|
||||
else
|
||||
setNativeBounds (x, y, width, height);
|
||||
}
|
||||
|
||||
public void setCursor (Cursor cursor)
|
||||
{
|
||||
gtkWidgetSetCursor (cursor.getType ());
|
||||
}
|
||||
|
||||
public void setEnabled (boolean b)
|
||||
{
|
||||
set ("sensitive", b);
|
||||
}
|
||||
|
||||
public void setFont (Font f)
|
||||
{
|
||||
}
|
||||
|
||||
public void setForeground (Color c)
|
||||
{
|
||||
// System.out.println ("setForeground [UNIMPLEMENTED");
|
||||
}
|
||||
|
||||
public Color getForeground ()
|
||||
{
|
||||
int rgb[] = gtkWidgetGetForeground ();
|
||||
return new Color (rgb[0], rgb[1], rgb[2]);
|
||||
}
|
||||
|
||||
public Color getBackground ()
|
||||
{
|
||||
int rgb[] = gtkWidgetGetBackground ();
|
||||
return new Color (rgb[0], rgb[1], rgb[2]);
|
||||
}
|
||||
|
||||
public void setVisible (boolean b)
|
||||
{
|
||||
set ("visible", b);
|
||||
}
|
||||
|
||||
public void hide ()
|
||||
{
|
||||
setVisible (false);
|
||||
}
|
||||
|
||||
public void show ()
|
||||
{
|
||||
setVisible (true);
|
||||
}
|
||||
|
||||
protected void postMouseEvent(int id, long when, int mods, int x, int y,
|
||||
int clickCount, boolean popupTrigger)
|
||||
{
|
||||
q.postEvent(new MouseEvent(awtComponent, id, when, mods, x, y,
|
||||
clickCount, popupTrigger));
|
||||
}
|
||||
|
||||
protected void postExposeEvent (int x, int y, int width, int height)
|
||||
{
|
||||
q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
|
||||
new Rectangle (x, y, width, height)));
|
||||
}
|
||||
|
||||
protected void postKeyEvent (int id, long when, int mods,
|
||||
int keyCode, char keyChar)
|
||||
{
|
||||
q.postEvent (new KeyEvent (awtComponent, id, when, mods,
|
||||
keyCode, keyChar));
|
||||
}
|
||||
|
||||
protected void postFocusEvent (int id, boolean temporary)
|
||||
{
|
||||
q.postEvent (new FocusEvent (awtComponent, id, temporary));
|
||||
}
|
||||
|
||||
protected void postItemEvent (Object item, int stateChange)
|
||||
{
|
||||
q.postEvent (new ItemEvent ((ItemSelectable)awtComponent,
|
||||
ItemEvent.ITEM_STATE_CHANGED,
|
||||
item, stateChange));
|
||||
}
|
||||
|
||||
public void getArgs (Component component, GtkArgList args)
|
||||
{
|
||||
args.add ("visible", component.isVisible ());
|
||||
args.add ("sensitive", component.isEnabled ());
|
||||
|
||||
ComponentPeer p;
|
||||
|
||||
do
|
||||
{
|
||||
component = component.getParent ();
|
||||
p = component.getPeer ();
|
||||
} while (p instanceof java.awt.peer.LightweightPeer);
|
||||
|
||||
args.add ("parent", p);
|
||||
}
|
||||
|
||||
native void set (String name, String value);
|
||||
native void set (String name, boolean value);
|
||||
native void set (String name, int value);
|
||||
native void set (String name, float value);
|
||||
native void set (String name, Object value);
|
||||
|
||||
void set (GtkArg arg)
|
||||
{
|
||||
String name = arg.getName ();
|
||||
Object value = arg.getValue ();
|
||||
|
||||
if (value instanceof Boolean)
|
||||
set (name, ((Boolean)value).booleanValue ());
|
||||
else if (value instanceof Integer)
|
||||
set (name, ((Integer)value).intValue ());
|
||||
else if (value instanceof Float)
|
||||
set (name, ((Float)value).floatValue ());
|
||||
else if (value instanceof String)
|
||||
set (name, ((String) value));
|
||||
else
|
||||
set (name, value);
|
||||
}
|
||||
|
||||
public GraphicsConfiguration getGraphicsConfiguration ()
|
||||
{
|
||||
// FIXME: just a stub for now.
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setEventMask (long mask)
|
||||
{
|
||||
// FIXME: just a stub for now.
|
||||
}
|
||||
}
|
125
libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
Normal file
125
libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
Normal file
@ -0,0 +1,125 @@
|
||||
/* GtkContainerPeer.java -- Implements ContainerPeer with GTK
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.peer.ContainerPeer;
|
||||
|
||||
public class GtkContainerPeer extends GtkComponentPeer
|
||||
implements ContainerPeer
|
||||
{
|
||||
Insets insets;
|
||||
Container c;
|
||||
|
||||
public GtkContainerPeer(Container c)
|
||||
{
|
||||
super (c);
|
||||
this.c = c;
|
||||
insets = new Insets (0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void beginValidate()
|
||||
{
|
||||
}
|
||||
|
||||
public void endValidate()
|
||||
{
|
||||
// q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
|
||||
// new Rectangle (x, y, width, height)));
|
||||
// Graphics gc = getGraphics ();
|
||||
// if (gc != null)
|
||||
// {
|
||||
// awtComponent.update (gc);
|
||||
// gc.dispose ();
|
||||
// }
|
||||
// System.out.println ("got here");
|
||||
// awtComponent.repaint ();
|
||||
}
|
||||
|
||||
public Insets getInsets()
|
||||
{
|
||||
return insets;
|
||||
}
|
||||
|
||||
public Insets insets()
|
||||
{
|
||||
return getInsets ();
|
||||
}
|
||||
|
||||
public void setBounds (int x, int y, int width, int height)
|
||||
{
|
||||
super.setBounds (x, y, width, height);
|
||||
awtComponent.validate ();
|
||||
}
|
||||
|
||||
public Graphics getGraphics ()
|
||||
{
|
||||
return new GdkGraphics (this);
|
||||
}
|
||||
|
||||
public void handleEvent (AWTEvent event)
|
||||
{
|
||||
int id = event.getID();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case PaintEvent.PAINT:
|
||||
case PaintEvent.UPDATE:
|
||||
{
|
||||
try
|
||||
{
|
||||
Graphics g = getGraphics ();
|
||||
g.setClip (((PaintEvent)event).getUpdateRect());
|
||||
|
||||
if (id == PaintEvent.PAINT)
|
||||
awtComponent.paint (g);
|
||||
else
|
||||
awtComponent.update (g);
|
||||
|
||||
g.dispose ();
|
||||
}
|
||||
catch (InternalError e)
|
||||
{
|
||||
System.err.println (e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
76
libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
Normal file
76
libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
Normal file
@ -0,0 +1,76 @@
|
||||
/* GtkDialogPeer.java -- Implements DialogPeer with GTK
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class GtkDialogPeer extends GtkWindowPeer
|
||||
implements DialogPeer
|
||||
{
|
||||
public GtkDialogPeer (Dialog dialog)
|
||||
{
|
||||
super (dialog);
|
||||
}
|
||||
|
||||
void create ()
|
||||
{
|
||||
create (GTK_WINDOW_DIALOG);
|
||||
}
|
||||
|
||||
public void getArgs (Component component, GtkArgList args)
|
||||
{
|
||||
super.getArgs (component, args);
|
||||
|
||||
Dialog dialog = (Dialog) component;
|
||||
|
||||
args.add ("modal", dialog.isModal ());
|
||||
args.add ("allow_shrink", dialog.isResizable ());
|
||||
args.add ("allow_grow", dialog.isResizable ());
|
||||
}
|
||||
|
||||
public void handleEvent (AWTEvent event)
|
||||
{
|
||||
// int id = event.getID();
|
||||
|
||||
// if (id == WindowEvent.WINDOW_CLOSING)
|
||||
// System.out.println ("got a closing event");
|
||||
}
|
||||
|
||||
}
|
70
libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
Normal file
70
libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
Normal file
@ -0,0 +1,70 @@
|
||||
/* GtkFileDialogPeer.java -- Implements FileDialogPeer with GTK
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.io.FilenameFilter;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
|
||||
{
|
||||
native void create ();
|
||||
|
||||
public GtkFileDialogPeer (FileDialog fd)
|
||||
{
|
||||
super (fd);
|
||||
}
|
||||
|
||||
public void setDirectory (String directory)
|
||||
{
|
||||
setFile (directory);
|
||||
}
|
||||
|
||||
public native void setFile (String file);
|
||||
public native void connectHooks ();
|
||||
|
||||
public void setFilenameFilter (FilenameFilter filter)
|
||||
{
|
||||
/* GTK has no filters. */
|
||||
}
|
||||
|
||||
public Graphics getGraphics ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
74
libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
Normal file
74
libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
Normal file
@ -0,0 +1,74 @@
|
||||
/* GtkFontPeer.java -- Implements FontPeer with GTK+
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.FontPeer;
|
||||
import java.awt.Font;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class GtkFontPeer implements FontPeer
|
||||
{
|
||||
private static ResourceBundle bundle;
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
bundle = ResourceBundle.getBundle ("gnu.java.awt.peer.gtk.font");
|
||||
}
|
||||
catch (Throwable ignored)
|
||||
{
|
||||
bundle = null;
|
||||
}
|
||||
}
|
||||
|
||||
final private String Xname;
|
||||
|
||||
public GtkFontPeer (String name, int style)
|
||||
{
|
||||
if (bundle != null)
|
||||
Xname = bundle.getString (name.toLowerCase () + "." + style);
|
||||
else
|
||||
Xname = "-*-*-medium-r-normal-*-12-*-*-*-c-*-*-*";
|
||||
}
|
||||
|
||||
public String getXLFD ()
|
||||
{
|
||||
return Xname;
|
||||
}
|
||||
}
|
132
libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
Normal file
132
libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
Normal file
@ -0,0 +1,132 @@
|
||||
/* GtkFramePeer.java -- Implements FramePeer with GTK
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class GtkFramePeer extends GtkWindowPeer
|
||||
implements FramePeer
|
||||
{
|
||||
int menuBarHeight = 0;
|
||||
native int getMenuBarHeight ();
|
||||
|
||||
native public void setMenuBarPeer (MenuBarPeer bar);
|
||||
|
||||
public void setMenuBar (MenuBar bar)
|
||||
{
|
||||
if (bar == null)
|
||||
setMenuBarPeer (null);
|
||||
else
|
||||
setMenuBarPeer ((MenuBarPeer) bar.getPeer ());
|
||||
}
|
||||
|
||||
public GtkFramePeer (Frame frame)
|
||||
{
|
||||
super (frame);
|
||||
}
|
||||
|
||||
void create ()
|
||||
{
|
||||
create (GTK_WINDOW_TOPLEVEL);
|
||||
}
|
||||
|
||||
public void getArgs (Component component, GtkArgList args)
|
||||
{
|
||||
super.getArgs (component, args);
|
||||
|
||||
Frame frame = (Frame) component;
|
||||
|
||||
args.add ("title", frame.getTitle ());
|
||||
args.add ("allow_shrink", frame.isResizable ());
|
||||
args.add ("allow_grow", frame.isResizable ());
|
||||
}
|
||||
public void setIconImage (Image image)
|
||||
{
|
||||
/* TODO: Waiting on Toolkit Image routines */
|
||||
}
|
||||
|
||||
public Graphics getGraphics ()
|
||||
{
|
||||
GdkGraphics g = new GdkGraphics (this);
|
||||
g.translateNative (-insets.left, -insets.top);
|
||||
return g;
|
||||
}
|
||||
|
||||
public void setBounds (int x, int y, int width, int height)
|
||||
{
|
||||
super.setBounds (0, 0, width - insets.left - insets.right,
|
||||
height - insets.top - insets.bottom + menuBarHeight);
|
||||
}
|
||||
|
||||
protected void postConfigureEvent (int x, int y, int width, int height,
|
||||
int top, int left, int bottom, int right)
|
||||
{
|
||||
if (((Frame)awtComponent).getMenuBar () != null)
|
||||
{
|
||||
menuBarHeight = getMenuBarHeight ();
|
||||
top += menuBarHeight;
|
||||
}
|
||||
|
||||
super.postConfigureEvent (0, 0,
|
||||
width + left + right,
|
||||
height + top + bottom - menuBarHeight,
|
||||
top, left, bottom, right);
|
||||
}
|
||||
|
||||
protected void postMouseEvent(int id, long when, int mods, int x, int y,
|
||||
int clickCount, boolean popupTrigger)
|
||||
{
|
||||
super.postMouseEvent (id, when, mods,
|
||||
x + insets.left, y + insets.top,
|
||||
clickCount, popupTrigger);
|
||||
}
|
||||
|
||||
protected void postExposeEvent (int x, int y, int width, int height)
|
||||
{
|
||||
// System.out.println ("x + insets.left:" + (x + insets.left));
|
||||
// System.out.println ("y + insets.top :" + (y + insets.top));
|
||||
q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
|
||||
new Rectangle (x + insets.left,
|
||||
y + insets.top,
|
||||
width, height)));
|
||||
}
|
||||
}
|
||||
|
||||
|
84
libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
Normal file
84
libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
Normal file
@ -0,0 +1,84 @@
|
||||
/* GtkGenericPeer.java - Has a hashcode. Yuck.
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class GtkGenericPeer
|
||||
{
|
||||
final int native_state = getUniqueInteger ();
|
||||
|
||||
// Next native state value we will assign.
|
||||
private static int next_native_state = 0;
|
||||
|
||||
// The widget or other java-side object we wrap.
|
||||
protected Object awtWidget;
|
||||
|
||||
// Global event queue.
|
||||
protected static EventQueue q = null;
|
||||
|
||||
// Dispose of our native state.
|
||||
public native void dispose ();
|
||||
|
||||
protected GtkGenericPeer (Object awtWidget)
|
||||
{
|
||||
this.awtWidget = awtWidget;
|
||||
}
|
||||
|
||||
public static void enableQueue (EventQueue sq)
|
||||
{
|
||||
if (q == null)
|
||||
q = sq;
|
||||
}
|
||||
|
||||
protected void postActionEvent (String command, int mods)
|
||||
{
|
||||
q.postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED,
|
||||
command, mods));
|
||||
}
|
||||
|
||||
// Return a unique integer for use in the native state mapping
|
||||
// code. We can't use a hash code since that is not guaranteed to
|
||||
// be unique.
|
||||
static synchronized int getUniqueInteger ()
|
||||
{
|
||||
// Let's assume this will never wrap.
|
||||
return next_native_state++;
|
||||
}
|
||||
}
|
286
libjava/gnu/java/awt/peer/gtk/GtkImage.java
Normal file
286
libjava/gnu/java/awt/peer/gtk/GtkImage.java
Normal file
@ -0,0 +1,286 @@
|
||||
/* GtkImage.java
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.awt.image.*;
|
||||
|
||||
public class GtkImage extends Image implements ImageConsumer
|
||||
{
|
||||
int width = -1, height = -1;
|
||||
Hashtable props = null;
|
||||
boolean isLoaded = false;
|
||||
boolean isCacheable = true;
|
||||
boolean loading = false;
|
||||
|
||||
Vector widthObservers = new Vector ();
|
||||
Vector heightObservers = new Vector ();
|
||||
Vector propertyObservers = new Vector ();
|
||||
|
||||
ImageProducer source;
|
||||
Graphics g;
|
||||
|
||||
/* Variables in which we stored cached data, if possible.
|
||||
|
||||
An image is cached if the following properties are true:
|
||||
1. The ColorModel passed into setColorModel is the same ColorModel
|
||||
passed to all invocations of setPixels.
|
||||
2. The image contains a single frame.
|
||||
|
||||
*/
|
||||
int[] pixelCache;
|
||||
ColorModel model;
|
||||
|
||||
public
|
||||
GtkImage (ImageProducer producer, Graphics g)
|
||||
{
|
||||
source = producer;
|
||||
this.g = g;
|
||||
|
||||
source.addConsumer (this);
|
||||
}
|
||||
|
||||
public synchronized int
|
||||
getWidth (ImageObserver observer)
|
||||
{
|
||||
if (width == -1)
|
||||
widthObservers.addElement (observer);
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
public synchronized int
|
||||
getHeight (ImageObserver observer)
|
||||
{
|
||||
if (height == -1)
|
||||
heightObservers.addElement (observer);
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
public ImageProducer
|
||||
getSource ()
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
public Graphics
|
||||
getGraphics ()
|
||||
{
|
||||
return g;
|
||||
}
|
||||
|
||||
public synchronized Object
|
||||
getProperty (String name, ImageObserver observer)
|
||||
{
|
||||
if (props == null)
|
||||
{
|
||||
propertyObservers.addElement (observer);
|
||||
return null;
|
||||
}
|
||||
|
||||
Object value = props.get (name);
|
||||
return (value == null) ? UndefinedProperty : value;
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
flush ()
|
||||
{
|
||||
isLoaded = false;
|
||||
isCacheable = true;
|
||||
width = height = -1;
|
||||
props = null;
|
||||
pixelCache = null;
|
||||
model = null;
|
||||
|
||||
source.removeConsumer (this);
|
||||
source.addConsumer (this);
|
||||
}
|
||||
|
||||
public boolean
|
||||
isLoaded ()
|
||||
{
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
/* ImageConsumer methods */
|
||||
|
||||
public synchronized void
|
||||
setDimensions (int width, int height)
|
||||
{
|
||||
pixelCache = new int[width*height];
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
for (int i = 0; i < widthObservers.size (); i++)
|
||||
{
|
||||
ImageObserver io = (ImageObserver) widthObservers.elementAt (i);
|
||||
io.imageUpdate (this, ImageObserver.WIDTH, -1, -1, width, height);
|
||||
}
|
||||
|
||||
for (int i = 0; i < heightObservers.size (); i++)
|
||||
{
|
||||
ImageObserver io = (ImageObserver) heightObservers.elementAt (i);
|
||||
io.imageUpdate (this, ImageObserver.HEIGHT, -1, -1, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
setProperties (Hashtable props)
|
||||
{
|
||||
this.props = props;
|
||||
|
||||
for (int i = 0; i < propertyObservers.size (); i++)
|
||||
{
|
||||
ImageObserver io = (ImageObserver) propertyObservers.elementAt (i);
|
||||
io.imageUpdate (this, ImageObserver.PROPERTIES, -1, -1, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
setColorModel (ColorModel model)
|
||||
{
|
||||
if (this.model == null || this.model == model)
|
||||
this.model = model;
|
||||
else
|
||||
isCacheable = false;
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
setHints (int flags)
|
||||
{
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
setPixels (int x, int y, int width, int height, ColorModel cm, byte[] pixels,
|
||||
int offset, int scansize)
|
||||
{
|
||||
setPixels (x, y, width, height, cm, convertPixels (pixels), offset,
|
||||
scansize);
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
setPixels (int x, int y, int width, int height, ColorModel cm, int[] pixels,
|
||||
int offset, int scansize)
|
||||
{
|
||||
loading = true;
|
||||
|
||||
if (!isCacheable)
|
||||
return;
|
||||
|
||||
if (cm != model || pixelCache == null)
|
||||
{
|
||||
isCacheable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (scansize == width)
|
||||
{
|
||||
System.arraycopy (pixels, offset,
|
||||
pixelCache, y * this.width + x,
|
||||
pixels.length - offset);
|
||||
}
|
||||
else // skip over scansize-width for each row
|
||||
{
|
||||
for (int i = 0; i < height; i++)
|
||||
System.arraycopy (pixels, offset + (i * scansize),
|
||||
pixelCache, (y + i) * this.width + x,
|
||||
width);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
imageComplete (int status)
|
||||
{
|
||||
if (status == ImageConsumer.STATICIMAGEDONE && isCacheable)
|
||||
isLoaded = true;
|
||||
|
||||
if (status == ImageConsumer.SINGLEFRAMEDONE)
|
||||
isCacheable = false;
|
||||
|
||||
source.removeConsumer (this);
|
||||
}
|
||||
|
||||
public synchronized void
|
||||
startProduction (GtkImagePainter painter)
|
||||
{
|
||||
if (isLoaded)
|
||||
{
|
||||
painter.setDimensions (width, height);
|
||||
painter.setPixels (0, 0, width, height, model, pixelCache, 0, width);
|
||||
}
|
||||
else
|
||||
{
|
||||
source.startProduction (painter);
|
||||
source.removeConsumer (painter);
|
||||
}
|
||||
}
|
||||
|
||||
private int[]
|
||||
convertPixels (byte[] pixels)
|
||||
{
|
||||
int ret[] = new int[pixels.length];
|
||||
|
||||
for (int i = 0; i < pixels.length; i++)
|
||||
ret[i] = pixels[i];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
synchronized int
|
||||
checkImage ()
|
||||
{
|
||||
int bits = 0;
|
||||
|
||||
if (width != -1)
|
||||
bits |= ImageObserver.WIDTH;
|
||||
if (height != -1)
|
||||
bits |= ImageObserver.HEIGHT;
|
||||
if (props != null)
|
||||
bits |= ImageObserver.PROPERTIES;
|
||||
if (loading)
|
||||
bits |= ImageObserver.SOMEBITS;
|
||||
if (isLoaded)
|
||||
bits |= ImageObserver.ALLBITS;
|
||||
|
||||
return bits;
|
||||
}
|
||||
}
|
239
libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java
Normal file
239
libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java
Normal file
@ -0,0 +1,239 @@
|
||||
/* GtkImagePainter.java
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.util.*;
|
||||
|
||||
public class GtkImagePainter implements Runnable, ImageConsumer
|
||||
{
|
||||
GtkImage image;
|
||||
GdkGraphics gc;
|
||||
int startX, startY;
|
||||
int redBG;
|
||||
int greenBG;
|
||||
int blueBG;
|
||||
double affine[];
|
||||
int width, height;
|
||||
boolean flipX, flipY;
|
||||
Rectangle clip;
|
||||
int s_width, s_height;
|
||||
|
||||
public
|
||||
GtkImagePainter (GtkImage image, GdkGraphics gc, int x, int y,
|
||||
int width, int height, Color bgcolor)
|
||||
{
|
||||
this.image = image;
|
||||
this.gc = (GdkGraphics) gc.create ();
|
||||
startX = x;
|
||||
startY = y;
|
||||
redBG = bgcolor.getRed ();
|
||||
greenBG = bgcolor.getGreen ();
|
||||
blueBG = bgcolor.getBlue ();
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
flipX = flipY = false;
|
||||
s_width = s_height = 0;
|
||||
clip = null;
|
||||
|
||||
new Thread (this).start ();
|
||||
}
|
||||
|
||||
public
|
||||
GtkImagePainter (GtkImage image, GdkGraphics gc,
|
||||
int dx1, int dy1, int dx2, int dy2,
|
||||
int sx1, int sy1, int sx2, int sy2,
|
||||
Color bgcolor)
|
||||
{
|
||||
this.image = image;
|
||||
this.gc = (GdkGraphics) gc.create ();
|
||||
startX = (dx1 < dx2) ? dx1 : dx2;
|
||||
startY = dy1;
|
||||
redBG = bgcolor.getRed ();
|
||||
greenBG = bgcolor.getGreen ();
|
||||
blueBG = bgcolor.getBlue ();
|
||||
|
||||
this.width = Math.abs (dx2 - dx1);
|
||||
this.height = Math.abs (dy2 - dy1);
|
||||
|
||||
flipX = ((dx1 > dx2 && sx2 > sx1)
|
||||
|| (dx1 < dx2 && sx2 < sx1));
|
||||
|
||||
flipY = ((dy1 > dy2 && sy2 > sy1)
|
||||
|| (dy1 < dy2 && sy2 < sy1));
|
||||
|
||||
s_width = Math.abs (sx2 - sx1);
|
||||
s_height = Math.abs (sy2 - sy1);
|
||||
clip = new Rectangle (sx1, sy1, s_width, s_height);
|
||||
|
||||
new Thread (this).start ();
|
||||
}
|
||||
|
||||
public void
|
||||
run ()
|
||||
{
|
||||
image.startProduction (this);
|
||||
gc.dispose ();
|
||||
}
|
||||
|
||||
/* Convert pixel data into a format that gdkrgb can understand */
|
||||
static int[]
|
||||
convertPixels (int[] pixels, ColorModel model)
|
||||
{
|
||||
if (model.equals (ColorModel.getRGBdefault ()))
|
||||
return pixels;
|
||||
|
||||
int ret[] = new int[pixels.length];
|
||||
|
||||
for (int i = 0; i < pixels.length; i++)
|
||||
ret[i] = model.getRGB (pixels[i]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int[]
|
||||
convertPixels (byte[] pixels, ColorModel model)
|
||||
{
|
||||
int ret[] = new int[pixels.length];
|
||||
|
||||
for (int i = 0; i < pixels.length; i++)
|
||||
ret[i] = model.getRGB (pixels[i]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
native void
|
||||
drawPixels (GdkGraphics gc, int bg_red, int bg_green, int bg_blue,
|
||||
int x, int y, int width, int height, int[] pixels, int offset,
|
||||
int scansize, double affine[]);
|
||||
|
||||
|
||||
public void
|
||||
setPixels (int x, int y, int width, int height, ColorModel model,
|
||||
int[] pixels, int offset, int scansize)
|
||||
{
|
||||
if (clip != null)
|
||||
{
|
||||
Rectangle r;
|
||||
r = clip.intersection (new Rectangle (x, y, width, height));
|
||||
if (r.width == 0 && r.height == 0)
|
||||
return;
|
||||
|
||||
offset += r.y * scansize + r.x;
|
||||
|
||||
r.translate (-Math.abs (clip.x - startX), -Math.abs (clip.y - startY));
|
||||
|
||||
width = r.width;
|
||||
height = r.height;
|
||||
x = r.x;
|
||||
y = r.y;
|
||||
}
|
||||
|
||||
drawPixels (gc, redBG, greenBG, blueBG,
|
||||
startX + x, startY + y,
|
||||
width, height, convertPixels (pixels, model), offset,
|
||||
scansize, affine);
|
||||
}
|
||||
|
||||
public void
|
||||
setPixels (int x, int y, int width, int height, ColorModel model,
|
||||
byte[] pixels, int offset, int scansize)
|
||||
{
|
||||
setPixels (x, y, width, height, model, convertPixels (pixels, model),
|
||||
offset, scansize);
|
||||
}
|
||||
|
||||
public void
|
||||
setDimensions (int width, int height)
|
||||
{
|
||||
if (!flipX && !flipY &&
|
||||
((this.width == -1 && this.height == -1)
|
||||
|| (this.width == width && this.height == height)))
|
||||
return;
|
||||
|
||||
affine = new double[6];
|
||||
affine[1] = affine[2] = affine[4] = affine[5] = 0;
|
||||
|
||||
if (clip != null)
|
||||
{
|
||||
affine[0] = this.width / (double) s_width;
|
||||
affine[3] = this.height / (double) s_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
affine[0] = this.width / (double) width;
|
||||
affine[3] = this.height / (double) height;
|
||||
}
|
||||
|
||||
if (flipX)
|
||||
{
|
||||
affine[0] = -affine[0];
|
||||
affine[4] = this.width;
|
||||
}
|
||||
|
||||
if (flipY)
|
||||
{
|
||||
affine[3] = -affine[3];
|
||||
affine[5] = this.height;
|
||||
}
|
||||
|
||||
if (affine[0] == 1 && affine[3] == 1)
|
||||
affine = null;
|
||||
}
|
||||
|
||||
public void
|
||||
setProperties (Hashtable props)
|
||||
{
|
||||
}
|
||||
|
||||
public void
|
||||
setColorModel (ColorModel model)
|
||||
{
|
||||
}
|
||||
|
||||
public void
|
||||
setHints (int flags)
|
||||
{
|
||||
}
|
||||
|
||||
public void
|
||||
imageComplete (int status)
|
||||
{
|
||||
}
|
||||
}
|
88
libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
Normal file
88
libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
Normal file
@ -0,0 +1,88 @@
|
||||
/* GtkLabelPeer.java -- Implements LabelPeer with GTK
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.*;
|
||||
|
||||
public class GtkLabelPeer extends GtkComponentPeer
|
||||
implements LabelPeer
|
||||
{
|
||||
native void create ();
|
||||
|
||||
public GtkLabelPeer (Label l)
|
||||
{
|
||||
super (l);
|
||||
}
|
||||
|
||||
public void setText (String text)
|
||||
{
|
||||
set ("label", text);
|
||||
}
|
||||
|
||||
public void setAlignment (int alignment)
|
||||
{
|
||||
set ("xalign", getGtkAlignment (alignment));
|
||||
}
|
||||
|
||||
float getGtkAlignment (int alignment)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case Label.LEFT:
|
||||
return 0.0f;
|
||||
case Label.CENTER:
|
||||
return 0.5f;
|
||||
case Label.RIGHT:
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public void getArgs (Component component, GtkArgList args)
|
||||
{
|
||||
super.getArgs (component, args);
|
||||
|
||||
Label label = (Label) component;
|
||||
|
||||
args.add ("label", label.getText ());
|
||||
args.add ("xalign", getGtkAlignment (label.getAlignment ()));
|
||||
args.add ("yalign", 0.5f);
|
||||
}
|
||||
}
|
126
libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
Normal file
126
libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
Normal file
@ -0,0 +1,126 @@
|
||||
/* GtkListPeer.java -- Implements ListPeer with GTK
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.*;
|
||||
|
||||
public class GtkListPeer extends GtkComponentPeer
|
||||
implements ListPeer
|
||||
{
|
||||
// native void create (ComponentPeer parent, String [] items, boolean mode);
|
||||
|
||||
native void create ();
|
||||
native void connectHooks ();
|
||||
|
||||
native void getSize (int rows, int dims[]);
|
||||
|
||||
public GtkListPeer (List list)
|
||||
{
|
||||
super (list);
|
||||
|
||||
setMultipleMode (list.isMultipleMode ());
|
||||
|
||||
if (list.getItemCount () > 0)
|
||||
append (list.getItems ());
|
||||
}
|
||||
|
||||
native void append (String items[]);
|
||||
|
||||
public native void add (String item, int index);
|
||||
|
||||
public void addItem (String item, int index)
|
||||
{
|
||||
add (item, index);
|
||||
}
|
||||
|
||||
public void clear ()
|
||||
{
|
||||
removeAll ();
|
||||
}
|
||||
|
||||
public native void delItems (int start, int end);
|
||||
public native void deselect (int index);
|
||||
|
||||
public Dimension getMinimumSize (int rows)
|
||||
{
|
||||
int dims[] = new int[2];
|
||||
|
||||
getSize (rows, dims);
|
||||
return (new Dimension (dims[0], dims[1]));
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize (int rows)
|
||||
{
|
||||
int dims[] = new int[2];
|
||||
|
||||
getSize (rows, dims);
|
||||
return (new Dimension (dims[0], dims[1]));
|
||||
}
|
||||
|
||||
public native int[] getSelectedIndexes ();
|
||||
public native void makeVisible (int index);
|
||||
|
||||
public Dimension minimumSize (int rows)
|
||||
{
|
||||
return (getMinimumSize (rows));
|
||||
}
|
||||
|
||||
public Dimension preferredSize (int rows)
|
||||
{
|
||||
return (getPreferredSize (rows));
|
||||
}
|
||||
|
||||
public void removeAll ()
|
||||
{
|
||||
delItems (0, -1);
|
||||
}
|
||||
|
||||
public native void select (int index);
|
||||
public native void setMultipleMode (boolean b);
|
||||
|
||||
public void setMultipleSelections (boolean b)
|
||||
{
|
||||
setMultipleMode (b);
|
||||
}
|
||||
|
||||
protected void postItemEvent (int item, int stateChange)
|
||||
{
|
||||
postItemEvent (new Integer (item), stateChange);
|
||||
}
|
||||
}
|
80
libjava/gnu/java/awt/peer/gtk/GtkMainThread.java
Normal file
80
libjava/gnu/java/awt/peer/gtk/GtkMainThread.java
Normal file
@ -0,0 +1,80 @@
|
||||
/* GtkMainThread.java -- Runs gtk_main()
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
public class GtkMainThread extends GtkGenericPeer implements Runnable
|
||||
{
|
||||
private static Thread mainThread = null;
|
||||
private static Object mainThreadLock = new Object();
|
||||
|
||||
static native void gtkInit();
|
||||
native void gtkMain();
|
||||
|
||||
public GtkMainThread()
|
||||
{
|
||||
super (null);
|
||||
synchronized (mainThreadLock)
|
||||
{
|
||||
if (mainThread != null)
|
||||
throw new IllegalStateException();
|
||||
mainThread = new Thread(this, "GtkMain");
|
||||
}
|
||||
|
||||
synchronized (this)
|
||||
{
|
||||
mainThread.start();
|
||||
try {
|
||||
wait();
|
||||
} catch (InterruptedException e) { }
|
||||
}
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
gtkInit();
|
||||
notify();
|
||||
}
|
||||
gtkMain();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
69
libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
Normal file
69
libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
Normal file
@ -0,0 +1,69 @@
|
||||
/* GtkMenuBarPeer.java -- Implements MenuBarPeer with GTK+
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.MenuBarPeer;
|
||||
import java.awt.peer.MenuPeer;
|
||||
|
||||
public class GtkMenuBarPeer extends GtkMenuComponentPeer
|
||||
implements MenuBarPeer
|
||||
{
|
||||
|
||||
native void create ();
|
||||
native void addMenu (MenuPeer menu);
|
||||
|
||||
public GtkMenuBarPeer (MenuBar target)
|
||||
{
|
||||
super (target);
|
||||
create ();
|
||||
}
|
||||
|
||||
/* In Gnome, help menus are no longer right flushed. */
|
||||
public void addHelpMenu (Menu menu)
|
||||
{
|
||||
addMenu (menu);
|
||||
}
|
||||
|
||||
public void addMenu (Menu menu)
|
||||
{
|
||||
addMenu ((MenuPeer) menu.getPeer ());
|
||||
}
|
||||
|
||||
native public void delMenu (int index);
|
||||
}
|
54
libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
Normal file
54
libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
Normal file
@ -0,0 +1,54 @@
|
||||
/* GtkMenuComponentPeer.java -- Implements MenuComponentPeer with GTK+
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.MenuComponentPeer;
|
||||
|
||||
public class GtkMenuComponentPeer extends GtkGenericPeer
|
||||
implements MenuComponentPeer
|
||||
{
|
||||
public GtkMenuComponentPeer (Object awtWidget)
|
||||
{
|
||||
super (awtWidget);
|
||||
}
|
||||
|
||||
public void dispose ()
|
||||
{
|
||||
}
|
||||
}
|
92
libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
Normal file
92
libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
Normal file
@ -0,0 +1,92 @@
|
||||
/* GtkMenuItemPeer.java -- Implements MenuItemPeer with GTK+
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.MenuItemPeer;
|
||||
import java.awt.peer.MenuComponentPeer;
|
||||
import java.awt.peer.MenuBarPeer;
|
||||
import java.awt.peer.MenuPeer;
|
||||
|
||||
public class GtkMenuItemPeer extends GtkMenuComponentPeer
|
||||
implements MenuItemPeer
|
||||
{
|
||||
native void create (String label);
|
||||
|
||||
public GtkMenuItemPeer (MenuItem item)
|
||||
{
|
||||
super (item);
|
||||
create (item.getLabel ());
|
||||
setEnabled (item.isEnabled ());
|
||||
setParent (item);
|
||||
}
|
||||
|
||||
void setParent (MenuItem item)
|
||||
{
|
||||
// add ourself differently, based on what type of parent we have
|
||||
// yes, the typecasting here is nasty.
|
||||
Object parent = item.getParent ();
|
||||
if (parent instanceof MenuBar)
|
||||
{
|
||||
((GtkMenuBarPeer)((MenuBar)parent).getPeer ()).addMenu ((MenuPeer) this);
|
||||
}
|
||||
else // parent instanceof Menu
|
||||
{
|
||||
((GtkMenuPeer)((Menu)parent).getPeer ()).addItem (this,
|
||||
item.getShortcut ());
|
||||
}
|
||||
}
|
||||
|
||||
public void disable ()
|
||||
{
|
||||
setEnabled (false);
|
||||
}
|
||||
|
||||
public void enable ()
|
||||
{
|
||||
setEnabled (true);
|
||||
}
|
||||
|
||||
native public void setEnabled (boolean b);
|
||||
native public void setLabel (String label);
|
||||
|
||||
protected void postMenuActionEvent ()
|
||||
{
|
||||
postActionEvent (((MenuItem)awtWidget).getActionCommand (), 0);
|
||||
}
|
||||
}
|
99
libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java
Normal file
99
libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java
Normal file
@ -0,0 +1,99 @@
|
||||
/* GtkMenuPeer.java -- Implements MenuPeer with GTK+
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.MenuPeer;
|
||||
import java.awt.peer.MenuItemPeer;
|
||||
|
||||
public class GtkMenuPeer extends GtkMenuItemPeer
|
||||
implements MenuPeer
|
||||
{
|
||||
native void create (String label);
|
||||
native void addItem (MenuItemPeer item, int key, boolean shiftModifier);
|
||||
native void setupAccelGroup (GtkGenericPeer container);
|
||||
|
||||
public GtkMenuPeer (Menu menu)
|
||||
{
|
||||
super (menu);
|
||||
|
||||
MenuContainer parent = menu.getParent ();
|
||||
if (parent instanceof Menu)
|
||||
setupAccelGroup ((GtkGenericPeer)((Menu)parent).getPeer ());
|
||||
else if (parent instanceof Component)
|
||||
setupAccelGroup ((GtkGenericPeer)((Component)parent).getPeer ());
|
||||
else
|
||||
setupAccelGroup (null);
|
||||
}
|
||||
|
||||
public void addItem (MenuItem item)
|
||||
{
|
||||
int key = 0;
|
||||
boolean shiftModifier = false;
|
||||
|
||||
MenuShortcut ms = item.getShortcut ();
|
||||
if (ms != null)
|
||||
{
|
||||
key = ms.getKey ();
|
||||
shiftModifier = ms.usesShiftModifier ();
|
||||
}
|
||||
|
||||
addItem ((MenuItemPeer) item.getPeer (), key, shiftModifier);
|
||||
}
|
||||
|
||||
public void addItem (MenuItemPeer item, MenuShortcut ms)
|
||||
{
|
||||
int key = 0;
|
||||
boolean shiftModifier = false;
|
||||
|
||||
if (ms != null)
|
||||
{
|
||||
key = ms.getKey ();
|
||||
shiftModifier = ms.usesShiftModifier ();
|
||||
}
|
||||
|
||||
addItem (item, key, shiftModifier);
|
||||
}
|
||||
|
||||
public void addSeparator ()
|
||||
{
|
||||
addItem (new MenuItem ("-"));
|
||||
}
|
||||
|
||||
native public void delItem (int index);
|
||||
}
|
87
libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java
Normal file
87
libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java
Normal file
@ -0,0 +1,87 @@
|
||||
/* GtkOffScreenImage.java
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
|
||||
public class GtkOffScreenImage extends Image
|
||||
{
|
||||
int width, height;
|
||||
ImageProducer source;
|
||||
Graphics g;
|
||||
|
||||
public GtkOffScreenImage (ImageProducer source, Graphics g,
|
||||
int width, int height)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
this.source = source;
|
||||
this.g = g;
|
||||
}
|
||||
|
||||
public int getWidth (ImageObserver observer)
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight (ImageObserver observer)
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
public ImageProducer getSource ()
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
public Graphics getGraphics ()
|
||||
{
|
||||
return g;
|
||||
}
|
||||
|
||||
public Object getProperty (String name, ImageObserver observer)
|
||||
{
|
||||
return Image.UndefinedProperty;
|
||||
}
|
||||
|
||||
public void flush ()
|
||||
{
|
||||
}
|
||||
}
|
53
libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java
Normal file
53
libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java
Normal file
@ -0,0 +1,53 @@
|
||||
/* GtkPanelPeer.java -- Implements PanelPeer with GTK
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class GtkPanelPeer extends GtkContainerPeer
|
||||
implements PanelPeer
|
||||
{
|
||||
native void create ();
|
||||
native void connectHooks ();
|
||||
|
||||
public GtkPanelPeer (Panel p)
|
||||
{
|
||||
super (p);
|
||||
}
|
||||
}
|
65
libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
Normal file
65
libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
Normal file
@ -0,0 +1,65 @@
|
||||
/* GtkPopupMenuPeer.java -- Implements PopupMenuPeer with GTK+
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.awt.peer.PopupMenuPeer;
|
||||
|
||||
public class GtkPopupMenuPeer extends GtkMenuPeer
|
||||
implements PopupMenuPeer
|
||||
{
|
||||
public GtkPopupMenuPeer (PopupMenu menu)
|
||||
{
|
||||
super (menu);
|
||||
}
|
||||
|
||||
native void setupAccelGroup (GtkGenericPeer container);
|
||||
|
||||
void setParent (MenuItem item)
|
||||
{
|
||||
// we don't need to "add" ourselves to our parent
|
||||
}
|
||||
|
||||
native void show (int x, int y, long time);
|
||||
public void show (Component origin, int x, int y)
|
||||
{
|
||||
Point abs = origin.getLocationOnScreen ();
|
||||
show (abs.x + x, abs.y + y, 0);
|
||||
}
|
||||
}
|
91
libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
Normal file
91
libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
Normal file
@ -0,0 +1,91 @@
|
||||
/* GtkScrollPanePeer.java -- Implements ScrollPanePeer with GTK
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class GtkScrollPanePeer extends GtkContainerPeer
|
||||
implements ScrollPanePeer
|
||||
{
|
||||
native void create ();
|
||||
|
||||
native void gtkScrolledWindowNew(ComponentPeer parent,
|
||||
int policy, int w, int h, int[] dims);
|
||||
native void gtkScrolledWindowSetScrollPosition(int x, int y);
|
||||
native void gtkScrolledWindowSetHScrollIncrement (int u);
|
||||
native void gtkScrolledWindowSetVScrollIncrement (int u);
|
||||
native void gtkScrolledWindowSetSize(int w, int h);
|
||||
|
||||
public GtkScrollPanePeer (ScrollPane sp)
|
||||
{
|
||||
super (sp);
|
||||
|
||||
setPolicy (sp.getScrollbarDisplayPolicy ());
|
||||
}
|
||||
|
||||
native void setPolicy (int policy);
|
||||
native public void childResized (int width, int height);
|
||||
native public int getHScrollbarHeight ();
|
||||
native public int getVScrollbarWidth ();
|
||||
native public void setScrollPosition (int x, int y);
|
||||
|
||||
// public Dimension getPreferredSize ()
|
||||
// {
|
||||
// return new Dimension (60, 60);
|
||||
// }
|
||||
|
||||
public void setUnitIncrement (Adjustable adj, int u)
|
||||
{
|
||||
if (adj.getOrientation()==Adjustable.HORIZONTAL)
|
||||
gtkScrolledWindowSetHScrollIncrement (u);
|
||||
else
|
||||
gtkScrolledWindowSetVScrollIncrement (u);
|
||||
}
|
||||
|
||||
public void setValue (Adjustable adj, int v)
|
||||
{
|
||||
// System.out.println("SPP: setVal: "+adj+":"+v);
|
||||
// Point p=myScrollPane.getScrollPosition ();
|
||||
// if (adj.getOrientation()==Adjustable.HORIZONTAL)
|
||||
// gtkScrolledWindowSetScrollPosition (v,p.y);
|
||||
// else
|
||||
// gtkScrolledWindowSetScrollPosition (p.x,v);
|
||||
// adj.setValue(v);
|
||||
}
|
||||
}
|
78
libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
Normal file
78
libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
Normal file
@ -0,0 +1,78 @@
|
||||
/* GtkScrollbarPeer.java -- Implements ScrollbarPeer with GTK+
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.event.AdjustmentEvent;
|
||||
|
||||
public class GtkScrollbarPeer extends GtkComponentPeer
|
||||
implements ScrollbarPeer
|
||||
{
|
||||
void create ()
|
||||
{
|
||||
Scrollbar sb = (Scrollbar) awtComponent;
|
||||
|
||||
create (sb.getOrientation (), sb.getValue (),
|
||||
sb.getMinimum (), sb.getMaximum (),
|
||||
sb.getUnitIncrement (), sb.getBlockIncrement (),
|
||||
sb.getVisibleAmount ());
|
||||
}
|
||||
|
||||
native void create (int orientation, int value,
|
||||
int min, int max, int stepIncr, int pageIncr,
|
||||
int visibleAmount);
|
||||
|
||||
native void connectHooks ();
|
||||
|
||||
public GtkScrollbarPeer (Scrollbar s)
|
||||
{
|
||||
super (s);
|
||||
}
|
||||
|
||||
native public void setLineIncrement (int amount);
|
||||
native public void setPageIncrement (int amount);
|
||||
native public void setValues (int value, int visible, int min, int max);
|
||||
|
||||
protected void postAdjustmentEvent (int type, int value)
|
||||
{
|
||||
q.postEvent (new AdjustmentEvent ((Adjustable)awtComponent,
|
||||
AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
|
||||
type, value));
|
||||
}
|
||||
}
|
102
libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
Normal file
102
libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
Normal file
@ -0,0 +1,102 @@
|
||||
/* GtkTextAreaPeer.java -- Implements TextAreaPeer with GTK
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class GtkTextAreaPeer extends GtkTextComponentPeer
|
||||
implements TextAreaPeer
|
||||
{
|
||||
native void create (int scrollbarVisibility);
|
||||
|
||||
void create ()
|
||||
{
|
||||
create (((TextArea)awtComponent).getScrollbarVisibility ());
|
||||
}
|
||||
|
||||
// native void create (Object parent, String text, int scroll);
|
||||
native void gtkTextGetSize (int rows, int cols, int dims[]);
|
||||
|
||||
public GtkTextAreaPeer (TextArea ta)
|
||||
{
|
||||
super (ta);
|
||||
}
|
||||
|
||||
public native void insert (String str, int pos);
|
||||
public native void replaceRange (String str, int start, int end);
|
||||
|
||||
public Dimension getMinimumSize (int rows, int cols)
|
||||
{
|
||||
int dims[] = new int[2];
|
||||
|
||||
gtkTextGetSize (rows, cols, dims);
|
||||
|
||||
return (new Dimension (dims[0], dims[1]));
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize (int rows, int cols)
|
||||
{
|
||||
int dims[] = new int[2];
|
||||
|
||||
gtkTextGetSize (rows, cols, dims);
|
||||
|
||||
return (new Dimension (dims[0], dims[1]));
|
||||
}
|
||||
|
||||
/* Deprecated */
|
||||
public Dimension minimumSize (int rows, int cols)
|
||||
{
|
||||
return getMinimumSize (rows, cols);
|
||||
}
|
||||
|
||||
public Dimension preferredSize (int rows, int cols)
|
||||
{
|
||||
return getPreferredSize (rows, cols);
|
||||
}
|
||||
|
||||
public void replaceText (String str, int start, int end)
|
||||
{
|
||||
replaceRange (str, start, end);
|
||||
}
|
||||
|
||||
public void insertText (String str, int pos)
|
||||
{
|
||||
insert (str, pos);
|
||||
}
|
||||
}
|
79
libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
Normal file
79
libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
Normal file
@ -0,0 +1,79 @@
|
||||
/* GtkTextComponentPeer.java -- Implements TextComponentPeer with GTK
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class GtkTextComponentPeer extends GtkComponentPeer
|
||||
implements TextComponentPeer
|
||||
{
|
||||
GtkTextComponentPeer (TextComponent tc)
|
||||
{
|
||||
super (tc);
|
||||
|
||||
setText (tc.getText ());
|
||||
}
|
||||
|
||||
public native int getCaretPosition ();
|
||||
public void setCaretPosition (int pos)
|
||||
{
|
||||
set ("text_position", pos);
|
||||
}
|
||||
public native int getSelectionStart ();
|
||||
public native int getSelectionEnd ();
|
||||
public native String getText ();
|
||||
public native void select (int start, int end);
|
||||
|
||||
public void setEditable (boolean state)
|
||||
{
|
||||
set ("editable", state);
|
||||
}
|
||||
|
||||
public native void setText (String text);
|
||||
|
||||
public void getArgs (Component component, GtkArgList args)
|
||||
{
|
||||
super.getArgs (component, args);
|
||||
|
||||
TextComponent tc = (TextComponent) component;
|
||||
|
||||
args.add ("text_position", tc.getCaretPosition ());
|
||||
args.add ("editable", tc.isEditable ());
|
||||
}
|
||||
}
|
98
libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
Normal file
98
libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
Normal file
@ -0,0 +1,98 @@
|
||||
/* GtkTextFieldPeer.java -- Implements TextFieldPeer with GTK
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class GtkTextFieldPeer extends GtkTextComponentPeer
|
||||
implements TextFieldPeer
|
||||
{
|
||||
|
||||
// native void create (ComponentPeer parent, String text);
|
||||
|
||||
native void create ();
|
||||
native void createHooks ();
|
||||
|
||||
native void gtkEntryGetSize (int cols, int dims[]);
|
||||
|
||||
public GtkTextFieldPeer (TextField tf)
|
||||
{
|
||||
super (tf);
|
||||
|
||||
if (tf.echoCharIsSet ())
|
||||
setEchoChar (tf.getEchoChar ());
|
||||
}
|
||||
|
||||
public Dimension getMinimumSize (int cols)
|
||||
{
|
||||
int dims[] = new int[2];
|
||||
|
||||
gtkEntryGetSize (cols, dims);
|
||||
|
||||
return (new Dimension (dims[0], dims[1]));
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize (int cols)
|
||||
{
|
||||
int dims[] = new int[2];
|
||||
|
||||
gtkEntryGetSize (cols, dims);
|
||||
|
||||
return (new Dimension (dims[0], dims[1]));
|
||||
}
|
||||
|
||||
public native void setEchoChar (char c);
|
||||
|
||||
/* Deprecated */
|
||||
|
||||
public Dimension minimumSize (int cols)
|
||||
{
|
||||
return getMinimumSize (cols);
|
||||
}
|
||||
|
||||
public Dimension preferredSize (int cols)
|
||||
{
|
||||
return getPreferredSize (cols);
|
||||
}
|
||||
|
||||
public void setEchoCharacter (char c)
|
||||
{
|
||||
setEchoChar (c);
|
||||
}
|
||||
}
|
329
libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
Normal file
329
libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
Normal file
@ -0,0 +1,329 @@
|
||||
/* GtkToolkit.java -- Implements an AWT Toolkit using GTK for peers
|
||||
Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.*;
|
||||
import java.awt.dnd.DragGestureEvent;
|
||||
import java.awt.dnd.peer.DragSourceContextPeer;
|
||||
import java.awt.im.InputMethodHighlight;
|
||||
import java.awt.image.*;
|
||||
import java.awt.peer.*;
|
||||
import java.net.*;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Properties;
|
||||
import gnu.java.awt.image.*;
|
||||
import gnu.classpath.Configuration;
|
||||
|
||||
/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer().
|
||||
This merits comment. We are basically calling Sun's bluff on this one.
|
||||
We think Sun has deprecated it simply to discourage its use as it is
|
||||
bad programming style. However, we need to get at a component's peer in
|
||||
this class. If getPeer() ever goes away, we can implement a hash table
|
||||
that will keep up with every window's peer, but for now this is faster. */
|
||||
|
||||
public class GtkToolkit extends java.awt.Toolkit
|
||||
{
|
||||
GtkMainThread main;
|
||||
Hashtable containers = new Hashtable();
|
||||
static EventQueue q = new EventQueue();
|
||||
static Clipboard systemClipboard;
|
||||
|
||||
static
|
||||
{
|
||||
if (Configuration.INIT_LOAD_LIBRARY)
|
||||
System.loadLibrary("gtkpeer");
|
||||
}
|
||||
|
||||
public GtkToolkit ()
|
||||
{
|
||||
main = new GtkMainThread ();
|
||||
systemClipboard = new GtkClipboard ();
|
||||
GtkGenericPeer.enableQueue (q);
|
||||
}
|
||||
|
||||
native public void beep ();
|
||||
native private void getScreenSizeDimensions (int[] xy);
|
||||
|
||||
public int checkImage (Image image, int width, int height,
|
||||
ImageObserver observer)
|
||||
{
|
||||
return ImageObserver.ALLBITS;
|
||||
|
||||
// GtkImage i = (GtkImage) image;
|
||||
// return i.checkImage ();
|
||||
}
|
||||
|
||||
public Image createImage (String filename)
|
||||
{
|
||||
// FIXME - gcj local: GdkPixbufDecoder doesn't work.
|
||||
// return new GtkImage (new GdkPixbufDecoder (filename), null);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Image createImage (URL url)
|
||||
{
|
||||
// FIXME - gcj local: GdkPixbufDecoder doesn't work.
|
||||
// return new GtkImage (new GdkPixbufDecoder (url), null);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Image createImage (ImageProducer producer)
|
||||
{
|
||||
return new GtkImage (producer, null);
|
||||
}
|
||||
|
||||
public Image createImage (byte[] imagedata, int imageoffset,
|
||||
int imagelength)
|
||||
{
|
||||
// System.out.println ("createImage byte[] NOT SUPPORTED");
|
||||
return null;
|
||||
}
|
||||
|
||||
public ColorModel getColorModel ()
|
||||
{
|
||||
return ColorModel.getRGBdefault ();
|
||||
}
|
||||
|
||||
public String[] getFontList ()
|
||||
{
|
||||
return (new String[] { "Dialog",
|
||||
"DialogInput",
|
||||
"Monospaced",
|
||||
"Serif",
|
||||
"SansSerif" });
|
||||
}
|
||||
|
||||
public FontMetrics getFontMetrics (Font font)
|
||||
{
|
||||
return new GdkFontMetrics (font);
|
||||
}
|
||||
|
||||
public Image getImage (String filename)
|
||||
{
|
||||
// FIXME - gcj local: GdkPixbufDecoder doesn't work.
|
||||
// return new GtkImage (new GdkPixbufDecoder (filename), null);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Image getImage (URL url)
|
||||
{
|
||||
// FIXME - gcj local: GdkPixbufDecoder doesn't work.
|
||||
// return new GtkImage (new GdkPixbufDecoder (url), null);
|
||||
return null;
|
||||
}
|
||||
|
||||
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
native public int getScreenResolution();
|
||||
|
||||
public Dimension getScreenSize () {
|
||||
int dim[] = new int[2];
|
||||
getScreenSizeDimensions(dim);
|
||||
return new Dimension(dim[0], dim[1]);
|
||||
}
|
||||
|
||||
public Clipboard getSystemClipboard()
|
||||
{
|
||||
return systemClipboard;
|
||||
}
|
||||
|
||||
public boolean prepareImage (Image image, int width, int height,
|
||||
ImageObserver observer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
native public void sync ();
|
||||
|
||||
protected void setComponentState (Component c, GtkComponentPeer cp)
|
||||
{
|
||||
/* Make the Component reflect Peer defaults */
|
||||
if (c.getForeground () == null)
|
||||
c.setForeground (cp.getForeground ());
|
||||
if (c.getBackground () == null)
|
||||
c.setBackground (cp.getBackground ());
|
||||
// if (c.getFont () == null)
|
||||
// c.setFont (cp.getFont ());
|
||||
|
||||
/* Make the Peer reflect the state of the Component */
|
||||
if (! (c instanceof Window))
|
||||
{
|
||||
cp.setCursor (c.getCursor ());
|
||||
|
||||
Rectangle bounds = c.getBounds ();
|
||||
cp.setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
cp.setVisible (c.isVisible ());
|
||||
}
|
||||
}
|
||||
|
||||
protected ButtonPeer createButton (Button b)
|
||||
{
|
||||
return new GtkButtonPeer (b);
|
||||
}
|
||||
|
||||
protected CanvasPeer createCanvas (Canvas c)
|
||||
{
|
||||
return new GtkCanvasPeer (c);
|
||||
}
|
||||
|
||||
protected CheckboxPeer createCheckbox (Checkbox cb)
|
||||
{
|
||||
return new GtkCheckboxPeer (cb);
|
||||
}
|
||||
|
||||
protected CheckboxMenuItemPeer createCheckboxMenuItem (CheckboxMenuItem cmi)
|
||||
{
|
||||
return new GtkCheckboxMenuItemPeer (cmi);
|
||||
}
|
||||
|
||||
protected ChoicePeer createChoice (Choice c)
|
||||
{
|
||||
return new GtkChoicePeer (c);
|
||||
}
|
||||
|
||||
protected DialogPeer createDialog (Dialog d)
|
||||
{
|
||||
return new GtkDialogPeer (d);
|
||||
}
|
||||
|
||||
protected FileDialogPeer createFileDialog (FileDialog fd)
|
||||
{
|
||||
return new GtkFileDialogPeer (fd);
|
||||
}
|
||||
|
||||
protected FramePeer createFrame (Frame f)
|
||||
{
|
||||
return new GtkFramePeer (f);
|
||||
}
|
||||
|
||||
protected LabelPeer createLabel (Label label)
|
||||
{
|
||||
return new GtkLabelPeer (label);
|
||||
}
|
||||
|
||||
protected ListPeer createList (List list)
|
||||
{
|
||||
return new GtkListPeer (list);
|
||||
}
|
||||
|
||||
protected MenuPeer createMenu (Menu m)
|
||||
{
|
||||
return new GtkMenuPeer (m);
|
||||
}
|
||||
|
||||
protected MenuBarPeer createMenuBar (MenuBar mb)
|
||||
{
|
||||
return new GtkMenuBarPeer (mb);
|
||||
}
|
||||
|
||||
protected MenuItemPeer createMenuItem (MenuItem mi)
|
||||
{
|
||||
return new GtkMenuItemPeer (mi);
|
||||
}
|
||||
|
||||
protected PanelPeer createPanel (Panel p)
|
||||
{
|
||||
return new GtkPanelPeer (p);
|
||||
}
|
||||
|
||||
protected PopupMenuPeer createPopupMenu (PopupMenu target)
|
||||
{
|
||||
return new GtkPopupMenuPeer (target);
|
||||
}
|
||||
|
||||
protected ScrollPanePeer createScrollPane (ScrollPane sp)
|
||||
{
|
||||
return new GtkScrollPanePeer (sp);
|
||||
}
|
||||
|
||||
protected ScrollbarPeer createScrollbar (Scrollbar sb)
|
||||
{
|
||||
return new GtkScrollbarPeer (sb);
|
||||
}
|
||||
|
||||
protected TextAreaPeer createTextArea (TextArea ta)
|
||||
{
|
||||
return new GtkTextAreaPeer (ta);
|
||||
}
|
||||
|
||||
protected TextFieldPeer createTextField (TextField tf)
|
||||
{
|
||||
return new GtkTextFieldPeer (tf);
|
||||
}
|
||||
|
||||
protected WindowPeer createWindow (Window w)
|
||||
{
|
||||
return new GtkWindowPeer (w);
|
||||
}
|
||||
|
||||
protected FontPeer getFontPeer (String name, int style)
|
||||
{
|
||||
try {
|
||||
GtkFontPeer fp = new GtkFontPeer (name, style);
|
||||
return fp;
|
||||
} catch (MissingResourceException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected EventQueue getSystemEventQueueImpl()
|
||||
{
|
||||
return q;
|
||||
}
|
||||
|
||||
protected void loadSystemColors (int[] systemColors)
|
||||
{
|
||||
}
|
||||
|
||||
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent e)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
public Map mapInputMethodHighlight(InputMethodHighlight highlight)
|
||||
{
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
} // class GtkToolkit
|
111
libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
Normal file
111
libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
Normal file
@ -0,0 +1,111 @@
|
||||
/* GtkWindowPeer.java -- Implements WindowPeer with GTK
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package gnu.java.awt.peer.gtk;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class GtkWindowPeer extends GtkContainerPeer
|
||||
implements WindowPeer
|
||||
{
|
||||
static protected final int GTK_WINDOW_TOPLEVEL = 0;
|
||||
static protected final int GTK_WINDOW_DIALOG = 1;
|
||||
static protected final int GTK_WINDOW_POPUP = 2;
|
||||
|
||||
native void create (int type);
|
||||
|
||||
void create ()
|
||||
{
|
||||
create (GTK_WINDOW_POPUP);
|
||||
}
|
||||
|
||||
native void connectHooks ();
|
||||
|
||||
public GtkWindowPeer (Window window)
|
||||
{
|
||||
super (window);
|
||||
|
||||
Dimension d = window.getSize ();
|
||||
setBounds (0, 0, d.width, d.height);
|
||||
}
|
||||
|
||||
public void getArgs (Component component, GtkArgList args)
|
||||
{
|
||||
args.add ("visible", component.isVisible ());
|
||||
args.add ("sensitive", component.isEnabled ());
|
||||
}
|
||||
|
||||
native public void toBack ();
|
||||
native public void toFront ();
|
||||
|
||||
native public void setBounds (int x, int y, int width, int height);
|
||||
|
||||
public void setTitle (String title)
|
||||
{
|
||||
set ("title", title);
|
||||
}
|
||||
|
||||
native public void setResizable (boolean r);
|
||||
|
||||
protected void postConfigureEvent (int x, int y, int width, int height,
|
||||
int top, int left, int bottom, int right)
|
||||
{
|
||||
/*
|
||||
If our borders change (which often happens when we opaque resize),
|
||||
we need to make sure that a new layout will happen, since Sun
|
||||
forgets to handle this case.
|
||||
*/
|
||||
if (insets.top != top
|
||||
|| insets.left != left
|
||||
|| insets.bottom != bottom
|
||||
|| insets.right != right)
|
||||
{
|
||||
awtComponent.invalidate ();
|
||||
}
|
||||
|
||||
insets.top = top;
|
||||
insets.left = left;
|
||||
insets.bottom = bottom;
|
||||
insets.right = right;
|
||||
|
||||
awtComponent.setBounds (x, y, width, height);
|
||||
awtComponent.validate ();
|
||||
}
|
||||
|
||||
native public void setVisible (boolean b);
|
||||
}
|
299
libjava/gnu/java/awt/peer/gtk/Test.java
Normal file
299
libjava/gnu/java/awt/peer/gtk/Test.java
Normal file
@ -0,0 +1,299 @@
|
||||
/* Test.java -- Tests the GTK Toolkit
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.peer.*;
|
||||
import java.awt.datatransfer.*;
|
||||
import gnu.java.awt.image.*;
|
||||
import java.io.*;
|
||||
|
||||
class Test
|
||||
{
|
||||
static int xs = 5, ys = 5;
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
Properties prop=System.getProperties ();
|
||||
prop.put ("awt.toolkit","gnu.java.awt.peer.gtk.GtkToolkit");
|
||||
}
|
||||
|
||||
final Frame f=new Frame();
|
||||
f.setTitle ("Red Hat Classpath");
|
||||
|
||||
// f.addComponentListener (new ComponentAdapter() {
|
||||
// public void componentMoved (ComponentEvent e) {
|
||||
// System.out.println("component moved");
|
||||
// }
|
||||
// public void componentResized (ComponentEvent e) {
|
||||
// System.out.println("component resized");
|
||||
// }
|
||||
// });
|
||||
f.setSize(200,200);
|
||||
|
||||
Panel pan=new Panel();
|
||||
|
||||
final Label l = new Label ("Pithy Message:");
|
||||
l.setCursor (Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR));
|
||||
pan.add (l);
|
||||
|
||||
TextField tf = new TextField("Hello world!");
|
||||
pan.add(tf);
|
||||
|
||||
final Image img;
|
||||
img = Toolkit.getDefaultToolkit ().createImage (new XBMDecoder ("fvwm.xbm"));
|
||||
|
||||
|
||||
final Canvas ch = new Canvas () {
|
||||
|
||||
public void update (Graphics g)
|
||||
{
|
||||
System.out.println ("update called");
|
||||
super.update (g);
|
||||
}
|
||||
public void paint (Graphics g) {
|
||||
g.drawString("Hello world!", xs+5, ys+10);
|
||||
g.setColor (Color.blue);
|
||||
g.drawLine (xs,ys,xs+20,ys+20);
|
||||
|
||||
// System.out.println (TextArea.SCROLLBARS_BOTH);
|
||||
// System.out.println (TextArea.SCROLLBARS_HORIZONTAL_ONLY);
|
||||
// System.out.println (TextArea.SCROLLBARS_VERTICAL_ONLY);
|
||||
|
||||
// Font f1 = new Font ("TimesRoman", Font.PLAIN, 10);
|
||||
// System.out.println (f1.getName ());
|
||||
// System.out.println (f1.getFamily ());
|
||||
|
||||
// Font font = new Font ("Serif", Font.PLAIN, 18);
|
||||
// g.setFont (font);
|
||||
// g.setXORMode (Color.red);
|
||||
|
||||
|
||||
// System.out.println (g.getFontMetrics (font).stringWidth ("foobar"));
|
||||
|
||||
// System.out.println (g.drawImage (img, 0, 0, this));
|
||||
}
|
||||
};
|
||||
|
||||
ch.setSize(60, 60);
|
||||
// List ch=new List();
|
||||
// ch.add("Ding");
|
||||
// ch.add("September");
|
||||
// ch.add("Red");
|
||||
// ch.add("Quassia");
|
||||
// ch.add("Pterodactyl");
|
||||
|
||||
// ch.addMouseListener(new MouseAdapter() {
|
||||
// public void mousePressed(MouseEvent e) {
|
||||
// System.out.println("mouse pressed ch");
|
||||
// System.out.println("shift = " + e.isShiftDown());
|
||||
// System.out.println("meta = " + e.isMetaDown());
|
||||
// System.out.println("alt = " + e.isAltDown());
|
||||
// System.out.println("ctrl = " + e.isControlDown());
|
||||
// System.out.println("x = " + e.getX());
|
||||
// System.out.println("y = " + e.getY());
|
||||
// System.out.println("clickcount = " + e.getClickCount());
|
||||
// System.out.println("when = " + e.getWhen());
|
||||
// System.out.println();
|
||||
// }
|
||||
// public void mouseReleased(MouseEvent e) {
|
||||
// System.out.println("mouse released ch");
|
||||
// }
|
||||
// public void mouseClicked(MouseEvent e) {
|
||||
// System.out.println("mouse clicked ch");
|
||||
// }
|
||||
// });
|
||||
|
||||
pan.add(ch);
|
||||
f.add(pan,"North");
|
||||
|
||||
final ScrollPane sp=new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
|
||||
System.out.println ("ALWAYS HERE: " + ScrollPane.SCROLLBARS_ALWAYS);
|
||||
System.out.println ("ALWAYS" + ScrollPane.SCROLLBARS_ALWAYS);
|
||||
System.out.println ("NEEDED" + ScrollPane.SCROLLBARS_AS_NEEDED);
|
||||
System.out.println ("NEVER " + ScrollPane.SCROLLBARS_NEVER);
|
||||
|
||||
|
||||
final Panel p=new Panel();
|
||||
System.out.println ("PREFERED: " + p.getPreferredSize ());
|
||||
p.add(new Button("Stop"));
|
||||
System.out.println ("PREFERED: " + p.getPreferredSize ());
|
||||
p.add(new Button("evil"));
|
||||
System.out.println ("PREFERED: " + p.getPreferredSize ());
|
||||
p.add(new Button("hoarders"));
|
||||
p.add(new Button("use"));
|
||||
p.add(new Button("GNU"));
|
||||
p.add(new Scrollbar(Scrollbar.HORIZONTAL));
|
||||
System.out.println ("PREFERED: " + p.getPreferredSize ());
|
||||
|
||||
sp.add(p);
|
||||
f.add(sp,"South");
|
||||
|
||||
Panel east_panel = new Panel();
|
||||
east_panel.setLayout(new GridLayout (0,1));
|
||||
|
||||
// CheckboxGroup group = new CheckboxGroup();
|
||||
|
||||
// Checkbox cb=new Checkbox("one", group, true);
|
||||
// east_panel.add(cb);
|
||||
// cb=new Checkbox("two", group, false);
|
||||
// east_panel.add(cb);
|
||||
|
||||
// cb.addMouseListener(new MouseAdapter() {
|
||||
// public void mousePressed(MouseEvent e) {
|
||||
// System.out.println("mouse pressed cb");
|
||||
// System.out.println("shift = " + e.isShiftDown());
|
||||
// System.out.println("meta = " + e.isMetaDown());
|
||||
// System.out.println("alt = " + e.isAltDown());
|
||||
// System.out.println("ctrl = " + e.isControlDown());
|
||||
// System.out.println("x = " + e.getX());
|
||||
// System.out.println("y = " + e.getY());
|
||||
// System.out.println("clickcount = " + e.getClickCount());
|
||||
// System.out.println("when = " + e.getWhen());
|
||||
// System.out.println();
|
||||
// }
|
||||
// public void mouseReleased(MouseEvent e) {
|
||||
// System.out.println("mouse released cb");
|
||||
// }
|
||||
// public void mouseClicked(MouseEvent e) {
|
||||
// System.out.println("mouse clicked cb");
|
||||
// }
|
||||
// public void mouseEntered(MouseEvent e) {
|
||||
// System.out.println("mouse entered cb");
|
||||
// }
|
||||
// public void mouseExited(MouseEvent e) {
|
||||
// System.out.println("mouse exited cb");
|
||||
// }
|
||||
// });
|
||||
|
||||
f.add(east_panel,"East");
|
||||
|
||||
final Button wb=new Button();
|
||||
wb.setLabel("Destroy Frame on Click");
|
||||
wb.addActionListener (new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
ScrollPanePeer peer = (ScrollPanePeer)sp.getPeer ();
|
||||
if (peer != null)
|
||||
{
|
||||
System.out.println (peer.getHScrollbarHeight ());
|
||||
System.out.println (peer.getVScrollbarWidth ());
|
||||
}
|
||||
|
||||
l.setText ("Hello World!");
|
||||
System.out.println ("PREFERED: " + p.getPreferredSize ());
|
||||
|
||||
final Dialog d = new Dialog (f);
|
||||
d.setModal (true);
|
||||
Button b = new Button ("foobar");
|
||||
b.addMouseListener (new MouseAdapter () {
|
||||
public void mousePressed (MouseEvent me) {
|
||||
System.out.println ("I got called");
|
||||
d.hide ();
|
||||
|
||||
// System.out.println (ScrollPane.SCROLLBARS_ALWAYS);
|
||||
// System.out.println (ScrollPane.SCROLLBARS_AS_NEEDED);
|
||||
// System.out.println (ScrollPane.SCROLLBARS_NEVER);
|
||||
}
|
||||
});
|
||||
d.add (b);
|
||||
d.pack ();
|
||||
d.show ();
|
||||
System.out.println ("hello world");
|
||||
// System.out.println ("action listener on wb called");
|
||||
// Clipboard clip = Toolkit.getDefaultToolkit ().getSystemClipboard ();
|
||||
// StringSelection ss = new StringSelection("123456789");
|
||||
// clip.setContents (ss, ss);
|
||||
// Transferable t = clip.getContents (this);
|
||||
// try {
|
||||
// System.out.println (t.getTransferData (DataFlavor.stringFlavor));
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace ();
|
||||
// }
|
||||
// System.exit (0);
|
||||
}
|
||||
});
|
||||
|
||||
wb.addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
System.out.println("mouse pressed wb");
|
||||
xs++;
|
||||
ys++;
|
||||
ch.repaint ();
|
||||
}
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
System.out.println("mouse released wb");
|
||||
}
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
System.out.println("mouse clicked wb");
|
||||
}
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
System.out.println("mouse entered wb");
|
||||
}
|
||||
public void mouseExited(MouseEvent e) {
|
||||
System.out.println("mouse exited wb");
|
||||
}
|
||||
});
|
||||
|
||||
f.add(wb,"West");
|
||||
|
||||
f.pack();
|
||||
f.show();
|
||||
|
||||
sp.setScrollPosition (10,0);
|
||||
|
||||
Toolkit t = Toolkit.getDefaultToolkit();
|
||||
/* t.beep(); */
|
||||
System.out.println("screen size: " + t.getScreenSize());
|
||||
System.out.println("resolution : " + t.getScreenResolution());
|
||||
// try {
|
||||
// Thread.sleep (5000);
|
||||
// } catch (InterruptedException e) {}
|
||||
// f.setSize(500,500);
|
||||
|
||||
System.out.println ("background of canvas: " + ch.getBackground ());
|
||||
System.out.println ("foreground of canvas: " + ch.getForeground ());
|
||||
|
||||
System.out.println("done");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
571
libjava/gnu/java/awt/peer/gtk/TestAWT.java
Normal file
571
libjava/gnu/java/awt/peer/gtk/TestAWT.java
Normal file
@ -0,0 +1,571 @@
|
||||
/* TestAWT.java -- Tests the AWT like testgtk
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
import java.awt.List;
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.peer.*;
|
||||
|
||||
class TestAWT
|
||||
{
|
||||
public static void main(String args[])
|
||||
{
|
||||
if (args.length==0)
|
||||
{
|
||||
Properties prop = System.getProperties ();
|
||||
prop.put ("awt.toolkit", "gnu.java.awt.peer.gtk.GtkToolkit");
|
||||
}
|
||||
MainWindow f = new MainWindow();
|
||||
System.out.println(f.isDisplayable());
|
||||
f.show();
|
||||
System.out.println(f.isDisplayable());
|
||||
}
|
||||
}
|
||||
|
||||
interface SubWindow
|
||||
{
|
||||
public void init ();
|
||||
}
|
||||
|
||||
class PrettyPanel extends Panel
|
||||
{
|
||||
Insets myInsets;
|
||||
|
||||
public PrettyPanel ()
|
||||
{
|
||||
myInsets = new Insets (10, 10, 10, 10);
|
||||
}
|
||||
public Insets getInsets ()
|
||||
{
|
||||
return myInsets;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class PrettyFrame extends Frame
|
||||
{
|
||||
public PrettyFrame ()
|
||||
{
|
||||
((BorderLayout) getLayout ()).setHgap (5);
|
||||
((BorderLayout) getLayout ()).setVgap (5);
|
||||
}
|
||||
|
||||
// public Insets getInsets()
|
||||
// {
|
||||
// Insets oldInsets = super.getInsets ();
|
||||
// return new Insets (oldInsets.top+10,
|
||||
// oldInsets.left+10,
|
||||
// oldInsets.bottom+10,
|
||||
// oldInsets.right+10);
|
||||
// }
|
||||
}
|
||||
|
||||
abstract class SubFrame extends PrettyFrame implements SubWindow
|
||||
{
|
||||
boolean initted = false;
|
||||
|
||||
public void setVisible (boolean visible)
|
||||
{
|
||||
if (!initted && visible)
|
||||
init();
|
||||
super.setVisible (visible);
|
||||
}
|
||||
}
|
||||
|
||||
class MainWindow extends PrettyFrame implements ActionListener
|
||||
{
|
||||
Button closeButton;
|
||||
|
||||
Hashtable windows;
|
||||
Vector buttons;
|
||||
|
||||
void addSubWindow (String name, SubWindow w)
|
||||
{
|
||||
Button b = new Button (name);
|
||||
b.addActionListener (this);
|
||||
|
||||
buttons.addElement (b);
|
||||
windows.put (b, w);
|
||||
}
|
||||
|
||||
MainWindow ()
|
||||
{
|
||||
MenuBar mb = new MenuBar ();
|
||||
Menu menu = new Menu ("File");
|
||||
Menu submenu = new Menu ("Testing");
|
||||
submenu.add (new CheckboxMenuItem ("Foobar"));
|
||||
menu.add (submenu);
|
||||
mb.add (menu);
|
||||
|
||||
setMenuBar (mb);
|
||||
|
||||
add (new Label ("Classpath v0.0.0"), "North");
|
||||
|
||||
closeButton = new Button ("Close");
|
||||
closeButton.addActionListener (this);
|
||||
closeButton.setFont (new Font ("Serif", Font.BOLD | Font.ITALIC, 18));
|
||||
add (closeButton, "South");
|
||||
|
||||
windows = new Hashtable ();
|
||||
buttons = new Vector ();
|
||||
|
||||
addSubWindow ("Buttons", new ButtonsWindow ());
|
||||
addSubWindow ("Cursors", new CursorsWindow ());
|
||||
addSubWindow ("Dialog", new DialogWindow (this));
|
||||
addSubWindow ("File", new FileWindow (this));
|
||||
addSubWindow ("Labels", new LabelWindow ());
|
||||
addSubWindow ("List", new ListWindow ());
|
||||
addSubWindow ("Radio Buttons", new RadioWindow ());
|
||||
addSubWindow ("TextField", new TextFieldWindow ());
|
||||
|
||||
Panel sp = new Panel();
|
||||
PrettyPanel p = new PrettyPanel();
|
||||
p.setLayout (new GridLayout (windows.size(), 1));
|
||||
|
||||
for (Enumeration e = buttons.elements (); e.hasMoreElements (); )
|
||||
{
|
||||
p.add ((Button) e.nextElement ());
|
||||
}
|
||||
|
||||
sp.add (p);
|
||||
add (sp, "Center");
|
||||
|
||||
setSize (200, 86 + (windows.size ()*22));
|
||||
setTitle ("TestAWT");
|
||||
}
|
||||
|
||||
public void actionPerformed (ActionEvent evt)
|
||||
{
|
||||
Button source = (Button) evt.getSource ();
|
||||
|
||||
if (source==closeButton)
|
||||
{
|
||||
System.getProperties ().list (System.out);
|
||||
dispose();
|
||||
System.exit (0);
|
||||
}
|
||||
|
||||
Window w = (Window) windows.get (source);
|
||||
if (w.isVisible ())
|
||||
w.dispose ();
|
||||
else
|
||||
{
|
||||
w.setVisible (true);
|
||||
w.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ButtonsWindow extends SubFrame implements ActionListener
|
||||
{
|
||||
Button b[] = new Button [9];
|
||||
|
||||
public void init ()
|
||||
{
|
||||
initted = true;
|
||||
Panel p = new Panel ();
|
||||
p.setLayout (new GridLayout (0, 3, 5, 5));
|
||||
|
||||
for (int i=0; i<9; i++)
|
||||
{
|
||||
b[i]=new Button ("button" + (i+1));
|
||||
b[i].addActionListener (this);
|
||||
}
|
||||
|
||||
p.add (b[0]);
|
||||
p.add (b[6]);
|
||||
p.add (b[4]);
|
||||
p.add (b[8]);
|
||||
p.add (b[1]);
|
||||
p.add (b[7]);
|
||||
p.add (b[3]);
|
||||
p.add (b[5]);
|
||||
p.add (b[2]);
|
||||
|
||||
add (p, "North");
|
||||
|
||||
Button cb = new Button ("close");
|
||||
cb.addActionListener(new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
add (cb, "South");
|
||||
setTitle ("Buttons");
|
||||
}
|
||||
|
||||
public void actionPerformed (ActionEvent evt)
|
||||
{
|
||||
Button source = (Button) evt.getSource ();
|
||||
|
||||
for (int i=0; i<9; i++)
|
||||
{
|
||||
if (source == b[i])
|
||||
{
|
||||
int i2=((i+1)==9)?0:(i+1);
|
||||
if (b[i2].isVisible())
|
||||
b[i2].setVisible(false);
|
||||
else
|
||||
b[i2].setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DialogWindow extends Dialog implements SubWindow
|
||||
{
|
||||
Label text;
|
||||
boolean initted = false;
|
||||
|
||||
public DialogWindow (Frame f)
|
||||
{
|
||||
super (f, true);
|
||||
}
|
||||
|
||||
public void setVisible (boolean visible)
|
||||
{
|
||||
if (!initted && visible)
|
||||
init();
|
||||
super.setVisible (visible);
|
||||
}
|
||||
|
||||
public void init ()
|
||||
{
|
||||
text = new Label ("Dialog Test");
|
||||
text.setAlignment (Label.CENTER);
|
||||
|
||||
add (text, "North");
|
||||
text.setVisible (false);
|
||||
|
||||
Panel p = new PrettyPanel();
|
||||
|
||||
Button cb = new Button ("OK");
|
||||
cb.addActionListener(new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
|
||||
p.setLayout (new GridLayout (1, 2));
|
||||
((GridLayout) p.getLayout ()).setHgap (5);
|
||||
((GridLayout) p.getLayout ()).setVgap (5);
|
||||
p.add (cb);
|
||||
|
||||
Button toggle = new Button ("Toggle");
|
||||
p.add (toggle);
|
||||
|
||||
toggle.addActionListener(new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
if (text.isVisible ())
|
||||
text.setVisible (false);
|
||||
else
|
||||
text.setVisible (true);
|
||||
doLayout();
|
||||
}
|
||||
});
|
||||
|
||||
add (p, "South");
|
||||
setTitle ("Dialog");
|
||||
setSize (130, 70);
|
||||
}
|
||||
}
|
||||
|
||||
class CursorsWindow extends SubFrame implements ItemListener
|
||||
{
|
||||
Choice cursorChoice;
|
||||
Canvas cursorCanvas;
|
||||
|
||||
public void init ()
|
||||
{
|
||||
cursorChoice = new Choice();
|
||||
cursorChoice.add ("Default");
|
||||
cursorChoice.add ("Crosshair");
|
||||
cursorChoice.add ("Text");
|
||||
cursorChoice.add ("Wait");
|
||||
cursorChoice.add ("Southwest Resize");
|
||||
cursorChoice.add ("Southeast Resize");
|
||||
cursorChoice.add ("Northwest Resize");
|
||||
cursorChoice.add ("Northeast Resize");
|
||||
cursorChoice.add ("North Resize");
|
||||
cursorChoice.add ("South Resize");
|
||||
cursorChoice.add ("West Resize");
|
||||
cursorChoice.add ("East Resize");
|
||||
cursorChoice.add ("Hand");
|
||||
cursorChoice.add ("Move");
|
||||
|
||||
cursorChoice.addItemListener(this);
|
||||
|
||||
add (cursorChoice, "North");
|
||||
|
||||
cursorCanvas = new Canvas ()
|
||||
{
|
||||
public void paint (Graphics g)
|
||||
{
|
||||
Dimension d = this.getSize();
|
||||
g.setColor (Color.white);
|
||||
g.fillRect (0, 0, d.width, d.height/2);
|
||||
g.setColor (Color.black);
|
||||
g.fillRect (0, d.height/2, d.width, d.height/2);
|
||||
g.setColor (this.getBackground());
|
||||
g.fillRect (d.width/3, d.height/3, d.width/3,
|
||||
d.height/3);
|
||||
}
|
||||
};
|
||||
|
||||
cursorCanvas.setSize (80,80);
|
||||
|
||||
add (cursorCanvas, "Center");
|
||||
|
||||
Button cb = new Button ("Close");
|
||||
cb.addActionListener(new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
|
||||
add (cb, "South");
|
||||
setTitle ("Cursors");
|
||||
setSize (160, 180);
|
||||
}
|
||||
|
||||
public void itemStateChanged (ItemEvent e)
|
||||
{
|
||||
cursorCanvas.setCursor (Cursor.getPredefinedCursor (cursorChoice.getSelectedIndex()));
|
||||
}
|
||||
}
|
||||
|
||||
class TextFieldWindow extends SubFrame implements ItemListener
|
||||
{
|
||||
Checkbox editable, visible, sensitive;
|
||||
TextField text;
|
||||
|
||||
public void init ()
|
||||
{
|
||||
initted = true;
|
||||
text = new TextField ("hello world");
|
||||
add (text, "North");
|
||||
|
||||
Panel p = new Panel();
|
||||
p.setLayout (new GridLayout (3, 1));
|
||||
((GridLayout) p.getLayout ()).setHgap (5);
|
||||
((GridLayout) p.getLayout ()).setVgap (5);
|
||||
|
||||
editable = new Checkbox("Editable", true);
|
||||
p.add (editable);
|
||||
editable.addItemListener (this);
|
||||
|
||||
visible = new Checkbox("Visible", true);
|
||||
p.add (visible);
|
||||
visible.addItemListener (this);
|
||||
|
||||
sensitive = new Checkbox("Sensitive", true);
|
||||
p.add (sensitive);
|
||||
sensitive.addItemListener (this);
|
||||
|
||||
add (p, "Center");
|
||||
|
||||
Button cb = new Button ("Close");
|
||||
cb.addActionListener(new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
|
||||
add (cb, "South");
|
||||
setTitle ("TextField");
|
||||
setSize (160, 180);
|
||||
}
|
||||
|
||||
public void itemStateChanged (ItemEvent e)
|
||||
{
|
||||
boolean on=true;
|
||||
|
||||
if (e.getStateChange () == ItemEvent.DESELECTED)
|
||||
on=false;
|
||||
if (e.getSource() == editable)
|
||||
text.setEditable (on);
|
||||
if (e.getSource() == visible)
|
||||
if (on)
|
||||
text.setEchoChar ((char) 0);
|
||||
else
|
||||
text.setEchoChar ('*');
|
||||
if (e.getSource() == sensitive)
|
||||
text.setEnabled (on);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class FileWindow extends FileDialog implements SubWindow
|
||||
{
|
||||
boolean initted = false;
|
||||
|
||||
public FileWindow (MainWindow mw)
|
||||
{
|
||||
super (mw);
|
||||
}
|
||||
|
||||
public void setVisible (boolean visible)
|
||||
{
|
||||
if (!initted && visible)
|
||||
init();
|
||||
super.setVisible (visible);
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
initted = true;
|
||||
}
|
||||
}
|
||||
|
||||
class LabelWindow extends SubFrame
|
||||
{
|
||||
public void init ()
|
||||
{
|
||||
initted = true;
|
||||
|
||||
Panel p = new Panel();
|
||||
p.setLayout (new GridLayout (3, 1));
|
||||
((GridLayout) p.getLayout ()).setHgap (5);
|
||||
((GridLayout) p.getLayout ()).setVgap (5);
|
||||
|
||||
p.add (new Label ("left justified label", Label.LEFT));
|
||||
p.add (new Label ("center justified label", Label.CENTER));
|
||||
p.add (new Label ("right justified label", Label.RIGHT));
|
||||
|
||||
add (p, "Center");
|
||||
|
||||
Button cb = new Button ("Close");
|
||||
cb.addActionListener(new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
|
||||
add (cb, "South");
|
||||
setTitle ("Labels");
|
||||
setSize (160, 180);
|
||||
}
|
||||
}
|
||||
|
||||
class ListWindow extends SubFrame
|
||||
{
|
||||
public void init ()
|
||||
{
|
||||
initted = true;
|
||||
|
||||
Panel p = new Panel ();
|
||||
p.setLayout (new GridLayout (3, 1));
|
||||
|
||||
List l = new List (5, true);
|
||||
for (int i = 0; i < 10; i++)
|
||||
l.add ("added item " + i);
|
||||
|
||||
p.add (l);
|
||||
|
||||
add (p, "Center");
|
||||
|
||||
Button cb = new Button ("Close");
|
||||
cb.addActionListener(new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
|
||||
add (cb, "South");
|
||||
setTitle ("List");
|
||||
setSize (85, 167);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class RadioWindow extends SubFrame
|
||||
{
|
||||
public void init ()
|
||||
{
|
||||
initted = true;
|
||||
|
||||
Panel p = new Panel();
|
||||
p.setLayout (new GridLayout (3, 1));
|
||||
((GridLayout) p.getLayout ()).setHgap (5);
|
||||
((GridLayout) p.getLayout ()).setVgap (5);
|
||||
|
||||
final CheckboxGroup cg = new CheckboxGroup();
|
||||
final Checkbox[] boxes = new Checkbox[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
boxes[i] = new Checkbox("button" + i, cg, i == 0);
|
||||
p.add(boxes[i]);
|
||||
}
|
||||
|
||||
add (p, "North");
|
||||
|
||||
p = new Panel();
|
||||
p.setLayout (new GridLayout (1, 3));
|
||||
((GridLayout) p.getLayout ()).setHgap (5);
|
||||
((GridLayout) p.getLayout ()).setVgap (5);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
final int val = i;
|
||||
Button tweak = new Button ("Set " + i);
|
||||
tweak.addActionListener(new ActionListener ()
|
||||
{
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
cg.setSelectedCheckbox(boxes[val]);
|
||||
}
|
||||
});
|
||||
p.add(tweak);
|
||||
}
|
||||
|
||||
add (p, "Center");
|
||||
|
||||
Button cb = new Button ("Close");
|
||||
cb.addActionListener(new ActionListener () {
|
||||
public void actionPerformed (ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
|
||||
add (cb, "South");
|
||||
setTitle ("Radio Buttons");
|
||||
setSize (85, 167);
|
||||
}
|
||||
}
|
194
libjava/gtk.m4
Normal file
194
libjava/gtk.m4
Normal file
@ -0,0 +1,194 @@
|
||||
# Configure paths for GTK+
|
||||
# Owen Taylor 97-11-3
|
||||
|
||||
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_GTK,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the gtk-config script
|
||||
dnl
|
||||
AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
|
||||
gtk_config_prefix="$withval", gtk_config_prefix="")
|
||||
AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
|
||||
gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
|
||||
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
|
||||
, enable_gtktest=yes)
|
||||
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gthread)
|
||||
gtk_config_args="$gtk_config_args gthread"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test x$gtk_config_exec_prefix != x ; then
|
||||
gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
|
||||
if test x${GTK_CONFIG+set} != xset ; then
|
||||
GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
|
||||
fi
|
||||
fi
|
||||
if test x$gtk_config_prefix != x ; then
|
||||
gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
|
||||
if test x${GTK_CONFIG+set} != xset ; then
|
||||
GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
|
||||
min_gtk_version=ifelse([$1], ,0.99.7,$1)
|
||||
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
|
||||
no_gtk=""
|
||||
if test "$GTK_CONFIG" = "no" ; then
|
||||
no_gtk=yes
|
||||
else
|
||||
GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
|
||||
GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
|
||||
gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_gtktest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$GTK_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GTK is sufficiently new. (Also sanity
|
||||
dnl checks the results of gtk-config to some extent
|
||||
dnl
|
||||
rm -f conf.gtktest
|
||||
AC_TRY_RUN([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.gtktest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_gtk_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_gtk_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((gtk_major_version != $gtk_config_major_version) ||
|
||||
(gtk_minor_version != $gtk_config_minor_version) ||
|
||||
(gtk_micro_version != $gtk_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
|
||||
$gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf ("*** was found! If gtk-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
|
||||
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
|
||||
printf("*** before re-running configure\n");
|
||||
}
|
||||
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
|
||||
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
|
||||
(gtk_minor_version != GTK_MINOR_VERSION) ||
|
||||
(gtk_micro_version != GTK_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
|
||||
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
}
|
||||
#endif /* defined (GTK_MAJOR_VERSION) ... */
|
||||
else
|
||||
{
|
||||
if ((gtk_major_version > major) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version > minor)) ||
|
||||
((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of gtk-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_gtk" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$GTK_CONFIG" = "no" ; then
|
||||
echo "*** The gtk-config script installed by GTK could not be found"
|
||||
echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the GTK_CONFIG environment variable to the"
|
||||
echo "*** full path to gtk-config."
|
||||
else
|
||||
if test -f conf.gtktest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GTK test program, checking why..."
|
||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
||||
LIBS="$LIBS $GTK_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GTK or finding the wrong"
|
||||
echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
|
||||
echo "***"
|
||||
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
|
||||
echo "*** came with the system with the command"
|
||||
echo "***"
|
||||
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GTK was incorrectly installed"
|
||||
echo "*** or that you have moved GTK since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GTK_CFLAGS=""
|
||||
GTK_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
rm -f conf.gtktest
|
||||
])
|
@ -85,10 +85,19 @@ GCLIBS = @GCLIBS@
|
||||
GCOBJS = @GCOBJS@
|
||||
GCSPEC = @GCSPEC@
|
||||
GCTESTSPEC = @GCTESTSPEC@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_CONFIG = @GLIB_CONFIG@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_CONFIG = @GTK_CONFIG@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
|
||||
INCLTDL = @INCLTDL@
|
||||
INTERPRETER = @INTERPRETER@
|
||||
JC1GCSPEC = @JC1GCSPEC@
|
||||
LIBART_CFLAGS = @LIBART_CFLAGS@
|
||||
LIBART_CONFIG = @LIBART_CONFIG@
|
||||
LIBART_LIBS = @LIBART_LIBS@
|
||||
LIBFFI = @LIBFFI@
|
||||
LIBFFIINCS = @LIBFFIINCS@
|
||||
LIBGCJDEBUG = @LIBGCJDEBUG@
|
||||
@ -118,6 +127,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
|
||||
THREADLIBS = @THREADLIBS@
|
||||
THREADOBJS = @THREADOBJS@
|
||||
THREADSPEC = @THREADSPEC@
|
||||
TOOLKIT = @TOOLKIT@
|
||||
VERSION = @VERSION@
|
||||
ZINCS = @ZINCS@
|
||||
ZLIBS = @ZLIBS@
|
||||
@ -129,6 +139,9 @@ here = @here@
|
||||
libgcj_basedir = @libgcj_basedir@
|
||||
mkinstalldirs = @mkinstalldirs@
|
||||
tool_include_dir = @tool_include_dir@
|
||||
toolexecdir = @toolexecdir@
|
||||
toolexeclibdir = @toolexeclibdir@
|
||||
toolexecmainlibdir = @toolexecmainlibdir@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */
|
||||
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
@ -394,9 +394,6 @@
|
||||
/* Define if the compiler is configured for setjmp/longjmp exceptions. */
|
||||
#undef SJLJ_EXCEPTIONS
|
||||
|
||||
/* Indicate that linker is not able to 8-byte align static data */
|
||||
#undef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
|
||||
|
||||
/* Required define if using POSIX threads */
|
||||
#undef _REENTRANT
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Toolkit.java -- AWT Toolkit superclass
|
||||
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@ -96,7 +96,7 @@ public abstract class Toolkit
|
||||
{
|
||||
/** The default toolkit name. */
|
||||
private static String default_toolkit_name
|
||||
= "gnu.awt.gtk.GtkToolkit";
|
||||
= gnu.classpath.Configuration.default_awt_peer_toolkit;
|
||||
|
||||
/**
|
||||
* The toolkit in use. Once we load it, we don't ever change it
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Window.java --
|
||||
Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
||||
Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@ -141,11 +141,12 @@ public class Window extends Container
|
||||
&& gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
|
||||
throw new IllegalArgumentException ("gc must be from a screen device");
|
||||
|
||||
if (gc == null)
|
||||
graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
|
||||
.getDefaultScreenDevice()
|
||||
.getDefaultConfiguration();
|
||||
else
|
||||
// FIXME: until we implement this, it just causes AWT to crash.
|
||||
// if (gc == null)
|
||||
// graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
|
||||
// .getDefaultScreenDevice()
|
||||
// .getDefaultConfiguration();
|
||||
// else
|
||||
graphicsConfiguration = gc;
|
||||
}
|
||||
|
||||
|
134
libjava/jni/classpath/jcl.c
Normal file
134
libjava/jni/classpath/jcl.c
Normal file
@ -0,0 +1,134 @@
|
||||
/* jcl.c
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <jcl.h>
|
||||
#include <malloc.h>
|
||||
|
||||
static char errstr[4098]; // this way the memory is pre-allocated, so that we do not have to worry if we are out of memory.
|
||||
|
||||
JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char * errMsg) {
|
||||
jclass excClass;
|
||||
if((*env)->ExceptionOccurred(env)) {
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
excClass = (*env)->FindClass(env, className);
|
||||
if(excClass == NULL) {
|
||||
jclass errExcClass;
|
||||
errExcClass = (*env)->FindClass(env, "java/lang/ClassNotFoundException");
|
||||
if(errExcClass == NULL) {
|
||||
errExcClass = (*env)->FindClass(env, "java/lang/InternalError");
|
||||
if(errExcClass == NULL) {
|
||||
sprintf(errstr,"JCL: Utterly failed to throw exeption %s with message %s.",className,errMsg);
|
||||
fprintf(stderr, errstr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
sprintf(errstr,"JCL: Failed to throw exception %s with message %s: could not find exception class.", className, errMsg);
|
||||
(*env)->ThrowNew(env, errExcClass, errstr);
|
||||
}
|
||||
(*env)->ThrowNew(env, excClass, errMsg);
|
||||
}
|
||||
|
||||
JNIEXPORT void * JNICALL JCL_malloc(JNIEnv * env, size_t size) {
|
||||
void * mem = malloc(size);
|
||||
if(mem == NULL) {
|
||||
JCL_ThrowException(env, "java/lang/OutOfMemoryError", "malloc() failed.");
|
||||
return NULL;
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
JNIEXPORT void * JNICALL JCL_realloc(JNIEnv *env, void *ptr, size_t size)
|
||||
{
|
||||
ptr = realloc(ptr, size);
|
||||
if (ptr == 0)
|
||||
{
|
||||
JCL_ThrowException(env, "java/lang/OutOfMemoryError",
|
||||
"malloc() failed.");
|
||||
return NULL;
|
||||
}
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL JCL_free(JNIEnv * env, void * p) {
|
||||
if(p != NULL) {
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv * env, jstring s) {
|
||||
char* cstr;
|
||||
if(s == NULL) {
|
||||
JCL_ThrowException(env, "java/lang/NullPointerException","Null string");
|
||||
return NULL;
|
||||
}
|
||||
cstr = (char*)(*env)->GetStringUTFChars(env, s, NULL);
|
||||
if(cstr == NULL) {
|
||||
JCL_ThrowException(env, "java/lang/InternalError", "GetStringUTFChars() failed.");
|
||||
return NULL;
|
||||
}
|
||||
return cstr;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv * env, jstring s, char * cstr) {
|
||||
(*env)->ReleaseStringUTFChars(env, s, cstr);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL JCL_MonitorEnter(JNIEnv * env, jobject o) {
|
||||
jint retval = (*env)->MonitorEnter(env,o);
|
||||
if(retval != 0) {
|
||||
JCL_ThrowException(env, "java/lang/InternalError", "MonitorEnter() failed.");
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL JCL_MonitorExit(JNIEnv * env, jobject o) {
|
||||
jint retval = (*env)->MonitorExit(env,o);
|
||||
if(retval != 0) {
|
||||
JCL_ThrowException(env, "java/lang/InternalError", "MonitorExit() failed.");
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
JNIEXPORT jclass JNICALL JCL_FindClass(JNIEnv * env, char * className) {
|
||||
jclass retval = (*env)->FindClass(env,className);
|
||||
if(retval == NULL) {
|
||||
JCL_ThrowException(env, "java/lang/ClassNotFoundException", className);
|
||||
}
|
||||
return retval;
|
||||
}
|
64
libjava/jni/classpath/jcl.h
Normal file
64
libjava/jni/classpath/jcl.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* jcl.h
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#ifndef __JCL_H__
|
||||
#define __JCL_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <jni.h>
|
||||
#include <config.h>
|
||||
|
||||
JNIEXPORT jclass JNICALL JCL_FindClass(JNIEnv * env, char * className);
|
||||
JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char * errMsg);
|
||||
JNIEXPORT void * JNICALL JCL_malloc(JNIEnv *env, size_t size);
|
||||
JNIEXPORT void * JNICALL JCL_realloc(JNIEnv *env, void *ptr, size_t size);
|
||||
JNIEXPORT void JNICALL JCL_free(JNIEnv *env, void * p);
|
||||
JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv *env, jstring s);
|
||||
JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv *env, jstring s, char * cstr);
|
||||
JNIEXPORT jint JNICALL JCL_MonitorEnter(JNIEnv *env, jobject o);
|
||||
JNIEXPORT jint JNICALL JCL_MonitorExit(JNIEnv *env, jobject o);
|
||||
|
||||
#define JCL_RETHROW_EXCEPTION(env) if((*(env))->ExceptionOccurred((env)) != NULL) return NULL;
|
||||
|
||||
/* Simple debug macro */
|
||||
#ifdef DEBUG
|
||||
#define DBG(x) fprintf(stderr, (x));
|
||||
#else
|
||||
#define DBG(x)
|
||||
#endif
|
||||
|
||||
#endif
|
117
libjava/jni/classpath/jnilink.c
Normal file
117
libjava/jni/classpath/jnilink.c
Normal file
@ -0,0 +1,117 @@
|
||||
/* JNILINK 1.1: JNI version.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "jnilink.h"
|
||||
#include <string.h>
|
||||
#include <jcl.h>
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#define GETCLASS(c) *(jclass*)(c)
|
||||
|
||||
JNIEXPORT jclass JNICALL
|
||||
LINK_RelinkClass (JNIEnv * env, linkedClass * c, char * name) {
|
||||
jclass found;
|
||||
LINK_UnlinkClass(env,*c);
|
||||
|
||||
found = (*env)->FindClass(env,name);
|
||||
if(found == NULL)
|
||||
return NULL;
|
||||
|
||||
*c = JCL_malloc(env,sizeof(jclass));
|
||||
if(*c == NULL)
|
||||
return NULL;
|
||||
|
||||
GETCLASS(*c) = (*env)->NewGlobalRef(env,found);
|
||||
return GETCLASS(*c);
|
||||
}
|
||||
|
||||
JNIEXPORT jclass JNICALL
|
||||
LINK_RelinkKnownClass(JNIEnv * env, linkedClass * c, jclass newClass) {
|
||||
LINK_UnlinkClass(env,*c);
|
||||
|
||||
*c = JCL_malloc(env,sizeof(jclass));
|
||||
if(*c == NULL)
|
||||
return NULL;
|
||||
|
||||
GETCLASS(*c) = (*env)->NewGlobalRef(env,newClass);
|
||||
return newClass;
|
||||
}
|
||||
|
||||
JNIEXPORT jmethodID JNICALL
|
||||
LINK_RelinkMethod (JNIEnv * env, jmethodID * m, linkedClass c,
|
||||
char * name, char * sig) {
|
||||
*m = (*env)->GetMethodID(env,GETCLASS(c),name,sig);
|
||||
return *m;
|
||||
}
|
||||
|
||||
JNIEXPORT jmethodID JNICALL
|
||||
LINK_RelinkStaticMethod(JNIEnv * env, jmethodID * m, linkedClass c,
|
||||
char * name, char * sig) {
|
||||
*m = (*env)->GetStaticMethodID(env,GETCLASS(c),name,sig);
|
||||
return *m;
|
||||
}
|
||||
|
||||
JNIEXPORT jfieldID JNICALL
|
||||
LINK_RelinkField (JNIEnv * env, jfieldID * f, linkedClass c,
|
||||
char * name, char * sig) {
|
||||
*f = (*env)->GetFieldID(env,GETCLASS(c),name,sig);
|
||||
return *f;
|
||||
}
|
||||
|
||||
JNIEXPORT jfieldID JNICALL
|
||||
LINK_RelinkStaticField (JNIEnv * env, jfieldID * f, linkedClass c,
|
||||
char * name, char * sig) {
|
||||
*f = (*env)->GetStaticFieldID(env,GETCLASS(c),name,sig);
|
||||
return *f;
|
||||
}
|
||||
|
||||
|
||||
/* These are for when the class referencing the symbols is unloaded; it
|
||||
destroys any object references
|
||||
* the linker might have kept around.
|
||||
*/
|
||||
JNIEXPORT void JNICALL LINK_UnlinkClass (JNIEnv * env, linkedClass * c) {
|
||||
if(*c != NULL) {
|
||||
if(GETCLASS(*c) != NULL)
|
||||
(*env)->DeleteGlobalRef(env,GETCLASS(*c));
|
||||
JCL_free(env,*c);
|
||||
*c = NULL;
|
||||
}
|
||||
}
|
||||
|
86
libjava/jni/classpath/jnilink.h
Normal file
86
libjava/jni/classpath/jnilink.h
Normal file
@ -0,0 +1,86 @@
|
||||
/* JNILINK 1.1: JNI version.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#ifndef __JNILINK_H__
|
||||
#define __JNILINK_H__
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
typedef void* linkedClass;
|
||||
|
||||
#define LINK_LinkClass(env,c,name) ((c)==NULL ? LINK_ReallyLinkClass((env),&(c),(name)) : (c))
|
||||
#define LINK_LinkKnownClass(env,c,newClass) ((c)==NULL ? LINK_ReallyLinkKnownClass((env),&(c),(newClass)) : (c))
|
||||
#define LINK_LinkMethod(env,m,c,name,sig) ((m)==NULL ? LINK_RelinkMethod((env),&(m),(c),(name),(sig)) : (m))
|
||||
#define LINK_LinkStaticMethod(env,m,c,name,sig) ((m)==NULL ? LINK_RelinkStaticMethod((env),&(m),(c),(name),(sig)) : (m))
|
||||
#define LINK_LinkField(env,f,c,name,sig) ((m)==NULL ? LINK_RelinkField((env),&(f),(c),(name),(sig)) : (f))
|
||||
#define LINK_LinkStaticField(env,f,c,name,sig) ((m)==NULL ? LINK_RelinkStaticField((env),&(f),(c),(name),(sig)) : (f))
|
||||
|
||||
#define LINK_LinkConstructor(env,m,c,sig) ((m)==NULL ? LINK_RelinkMethod((env),&(m),(c),"<init>",(sig)) : (m))
|
||||
|
||||
JNIEXPORT jclass JNICALL
|
||||
LINK_ReallyLinkClass (JNIEnv * env, linkedClass * c,
|
||||
char * name);
|
||||
JNIEXPORT jclass JNICALL
|
||||
LINK_ReallyLinkKnownClass(JNIEnv * env, linkedClass * c,
|
||||
jclass newClass);
|
||||
JNIEXPORT jclass JNICALL
|
||||
LINK_RelinkClass (JNIEnv * env, linkedClass * c,
|
||||
char * name);
|
||||
JNIEXPORT jclass JNICALL
|
||||
LINK_RelinkKnownClass (JNIEnv * env, linkedClass * c,
|
||||
jclass newClass);
|
||||
JNIEXPORT jmethodID JNICALL
|
||||
LINK_RelinkMethod (JNIEnv * env, jmethodID * m, linkedClass c,
|
||||
char * name, char * sig);
|
||||
JNIEXPORT jmethodID JNICALL
|
||||
LINK_RelinkStaticMethod(JNIEnv * env, jmethodID * m, linkedClass c,
|
||||
char * name, char * sig);
|
||||
JNIEXPORT jfieldID JNICALL
|
||||
LINK_RelinkField (JNIEnv * env, jfieldID * f, linkedClass c,
|
||||
char * name, char * sig);
|
||||
JNIEXPORT jfieldID JNICALL
|
||||
LINK_RelinkStaticField (JNIEnv * env, jfieldID * f, linkedClass c,
|
||||
char * name, char * sig);
|
||||
|
||||
/* These are for when the class referencing the symbols is unloaded; it
|
||||
destroys any object references
|
||||
* the linker might have kept around.
|
||||
*/
|
||||
JNIEXPORT void JNICALL LINK_UnlinkClass (JNIEnv * env, linkedClass * c);
|
||||
|
||||
#endif
|
247
libjava/jni/classpath/native_state.c
Normal file
247
libjava/jni/classpath/native_state.c
Normal file
@ -0,0 +1,247 @@
|
||||
/* Magical NSA API -- Associate a C ptr with an instance of an object
|
||||
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <jni.h>
|
||||
#include "native_state.h"
|
||||
|
||||
#define DEFAULT_TABLE_SIZE 97
|
||||
|
||||
struct state_table *
|
||||
init_state_table_with_size (JNIEnv *env, jclass clazz, jint size)
|
||||
{
|
||||
struct state_table *table;
|
||||
jfieldID hash;
|
||||
jclass clazz_g;
|
||||
|
||||
hash = (*env)->GetFieldID (env, clazz, "native_state", "I");
|
||||
if (hash == NULL)
|
||||
return NULL;
|
||||
|
||||
clazz_g = (*env)->NewGlobalRef (env, clazz);
|
||||
if (clazz_g == NULL)
|
||||
return NULL;
|
||||
|
||||
table = (struct state_table *) malloc (sizeof (struct state_table));
|
||||
table->size = size;
|
||||
table->head = (struct state_node **) calloc (sizeof (struct state_node *),
|
||||
table->size);
|
||||
table->hash = hash;
|
||||
table->clazz = clazz_g;
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
struct state_table *
|
||||
init_state_table (JNIEnv *env, jclass clazz)
|
||||
{
|
||||
return init_state_table_with_size (env, clazz, DEFAULT_TABLE_SIZE);
|
||||
}
|
||||
|
||||
static void *
|
||||
remove_node (struct state_node **head, jint obj_id)
|
||||
{
|
||||
struct state_node *back_ptr = NULL;
|
||||
struct state_node *node = *head;
|
||||
|
||||
while (node != NULL)
|
||||
{
|
||||
if (node->key == obj_id)
|
||||
{
|
||||
void *return_value;
|
||||
if (back_ptr == NULL)
|
||||
*head = node->next;
|
||||
else
|
||||
back_ptr->next = node->next;
|
||||
return_value = node->c_state;
|
||||
free (node);
|
||||
return return_value;
|
||||
}
|
||||
back_ptr = node;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
get_node (struct state_node **head, jint obj_id)
|
||||
{
|
||||
struct state_node *back_ptr = NULL;
|
||||
struct state_node *node = *head;
|
||||
|
||||
while (node != NULL)
|
||||
{
|
||||
if (node->key == obj_id)
|
||||
{
|
||||
/* Move the node we found to the front of the list. */
|
||||
if (back_ptr != NULL)
|
||||
{
|
||||
back_ptr->next = node->next;
|
||||
node->next = *head;
|
||||
*head = node;
|
||||
}
|
||||
|
||||
/* Return the match. */
|
||||
return node->c_state;
|
||||
}
|
||||
|
||||
back_ptr = node;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
add_node (struct state_node **head, jint obj_id, void *state)
|
||||
{
|
||||
struct state_node *node = *head;
|
||||
struct state_node *back_ptr = NULL;
|
||||
|
||||
struct state_node *new_node;
|
||||
|
||||
if (node != NULL)
|
||||
{
|
||||
while (node->next != NULL && obj_id != node->key)
|
||||
{
|
||||
back_ptr = node;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
if (node->key == obj_id)
|
||||
{
|
||||
/* If we're updating a node, move it to the front of the
|
||||
list. */
|
||||
if (back_ptr != NULL)
|
||||
{
|
||||
back_ptr->next = node->next;
|
||||
node->next = *head;
|
||||
}
|
||||
node->c_state = state;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
new_node = (struct state_node *) malloc (sizeof (struct state_node));
|
||||
new_node->key = obj_id;
|
||||
new_node->c_state = state;
|
||||
new_node->next = *head;
|
||||
*head = new_node;
|
||||
}
|
||||
|
||||
void
|
||||
set_state_oid (JNIEnv *env, jobject lock, struct state_table *table,
|
||||
jint obj_id, void *state)
|
||||
{
|
||||
jint hash;
|
||||
|
||||
hash = obj_id % table->size;
|
||||
|
||||
(*env)->MonitorEnter (env, lock);
|
||||
add_node (&table->head[hash], obj_id, state);
|
||||
(*env)->MonitorExit (env, lock);
|
||||
}
|
||||
|
||||
void *
|
||||
get_state_oid (JNIEnv *env, jobject lock, struct state_table *table,
|
||||
jint obj_id)
|
||||
{
|
||||
jint hash;
|
||||
void *return_value;
|
||||
|
||||
hash = obj_id % table->size;
|
||||
|
||||
(*env)->MonitorEnter (env, lock);
|
||||
return_value = get_node (&table->head[hash], obj_id);
|
||||
(*env)->MonitorExit (env, lock);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
void *
|
||||
remove_state_oid (JNIEnv *env, jobject lock, struct state_table *table,
|
||||
jint obj_id)
|
||||
{
|
||||
jint hash;
|
||||
void *return_value;
|
||||
|
||||
hash = obj_id % table->size;
|
||||
|
||||
(*env)->MonitorEnter (env, lock);
|
||||
return_value = remove_node (&table->head[hash], obj_id);
|
||||
(*env)->MonitorExit (env, lock);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
int
|
||||
set_state (JNIEnv *env, jobject obj, struct state_table *table, void *state)
|
||||
{
|
||||
jint obj_id;
|
||||
obj_id = (*env)->GetIntField (env, obj, table->hash);
|
||||
|
||||
if ((*env)->ExceptionOccurred (env) != NULL)
|
||||
return -1;
|
||||
|
||||
set_state_oid (env, table->clazz, table, obj_id, state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
get_state (JNIEnv *env, jobject obj, struct state_table *table)
|
||||
{
|
||||
jint obj_id;
|
||||
obj_id = (*env)->GetIntField (env, obj, table->hash);
|
||||
|
||||
if ((*env)->ExceptionOccurred (env) != NULL)
|
||||
return NULL;
|
||||
|
||||
return get_state_oid (env, table->clazz, table, obj_id);
|
||||
}
|
||||
|
||||
void *
|
||||
remove_state_slot (JNIEnv *env, jobject obj, struct state_table *table)
|
||||
{
|
||||
jint obj_id;
|
||||
obj_id = (*env)->GetIntField (env, obj, table->hash);
|
||||
|
||||
if ((*env)->ExceptionOccurred (env) != NULL)
|
||||
return NULL;
|
||||
|
||||
return remove_state_oid (env, table->clazz, table, obj_id);
|
||||
}
|
71
libjava/jni/classpath/native_state.h
Normal file
71
libjava/jni/classpath/native_state.h
Normal file
@ -0,0 +1,71 @@
|
||||
/* Magical NSA API -- Associate a C ptr with an instance of an object
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#ifndef JCL_NATIVE_STATE
|
||||
#define JCL_NATIVE_STATE
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
struct state_table
|
||||
{
|
||||
jint size; /* number of slots, should be prime */
|
||||
jfieldID hash; /* field containing System.identityHashCode(this) */
|
||||
jclass clazz; /* lock aquired for reading/writing nodes */
|
||||
struct state_node **head;
|
||||
};
|
||||
|
||||
struct state_node
|
||||
{
|
||||
jint key;
|
||||
void *c_state;
|
||||
struct state_node *next;
|
||||
};
|
||||
|
||||
struct state_table * init_state_table_with_size (JNIEnv *, jclass, jint);
|
||||
struct state_table * init_state_table (JNIEnv *, jclass);
|
||||
|
||||
/* lowlevel api */
|
||||
void set_state_oid (JNIEnv *, jobject, struct state_table *, jint, void *);
|
||||
void * get_state_oid (JNIEnv *, jobject, struct state_table *, jint);
|
||||
void * remove_state_oid (JNIEnv *, jobject, struct state_table *, jint);
|
||||
|
||||
/* highlevel api */
|
||||
int set_state (JNIEnv *, jobject, struct state_table *, void *);
|
||||
void * get_state (JNIEnv *, jobject, struct state_table *);
|
||||
void * remove_state_slot (JNIEnv *, jobject, struct state_table *);
|
||||
|
||||
#endif
|
463
libjava/jni/classpath/primlib.c
Normal file
463
libjava/jni/classpath/primlib.c
Normal file
@ -0,0 +1,463 @@
|
||||
/* primlib.c
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#include <jnilink.h>
|
||||
#include <primlib.h>
|
||||
#include <jcl.h>
|
||||
|
||||
static jclass nativeWrapClass[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL,
|
||||
NULL,NULL,NULL, NULL,NULL,NULL};
|
||||
|
||||
static jclass nativeTypeClass[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL,
|
||||
NULL,NULL,NULL, NULL,NULL,NULL};
|
||||
|
||||
static jmethodID nativeWrapClassConstructor[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL,
|
||||
NULL,NULL,NULL, NULL,NULL,NULL};
|
||||
|
||||
static jmethodID nativeWrapClassAccessor[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL,
|
||||
NULL,NULL,NULL, NULL,NULL,NULL};
|
||||
|
||||
static char * nativeWrapClassName[PRIMLIB_NUMTYPES] = {
|
||||
NULL,
|
||||
NULL,
|
||||
"java/lang/Boolean",
|
||||
"java/lang/Byte",
|
||||
"java/lang/Character",
|
||||
"java/lang/Short",
|
||||
"java/lang/Integer",
|
||||
"java/lang/Long",
|
||||
"java/lang/Float",
|
||||
"java/lang/Double",
|
||||
"java/lang/Void",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char * nativeWrapClassConstructorSig[PRIMLIB_NUMTYPES] = {
|
||||
NULL,
|
||||
NULL,
|
||||
"(Z)V",
|
||||
"(B)V",
|
||||
"(C)V",
|
||||
"(S)V",
|
||||
"(I)V",
|
||||
"(J)V",
|
||||
"(F)V",
|
||||
"(D)V",
|
||||
"()V",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char * nativeWrapClassAccessorName[PRIMLIB_NUMTYPES] = {
|
||||
NULL,
|
||||
NULL,
|
||||
"booleanValue",
|
||||
"byteValue",
|
||||
"charValue",
|
||||
"shortValue",
|
||||
"intValue",
|
||||
"longValue",
|
||||
"floatValue",
|
||||
"doubleValue",
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static char * nativeWrapClassAccessorSig[PRIMLIB_NUMTYPES] = {
|
||||
NULL,
|
||||
NULL,
|
||||
"()Z",
|
||||
"()B",
|
||||
"()C",
|
||||
"()S",
|
||||
"()I",
|
||||
"()J",
|
||||
"()F",
|
||||
"()D",
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
JNIEXPORT jclass JNICALL PRIMLIB_GetNativeWrapClass(JNIEnv * env, int reflectType) {
|
||||
return LINK_LinkClass(env,nativeWrapClass[reflectType],nativeWrapClassName[reflectType]);
|
||||
}
|
||||
|
||||
static jclass ActuallyGetNativeTypeClass(JNIEnv * env, int reflectType) {
|
||||
jclass wrapClass;
|
||||
jfieldID typeField;
|
||||
|
||||
wrapClass = PRIMLIB_GetNativeWrapClass(env, reflectType);
|
||||
if(wrapClass == NULL)
|
||||
return NULL;
|
||||
typeField = (*env)->GetStaticFieldID(env, wrapClass, "TYPE", "Ljava/lang/Class");
|
||||
if(typeField == NULL)
|
||||
return NULL;
|
||||
return (*env)->GetStaticObjectField(env, wrapClass, typeField);
|
||||
}
|
||||
|
||||
JNIEXPORT jclass JNICALL PRIMLIB_GetNativeTypeClass(JNIEnv * env, int reflectType) {
|
||||
return LINK_LinkKnownClass(env, nativeTypeClass[reflectType], ActuallyGetNativeTypeClass(env,reflectType));
|
||||
}
|
||||
|
||||
JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassConstructor(JNIEnv * env, int reflectType) {
|
||||
PRIMLIB_GetNativeWrapClass(env,reflectType);
|
||||
return LINK_LinkConstructor(env, nativeWrapClassConstructor[reflectType], nativeWrapClass[reflectType], nativeWrapClassConstructorSig[reflectType]);
|
||||
}
|
||||
|
||||
JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassAccessor(JNIEnv * env, int reflectType) {
|
||||
PRIMLIB_GetNativeWrapClass(env,reflectType);
|
||||
return LINK_LinkMethod(env, nativeWrapClassAccessor[reflectType], nativeWrapClass[reflectType], nativeWrapClassAccessorName[reflectType], nativeWrapClassAccessorSig[reflectType]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapBoolean(JNIEnv * env, jboolean b) {
|
||||
jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_BOOLEAN);
|
||||
JCL_RETHROW_EXCEPTION(env);
|
||||
return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN), construct, b);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapByte (JNIEnv * env, jbyte b) {
|
||||
jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_BYTE);
|
||||
JCL_RETHROW_EXCEPTION(env);
|
||||
return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE), construct, b);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapChar (JNIEnv * env, jchar c) {
|
||||
jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_CHAR);
|
||||
JCL_RETHROW_EXCEPTION(env);
|
||||
return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR), construct, c);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapShort (JNIEnv * env, jshort s) {
|
||||
jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_SHORT);
|
||||
JCL_RETHROW_EXCEPTION(env);
|
||||
return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT), construct, s);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapInt (JNIEnv * env, jint i) {
|
||||
jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_INT);
|
||||
JCL_RETHROW_EXCEPTION(env);
|
||||
return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT), construct, i);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapLong (JNIEnv * env, jlong l) {
|
||||
jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_LONG);
|
||||
JCL_RETHROW_EXCEPTION(env);
|
||||
return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG), construct, l);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapFloat (JNIEnv * env, jfloat f) {
|
||||
jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_FLOAT);
|
||||
JCL_RETHROW_EXCEPTION(env);
|
||||
return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT), construct, f);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapDouble (JNIEnv * env, jdouble d) {
|
||||
jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_DOUBLE);
|
||||
JCL_RETHROW_EXCEPTION(env);
|
||||
return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE), construct, d);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL PRIMLIB_UnwrapBoolean(JNIEnv * env, jobject obj) {
|
||||
if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN))) {
|
||||
return PRIMLIB_GetBooleanObjectValue(env, obj);
|
||||
} else {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jbyte JNICALL PRIMLIB_UnwrapByte(JNIEnv * env, jobject obj) {
|
||||
if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
|
||||
return PRIMLIB_GetByteObjectValue(env, obj);
|
||||
} else {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jshort JNICALL PRIMLIB_UnwrapShort(JNIEnv * env, jobject obj) {
|
||||
if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
|
||||
return PRIMLIB_GetShortObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
|
||||
return (jshort)PRIMLIB_GetByteObjectValue(env, obj);
|
||||
} else {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jchar JNICALL PRIMLIB_UnwrapChar(JNIEnv * env, jobject obj) {
|
||||
if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
|
||||
return PRIMLIB_GetCharObjectValue(env, obj);
|
||||
} else {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL PRIMLIB_UnwrapInt(JNIEnv * env, jobject obj) {
|
||||
if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) {
|
||||
return PRIMLIB_GetIntObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
|
||||
return (jint)PRIMLIB_GetShortObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
|
||||
return (jint)PRIMLIB_GetCharObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
|
||||
return (jint)PRIMLIB_GetByteObjectValue(env, obj);
|
||||
} else {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL PRIMLIB_UnwrapLong(JNIEnv * env, jobject obj) {
|
||||
if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) {
|
||||
return PRIMLIB_GetLongObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) {
|
||||
return (jlong)PRIMLIB_GetIntObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
|
||||
return (jlong)PRIMLIB_GetShortObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
|
||||
return (jlong)PRIMLIB_GetCharObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
|
||||
return (jlong)PRIMLIB_GetByteObjectValue(env, obj);
|
||||
} else {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jfloat JNICALL PRIMLIB_UnwrapFloat(JNIEnv * env, jobject obj) {
|
||||
if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT))) {
|
||||
return PRIMLIB_GetFloatObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) {
|
||||
return (jfloat)PRIMLIB_GetLongObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) {
|
||||
return (jfloat)PRIMLIB_GetIntObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
|
||||
return (jfloat)PRIMLIB_GetShortObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
|
||||
return (jfloat)PRIMLIB_GetCharObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
|
||||
return (jfloat)PRIMLIB_GetByteObjectValue(env, obj);
|
||||
} else {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL PRIMLIB_UnwrapDouble(JNIEnv * env, jobject obj) {
|
||||
if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE))) {
|
||||
return PRIMLIB_GetDoubleObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT))) {
|
||||
return (jdouble)PRIMLIB_GetFloatObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) {
|
||||
return (jdouble)PRIMLIB_GetLongObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) {
|
||||
return (jdouble)PRIMLIB_GetIntObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
|
||||
return (jdouble)PRIMLIB_GetShortObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
|
||||
return (jdouble)PRIMLIB_GetCharObjectValue(env, obj);
|
||||
} else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
|
||||
return (jdouble)PRIMLIB_GetByteObjectValue(env, obj);
|
||||
} else {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveWrapperType(JNIEnv * env, jobject obj) {
|
||||
jclass typeClass;
|
||||
if(obj == NULL) {
|
||||
return PRIMLIB_NULL;
|
||||
}
|
||||
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_DOUBLE;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_FLOAT;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_LONG;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_INT;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_CHAR;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_SHORT;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_BYTE;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_BOOLEAN;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_VOID);
|
||||
if((*env)->IsInstanceOf(env, obj, typeClass)) {
|
||||
return PRIMLIB_VOID;
|
||||
}
|
||||
return PRIMLIB_OBJECT;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveType(JNIEnv * env, jclass returnType) {
|
||||
jclass typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_DOUBLE);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_DOUBLE;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_FLOAT);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_FLOAT;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_LONG);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_LONG;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_INT);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_INT;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_CHAR);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_CHAR;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_SHORT);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_SHORT;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_BYTE);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_BYTE;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_BOOLEAN);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_BOOLEAN;
|
||||
}
|
||||
typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_VOID);
|
||||
if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
|
||||
return PRIMLIB_VOID;
|
||||
}
|
||||
return PRIMLIB_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL PRIMLIB_GetBooleanObjectValue(JNIEnv * env, jobject obj) {
|
||||
jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_BOOLEAN);
|
||||
return (*env)->CallBooleanMethod(env, obj, acc);
|
||||
}
|
||||
|
||||
JNIEXPORT jbyte JNICALL PRIMLIB_GetByteObjectValue(JNIEnv * env, jobject obj) {
|
||||
jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_BYTE);
|
||||
return (*env)->CallByteMethod(env, obj, acc);
|
||||
}
|
||||
|
||||
JNIEXPORT jshort JNICALL PRIMLIB_GetShortObjectValue(JNIEnv * env, jobject obj) {
|
||||
jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_SHORT);
|
||||
return (*env)->CallShortMethod(env, obj, acc);
|
||||
}
|
||||
|
||||
JNIEXPORT jchar JNICALL PRIMLIB_GetCharObjectValue(JNIEnv * env, jobject obj) {
|
||||
jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_CHAR);
|
||||
return (*env)->CallCharMethod(env, obj, acc);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL PRIMLIB_GetIntObjectValue(JNIEnv * env, jobject obj) {
|
||||
jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_INT);
|
||||
return (*env)->CallIntMethod(env, obj, acc);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL PRIMLIB_GetLongObjectValue(JNIEnv * env, jobject obj) {
|
||||
jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_LONG);
|
||||
return (*env)->CallLongMethod(env, obj, acc);
|
||||
}
|
||||
|
||||
JNIEXPORT jfloat JNICALL PRIMLIB_GetFloatObjectValue(JNIEnv * env, jobject obj) {
|
||||
jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_FLOAT);
|
||||
return (*env)->CallFloatMethod(env, obj, acc);
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL PRIMLIB_GetDoubleObjectValue(JNIEnv * env, jobject obj) {
|
||||
jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_DOUBLE);
|
||||
return (*env)->CallDoubleMethod(env, obj, acc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
JNIEXPORT jvalue JNICALL PRIMLIB_UnwrapJValue(JNIEnv* env, jobject obj, jclass classType) {
|
||||
jvalue retval;
|
||||
jint objType = PRIMLIB_GetReflectiveType(env, classType);
|
||||
if(objType == PRIMLIB_BOOLEAN) {
|
||||
retval.z = PRIMLIB_UnwrapBoolean(env,obj);
|
||||
} else if(objType == PRIMLIB_BYTE) {
|
||||
retval.b = PRIMLIB_UnwrapByte(env,obj);
|
||||
} else if(objType == PRIMLIB_CHAR) {
|
||||
retval.c = PRIMLIB_UnwrapChar(env,obj);
|
||||
} else if(objType == PRIMLIB_SHORT) {
|
||||
retval.s = PRIMLIB_UnwrapShort(env,obj);
|
||||
} else if(objType == PRIMLIB_INT) {
|
||||
retval.i = PRIMLIB_UnwrapInt(env,obj);
|
||||
} else if(objType == PRIMLIB_LONG) {
|
||||
retval.j = PRIMLIB_UnwrapLong(env,obj);
|
||||
} else if(objType == PRIMLIB_FLOAT) {
|
||||
retval.f = PRIMLIB_UnwrapFloat(env,obj);
|
||||
} else if(objType == PRIMLIB_DOUBLE) {
|
||||
retval.d = PRIMLIB_UnwrapDouble(env,obj);
|
||||
} else {
|
||||
if(obj != NULL && !(*env)->IsInstanceOf(env, obj, classType)) {
|
||||
JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct object type.");
|
||||
return retval;
|
||||
}
|
||||
retval.l = obj;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
102
libjava/jni/classpath/primlib.h
Normal file
102
libjava/jni/classpath/primlib.h
Normal file
@ -0,0 +1,102 @@
|
||||
/* primlib.h
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#ifndef __PRIMLIB_H__
|
||||
#define __PRIMLIB_H__
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#define PRIMLIB_UNKNOWN 0
|
||||
#define PRIMLIB_OBJECT 1
|
||||
#define PRIMLIB_BOOLEAN 2
|
||||
#define PRIMLIB_BYTE 3
|
||||
#define PRIMLIB_CHAR 4
|
||||
#define PRIMLIB_SHORT 5
|
||||
#define PRIMLIB_INT 6
|
||||
#define PRIMLIB_LONG 7
|
||||
#define PRIMLIB_FLOAT 8
|
||||
#define PRIMLIB_DOUBLE 9
|
||||
#define PRIMLIB_VOID 10
|
||||
#define PRIMLIB_NULL 11
|
||||
#define PRIMLIB_NUMTYPES 12
|
||||
|
||||
/* Low-level primitive class accessor functions. */
|
||||
JNIEXPORT jclass JNICALL PRIMLIB_GetNativeWrapClass(JNIEnv * env, int reflectType);
|
||||
JNIEXPORT jclass JNICALL PRIMLIB_GetNativeTypeClass(JNIEnv * env, int reflectType);
|
||||
JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassConstructor(JNIEnv * env, int reflectType);
|
||||
JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassAccessor(JNIEnv * env, int reflectType);
|
||||
|
||||
/* Type discovery functions: WrapperType finds out j.l.Boolean/Byte/etc., and
|
||||
Type finds out j.l.Boolean.TYPE, etc.
|
||||
*/
|
||||
JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveWrapperType(JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveType(JNIEnv * env, jclass returnType);
|
||||
|
||||
/* Constructor functions. */
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapBoolean(JNIEnv * env, jboolean b);
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapByte (JNIEnv * env, jbyte b);
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapChar (JNIEnv * env, jchar c);
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapShort (JNIEnv * env, jshort s);
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapInt (JNIEnv * env, jint i);
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapLong (JNIEnv * env, jlong l);
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapFloat (JNIEnv * env, jfloat f);
|
||||
JNIEXPORT jobject JNICALL PRIMLIB_WrapDouble (JNIEnv * env, jdouble d);
|
||||
|
||||
/* Widening conversion unwrapping functions. */
|
||||
JNIEXPORT jboolean JNICALL PRIMLIB_UnwrapBoolean(JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jbyte JNICALL PRIMLIB_UnwrapByte (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jshort JNICALL PRIMLIB_UnwrapShort (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jchar JNICALL PRIMLIB_UnwrapChar (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jint JNICALL PRIMLIB_UnwrapInt (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jlong JNICALL PRIMLIB_UnwrapLong (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jfloat JNICALL PRIMLIB_UnwrapFloat (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jdouble JNICALL PRIMLIB_UnwrapDouble (JNIEnv * env, jobject obj);
|
||||
|
||||
/* Simple unwrapping functions. Objects *must* be of correct type. */
|
||||
JNIEXPORT jboolean JNICALL PRIMLIB_GetBooleanObjectValue(JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jbyte JNICALL PRIMLIB_GetByteObjectValue (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jshort JNICALL PRIMLIB_GetShortObjectValue (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jchar JNICALL PRIMLIB_GetCharObjectValue (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jint JNICALL PRIMLIB_GetIntObjectValue (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jlong JNICALL PRIMLIB_GetLongObjectValue (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jfloat JNICALL PRIMLIB_GetFloatObjectValue (JNIEnv * env, jobject obj);
|
||||
JNIEXPORT jdouble JNICALL PRIMLIB_GetDoubleObjectValue (JNIEnv * env, jobject obj);
|
||||
|
||||
/* jvalue conversion: Unwrap obj to the type of classType, with widening conversion. */
|
||||
JNIEXPORT jvalue JNICALL PRIMLIB_UnwrapJValue(JNIEnv* env, jobject obj, jclass classType);
|
||||
|
||||
#endif
|
102
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
Normal file
102
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
Normal file
@ -0,0 +1,102 @@
|
||||
/* gdkfontmetrics.c
|
||||
Copyright (C) 1999, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GdkFontMetrics.h"
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#define ASCENT 0
|
||||
#define MAX_ASCENT 1
|
||||
#define DESCENT 2
|
||||
#define MAX_DESCENT 3
|
||||
#define MAX_ADVANCE 4
|
||||
#define NUM_METRICS 5
|
||||
|
||||
JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_initState
|
||||
(JNIEnv *env, jobject obj, jstring fname, jint size)
|
||||
{
|
||||
jintArray array;
|
||||
jint *metrics;
|
||||
const char *cfname;
|
||||
char *xlfd;
|
||||
GdkFont *font;
|
||||
XFontStruct *xfont;
|
||||
|
||||
cfname = (*env)->GetStringUTFChars (env, fname, NULL);
|
||||
xlfd = g_strdup_printf (cfname, (size * 10));
|
||||
(*env)->ReleaseStringUTFChars (env, fname, cfname);
|
||||
|
||||
array = (*env)->NewIntArray (env, NUM_METRICS);
|
||||
metrics = (*env)->GetIntArrayElements (env, array, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
font = gdk_font_load (xlfd);
|
||||
xfont = GDK_FONT_XFONT (font);
|
||||
|
||||
metrics[ASCENT] = font->ascent;
|
||||
metrics[MAX_ASCENT] = xfont->max_bounds.ascent;
|
||||
metrics[DESCENT] = font->descent;
|
||||
metrics[MAX_DESCENT] = xfont->max_bounds.descent;
|
||||
metrics[MAX_ADVANCE] = xfont->max_bounds.width;
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_free (xlfd);
|
||||
(*env)->ReleaseIntArrayElements (env, array, metrics, 0);
|
||||
|
||||
NSA_SET_PTR (env, obj, font);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_stringWidth
|
||||
(JNIEnv *env, jobject obj, jstring str)
|
||||
{
|
||||
GdkFont *font;
|
||||
const char *cstr;
|
||||
jint width;
|
||||
|
||||
font = (GdkFont *) NSA_GET_PTR (env, obj);
|
||||
cstr = (*env)->GetStringUTFChars (env, str, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
width = gdk_string_width (font, cstr);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, str, cstr);
|
||||
|
||||
return width;
|
||||
}
|
498
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
Normal file
498
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
Normal file
@ -0,0 +1,498 @@
|
||||
/* gdkgraphics.c
|
||||
Copyright (C) 1999, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GdkGraphics.h"
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#define GDK_STABLE_IS_PIXMAP(d) (((GdkWindowPrivate *)d)->window_type == GDK_WINDOW_PIXMAP)
|
||||
|
||||
GdkPoint *
|
||||
translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
|
||||
jint npoints, jint x_offset, jint y_offset);
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
|
||||
(JNIEnv *env, jobject obj, jobject old)
|
||||
{
|
||||
struct graphics *g, *g_old;
|
||||
|
||||
g = (struct graphics *) malloc (sizeof (struct graphics));
|
||||
g_old = (struct graphics *) NSA_GET_PTR (env, old);
|
||||
|
||||
*g = *g_old;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
g->gc = gdk_gc_new (g->drawable);
|
||||
gdk_gc_copy (g->gc, g_old->gc);
|
||||
|
||||
if (GDK_STABLE_IS_PIXMAP (g->drawable))
|
||||
gdk_pixmap_ref (g->drawable);
|
||||
else /* GDK_IS_WINDOW (g->drawable) */
|
||||
gdk_window_ref (g->drawable);
|
||||
|
||||
gdk_colormap_ref (g->cm);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, g);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
|
||||
(JNIEnv *env, jobject obj, jint width, jint height)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) malloc (sizeof (struct graphics));
|
||||
g->x_offset = g->y_offset = 0;
|
||||
|
||||
gdk_threads_enter ();
|
||||
g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
|
||||
gdk_rgb_get_visual ()->depth);
|
||||
g->cm = gdk_rgb_get_cmap ();
|
||||
gdk_colormap_ref (g->cm);
|
||||
g->gc = gdk_gc_new (g->drawable);
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, g);
|
||||
}
|
||||
|
||||
/* copy the native state of the peer (GtkWidget *) to the native state
|
||||
of the graphics object */
|
||||
JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
|
||||
(JNIEnv *env, jobject obj, jobject peer)
|
||||
{
|
||||
struct graphics *g = (struct graphics *) malloc (sizeof (struct graphics));
|
||||
void *ptr;
|
||||
GtkWidget *widget;
|
||||
GdkColor color;
|
||||
jintArray array;
|
||||
jint *rgb;
|
||||
|
||||
ptr = NSA_GET_PTR (env, peer);
|
||||
g->x_offset = g->y_offset = 0;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
widget = GTK_WIDGET (ptr);
|
||||
|
||||
if (GTK_IS_WINDOW (widget))
|
||||
{
|
||||
g->drawable = find_gtk_layout (widget)->bin_window;
|
||||
}
|
||||
else if (GTK_IS_LAYOUT (widget))
|
||||
{
|
||||
g->drawable = (GdkDrawable *) GTK_LAYOUT (widget)->bin_window;
|
||||
}
|
||||
else
|
||||
{
|
||||
g->drawable = (GdkDrawable *) widget->window;
|
||||
}
|
||||
|
||||
gdk_window_ref (g->drawable);
|
||||
g->cm = gtk_widget_get_colormap (widget);
|
||||
gdk_colormap_ref (g->cm);
|
||||
g->gc = gdk_gc_new (g->drawable);
|
||||
gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
|
||||
color = widget->style->fg[GTK_STATE_NORMAL];
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
array = (*env)->NewIntArray (env, 3);
|
||||
rgb = (*env)->GetIntArrayElements (env, array, NULL);
|
||||
rgb[0] = color.red >> 8;
|
||||
rgb[1] = color.green >> 8;
|
||||
rgb[2] = color.blue >> 8;
|
||||
(*env)->ReleaseIntArrayElements (env, array, rgb, 0);
|
||||
|
||||
NSA_SET_PTR (env, obj, g);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_DEL_PTR (env, obj);
|
||||
|
||||
if (!g) return; /* dispose has been called more than once */
|
||||
|
||||
gdk_threads_enter ();
|
||||
XFlush (GDK_DISPLAY ());
|
||||
|
||||
gdk_gc_destroy (g->gc);
|
||||
|
||||
if (GDK_STABLE_IS_PIXMAP (g->drawable))
|
||||
gdk_pixmap_unref (g->drawable);
|
||||
else /* GDK_IS_WINDOW (g->drawable) */
|
||||
gdk_window_unref (g->drawable);
|
||||
|
||||
gdk_colormap_unref (g->cm);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
free (g);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
|
||||
(JNIEnv *env, jobject obj, jint x, jint y)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
g->x_offset += x;
|
||||
g->y_offset += y;
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString
|
||||
(JNIEnv *env, jobject obj, jstring str, jint x, jint y,
|
||||
jstring fname, jint size)
|
||||
{
|
||||
struct graphics *g;
|
||||
const char *cfname, *cstr;
|
||||
gchar *xlfd;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
cfname = (*env)->GetStringUTFChars (env, fname, NULL);
|
||||
xlfd = g_strdup_printf (cfname, (size * 10));
|
||||
(*env)->ReleaseStringUTFChars (env, fname, cfname);
|
||||
|
||||
cstr = (*env)->GetStringUTFChars (env, str, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_string (g->drawable, gdk_font_load (xlfd), g->gc,
|
||||
x + g->x_offset, y + g->y_offset, cstr);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, str, cstr);
|
||||
g_free (xlfd);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint x2, jint y2)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_line (g->drawable, g->gc,
|
||||
x + g->x_offset, y + g->y_offset,
|
||||
x2 + g->x_offset, y2 + g->y_offset);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_rectangle (g->drawable, g->gc, TRUE,
|
||||
x + g->x_offset, y + g->y_offset, width, height);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_rectangle (g->drawable, g->gc, FALSE,
|
||||
x + g->x_offset, y + g->y_offset, width, height);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
|
||||
(JNIEnv *env, jobject obj, jint x, jint y,
|
||||
jint width, jint height, jint dx, jint dy)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_window_copy_area ((GdkWindow *)g->drawable,
|
||||
g->gc,
|
||||
x + g->x_offset + dx, y + g->y_offset + dy,
|
||||
(GdkWindow *)g->drawable,
|
||||
x + g->x_offset, y + g->y_offset,
|
||||
width, height);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyPixmap
|
||||
(JNIEnv *env, jobject obj, jobject offscreen,
|
||||
jint x, jint y, jint width, jint height)
|
||||
{
|
||||
struct graphics *g1, *g2;
|
||||
|
||||
g1 = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
g2 = (struct graphics *) NSA_GET_PTR (env, offscreen);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_window_copy_area ((GdkWindow *)g1->drawable,
|
||||
g1->gc,
|
||||
x + g1->x_offset, y + g1->y_offset,
|
||||
(GdkWindow *)g2->drawable,
|
||||
0 + g2->x_offset, 0 + g2->y_offset,
|
||||
width, height);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_window_clear_area ((GdkWindow *)g->drawable,
|
||||
x + g->x_offset, y + g->y_offset, width, height);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
|
||||
(JNIEnv *env, jobject obj, jint func)
|
||||
{
|
||||
struct graphics *g;
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_gc_set_function (g->gc, func);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
|
||||
(JNIEnv *env, jobject obj, jint red, jint green, jint blue)
|
||||
{
|
||||
GdkColor color;
|
||||
struct graphics *g;
|
||||
|
||||
color.red = red << 8;
|
||||
color.green = green << 8;
|
||||
color.blue = blue << 8;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_color_alloc (g->cm, &color);
|
||||
gdk_gc_set_foreground (g->gc, &color);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
|
||||
jint angle1, jint angle2)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_arc (g->drawable, g->gc, FALSE,
|
||||
x + g->x_offset, y + g->y_offset,
|
||||
width, height, angle1 << 6, angle2 << 6);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
GdkPoint *
|
||||
translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints,
|
||||
jint npoints, jint x_offset, jint y_offset)
|
||||
{
|
||||
GdkPoint *points;
|
||||
jint *x, *y;
|
||||
int i;
|
||||
|
||||
/* allocate one more point than necessary, in case we need to tack
|
||||
on an extra due to the semantics of Java polygons. */
|
||||
points = g_malloc (sizeof (GdkPoint) * (npoints + 1));
|
||||
|
||||
x = (*env)->GetIntArrayElements (env, xpoints, NULL);
|
||||
y = (*env)->GetIntArrayElements (env, ypoints, NULL);
|
||||
|
||||
for (i = 0; i < npoints; i++)
|
||||
{
|
||||
points[i].x = x[i] + x_offset;
|
||||
points[i].y = y[i] + y_offset;
|
||||
}
|
||||
|
||||
(*env)->ReleaseIntArrayElements (env, xpoints, x, JNI_ABORT);
|
||||
(*env)->ReleaseIntArrayElements (env, ypoints, y, JNI_ABORT);
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
|
||||
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
|
||||
jint npoints)
|
||||
{
|
||||
struct graphics *g;
|
||||
GdkPoint *points;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
points = translate_points (env, xpoints, ypoints, npoints,
|
||||
g->x_offset, g->y_offset);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_lines (g->drawable, g->gc, points, npoints);
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_free (points);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
|
||||
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
|
||||
jint npoints)
|
||||
{
|
||||
struct graphics *g;
|
||||
GdkPoint *points;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
points = translate_points (env, xpoints, ypoints, npoints,
|
||||
g->x_offset, g->y_offset);
|
||||
|
||||
/* make sure the polygon is closed, per Java semantics.
|
||||
if it's not, we close it. */
|
||||
if (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y)
|
||||
points[npoints++] = points[0];
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_lines (g->drawable, g->gc, points, npoints);
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_free (points);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
|
||||
(JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints,
|
||||
jint npoints)
|
||||
{
|
||||
struct graphics *g;
|
||||
GdkPoint *points;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
points = translate_points (env, xpoints, ypoints, npoints,
|
||||
g->x_offset, g->y_offset);
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_polygon (g->drawable, g->gc, TRUE, points, npoints);
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_free (points);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height,
|
||||
jint angle1, jint angle2)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_arc (g->drawable, g->gc, TRUE,
|
||||
x + g->x_offset, y + g->y_offset,
|
||||
width, height, angle1 << 6, angle2 << 6);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_arc (g->drawable, g->gc, FALSE,
|
||||
x + g->x_offset, y + g->y_offset,
|
||||
width, height, 0, 23040);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
struct graphics *g;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_draw_arc (g->drawable, g->gc, TRUE,
|
||||
x + g->x_offset, y + g->y_offset,
|
||||
width, height, 0, 23040);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
struct graphics *g;
|
||||
GdkRectangle rectangle;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, obj);
|
||||
|
||||
rectangle.x = x + g->x_offset;
|
||||
rectangle.y = y + g->y_offset;
|
||||
rectangle.width = width;
|
||||
rectangle.height = height;
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_gc_set_clip_rectangle (g->gc, &rectangle);
|
||||
gdk_threads_leave ();
|
||||
}
|
52
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
Normal file
52
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* gtkbuttonpeer.c -- Native implementation of GtkButtonPeer
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkButtonPeer.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
gpointer widget;
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = gtk_type_new (gtk_button_get_type ());
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
54
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
Normal file
54
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
Normal file
@ -0,0 +1,54 @@
|
||||
/* gtkcanvaspeer.c -- Native implementation of GtkCanvasPeer
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkCanvasPeer.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
gpointer widget;
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = gtk_type_new (gtk_drawing_area_get_type ());
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,73 @@
|
||||
/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h"
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
|
||||
(JNIEnv *env, jobject obj, jstring label)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
const char *str;
|
||||
|
||||
str = (*env)->GetStringUTFChars (env, label, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = gtk_check_menu_item_new_with_label (str);
|
||||
gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), 1);
|
||||
gtk_widget_show (widget);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, label, str);
|
||||
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_setState
|
||||
(JNIEnv *env, jobject obj, jboolean state)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ptr), state);
|
||||
gdk_threads_leave ();
|
||||
}
|
175
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
Normal file
175
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
Normal file
@ -0,0 +1,175 @@
|
||||
/* gtkcheckboxpeer.c -- Native implementation of GtkCheckboxPeer
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkCheckboxPeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
|
||||
|
||||
static void item_toggled (GtkToggleButton *item, jobject peer);
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_dispose
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
/* The actual underlying widget is owned by a different class. So
|
||||
we just clean up the hash table here. */
|
||||
NSA_DEL_PTR (env, obj);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove
|
||||
(JNIEnv *env, jobject obj, jobject checkbox)
|
||||
{
|
||||
GtkRadioButton *button;
|
||||
void *ptr;
|
||||
GSList *list;
|
||||
|
||||
ptr = NSA_GET_PTR (env, checkbox);
|
||||
gdk_threads_enter ();
|
||||
button = GTK_RADIO_BUTTON (ptr);
|
||||
|
||||
/* Update the group to point to some other widget in the group. We
|
||||
have to do this because Gtk doesn't have a separate object to
|
||||
represent a radio button's group. */
|
||||
for (list = gtk_radio_button_group (button); list != NULL;
|
||||
list = list->next)
|
||||
{
|
||||
if (list->data != button)
|
||||
break;
|
||||
}
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, list ? list->data : NULL);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeCreate
|
||||
(JNIEnv *env, jobject obj, jobject group)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
if (group == NULL)
|
||||
button = gtk_check_button_new_with_label ("");
|
||||
else
|
||||
{
|
||||
void *native_group = NSA_GET_PTR (env, group);
|
||||
button = gtk_radio_button_new_with_label_from_widget (native_group, "");
|
||||
if (native_group == NULL)
|
||||
{
|
||||
/* Set the native group so we can use the correct value the
|
||||
next time around. FIXME: this doesn't work! */
|
||||
NSA_SET_PTR (env, group, button);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, button);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectHooks
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr = NSA_GET_PTR (env, obj);
|
||||
jobject peer;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
peer = (*env)->NewGlobalRef (env, obj);
|
||||
|
||||
/* FIXME: when the widget goes away, we should get rid of the global
|
||||
reference. */
|
||||
gtk_signal_connect (GTK_OBJECT (ptr), "toggled",
|
||||
GTK_SIGNAL_FUNC (item_toggled), peer);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
/* Connect the superclass hooks. */
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks (env, obj);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup
|
||||
(JNIEnv *env, jobject obj, jobject group)
|
||||
{
|
||||
GtkRadioButton *button;
|
||||
void *native_group, *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
/* FIXME: we can't yet switch between a checkbutton and a
|
||||
radiobutton. However, AWT requires this. For now we just
|
||||
crash. */
|
||||
|
||||
button = GTK_RADIO_BUTTON (ptr);
|
||||
|
||||
native_group = NSA_GET_PTR (env, group);
|
||||
if (native_group == NULL)
|
||||
gtk_radio_button_set_group (button, NULL);
|
||||
else
|
||||
gtk_radio_button_set_group (button,
|
||||
gtk_radio_button_group
|
||||
(GTK_RADIO_BUTTON (native_group)));
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
/* If the native group wasn't set on the new CheckboxGroup, then set
|
||||
it now so that the right thing will happen with the next
|
||||
radiobutton. The native state for a CheckboxGroup is a pointer
|
||||
to one of the widgets in the group. We are careful to keep this
|
||||
always pointing at a live widget; whenever a widget is destroyed
|
||||
(or otherwise removed from the group), the CheckboxGroup peer is
|
||||
notified. */
|
||||
if (native_group == NULL)
|
||||
NSA_SET_PTR (env, group, native_group);
|
||||
}
|
||||
|
||||
static void
|
||||
item_toggled (GtkToggleButton *item, jobject peer)
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, peer,
|
||||
postItemEventID,
|
||||
peer,
|
||||
item->active ?
|
||||
(jint) AWT_ITEM_SELECTED :
|
||||
(jint) AWT_ITEM_DESELECTED);
|
||||
}
|
204
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
Normal file
204
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
Normal file
@ -0,0 +1,204 @@
|
||||
/* gtkchoicepeer.c -- Native implementation of GtkChoicePeer
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkChoicePeer.h"
|
||||
|
||||
static void connect_choice_item_selectable_hook (JNIEnv *env,
|
||||
jobject peer_obj,
|
||||
GtkItem *item,
|
||||
jobject item_obj);
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkOptionMenu *option_menu;
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
gdk_threads_enter ();
|
||||
option_menu = GTK_OPTION_MENU (gtk_option_menu_new ());
|
||||
menu = gtk_menu_new ();
|
||||
gtk_widget_show (menu);
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
|
||||
gtk_widget_size_request (gtk_menu_item_new_with_label (""),
|
||||
&child_requisition);
|
||||
option_menu->width = child_requisition.width;
|
||||
option_menu->height = child_requisition.height;
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, option_menu);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_append
|
||||
(JNIEnv *env, jobject obj, jobjectArray items)
|
||||
{
|
||||
gpointer ptr;
|
||||
GtkMenu *menu;
|
||||
jsize count, i;
|
||||
int need_set_history = 0;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
menu = GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr)));
|
||||
|
||||
if (!gtk_container_children (GTK_CONTAINER (menu)))
|
||||
need_set_history = 1;
|
||||
|
||||
count = (*env)->GetArrayLength (env, items);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
jobject item;
|
||||
const char *label;
|
||||
GtkWidget *menuitem;
|
||||
|
||||
item = (*env)->GetObjectArrayElement (env, items, i);
|
||||
label = (*env)->GetStringUTFChars (env, item, NULL);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (label);
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, item, label);
|
||||
|
||||
gtk_menu_append (menu, menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
connect_choice_item_selectable_hook (env, obj,
|
||||
GTK_ITEM (menuitem), item);
|
||||
}
|
||||
|
||||
if (need_set_history)
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), 0);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_add
|
||||
(JNIEnv *env, jobject obj, jstring item, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
const char *label;
|
||||
GtkWidget *menu, *menuitem;
|
||||
int need_set_history = 0;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
label = (*env)->GetStringUTFChars (env, item, 0);
|
||||
|
||||
gdk_threads_enter ();
|
||||
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr));
|
||||
|
||||
if (!gtk_container_children (GTK_CONTAINER (menu)))
|
||||
need_set_history = 1;
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (label);
|
||||
gtk_menu_insert (GTK_MENU (menu), menuitem, index);
|
||||
gtk_widget_show (menuitem);
|
||||
connect_choice_item_selectable_hook (env, obj, GTK_ITEM (menuitem), item);
|
||||
|
||||
if (need_set_history)
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), 0);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, item, label);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_remove
|
||||
(JNIEnv *env, jobject obj, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
GtkContainer *menu;
|
||||
GList *children;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
menu = GTK_CONTAINER (gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr)));
|
||||
children = gtk_container_children (menu);
|
||||
gtk_container_remove (menu, GTK_WIDGET (g_list_nth (children, index)->data));
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_select
|
||||
(JNIEnv *env, jobject obj, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), index);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
item_activate (GtkItem *item, struct item_event_hook_info *ie)
|
||||
{
|
||||
gdk_threads_leave ();
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, ie->peer_obj,
|
||||
postItemEventID,
|
||||
ie->item_obj,
|
||||
(jint) AWT_ITEM_SELECTED);
|
||||
gdk_threads_enter ();
|
||||
}
|
||||
|
||||
static void
|
||||
connect_choice_item_selectable_hook (JNIEnv *env, jobject peer_obj,
|
||||
GtkItem *item, jobject item_obj)
|
||||
{
|
||||
struct item_event_hook_info *ie;
|
||||
|
||||
ie = (struct item_event_hook_info *)
|
||||
malloc (sizeof (struct item_event_hook_info));
|
||||
|
||||
ie->peer_obj = (*env)->NewGlobalRef (env, peer_obj);
|
||||
ie->item_obj = (*env)->NewGlobalRef (env, item_obj);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (item_activate), ie);
|
||||
}
|
180
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
Normal file
180
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
Normal file
@ -0,0 +1,180 @@
|
||||
/* gtkclipboard.c
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkClipboard.h"
|
||||
|
||||
jmethodID stringSelectionReceivedID;
|
||||
jmethodID stringSelectionHandlerID;
|
||||
jmethodID selectionClearID;
|
||||
|
||||
void selection_received (GtkWidget *, GtkSelectionData *, guint, gpointer);
|
||||
void selection_get (GtkWidget *, GtkSelectionData *, guint, guint, gpointer);
|
||||
gint selection_clear (GtkWidget *, GdkEventSelection *);
|
||||
|
||||
GtkWidget *clipboard;
|
||||
jobject cb_obj;
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env,
|
||||
jobject obj)
|
||||
{
|
||||
if (!stringSelectionReceivedID)
|
||||
{
|
||||
jclass gtkclipboard;
|
||||
|
||||
gtkclipboard = (*env)->FindClass (env,
|
||||
"gnu/java/awt/peer/gtk/GtkClipboard");
|
||||
stringSelectionReceivedID = (*env)->GetMethodID (env, gtkclipboard,
|
||||
"stringSelectionReceived",
|
||||
"(Ljava/lang/String;)V");
|
||||
stringSelectionHandlerID = (*env)->GetMethodID (env, gtkclipboard,
|
||||
"stringSelectionHandler",
|
||||
"()Ljava/lang/String;");
|
||||
selectionClearID = (*env)->GetMethodID (env, gtkclipboard,
|
||||
"selectionClear", "()V");
|
||||
}
|
||||
|
||||
cb_obj = (*env)->NewGlobalRef (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
clipboard = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(clipboard), "selection_received",
|
||||
GTK_SIGNAL_FUNC (selection_received), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(clipboard), "selection_clear_event",
|
||||
GTK_SIGNAL_FUNC (selection_clear), NULL);
|
||||
|
||||
gtk_selection_add_target (clipboard, GDK_SELECTION_PRIMARY,
|
||||
GDK_TARGET_STRING, GDK_TARGET_STRING);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(clipboard), "selection_get",
|
||||
GTK_SIGNAL_FUNC (selection_get), NULL);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkClipboard_requestStringConversion (JNIEnv *env,
|
||||
jclass clazz)
|
||||
{
|
||||
gdk_threads_enter ();
|
||||
gtk_selection_convert (clipboard, GDK_SELECTION_PRIMARY,
|
||||
GDK_TARGET_STRING, GDK_CURRENT_TIME);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
void
|
||||
selection_received (GtkWidget *widget, GtkSelectionData *selection_data,
|
||||
guint time, gpointer data)
|
||||
{
|
||||
/* Check to see if retrieval succeeded */
|
||||
if (selection_data->length < 0
|
||||
|| selection_data->type != GDK_SELECTION_TYPE_STRING)
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *str = (char *) selection_data->data;
|
||||
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID,
|
||||
(*gdk_env)->NewStringUTF (gdk_env, str));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
selection_get (GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
jstring jstr;
|
||||
const char *utf;
|
||||
jsize utflen;
|
||||
|
||||
jstr = (*gdk_env)->CallObjectMethod (gdk_env, cb_obj,
|
||||
stringSelectionHandlerID);
|
||||
|
||||
if (!jstr)
|
||||
{
|
||||
gtk_selection_data_set (selection_data,
|
||||
GDK_TARGET_STRING, 8, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
utflen = (*gdk_env)->GetStringUTFLength (gdk_env, jstr);
|
||||
utf = (*gdk_env)->GetStringUTFChars (gdk_env, jstr, NULL);
|
||||
|
||||
gtk_selection_data_set (selection_data, GDK_TARGET_STRING, 8,
|
||||
(char *)utf, utflen);
|
||||
|
||||
(*gdk_env)->ReleaseStringUTFChars (gdk_env, jstr, utf);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkClipboard_selectionGet (JNIEnv *env,
|
||||
jclass clazz)
|
||||
{
|
||||
GdkWindow *owner;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
/* if we already own the clipboard, we need to tell the old data object
|
||||
that we're no longer going to be using him */
|
||||
owner = gdk_selection_owner_get (GDK_SELECTION_PRIMARY);
|
||||
if (owner && owner == clipboard->window)
|
||||
(*env)->CallVoidMethod (env, cb_obj, selectionClearID);
|
||||
|
||||
gtk_selection_owner_set (clipboard, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
gint
|
||||
selection_clear (GtkWidget *widget, GdkEventSelection *event)
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, cb_obj, selectionClearID);
|
||||
|
||||
return TRUE;
|
||||
}
|
649
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
Normal file
649
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
Normal file
@ -0,0 +1,649 @@
|
||||
/* gtkcomponentpeer.c -- Native implementation of GtkComponentPeer
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
|
||||
#include <gtk/gtkprivate.h>
|
||||
|
||||
#define GTK_OBJECT_SETV(ptr, arg) \
|
||||
gdk_threads_enter (); \
|
||||
{ \
|
||||
GtkArgInfo *info = NULL; \
|
||||
char *error; \
|
||||
\
|
||||
error = gtk_object_arg_get_info (GTK_OBJECT_TYPE (ptr), arg.name, &info); \
|
||||
if (error) \
|
||||
{ \
|
||||
/* assume the argument is destined for the container's only child */ \
|
||||
ptr = gtk_container_children (GTK_CONTAINER (ptr))->data; \
|
||||
} \
|
||||
gtk_object_setv (GTK_OBJECT (ptr), 1, &arg); \
|
||||
} \
|
||||
gdk_threads_leave (); \
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_DEL_PTR (env, obj);
|
||||
|
||||
/* For now the native state for any object must be a widget.
|
||||
However, a subclass could override dispose() if required. */
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_destroy (GTK_WIDGET (ptr));
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor
|
||||
(JNIEnv *env, jobject obj, jint type)
|
||||
{
|
||||
void *ptr;
|
||||
GtkWidget *widget;
|
||||
GdkCursorType gdk_cursor_type;
|
||||
GdkCursor *gdk_cursor;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case AWT_CROSSHAIR_CURSOR:
|
||||
gdk_cursor_type = GDK_CROSSHAIR;
|
||||
break;
|
||||
case AWT_TEXT_CURSOR:
|
||||
gdk_cursor_type = GDK_XTERM;
|
||||
break;
|
||||
case AWT_WAIT_CURSOR:
|
||||
gdk_cursor_type = GDK_WATCH;
|
||||
break;
|
||||
case AWT_SW_RESIZE_CURSOR:
|
||||
gdk_cursor_type = GDK_BOTTOM_LEFT_CORNER;
|
||||
break;
|
||||
case AWT_SE_RESIZE_CURSOR:
|
||||
gdk_cursor_type = GDK_BOTTOM_RIGHT_CORNER;
|
||||
break;
|
||||
case AWT_NW_RESIZE_CURSOR:
|
||||
gdk_cursor_type = GDK_TOP_LEFT_CORNER;
|
||||
break;
|
||||
case AWT_NE_RESIZE_CURSOR:
|
||||
gdk_cursor_type = GDK_TOP_RIGHT_CORNER;
|
||||
break;
|
||||
case AWT_N_RESIZE_CURSOR:
|
||||
gdk_cursor_type = GDK_TOP_SIDE;
|
||||
break;
|
||||
case AWT_S_RESIZE_CURSOR:
|
||||
gdk_cursor_type = GDK_BOTTOM_SIDE;
|
||||
break;
|
||||
case AWT_W_RESIZE_CURSOR:
|
||||
gdk_cursor_type = GDK_LEFT_SIDE;
|
||||
break;
|
||||
case AWT_E_RESIZE_CURSOR:
|
||||
gdk_cursor_type = GDK_RIGHT_SIDE;
|
||||
break;
|
||||
case AWT_HAND_CURSOR:
|
||||
gdk_cursor_type = GDK_HAND2;
|
||||
break;
|
||||
case AWT_MOVE_CURSOR:
|
||||
gdk_cursor_type = GDK_FLEUR;
|
||||
break;
|
||||
default:
|
||||
gdk_cursor_type = GDK_LEFT_PTR;
|
||||
}
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
widget = GTK_WIDGET(ptr);
|
||||
|
||||
gdk_cursor = gdk_cursor_new (gdk_cursor_type);
|
||||
gdk_window_set_cursor (widget->window, gdk_cursor);
|
||||
gdk_cursor_destroy (gdk_cursor);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_requestFocus
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_grab_focus (GTK_WIDGET (ptr));
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Show a widget (NO LONGER USED)
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisible
|
||||
(JNIEnv *env, jobject obj, jboolean visible)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = GTK_WIDGET (ptr);
|
||||
|
||||
if (visible)
|
||||
gtk_widget_show (widget);
|
||||
else
|
||||
gtk_widget_hide (widget);
|
||||
|
||||
gdk_flush ();
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the origin of a widget's window.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen
|
||||
(JNIEnv * env, jobject obj, jintArray jpoint)
|
||||
{
|
||||
void *ptr;
|
||||
jint *point;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
point = (*env)->GetIntArrayElements (env, jpoint, 0);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_window_get_origin (GTK_WIDGET (ptr)->window, point, point+1);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the preferred size of a widget.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetDimensions
|
||||
(JNIEnv *env, jobject obj, jintArray jdims)
|
||||
{
|
||||
void *ptr;
|
||||
jint *dims;
|
||||
GtkRequisition req;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
dims = (*env)->GetIntArrayElements (env, jdims, 0);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (ptr), "size_request", &req);
|
||||
|
||||
dims[0] = req.width;
|
||||
dims[1] = req.height;
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseIntArrayElements(env, jdims, dims, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetUsize (JNIEnv *env,
|
||||
jobject obj, jint w, jint h)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_set_usize (GTK_WIDGET (ptr), w, h);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedNew (JNIEnv *env,
|
||||
jobject obj, jint width, jint height, jboolean visible)
|
||||
{
|
||||
GtkWidget *layout;
|
||||
|
||||
gdk_threads_enter ();
|
||||
layout = gtk_layout_new (NULL, NULL);
|
||||
gtk_widget_realize (layout);
|
||||
connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
|
||||
set_visible (layout, visible);
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, layout);
|
||||
}
|
||||
|
||||
/*
|
||||
* Place a widget on the layout widget.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedPut
|
||||
(JNIEnv *env, jobject obj, jobject container, jint x, jint y)
|
||||
{
|
||||
GList *child;
|
||||
GtkWidget *fix;
|
||||
void *containerptr=NULL;
|
||||
void *objptr=NULL;
|
||||
|
||||
/* We hawe a container which, if it is a window, will have
|
||||
this component added to its fixed. If it is a fixed, we add the
|
||||
component to it. */
|
||||
|
||||
containerptr=NSA_GET_PTR (env, container);
|
||||
objptr=NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
if (GTK_IS_WINDOW(GTK_OBJECT(containerptr)))
|
||||
{
|
||||
child=gtk_container_children (GTK_CONTAINER(containerptr));
|
||||
|
||||
while (child && !GTK_IS_FIXED(child->data))
|
||||
{
|
||||
child=g_list_next(child);
|
||||
}
|
||||
|
||||
fix=GTK_WIDGET(child->data);
|
||||
g_list_free(child);
|
||||
}
|
||||
else
|
||||
if (GTK_IS_SCROLLED_WINDOW(GTK_OBJECT(containerptr)))
|
||||
{
|
||||
child=gtk_container_children (GTK_CONTAINER (GTK_BIN(containerptr)->child));
|
||||
|
||||
while (child && !GTK_IS_FIXED(child->data))
|
||||
{
|
||||
child=g_list_next(child);
|
||||
}
|
||||
|
||||
fix=GTK_WIDGET(child->data);
|
||||
|
||||
g_list_free(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
fix=GTK_WIDGET(containerptr);
|
||||
}
|
||||
|
||||
gtk_fixed_put(GTK_FIXED(fix),GTK_WIDGET(objptr),x,y);
|
||||
gtk_widget_realize (GTK_WIDGET (objptr));
|
||||
gtk_widget_show (GTK_WIDGET (objptr));
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedMove (JNIEnv *env,
|
||||
jobject obj, jint x, jint y)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
void *ptr=NULL;
|
||||
|
||||
/* For some reason, ScrolledWindow tries to scroll its contents
|
||||
by moving them using this function. Since we want to use GTK's
|
||||
nice fast scrolling, we try to second guess it here. This
|
||||
might cause problems later. */
|
||||
|
||||
if (x >= 0 && y >= 0)
|
||||
{
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget=GTK_WIDGET (ptr);
|
||||
if (!GTK_IS_WINDOW (widget))
|
||||
gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
widget = GTK_WIDGET (ptr);
|
||||
if (GTK_IS_VIEWPORT (widget->parent))
|
||||
{
|
||||
gtk_widget_set_usize (widget, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_usize (widget, width, height);
|
||||
gtk_layout_move (GTK_LAYOUT (widget->parent), widget, x, y);
|
||||
}
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT jintArray JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
jintArray array;
|
||||
int *rgb;
|
||||
GdkColor bg;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
bg = GTK_WIDGET (ptr)->style->bg[GTK_STATE_NORMAL];
|
||||
gdk_threads_leave ();
|
||||
|
||||
array = (*env)->NewIntArray (env, 3);
|
||||
rgb = (*env)->GetIntArrayElements (env, array, NULL);
|
||||
/* convert color data from 16 bit values down to 8 bit values */
|
||||
rgb[0] = bg.red >> 8;
|
||||
rgb[1] = bg.green >> 8;
|
||||
rgb[2] = bg.blue >> 8;
|
||||
(*env)->ReleaseIntArrayElements (env, array, rgb, 0);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
JNIEXPORT jintArray JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetForeground
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
jintArray array;
|
||||
jint *rgb;
|
||||
GdkColor fg;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
fg = GTK_WIDGET (ptr)->style->fg[GTK_STATE_NORMAL];
|
||||
gdk_threads_leave ();
|
||||
|
||||
array = (*env)->NewIntArray (env, 3);
|
||||
rgb = (*env)->GetIntArrayElements (env, array, NULL);
|
||||
/* convert color data from 16 bit values down to 8 bit values */
|
||||
rgb[0] = fg.red >> 8;
|
||||
rgb[1] = fg.green >> 8;
|
||||
rgb[2] = fg.blue >> 8;
|
||||
(*env)->ReleaseIntArrayElements (env, array, rgb, 0);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
void
|
||||
set_visible (GtkWidget *widget, jboolean visible)
|
||||
{
|
||||
if (visible)
|
||||
gtk_widget_show (widget);
|
||||
else
|
||||
gtk_widget_hide (widget);
|
||||
}
|
||||
|
||||
GtkLayout *
|
||||
find_gtk_layout (GtkWidget *parent)
|
||||
{
|
||||
if (GTK_IS_WINDOW (parent))
|
||||
{
|
||||
GList *children = gtk_container_children
|
||||
(GTK_CONTAINER (GTK_BIN (parent)->child));
|
||||
|
||||
if (GTK_IS_MENU_BAR (children->data))
|
||||
return GTK_LAYOUT (children->next->data);
|
||||
else /* GTK_IS_LAYOUT (children->data) */
|
||||
return GTK_LAYOUT (children->data);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define WIDGET_CLASS(w) GTK_WIDGET_CLASS (GTK_OBJECT (w)->klass)
|
||||
|
||||
void
|
||||
set_parent (GtkWidget *widget, GtkContainer *parent)
|
||||
{
|
||||
if (GTK_IS_WINDOW (parent))
|
||||
{
|
||||
GList *children = gtk_container_children
|
||||
(GTK_CONTAINER (GTK_BIN (parent)->child));
|
||||
|
||||
if (GTK_IS_MENU_BAR (children->data))
|
||||
gtk_layout_put (GTK_LAYOUT (children->next->data), widget, 0, 0);
|
||||
else /* GTK_IS_LAYOUT (children->data) */
|
||||
gtk_layout_put (GTK_LAYOUT (children->data), widget, 0, 0);
|
||||
}
|
||||
else
|
||||
if (GTK_IS_SCROLLED_WINDOW (parent))
|
||||
{
|
||||
/* if (WIDGET_CLASS (widget)->set_scroll_adjustments_signal) */
|
||||
/* gtk_container_add (GTK_CONTAINER (parent), widget); */
|
||||
/* else */
|
||||
/* { */
|
||||
gtk_scrolled_window_add_with_viewport
|
||||
(GTK_SCROLLED_WINDOW (parent), widget);
|
||||
gtk_viewport_set_shadow_type (GTK_VIEWPORT (widget->parent),
|
||||
GTK_SHADOW_NONE);
|
||||
/* } */
|
||||
|
||||
}
|
||||
/* gtk_layout_put */
|
||||
/* (GTK_LAYOUT (GTK_BIN (parent)->child), widget, 0, 0); */
|
||||
|
||||
/* if (GTK_IS_SCROLLED_WINDOW (parent)) */
|
||||
/* gtk_layout_put */
|
||||
/* (GTK_LAYOUT (GTK_BIN (GTK_BIN (parent)->child)->child), widget, 0, 0); */
|
||||
else
|
||||
gtk_layout_put (GTK_LAYOUT (parent), widget, 0, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
jboolean ret_val;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
ret_val = GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (ptr));
|
||||
gdk_threads_leave ();
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_modalHasGrab
|
||||
(JNIEnv *env, jclass clazz)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
jboolean retval;
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = gtk_grab_get_current ();
|
||||
retval = (widget && GTK_IS_WINDOW (widget) && GTK_WINDOW (widget)->modal);
|
||||
gdk_threads_leave ();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_String_2
|
||||
(JNIEnv *env, jobject obj, jstring jname, jstring jvalue)
|
||||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
void *ptr;
|
||||
GtkArg arg;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||
value = (*env)->GetStringUTFChars (env, jvalue, NULL);
|
||||
|
||||
arg.type = GTK_TYPE_STRING;
|
||||
arg.name = (char *) name;
|
||||
GTK_VALUE_STRING (arg) = (char *) value;
|
||||
|
||||
GTK_OBJECT_SETV (ptr, arg);
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, jname, name);
|
||||
(*env)->ReleaseStringUTFChars (env, jvalue, value);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Z
|
||||
(JNIEnv *env, jobject obj, jstring jname, jboolean value)
|
||||
{
|
||||
const char *name;
|
||||
void *ptr;
|
||||
GtkArg arg;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||
|
||||
arg.type = GTK_TYPE_BOOL;
|
||||
arg.name = (char *) name;
|
||||
GTK_VALUE_BOOL (arg) = value;
|
||||
|
||||
GTK_OBJECT_SETV (ptr, arg);
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, jname, name);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2I
|
||||
(JNIEnv *env, jobject obj, jstring jname, jint value)
|
||||
{
|
||||
const char *name;
|
||||
void *ptr;
|
||||
GtkArg arg;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||
|
||||
arg.type = GTK_TYPE_INT;
|
||||
arg.name = (char *) name;
|
||||
GTK_VALUE_INT (arg) = value;
|
||||
|
||||
GTK_OBJECT_SETV (ptr, arg);
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, jname, name);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2F
|
||||
(JNIEnv *env, jobject obj, jstring jname, jfloat value)
|
||||
{
|
||||
const char *name;
|
||||
void *ptr;
|
||||
GtkArg arg;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||
|
||||
arg.type = GTK_TYPE_FLOAT;
|
||||
arg.name = (char *) name;
|
||||
GTK_VALUE_FLOAT (arg) = value;
|
||||
|
||||
GTK_OBJECT_SETV (ptr, arg);
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, jname, name);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_Object_2
|
||||
(JNIEnv *env, jobject obj1, jstring jname, jobject obj2)
|
||||
{
|
||||
const char *name;
|
||||
void *ptr1, *ptr2;
|
||||
GtkArg arg;
|
||||
|
||||
ptr1 = NSA_GET_PTR (env, obj1);
|
||||
ptr2 = NSA_GET_PTR (env, obj2);
|
||||
|
||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||
|
||||
/* special case to catch where we need to set the parent */
|
||||
if (!strcmp (name, "parent"))
|
||||
{
|
||||
gdk_threads_enter ();
|
||||
set_parent (GTK_WIDGET (ptr1), GTK_CONTAINER (ptr2));
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, jname, name);
|
||||
return;
|
||||
}
|
||||
|
||||
arg.type = GTK_TYPE_OBJECT;
|
||||
arg.name = (char *) name;
|
||||
GTK_VALUE_OBJECT (arg) = GTK_OBJECT (ptr2);
|
||||
|
||||
GTK_OBJECT_SETV (ptr1, arg);
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, jname, name);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_create
|
||||
(JNIEnv *env, jobject obj, jstring jtypename)
|
||||
{
|
||||
const char *typename;
|
||||
gpointer widget;
|
||||
|
||||
typename = (*env)->GetStringUTFChars (env, jtypename, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_button_get_type ();
|
||||
widget = gtk_object_newv (gtk_type_from_name (typename),
|
||||
0, NULL);
|
||||
/* widget = gtk_type_new (gtk_type_from_name (typename)); */
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, jtypename, typename);
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_realize (GTK_WIDGET (ptr));
|
||||
connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
|
||||
gdk_threads_leave ();
|
||||
}
|
552
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
Normal file
552
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
Normal file
@ -0,0 +1,552 @@
|
||||
/* gtkevents.c -- GDK/GTK event handlers
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* A widget can be composed of multipled windows, so we need to hook
|
||||
events on all of them. */
|
||||
struct event_hook_info
|
||||
{
|
||||
jobject *peer_obj;
|
||||
int nwindows;
|
||||
GdkWindow ***windows; /* array of pointers to (GdkWindow *) */
|
||||
};
|
||||
|
||||
static jint
|
||||
button_to_awt_mods (int button)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
case 1:
|
||||
return AWT_BUTTON1_MASK;
|
||||
case 2:
|
||||
return AWT_BUTTON2_MASK;
|
||||
case 3:
|
||||
return AWT_BUTTON3_MASK;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static jint
|
||||
state_to_awt_mods (int mods)
|
||||
{
|
||||
jint result = 0;
|
||||
|
||||
if (mods & (GDK_SHIFT_MASK | GDK_LOCK_MASK))
|
||||
result |= AWT_SHIFT_MASK;
|
||||
if (mods & GDK_CONTROL_MASK)
|
||||
result |= AWT_CTRL_MASK;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static jint
|
||||
keysym_to_awt_keycode (guint keyval)
|
||||
{
|
||||
guint vk;
|
||||
|
||||
vk = gdk_keyval_to_upper (keyval);
|
||||
|
||||
if (vk <= 0x41 && vk <= 0x5A) /* VK_A through VK_Z */
|
||||
return vk;
|
||||
|
||||
if (vk <= 0x30 && vk <= 39) /* VK_0 through VK_9 */
|
||||
return vk;
|
||||
|
||||
switch (vk)
|
||||
{
|
||||
case GDK_Alt_L:
|
||||
case GDK_Alt_R:
|
||||
return VK_ALT;
|
||||
case GDK_BackSpace:
|
||||
return VK_BACK_SPACE;
|
||||
case GDK_Cancel:
|
||||
return VK_CANCEL;
|
||||
case GDK_Caps_Lock:
|
||||
return VK_CAPS_LOCK;
|
||||
case GDK_Clear:
|
||||
return VK_CLEAR;
|
||||
case GDK_bracketright:
|
||||
return VK_CLOSE_BRACKET;
|
||||
case GDK_comma:
|
||||
return VK_COMMA;
|
||||
case GDK_Control_L:
|
||||
case GDK_Control_R:
|
||||
return VK_CONTROL;
|
||||
case GDK_KP_Decimal:
|
||||
return VK_DECIMAL;
|
||||
case GDK_Delete:
|
||||
return VK_DELETE;
|
||||
case GDK_KP_Divide:
|
||||
return VK_DIVIDE;
|
||||
case GDK_Down:
|
||||
return VK_DOWN;
|
||||
case GDK_End:
|
||||
return VK_END;
|
||||
case GDK_Return:
|
||||
return VK_ENTER;
|
||||
case GDK_Escape:
|
||||
return VK_ESCAPE;
|
||||
case GDK_F1:
|
||||
return VK_F1;
|
||||
case GDK_F2:
|
||||
return VK_F2;
|
||||
case GDK_F3:
|
||||
return VK_F3;
|
||||
case GDK_F4:
|
||||
return VK_F4;
|
||||
case GDK_F5:
|
||||
return VK_F5;
|
||||
case GDK_F6:
|
||||
return VK_F6;
|
||||
case GDK_F7:
|
||||
return VK_F7;
|
||||
case GDK_F8:
|
||||
return VK_F8;
|
||||
case GDK_F9:
|
||||
return VK_F9;
|
||||
case GDK_F10:
|
||||
return VK_F10;
|
||||
case GDK_F11:
|
||||
return VK_F11;
|
||||
case GDK_F12:
|
||||
return VK_F12;
|
||||
case GDK_Help:
|
||||
return VK_HELP;
|
||||
case GDK_Home:
|
||||
return VK_HOME;
|
||||
case GDK_Insert:
|
||||
return VK_INSERT;
|
||||
case GDK_Kanji:
|
||||
return VK_KANJI;
|
||||
case GDK_Left:
|
||||
return VK_LEFT;
|
||||
case GDK_Meta_L:
|
||||
case GDK_Meta_R:
|
||||
return VK_META;
|
||||
case GDK_KP_Multiply:
|
||||
return VK_MULTIPLY;
|
||||
case GDK_Num_Lock:
|
||||
return VK_NUM_LOCK;
|
||||
case GDK_KP_0:
|
||||
return VK_NUMPAD0;
|
||||
case GDK_KP_1:
|
||||
return VK_NUMPAD1;
|
||||
case GDK_KP_2:
|
||||
return VK_NUMPAD2;
|
||||
case GDK_KP_3:
|
||||
return VK_NUMPAD3;
|
||||
case GDK_KP_4:
|
||||
return VK_NUMPAD4;
|
||||
case GDK_KP_5:
|
||||
return VK_NUMPAD5;
|
||||
case GDK_KP_6:
|
||||
return VK_NUMPAD6;
|
||||
case GDK_KP_7:
|
||||
return VK_NUMPAD7;
|
||||
case GDK_KP_8:
|
||||
return VK_NUMPAD8;
|
||||
case GDK_KP_9:
|
||||
return VK_NUMPAD9;
|
||||
case GDK_bracketleft:
|
||||
return VK_OPEN_BRACKET;
|
||||
case GDK_Page_Down:
|
||||
return VK_PAGE_DOWN;
|
||||
case GDK_Page_Up:
|
||||
return VK_PAGE_UP;
|
||||
case GDK_Pause:
|
||||
return VK_PAUSE;
|
||||
case GDK_period:
|
||||
return VK_PERIOD;
|
||||
case GDK_Print:
|
||||
return VK_PRINTSCREEN;
|
||||
case GDK_quoteright:
|
||||
return VK_QUOTE;
|
||||
case GDK_Right:
|
||||
return VK_RIGHT;
|
||||
case GDK_Scroll_Lock:
|
||||
return VK_SCROLL_LOCK;
|
||||
case GDK_semicolon:
|
||||
return VK_SEMICOLON;
|
||||
case GDK_KP_Separator:
|
||||
return VK_SEPARATOR;
|
||||
case GDK_Shift_L:
|
||||
case GDK_Shift_R:
|
||||
return VK_SHIFT;
|
||||
case GDK_slash:
|
||||
return VK_SLASH;
|
||||
case GDK_space:
|
||||
return VK_SPACE;
|
||||
case GDK_KP_Subtract:
|
||||
return VK_SUBTRACT;
|
||||
case GDK_Tab:
|
||||
return VK_TAB;
|
||||
case GDK_Up:
|
||||
return VK_UP;
|
||||
|
||||
default:
|
||||
return VK_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
awt_event_handler (GdkEvent *event)
|
||||
{
|
||||
jobject *obj_ptr;
|
||||
static guint32 button_click_time = 0;
|
||||
static GdkWindow *button_window = NULL;
|
||||
static guint button_number = -1;
|
||||
static jint click_count = 1;
|
||||
|
||||
/* keep synthetic AWT events from being processed recursively */
|
||||
if (event->type & SYNTHETIC_EVENT_MASK && event->type != GDK_NOTHING)
|
||||
{
|
||||
event->type ^= SYNTHETIC_EVENT_MASK;
|
||||
gtk_main_do_event (event);
|
||||
return;
|
||||
}
|
||||
|
||||
/* keep track of clickCount ourselves, since the AWT allows more
|
||||
than a triple click to occur */
|
||||
if (event->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
if ((event->button.time < (button_click_time + MULTI_CLICK_TIME))
|
||||
&& (event->button.window == button_window)
|
||||
&& (event->button.button == button_number))
|
||||
click_count++;
|
||||
else
|
||||
click_count = 1;
|
||||
|
||||
button_click_time = event->button.time;
|
||||
button_window = event->button.window;
|
||||
button_number = event->button.button;
|
||||
}
|
||||
|
||||
/* for all input events, which have a window with a jobject attached,
|
||||
send the input event off to Java before GTK has a chance to process
|
||||
the event */
|
||||
if ((event->type == GDK_BUTTON_PRESS
|
||||
|| event->type == GDK_BUTTON_RELEASE
|
||||
|| event->type == GDK_ENTER_NOTIFY
|
||||
|| event->type == GDK_LEAVE_NOTIFY
|
||||
|| event->type == GDK_CONFIGURE
|
||||
|| event->type == GDK_EXPOSE
|
||||
|| event->type == GDK_KEY_PRESS
|
||||
|| event->type == GDK_FOCUS_CHANGE
|
||||
|| event->type == GDK_MOTION_NOTIFY)
|
||||
&& gdk_property_get (event->any.window,
|
||||
gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE),
|
||||
gdk_atom_intern ("CARDINAL", FALSE),
|
||||
0,
|
||||
sizeof (jobject),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(guchar **)&obj_ptr))
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
|
||||
AWT_MOUSE_PRESSED,
|
||||
(jlong)event->button.time,
|
||||
state_to_awt_mods (event->button.state) |
|
||||
button_to_awt_mods (event->button.button),
|
||||
(jint)event->button.x,
|
||||
(jint)event->button.y,
|
||||
click_count,
|
||||
(event->button.button == 3) ? JNI_TRUE :
|
||||
JNI_FALSE);
|
||||
|
||||
/* grab_counter++;
|
||||
gdk_pointer_grab (event->any.window,
|
||||
FALSE,
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_BUTTON_MOTION_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK,
|
||||
NULL,
|
||||
NULL,
|
||||
event->button.time);*/
|
||||
break;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
{
|
||||
int width, height;
|
||||
|
||||
/* only ungrab if no other buttons are pressed down */
|
||||
/* if (--grab_counter == 0)
|
||||
gdk_pointer_ungrab (event->button.time);
|
||||
*/
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
|
||||
AWT_MOUSE_RELEASED,
|
||||
(jlong)event->button.time,
|
||||
state_to_awt_mods (event->button.state) |
|
||||
button_to_awt_mods (event->button.button),
|
||||
(jint)event->button.x,
|
||||
(jint)event->button.y,
|
||||
click_count, JNI_FALSE);
|
||||
|
||||
/* check to see if the release occured in the window it was pressed
|
||||
in, and if so, generate an AWT click event */
|
||||
gdk_window_get_size (event->any.window, &width, &height);
|
||||
if (event->button.x >= 0
|
||||
&& event->button.y >= 0
|
||||
&& event->button.x <= width
|
||||
&& event->button.y <= height)
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
|
||||
AWT_MOUSE_CLICKED,
|
||||
(jlong)event->button.time,
|
||||
state_to_awt_mods (event->button.state) |
|
||||
button_to_awt_mods (event->button.button),
|
||||
(jint)event->button.x,
|
||||
(jint)event->button.y,
|
||||
click_count, JNI_FALSE);
|
||||
|
||||
}
|
||||
break;
|
||||
case GDK_MOTION_NOTIFY:
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
|
||||
AWT_MOUSE_MOVED,
|
||||
(jlong)event->motion.time,
|
||||
state_to_awt_mods (event->motion.state),
|
||||
(jint)event->motion.x,
|
||||
(jint)event->motion.y,
|
||||
0, JNI_FALSE);
|
||||
|
||||
if (event->motion.state & (GDK_BUTTON1_MASK
|
||||
| GDK_BUTTON2_MASK
|
||||
| GDK_BUTTON3_MASK
|
||||
| GDK_BUTTON4_MASK
|
||||
| GDK_BUTTON5_MASK))
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
|
||||
AWT_MOUSE_DRAGGED,
|
||||
(jlong)event->motion.time,
|
||||
state_to_awt_mods (event->motion.state),
|
||||
(jint)event->motion.x,
|
||||
(jint)event->motion.y,
|
||||
0, JNI_FALSE);
|
||||
}
|
||||
break;
|
||||
case GDK_ENTER_NOTIFY:
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
|
||||
AWT_MOUSE_ENTERED,
|
||||
(jlong)event->crossing.time,
|
||||
state_to_awt_mods (event->crossing.state),
|
||||
(jint)event->crossing.x,
|
||||
(jint)event->crossing.y,
|
||||
0, JNI_FALSE);
|
||||
break;
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
if (event->crossing.mode == GDK_CROSSING_NORMAL)
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
|
||||
AWT_MOUSE_EXITED,
|
||||
(jlong)event->crossing.time,
|
||||
state_to_awt_mods (event->crossing.state),
|
||||
(jint)event->crossing.x,
|
||||
(jint)event->crossing.y,
|
||||
0, JNI_FALSE);
|
||||
break;
|
||||
case GDK_CONFIGURE:
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
gdk_window_get_user_data (event->any.window, (void **) &widget);
|
||||
|
||||
if (widget && GTK_WIDGET_TOPLEVEL (widget))
|
||||
{
|
||||
gint top, left, right, bottom;
|
||||
gint x, y, w, h, wb, d;
|
||||
|
||||
/* calculate our insets */
|
||||
gdk_window_get_root_geometry (event->any.window,
|
||||
&x, &y, &w, &h, &wb, &d);
|
||||
|
||||
/* We used to compute these based on the configure
|
||||
event's fields. However, that gives strange and
|
||||
apparently incorrect results. */
|
||||
top = left = bottom = right = 0;
|
||||
|
||||
/* configure events are not posted to the AWT event queue,
|
||||
and as such, gdk/gtk will be called back before
|
||||
postConfigureEvent returns */
|
||||
gdk_threads_leave ();
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
|
||||
postConfigureEventID,
|
||||
(jint)event->configure.x,
|
||||
(jint)event->configure.y,
|
||||
(jint)event->configure.width,
|
||||
(jint)event->configure.height,
|
||||
(jint)top,
|
||||
(jint)left,
|
||||
(jint)bottom,
|
||||
(jint)right);
|
||||
gdk_threads_enter ();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GDK_EXPOSE:
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
|
||||
postExposeEventID,
|
||||
(jint)event->expose.area.x,
|
||||
(jint)event->expose.area.y,
|
||||
(jint)event->expose.area.width,
|
||||
(jint)event->expose.area.height);
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_KEY_PRESS:
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWindow *window;
|
||||
|
||||
gdk_window_get_user_data (event->any.window, (void **) &widget);
|
||||
|
||||
window = GTK_WINDOW (gtk_widget_get_ancestor (widget,
|
||||
GTK_TYPE_WINDOW));
|
||||
if (window
|
||||
&& GTK_WIDGET_IS_SENSITIVE (window)
|
||||
&& window->focus_widget
|
||||
&& GTK_WIDGET_IS_SENSITIVE (window->focus_widget)
|
||||
&& window->focus_widget->window)
|
||||
{
|
||||
gtk_widget_activate (window->focus_widget);
|
||||
gdk_property_get (window->focus_widget->window,
|
||||
gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE),
|
||||
gdk_atom_intern ("CARDINAL", FALSE),
|
||||
0,
|
||||
sizeof (jobject),
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(guchar **)&obj_ptr);
|
||||
|
||||
/* if (grab && GTK_WIDGET_HAS_DEFAULT (widget) ) */
|
||||
/* { */
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
|
||||
postKeyEventID,
|
||||
(jint) AWT_KEY_PRESSED,
|
||||
(jlong) event->key.time,
|
||||
state_to_awt_mods (event->key.state),
|
||||
keysym_to_awt_keycode (event->key.keyval),
|
||||
(jchar) (event->key.length) ?
|
||||
event->key.string[0] :
|
||||
AWT_KEY_CHAR_UNDEFINED);
|
||||
if (event->key.length)
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
|
||||
postKeyEventID,
|
||||
(jint) AWT_KEY_TYPED,
|
||||
(jlong) event->key.time,
|
||||
state_to_awt_mods (event->key.state),
|
||||
VK_UNDEFINED,
|
||||
(jchar) event->key.string[0]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GDK_FOCUS_CHANGE:
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
|
||||
postFocusEventID,
|
||||
(jint) (event->focus_change.in) ?
|
||||
AWT_FOCUS_GAINED : AWT_FOCUS_LOST,
|
||||
JNI_FALSE);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
g_free (obj_ptr);
|
||||
}
|
||||
|
||||
gtk_main_do_event (event);
|
||||
}
|
||||
|
||||
static void
|
||||
attach_jobject (GdkWindow *window, jobject *obj)
|
||||
{
|
||||
GdkAtom addr_atom = gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE);
|
||||
GdkAtom type_atom = gdk_atom_intern ("CARDINAL", FALSE);
|
||||
|
||||
gdk_window_set_events (window,
|
||||
gdk_window_get_events (window)
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_BUTTON_MOTION_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_KEY_PRESS_MASK
|
||||
| GDK_KEY_RELEASE_MASK
|
||||
| GDK_ENTER_NOTIFY_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_STRUCTURE_MASK
|
||||
| GDK_KEY_PRESS_MASK
|
||||
| GDK_FOCUS_CHANGE_MASK);
|
||||
|
||||
gdk_property_change (window,
|
||||
addr_atom,
|
||||
type_atom,
|
||||
8,
|
||||
GDK_PROP_MODE_REPLACE,
|
||||
(guchar *)obj,
|
||||
sizeof (jobject));
|
||||
}
|
||||
|
||||
void
|
||||
connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...)
|
||||
{
|
||||
int i;
|
||||
va_list ap;
|
||||
jobject *obj;
|
||||
|
||||
obj = (jobject *) malloc (sizeof (jobject));
|
||||
*obj = (*env)->NewGlobalRef (env, peer_obj);
|
||||
|
||||
va_start (ap, nwindows);
|
||||
for (i = 0; i < nwindows; i++)
|
||||
attach_jobject (va_arg (ap, GdkWindow *), obj);
|
||||
va_end (ap);
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
/* gtkfiledialogpeer.c -- Native implementation of GtkFileDialogPeer
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h"
|
||||
|
||||
/*
|
||||
* Make a new file selection dialog
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
gpointer widget;
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = gtk_type_new (gtk_file_selection_get_type ());
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectHooks
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
/* NOTE: we don't call the superclass connect method here. */
|
||||
gtk_widget_realize (GTK_WIDGET (ptr));
|
||||
connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the filename in the file selection dialog.
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_gtkFileSelectionSetFilename
|
||||
(JNIEnv *env, jobject obj, jstring filename)
|
||||
{
|
||||
void *ptr;
|
||||
const char *str;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
str = (*env)->GetStringUTFChars (env, filename, 0);
|
||||
gdk_threads_enter ();
|
||||
gtk_file_selection_set_filename (GTK_FILE_SELECTION (ptr), str);
|
||||
gdk_threads_leave ();
|
||||
(*env)->ReleaseStringUTFChars (env, filename, str);
|
||||
}
|
160
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
Normal file
160
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
Normal file
@ -0,0 +1,160 @@
|
||||
/* gtkimagepainter.c
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkImagePainter.h"
|
||||
#include <libart_lgpl/art_misc.h>
|
||||
#include <libart_lgpl/art_rgb_affine.h>
|
||||
|
||||
#define SWAPU32(w) \
|
||||
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels
|
||||
(JNIEnv *env, jobject obj, jobject gc_obj, jint bg_red, jint bg_green,
|
||||
jint bg_blue, jint x, jint y, jint width, jint height, jintArray jpixels,
|
||||
jint offset, jint scansize, jdoubleArray jaffine)
|
||||
{
|
||||
struct graphics *g;
|
||||
jint *pixels, *elems;
|
||||
guchar *packed;
|
||||
int i;
|
||||
jsize num_pixels;
|
||||
guchar *j_rgba, *c_rgb;
|
||||
|
||||
g = (struct graphics *) NSA_GET_PTR (env, gc_obj);
|
||||
|
||||
elems = (*env)->GetIntArrayElements (env, jpixels, NULL);
|
||||
num_pixels = (*env)->GetArrayLength (env, jpixels);
|
||||
|
||||
/* get a copy of the pixel data so we can modify it */
|
||||
pixels = malloc (sizeof (jint) * num_pixels);
|
||||
memcpy (pixels, elems, sizeof (jint) * num_pixels);
|
||||
|
||||
(*env)->ReleaseIntArrayElements (env, jpixels, elems, 0);
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
/* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
|
||||
for (i = 0; i < num_pixels; i++)
|
||||
pixels[i] = SWAPU32 ((unsigned)pixels[i]);
|
||||
#endif
|
||||
|
||||
packed = (guchar *) malloc (sizeof (guchar) * 3 * num_pixels);
|
||||
j_rgba = (guchar *) pixels;
|
||||
c_rgb = packed;
|
||||
|
||||
/* copy over pixels in DirectColorModel format to 24 bit RGB image data,
|
||||
and process the alpha channel */
|
||||
for (i = 0; i < num_pixels; i++)
|
||||
{
|
||||
jint ialpha = *j_rgba++;
|
||||
|
||||
switch (ialpha)
|
||||
{
|
||||
case 0: /* full transparency */
|
||||
*c_rgb++ = bg_red;
|
||||
*c_rgb++ = bg_green;
|
||||
*c_rgb++ = bg_blue;
|
||||
j_rgba += 3;
|
||||
break;
|
||||
case 255: /* opaque */
|
||||
*c_rgb++ = *j_rgba++;
|
||||
*c_rgb++ = *j_rgba++;
|
||||
*c_rgb++ = *j_rgba++;
|
||||
break;
|
||||
default: /* compositing required */
|
||||
{
|
||||
jfloat alpha = ialpha / 255.0;
|
||||
jfloat comp_alpha = 1.0 - alpha;
|
||||
|
||||
*c_rgb++ = *j_rgba++ * alpha + bg_red * comp_alpha;
|
||||
*c_rgb++ = *j_rgba++ * alpha + bg_green * comp_alpha;
|
||||
*c_rgb++ = *j_rgba++ * alpha + bg_blue * comp_alpha;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (jaffine)
|
||||
{
|
||||
jdouble *affine;
|
||||
ArtAlphaGamma *alphagamma = NULL;
|
||||
art_u8 *dst;
|
||||
int new_width, new_height;
|
||||
int i;
|
||||
|
||||
affine = (*env)->GetDoubleArrayElements (env, jaffine, NULL);
|
||||
|
||||
new_width = abs (width * affine[0]);
|
||||
new_height = abs (height * affine[3]);
|
||||
|
||||
dst = (art_u8 *) malloc (sizeof (art_u8) * 3 * (new_width * new_height));
|
||||
|
||||
art_rgb_affine (dst,
|
||||
0, 0,
|
||||
new_width, new_height,
|
||||
new_width * 3,
|
||||
(art_u8 *) packed + offset * 3,
|
||||
width, height,
|
||||
scansize * 3,
|
||||
affine,
|
||||
ART_FILTER_NEAREST,
|
||||
alphagamma);
|
||||
|
||||
(*env)->ReleaseDoubleArrayElements (env, jaffine, affine, JNI_ABORT);
|
||||
|
||||
free (packed);
|
||||
packed = (guchar *) dst;
|
||||
|
||||
width = scansize = new_width;
|
||||
height = new_height;
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
gdk_draw_rgb_image (g->drawable,
|
||||
g->gc,
|
||||
x + g->x_offset,
|
||||
y + g->y_offset,
|
||||
width, height, GDK_RGB_DITHER_NORMAL,
|
||||
packed + offset * 3, scansize * 3);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
free (pixels);
|
||||
free (packed);
|
||||
}
|
57
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
Normal file
57
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
Normal file
@ -0,0 +1,57 @@
|
||||
/* gtklabelpeer.c -- Native implementation of GtkLabelPeer
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkLabelPeer.h"
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkContainer *ebox;
|
||||
|
||||
gdk_threads_enter ();
|
||||
ebox = GTK_CONTAINER (gtk_type_new (gtk_event_box_get_type ()));
|
||||
label = GTK_WIDGET (gtk_type_new (gtk_label_get_type ()));
|
||||
gtk_container_add (ebox, label);
|
||||
gtk_widget_show (label);
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, ebox);
|
||||
}
|
381
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
Normal file
381
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
Normal file
@ -0,0 +1,381 @@
|
||||
/* gtklistpeer.c -- Native implementation of GtkListPeer
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkListPeer.h"
|
||||
|
||||
static void
|
||||
connect_selectable_hook (JNIEnv *env, jobject peer_obj, GtkCList *list);
|
||||
|
||||
#define CLIST_FROM_SW(obj) (GTK_CLIST(GTK_SCROLLED_WINDOW (obj)->container.child))
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
GtkWidget *list, *sw;
|
||||
|
||||
gdk_threads_enter ();
|
||||
list = gtk_clist_new (1);
|
||||
gtk_widget_show (list);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), list);
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, sw);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_connectHooks
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_realize (GTK_WIDGET (ptr));
|
||||
connect_selectable_hook (env, obj, CLIST_FROM_SW (ptr));
|
||||
connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_append
|
||||
(JNIEnv *env, jobject obj, jobjectArray items)
|
||||
{
|
||||
void *ptr;
|
||||
GtkCList *list;
|
||||
jint count, i;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
count = (*env)->GetArrayLength (env, items);
|
||||
|
||||
gdk_threads_enter ();
|
||||
list = CLIST_FROM_SW (ptr);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const char *text;
|
||||
jobject item;
|
||||
|
||||
item = (*env)->GetObjectArrayElement (env, items, i);
|
||||
|
||||
text = (*env)->GetStringUTFChars (env, item, NULL);
|
||||
gtk_clist_append (list, (char **)&text);
|
||||
(*env)->ReleaseStringUTFChars (env, item, text);
|
||||
}
|
||||
|
||||
gtk_clist_columns_autosize (list);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_old_create
|
||||
(JNIEnv *env, jobject obj, jobject parent_obj,
|
||||
jobjectArray items, jboolean mode)
|
||||
{
|
||||
GtkWidget *list, *sw, *parent;
|
||||
jsize count, i;
|
||||
|
||||
parent = NSA_GET_PTR (env, parent_obj);
|
||||
|
||||
count = (*env)->GetArrayLength (env, items);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
list = gtk_clist_new (1);
|
||||
gtk_widget_show (list);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
set_parent (sw, GTK_CONTAINER (parent));
|
||||
gtk_widget_realize (sw);
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), list);
|
||||
|
||||
connect_selectable_hook (env, obj, GTK_CLIST (list));
|
||||
connect_awt_hook (env, obj, 1, list->window);
|
||||
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (list),
|
||||
mode ? GTK_SELECTION_MULTIPLE :
|
||||
GTK_SELECTION_SINGLE);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const char *text;
|
||||
jobject item;
|
||||
|
||||
item = (*env)->GetObjectArrayElement (env, items, i);
|
||||
|
||||
text = (*env)->GetStringUTFChars (env, item, NULL);
|
||||
gtk_clist_append (GTK_CLIST (list), (char **)&text);
|
||||
(*env)->ReleaseStringUTFChars (env, item, text);
|
||||
}
|
||||
|
||||
gtk_clist_columns_autosize (GTK_CLIST (list));
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, sw);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_add
|
||||
(JNIEnv *env, jobject obj, jstring text, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
const char *str;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
str = (*env)->GetStringUTFChars (env, text, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_clist_insert (CLIST_FROM_SW (ptr), index, (char **)&str);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, text, str);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_delItems
|
||||
(JNIEnv *env, jobject obj, jint start, jint end)
|
||||
{
|
||||
void *ptr;
|
||||
GtkCList *list;
|
||||
jint i;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
list = CLIST_FROM_SW (ptr);
|
||||
|
||||
if (end == -1) /* special case for removing all rows */
|
||||
end = list->rows;
|
||||
|
||||
gtk_clist_freeze (list);
|
||||
for (i = start; i < end; i++)
|
||||
gtk_clist_remove (list, i);
|
||||
gtk_clist_thaw (list);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_select
|
||||
(JNIEnv *env, jobject obj, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_clist_select_row (CLIST_FROM_SW (ptr), index, 0);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_deselect
|
||||
(JNIEnv *env, jobject obj, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_clist_unselect_row (CLIST_FROM_SW (ptr), index, 0);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
/* FIXME: magic mojo (that doesn't seem to do anything) */
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_getSize
|
||||
(JNIEnv *env, jobject obj, jint rows, jintArray jdims)
|
||||
{
|
||||
void *ptr;
|
||||
jint *dims;
|
||||
GtkWidget *list;
|
||||
GtkScrolledWindow *sw;
|
||||
GtkRequisition myreq;
|
||||
|
||||
dims = (*env)->GetIntArrayElements (env, jdims, NULL);
|
||||
dims[0] = dims[1] = 0;
|
||||
|
||||
if (rows < 3)
|
||||
rows = 3;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
gdk_threads_enter ();
|
||||
|
||||
list = GTK_WIDGET (CLIST_FROM_SW (ptr));
|
||||
sw = GTK_SCROLLED_WINDOW (ptr);
|
||||
|
||||
/*
|
||||
gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
|
||||
&myreq);
|
||||
dims[1]=myreq.height+GTK_SCROLLED_WINDOW_CLASS
|
||||
(GTK_OBJECT (sw)->klass)->scrollbar_spacing;
|
||||
*/
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
|
||||
"size_request", &myreq);
|
||||
/*
|
||||
|
||||
gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
|
||||
&myreq);
|
||||
*/
|
||||
|
||||
dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
|
||||
(GTK_OBJECT (sw)->klass)->scrollbar_spacing;
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (list), "size_request", &myreq);
|
||||
|
||||
// gtk_widget_size_request(GTK_WIDGET (list), &myreq);
|
||||
|
||||
dims[0] += myreq.width + gdk_char_width (list->style->font, 'W');
|
||||
|
||||
dims[1] += ((rows * (gdk_char_height (list->style->font, 'W')+7))
|
||||
+ (2 * (list->style->klass->ythickness)));
|
||||
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jintArray JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_getSelectedIndexes
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
GtkCList *list;
|
||||
jintArray selection;
|
||||
jint *sel;
|
||||
GList *child;
|
||||
jint count, i;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
gdk_threads_enter ();
|
||||
|
||||
list = CLIST_FROM_SW (ptr);
|
||||
count = g_list_length (list->selection);
|
||||
|
||||
selection = (*env)->NewIntArray (env, count);
|
||||
sel = (*env)->GetIntArrayElements (env, selection, NULL);
|
||||
|
||||
for (i = 0, child = list->selection; i < count; i++)
|
||||
{
|
||||
sel[i] = GPOINTER_TO_INT (child->data);
|
||||
child = g_list_next (child);
|
||||
}
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseIntArrayElements (env, selection, sel, 0);
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_makeVisible
|
||||
(JNIEnv *env, jobject obj, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_clist_moveto (CLIST_FROM_SW (ptr), index, 0, 0.5, 0.5);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkListPeer_setMultipleMode
|
||||
(JNIEnv *env, jobject obj, jboolean mode)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_clist_set_selection_mode (CLIST_FROM_SW (ptr),
|
||||
mode ? GTK_SELECTION_MULTIPLE :
|
||||
GTK_SELECTION_SINGLE);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
static void
|
||||
item_select (GtkCList *list, int row, int col, GdkEventButton *event,
|
||||
jobject *peer_obj)
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
|
||||
postListItemEventID,
|
||||
row,
|
||||
(jint) AWT_ITEM_SELECTED);
|
||||
}
|
||||
|
||||
static void
|
||||
item_unselect (GtkCList *list, int row, int col, GdkEventButton *event,
|
||||
jobject *peer_obj)
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
|
||||
postListItemEventID,
|
||||
row,
|
||||
(jint) AWT_ITEM_DESELECTED);
|
||||
}
|
||||
|
||||
static void
|
||||
connect_selectable_hook (JNIEnv *env, jobject peer_obj, GtkCList *list)
|
||||
{
|
||||
jobject *obj;
|
||||
|
||||
obj = (jobject *) malloc (sizeof (jobject));
|
||||
*obj = (*env)->NewGlobalRef (env, peer_obj);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (list), "select_row",
|
||||
GTK_SIGNAL_FUNC (item_select), obj);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (list), "unselect_row",
|
||||
GTK_SIGNAL_FUNC (item_unselect), obj);
|
||||
}
|
163
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
Normal file
163
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
Normal file
@ -0,0 +1,163 @@
|
||||
/* gtkmainthread.c -- Native implementation of GtkMainThread
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkMainThread.h"
|
||||
#include "gthread-jni.h"
|
||||
|
||||
#ifdef JVM_SUN
|
||||
struct state_table *native_state_table;
|
||||
#endif
|
||||
|
||||
jmethodID postActionEventID;
|
||||
jmethodID postMenuActionEventID;
|
||||
jmethodID postMouseEventID;
|
||||
jmethodID postConfigureEventID;
|
||||
jmethodID postExposeEventID;
|
||||
jmethodID postKeyEventID;
|
||||
jmethodID postFocusEventID;
|
||||
jmethodID postAdjustmentEventID;
|
||||
jmethodID postItemEventID;
|
||||
jmethodID postListItemEventID;
|
||||
JNIEnv *gdk_env;
|
||||
|
||||
/*
|
||||
* Call gtk_init. It is very important that this happen before any other
|
||||
* gtk calls.
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz)
|
||||
{
|
||||
int argc = 1;
|
||||
char **argv;
|
||||
char *homedir, *rcpath = NULL;
|
||||
/* jclass gtkgenericpeer; */
|
||||
jclass gtkcomponentpeer, gtkwindowpeer, gtkscrollbarpeer, gtklistpeer, gtkmenuitempeer;
|
||||
|
||||
NSA_INIT (env, clazz);
|
||||
|
||||
/* GTK requires a program's argc and argv variables, and requires that they
|
||||
be valid. */
|
||||
|
||||
argv = (char **) malloc (sizeof (char *) * 2);
|
||||
argv[0] = "";
|
||||
argv[1] = NULL;
|
||||
|
||||
/* until we have JDK 1.2 JNI, assume we have a VM with threads that
|
||||
match what GLIB was compiled for */
|
||||
g_thread_init (NULL);
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
gdk_rgb_init ();
|
||||
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
|
||||
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
|
||||
|
||||
/* Make sure queued calls don't get sent to GTK/GDK while
|
||||
we're shutting down. */
|
||||
atexit (gdk_threads_enter);
|
||||
|
||||
gdk_env = env;
|
||||
gdk_event_handler_set ((GdkEventFunc)awt_event_handler, NULL, NULL);
|
||||
|
||||
if ((homedir = getenv ("HOME")))
|
||||
{
|
||||
rcpath = (char *) malloc (strlen (homedir) + strlen (RC_FILE) + 2);
|
||||
sprintf (rcpath, "%s/%s", homedir, RC_FILE);
|
||||
}
|
||||
|
||||
gtk_rc_parse ((rcpath) ? rcpath : RC_FILE);
|
||||
|
||||
if (rcpath)
|
||||
free (rcpath);
|
||||
|
||||
free (argv);
|
||||
|
||||
/* setup cached IDs for posting GTK events to Java */
|
||||
/* gtkgenericpeer = (*env)->FindClass (env, */
|
||||
/* "gnu/java/awt/peer/gtk/GtkGenericPeer"); */
|
||||
gtkcomponentpeer = (*env)->FindClass (env,
|
||||
"gnu/java/awt/peer/gtk/GtkComponentPeer");
|
||||
gtkwindowpeer = (*env)->FindClass (env,
|
||||
"gnu/java/awt/peer/gtk/GtkWindowPeer");
|
||||
gtkscrollbarpeer = (*env)->FindClass (env,
|
||||
"gnu/java/awt/peer/gtk/GtkScrollbarPeer");
|
||||
gtklistpeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkListPeer");
|
||||
gtkmenuitempeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkMenuItemPeer");
|
||||
/* gdkColor = (*env)->FindClass (env, */
|
||||
/* "gnu/java/awt/peer/gtk/GdkColor"); */
|
||||
/* gdkColorID = (*env)->GetMethodID (env, gdkColor, "<init>", "(III)V"); */
|
||||
/* postActionEventID = (*env)->GetMethodID (env, gtkgenericpeer, */
|
||||
/* "postActionEvent", */
|
||||
/* "(Ljava/lang/String;I)V"); */
|
||||
|
||||
postMenuActionEventID = (*env)->GetMethodID (env, gtkmenuitempeer,
|
||||
"postMenuActionEvent",
|
||||
"()V");
|
||||
postMouseEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
|
||||
"postMouseEvent", "(IJIIIIZ)V");
|
||||
postConfigureEventID = (*env)->GetMethodID (env, gtkwindowpeer,
|
||||
"postConfigureEvent", "(IIIIIIII)V");
|
||||
postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
|
||||
"postExposeEvent", "(IIII)V");
|
||||
postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
|
||||
"postKeyEvent", "(IJIIC)V");
|
||||
postFocusEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
|
||||
"postFocusEvent", "(IZ)V");
|
||||
postAdjustmentEventID = (*env)->GetMethodID (env, gtkscrollbarpeer,
|
||||
"postAdjustmentEvent",
|
||||
"(II)V");
|
||||
postItemEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
|
||||
"postItemEvent",
|
||||
"(Ljava/lang/Object;I)V");
|
||||
postListItemEventID = (*env)->GetMethodID (env, gtklistpeer,
|
||||
"postItemEvent",
|
||||
"(II)V");
|
||||
}
|
||||
|
||||
/*
|
||||
* Run gtk_main and block.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkMain (JNIEnv *env, jobject obj)
|
||||
{
|
||||
gdk_threads_enter ();
|
||||
gtk_main ();
|
||||
gdk_threads_leave ();
|
||||
}
|
81
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
Normal file
81
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
Normal file
@ -0,0 +1,81 @@
|
||||
/* gtkmenubarpeer.c -- Native implementation of GtkMenuBarPeer
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkMenuBarPeer.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = gtk_menu_bar_new ();
|
||||
gtk_widget_show (widget);
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
|
||||
(JNIEnv *env, jobject obj, jobject menupeer)
|
||||
{
|
||||
void *mbar, *menu;
|
||||
|
||||
mbar = NSA_GET_PTR (env, obj);
|
||||
menu = NSA_GET_PTR (env, menupeer);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_menu_bar_append (GTK_MENU_BAR (mbar), GTK_WIDGET (menu));
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
|
||||
(JNIEnv *env, jobject obj, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
GList *list;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
list = gtk_container_children (GTK_CONTAINER (ptr));
|
||||
list = g_list_nth (list, index);
|
||||
gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
|
||||
gdk_threads_leave ();
|
||||
}
|
120
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
Normal file
120
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
Normal file
@ -0,0 +1,120 @@
|
||||
/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
|
||||
|
||||
static void
|
||||
connect_activate_hook (JNIEnv *, jobject, GtkMenuItem *);
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
|
||||
(JNIEnv *env, jobject obj, jstring label)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
const char *str;
|
||||
|
||||
str = (*env)->GetStringUTFChars (env, label, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
|
||||
widget = gtk_menu_item_new ();
|
||||
else
|
||||
widget = gtk_menu_item_new_with_label (str);
|
||||
|
||||
connect_activate_hook (env, obj, GTK_MENU_ITEM (widget));
|
||||
gtk_widget_show (widget);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, label, str);
|
||||
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
|
||||
(JNIEnv *env, jobject obj, jstring label)
|
||||
{
|
||||
void *ptr;
|
||||
const char *str;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
str = (*env)->GetStringUTFChars (env, label, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
|
||||
gtk_container_remove (GTK_CONTAINER (ptr), GTK_BIN (ptr)->child);
|
||||
else
|
||||
{
|
||||
GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (accel_label), str);
|
||||
gtk_accel_label_refetch (accel_label);
|
||||
}
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, label, str);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
|
||||
(JNIEnv *env, jobject obj, jboolean enabled)
|
||||
{
|
||||
/* Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setEnabled (env, obj, enabled); */
|
||||
}
|
||||
|
||||
static void
|
||||
item_activate (GtkMenuItem *item, jobject *peer_obj)
|
||||
{
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
|
||||
postMenuActionEventID);
|
||||
}
|
||||
|
||||
static void
|
||||
connect_activate_hook (JNIEnv *env, jobject peer_obj, GtkMenuItem *item)
|
||||
{
|
||||
jobject *obj;
|
||||
|
||||
obj = (jobject *) malloc (sizeof (jobject));
|
||||
*obj = (*env)->NewGlobalRef (env, peer_obj);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (item_activate), obj);
|
||||
}
|
152
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
Normal file
152
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
Normal file
@ -0,0 +1,152 @@
|
||||
/* gtkmenupeer.c -- Native implementation of GtkMenuPeer
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkMenuPeer.h"
|
||||
|
||||
static void
|
||||
accel_attach (GtkMenuItem *menu_item, gpointer *user_data)
|
||||
{
|
||||
GtkAccelGroup *accel;
|
||||
|
||||
accel = gtk_menu_get_accel_group (GTK_MENU (menu_item->submenu));
|
||||
gtk_accel_group_attach (accel,
|
||||
GTK_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET(menu_item))));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
|
||||
(JNIEnv *env, jobject obj, jobject parent)
|
||||
{
|
||||
void *ptr1, *ptr2;
|
||||
|
||||
ptr1 = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
if (!parent)
|
||||
{
|
||||
gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu),
|
||||
gtk_accel_group_new ());
|
||||
|
||||
if (GTK_WIDGET_REALIZED (GTK_WIDGET (ptr1)))
|
||||
accel_attach (GTK_MENU_ITEM (ptr1), NULL);
|
||||
else
|
||||
gtk_signal_connect (GTK_OBJECT (ptr1),
|
||||
"realize",
|
||||
GTK_SIGNAL_FUNC (accel_attach),
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkAccelGroup *parent_accel;
|
||||
|
||||
ptr2 = NSA_GET_PTR (env, parent);
|
||||
parent_accel = gtk_menu_get_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr2)->submenu));
|
||||
|
||||
gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu),
|
||||
parent_accel);
|
||||
}
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
|
||||
(JNIEnv *env, jobject obj, jstring label)
|
||||
{
|
||||
GtkWidget *menu_title, *menu;
|
||||
const char *str;
|
||||
|
||||
str = (*env)->GetStringUTFChars (env, label, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
menu_title = gtk_menu_item_new_with_label (str);
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_title), menu);
|
||||
|
||||
gtk_widget_show (menu);
|
||||
gtk_widget_show (menu_title);
|
||||
|
||||
NSA_SET_PTR (env, obj, menu_title);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, label, str);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
|
||||
(JNIEnv *env, jobject obj, jobject menuitempeer, jint key, jboolean shift)
|
||||
{
|
||||
void *ptr1, *ptr2;
|
||||
GtkMenu *menu;
|
||||
|
||||
ptr1 = NSA_GET_PTR (env, obj);
|
||||
ptr2 = NSA_GET_PTR (env, menuitempeer);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
|
||||
gtk_menu_append (menu, GTK_WIDGET (ptr2));
|
||||
|
||||
if (key)
|
||||
{
|
||||
gtk_widget_add_accelerator (GTK_WIDGET (ptr2), "activate",
|
||||
gtk_menu_get_accel_group (menu), key,
|
||||
(GDK_CONTROL_MASK
|
||||
| ((shift) ? GDK_SHIFT_MASK : 0)),
|
||||
GTK_ACCEL_VISIBLE);
|
||||
}
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
|
||||
(JNIEnv *env, jobject obj, jint index)
|
||||
{
|
||||
void *ptr;
|
||||
GList *list;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
list = gtk_container_children (GTK_CONTAINER (ptr));
|
||||
list = g_list_nth (list, index);
|
||||
gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
137
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
Normal file
137
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
Normal file
@ -0,0 +1,137 @@
|
||||
/* gtkpanelpeer.c -- Native implementation of GtkPanelPeer
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkPanelPeer.h"
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
gpointer widget;
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = gtk_layout_new (NULL, NULL);
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
typedef struct _GtkLayoutChild GtkLayoutChild;
|
||||
|
||||
struct _GtkLayoutChild {
|
||||
GtkWidget *widget;
|
||||
gint x;
|
||||
gint y;
|
||||
};
|
||||
|
||||
static
|
||||
void sr (GtkWidget *widget, GtkRequisition *requisition, gpointer user_data)
|
||||
{
|
||||
GtkLayout *layout;
|
||||
GtkLayoutChild *child;
|
||||
GList *children;
|
||||
|
||||
layout = GTK_LAYOUT (widget);
|
||||
requisition->width = GTK_WIDGET (widget)->allocation.width;
|
||||
requisition->height = GTK_WIDGET (widget)->allocation.height;
|
||||
|
||||
children = layout->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
children = children->next;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (child->widget))
|
||||
{
|
||||
requisition->height = MAX (requisition->height,
|
||||
child->y +
|
||||
child->widget->allocation.height);
|
||||
requisition->width = MAX (requisition->width,
|
||||
child->x +
|
||||
child->widget->allocation.width);
|
||||
}
|
||||
}
|
||||
|
||||
requisition->height += GTK_CONTAINER (layout)->border_width * 2;
|
||||
requisition->width += GTK_CONTAINER (layout)->border_width * 2;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectHooks
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_realize (GTK_WIDGET (ptr));
|
||||
connect_awt_hook (env, obj, 1, GTK_LAYOUT (ptr)->bin_window);
|
||||
|
||||
/* gtk_signal_connect (GTK_OBJECT (ptr), "size_request", GTK_SIGNAL_FUNC (sr), */
|
||||
/* NULL); */
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a new panel.
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_gtkPanelNew
|
||||
(JNIEnv *env, jobject obj, jobject parent_obj)
|
||||
{
|
||||
GtkWidget *layout;
|
||||
void *parent;
|
||||
|
||||
parent = NSA_GET_PTR (env, parent_obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
layout = gtk_layout_new (NULL, NULL);
|
||||
|
||||
set_parent (layout, GTK_CONTAINER (parent));
|
||||
|
||||
gtk_widget_realize (layout);
|
||||
connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
|
||||
set_visible (layout, 1);
|
||||
|
||||
NSA_SET_PTR (env, obj, layout);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,93 @@
|
||||
/* gtkpopupmenupeer.c -- Native implementation of GtkPopupMenuPeer
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h"
|
||||
|
||||
struct pos
|
||||
{
|
||||
gint x;
|
||||
gint y;
|
||||
};
|
||||
|
||||
void
|
||||
menu_pos (GtkMenu *menu, gint *x, gint *y, gpointer user_data)
|
||||
{
|
||||
struct pos *p = (struct pos *) user_data;
|
||||
|
||||
*x = p->x;
|
||||
*y = p->y;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jlong time)
|
||||
{
|
||||
void *ptr;
|
||||
struct pos *p;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
p = g_malloc (sizeof (struct pos));
|
||||
p->x = x;
|
||||
p->y = y;
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_menu_popup (GTK_MENU (GTK_MENU_ITEM (ptr)->submenu),
|
||||
NULL, NULL, menu_pos, p, 3, time);
|
||||
gdk_threads_leave ();
|
||||
|
||||
g_free (p);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_setupAccelGroup
|
||||
(JNIEnv *env, jobject obj, jobject parent)
|
||||
{
|
||||
void *ptr1, *ptr2;
|
||||
GtkMenu *menu;
|
||||
|
||||
ptr1 = NSA_GET_PTR (env, obj);
|
||||
ptr2 = NSA_GET_PTR (env, parent);
|
||||
|
||||
gdk_threads_enter ();
|
||||
menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
|
||||
gtk_menu_set_accel_group (menu, gtk_accel_group_new ());
|
||||
gtk_accel_group_attach (gtk_menu_get_accel_group (menu),
|
||||
GTK_OBJECT (gtk_widget_get_toplevel (ptr2)));
|
||||
gdk_threads_leave ();
|
||||
}
|
183
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
Normal file
183
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
Normal file
@ -0,0 +1,183 @@
|
||||
/* gtkscrollbarpeer.c -- Native implementation of GtkScrollbarPeer
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkScrollbarPeer.h"
|
||||
|
||||
struct range_scrollbar
|
||||
{
|
||||
GtkRange *range;
|
||||
jobject *scrollbar;
|
||||
};
|
||||
|
||||
static void
|
||||
post_adjustment_event (GtkAdjustment *adj, struct range_scrollbar *rs)
|
||||
{
|
||||
jint type;
|
||||
|
||||
switch (rs->range->scroll_type)
|
||||
{
|
||||
case GTK_SCROLL_STEP_FORWARD:
|
||||
type = AWT_ADJUSTMENT_UNIT_INCREMENT;
|
||||
break;
|
||||
case GTK_SCROLL_STEP_BACKWARD:
|
||||
type = AWT_ADJUSTMENT_UNIT_DECREMENT;
|
||||
break;
|
||||
case GTK_SCROLL_PAGE_FORWARD:
|
||||
type = AWT_ADJUSTMENT_BLOCK_INCREMENT;
|
||||
break;
|
||||
case GTK_SCROLL_PAGE_BACKWARD:
|
||||
type = AWT_ADJUSTMENT_BLOCK_DECREMENT;
|
||||
break;
|
||||
case GTK_SCROLL_JUMP:
|
||||
type = AWT_ADJUSTMENT_TRACK;
|
||||
break;
|
||||
default: /* GTK_SCROLL_NONE */
|
||||
return;
|
||||
}
|
||||
|
||||
(*gdk_env)->CallVoidMethod (gdk_env, *(rs->scrollbar), postAdjustmentEventID,
|
||||
type, (jint) adj->value);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
|
||||
(JNIEnv *env, jobject obj, jint orientation, jint value,
|
||||
jint min, jint max, jint step_incr, jint page_incr, jint visible_amount)
|
||||
{
|
||||
GtkWidget *sb;
|
||||
GtkObject *adj;
|
||||
|
||||
gdk_threads_enter ();
|
||||
adj = gtk_adjustment_new (value, min, max,
|
||||
step_incr, page_incr,
|
||||
visible_amount);
|
||||
|
||||
sb = (orientation) ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj)) :
|
||||
gtk_hscrollbar_new (GTK_ADJUSTMENT (adj));
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, sb);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectHooks
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
struct range_scrollbar *rs;
|
||||
|
||||
rs = (struct range_scrollbar *) malloc (sizeof (struct range_scrollbar));
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_realize (GTK_WIDGET (ptr));
|
||||
|
||||
rs->range = GTK_RANGE (ptr);
|
||||
rs->scrollbar = (jobject *) malloc (sizeof (jobject));
|
||||
*(rs->scrollbar) = (*env)->NewGlobalRef (env, obj);
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_RANGE (ptr)->adjustment),
|
||||
"value_changed",
|
||||
GTK_SIGNAL_FUNC (post_adjustment_event), rs);
|
||||
|
||||
connect_awt_hook (env, obj, 4,
|
||||
GTK_RANGE (ptr)->trough,
|
||||
GTK_RANGE (ptr)->slider,
|
||||
GTK_RANGE (ptr)->step_forw,
|
||||
GTK_RANGE (ptr)->step_back);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setLineIncrement
|
||||
(JNIEnv *env, jobject obj, jint amount)
|
||||
{
|
||||
void *ptr;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
adj = GTK_RANGE (ptr)->adjustment;
|
||||
adj->step_increment = amount;
|
||||
gtk_adjustment_changed (adj);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setPageIncrement
|
||||
(JNIEnv *env, jobject obj, jint amount)
|
||||
{
|
||||
void *ptr;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
adj = GTK_RANGE (ptr)->adjustment;
|
||||
adj->page_increment = amount;
|
||||
gtk_adjustment_changed (adj);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setValues
|
||||
(JNIEnv *env, jobject obj, jint value, jint visible, jint min, jint max)
|
||||
{
|
||||
void *ptr;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
adj = GTK_RANGE (ptr)->adjustment;
|
||||
adj->value = value;
|
||||
adj->page_size = visible;
|
||||
adj->lower = min;
|
||||
adj->upper = max;
|
||||
gtk_adjustment_changed (adj);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
190
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
Normal file
190
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
Normal file
@ -0,0 +1,190 @@
|
||||
/* gtkscrollpanepeer.c -- Native implementation of GtkScrollPanePeer
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkScrollPanePeer.h"
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
gpointer window;
|
||||
GtkWidget *layout;
|
||||
|
||||
gdk_threads_enter ();
|
||||
window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, window);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setScrollPosition
|
||||
(JNIEnv *env, jobject obj, jint x, jint y)
|
||||
{
|
||||
GtkAdjustment *hadj, *vadj;
|
||||
GtkScrolledWindow *sw;
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
sw = GTK_SCROLLED_WINDOW (ptr);
|
||||
|
||||
hadj = gtk_scrolled_window_get_hadjustment (sw);
|
||||
vadj = gtk_scrolled_window_get_vadjustment (sw);
|
||||
|
||||
gtk_adjustment_set_value (hadj, x);
|
||||
gtk_adjustment_set_value (vadj, y);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetHScrollIncrement
|
||||
(JNIEnv *env, jobject obj, jint u)
|
||||
{
|
||||
GtkAdjustment *hadj;
|
||||
GtkScrolledWindow *sw;
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
sw = GTK_SCROLLED_WINDOW(ptr);
|
||||
|
||||
hadj = gtk_scrolled_window_get_hadjustment (sw);
|
||||
hadj->step_increment = u;
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetVScrollIncrement
|
||||
(JNIEnv *env, jobject obj, jint u)
|
||||
{
|
||||
GtkAdjustment *vadj;
|
||||
GtkScrolledWindow *sw;
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
sw = GTK_SCROLLED_WINDOW(ptr);
|
||||
|
||||
vadj = gtk_scrolled_window_get_hadjustment (sw);
|
||||
vadj->step_increment = u;
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_childResized
|
||||
(JNIEnv *env, jobject obj, jint width, jint height)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
return;
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_set_usize (GTK_BIN (ptr)->child, width, height);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getHScrollbarHeight
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
GtkScrolledWindow *sw;
|
||||
jint height;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
sw = GTK_SCROLLED_WINDOW (ptr);
|
||||
height = (sw->hscrollbar_visible) ? sw->hscrollbar->allocation.height : 0;
|
||||
gdk_threads_leave ();
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getVScrollbarWidth
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
GtkScrolledWindow *sw;
|
||||
jint width;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
sw = GTK_SCROLLED_WINDOW (ptr);
|
||||
width = (sw->vscrollbar_visible) ? sw->vscrollbar->allocation.width : 0;
|
||||
gdk_threads_leave ();
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setPolicy
|
||||
(JNIEnv *env, jobject obj, jint policy)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
switch (policy)
|
||||
{
|
||||
case AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED:
|
||||
policy = GTK_POLICY_AUTOMATIC;
|
||||
break;
|
||||
case AWT_SCROLLPANE_SCROLLBARS_ALWAYS:
|
||||
policy = GTK_POLICY_ALWAYS;
|
||||
break;
|
||||
case AWT_SCROLLPANE_SCROLLBARS_NEVER:
|
||||
policy = GTK_POLICY_NEVER;
|
||||
break;
|
||||
}
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ptr), policy, policy);
|
||||
gdk_threads_leave ();
|
||||
}
|
209
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
Normal file
209
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
Normal file
@ -0,0 +1,209 @@
|
||||
/* gtktextareapeer.c -- Native implementation of GtkTextAreaPeer
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkTextAreaPeer.h"
|
||||
|
||||
#define TEXT_FROM_SW(obj) (GTK_TEXT(GTK_SCROLLED_WINDOW (obj)->container.child))
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
|
||||
(JNIEnv *env, jobject obj, jint scroll)
|
||||
{
|
||||
GtkWidget *text, *sw;
|
||||
|
||||
gdk_threads_enter ();
|
||||
text = gtk_text_new (NULL, NULL);
|
||||
gtk_widget_show (text);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), text);
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
|
||||
/* horizontal scrollbar */
|
||||
(scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
|
||||
|| scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ?
|
||||
GTK_POLICY_ALWAYS : GTK_POLICY_NEVER,
|
||||
|
||||
/* vertical scrollbar */
|
||||
(scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
|
||||
|| scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ?
|
||||
GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, sw);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_old_create
|
||||
(JNIEnv *env, jobject obj, jobject parent_obj,
|
||||
jstring contents, jint scroll)
|
||||
{
|
||||
GtkWidget *text, *sw;
|
||||
const char *str;
|
||||
int pos=0;
|
||||
void *parent;
|
||||
|
||||
parent = NSA_GET_PTR (env, parent_obj);
|
||||
str = (*env)->GetStringUTFChars (env, contents, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
text = gtk_text_new (NULL, NULL);
|
||||
gtk_text_set_editable (GTK_TEXT (text), TRUE);
|
||||
|
||||
gtk_editable_insert_text (GTK_EDITABLE (text), str,
|
||||
strlen (str), &pos);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), text);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
|
||||
/* horizontal scrollbar */
|
||||
(scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
|
||||
|| scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ?
|
||||
GTK_POLICY_ALWAYS : GTK_POLICY_NEVER,
|
||||
|
||||
/* vertical scrollbar */
|
||||
(scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
|
||||
|| scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ?
|
||||
GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
|
||||
|
||||
set_visible (text, TRUE);
|
||||
set_parent (sw, GTK_CONTAINER (parent));
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, contents, str);
|
||||
|
||||
NSA_SET_PTR (env, obj, sw);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkTextGetSize
|
||||
(JNIEnv *env, jobject obj, jint rows, jint cols, jintArray jdims)
|
||||
{
|
||||
void *ptr;
|
||||
jint *dims;
|
||||
GtkWidget *text;
|
||||
GtkScrolledWindow *sw;
|
||||
GtkRequisition myreq;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
dims = (*env)->GetIntArrayElements (env, jdims, 0);
|
||||
dims[0] = dims[1] = 0;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
text = GTK_WIDGET (TEXT_FROM_SW (ptr));
|
||||
sw = GTK_SCROLLED_WINDOW (ptr);
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
|
||||
"size_request", &myreq);
|
||||
//gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar),
|
||||
// &myreq);
|
||||
dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
|
||||
(GTK_OBJECT (sw)->klass)->scrollbar_spacing;
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
|
||||
"size_request", &myreq);
|
||||
//gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar),
|
||||
// &myreq);
|
||||
dims[1]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
|
||||
(GTK_OBJECT (sw)->klass)->scrollbar_spacing;
|
||||
|
||||
/* The '1' in the following assignments is from
|
||||
#define TEXT_BORDER_ROOM 1
|
||||
in gtktext.c */
|
||||
|
||||
dims[0] += ((cols * gdk_char_width (text->style->font, 'W'))
|
||||
+ (2 * (text->style->klass->xthickness + 1)));
|
||||
dims[1] += ((rows * gdk_char_height (text->style->font, 'W'))
|
||||
+ (2 * (text->style->klass->ythickness + 1)));
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert
|
||||
(JNIEnv *env, jobject obj, jstring contents, jint position)
|
||||
{
|
||||
void *ptr;
|
||||
const char *str;
|
||||
int pos=position;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
str = (*env)->GetStringUTFChars (env, contents, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_editable_insert_text (GTK_EDITABLE (TEXT_FROM_SW (ptr)),
|
||||
str, strlen (str), &pos);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, contents, str);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange
|
||||
(JNIEnv *env, jobject obj, jstring contents, jint start, jint end)
|
||||
{
|
||||
void *ptr;
|
||||
GtkEditable *text;
|
||||
const char *str;
|
||||
int pos = start;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
str = (*env)->GetStringUTFChars (env, contents, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
text = GTK_EDITABLE (TEXT_FROM_SW (ptr));
|
||||
gtk_text_freeze (GTK_TEXT (text));
|
||||
gtk_editable_delete_text (text, start, end);
|
||||
gtk_editable_insert_text (text, str, strlen (str), &pos);
|
||||
gtk_text_thaw (GTK_TEXT (text));
|
||||
|
||||
gdk_threads_leave ();
|
||||
(*env)->ReleaseStringUTFChars (env, contents, str);
|
||||
}
|
||||
|
@ -0,0 +1,180 @@
|
||||
/* gtktextcomponentpeer.c -- Native implementation of GtkTextComponentPeer
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkTextComponentPeer.h"
|
||||
|
||||
#define GET_EDITABLE(obj) (GTK_IS_EDITABLE (obj) ? GTK_EDITABLE (obj) : \
|
||||
GTK_EDITABLE (GTK_SCROLLED_WINDOW (obj)->container.child))
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getCaretPosition
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
int pos;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
pos = gtk_editable_get_position (GET_EDITABLE (ptr));
|
||||
gdk_threads_leave ();
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setCaretPosition
|
||||
(JNIEnv *env, jobject obj, jint pos)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_editable_set_position (GET_EDITABLE (ptr), pos);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionStart
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
int pos;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
pos = GET_EDITABLE (ptr)->selection_start_pos;
|
||||
gdk_threads_leave ();
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionEnd
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
int pos;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
pos = GET_EDITABLE (ptr)->selection_end_pos;
|
||||
gdk_threads_leave ();
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_select
|
||||
(JNIEnv *env, jobject obj, jint start, jint end)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_editable_select_region (GET_EDITABLE (ptr), start, end);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setEditable
|
||||
(JNIEnv *env, jobject obj, jboolean state)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_editable_set_editable (GET_EDITABLE (ptr), state);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getText
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
char *contents;
|
||||
jstring jcontents;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
contents = gtk_editable_get_chars (GET_EDITABLE (ptr), 0, -1);
|
||||
gdk_threads_leave ();
|
||||
|
||||
jcontents = (*env)->NewStringUTF (env, contents);
|
||||
g_free (contents);
|
||||
|
||||
return jcontents;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setText
|
||||
(JNIEnv *env, jobject obj, jstring contents)
|
||||
{
|
||||
void *ptr;
|
||||
GtkEditable *text;
|
||||
const char *str;
|
||||
int pos = 0;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
str = (*env)->GetStringUTFChars (env, contents, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
text = GET_EDITABLE (ptr);
|
||||
|
||||
if (GTK_IS_TEXT (text))
|
||||
gtk_text_freeze (GTK_TEXT (text));
|
||||
|
||||
gtk_editable_delete_text (text, 0, -1);
|
||||
gtk_editable_insert_text (text, str, strlen (str), &pos);
|
||||
|
||||
if (GTK_IS_TEXT (text))
|
||||
gtk_text_thaw (GTK_TEXT (text));
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, contents, str);
|
||||
}
|
150
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
Normal file
150
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
Normal file
@ -0,0 +1,150 @@
|
||||
/* gtktextfieldpeer.c -- Native implementation of GtkTextFieldPeer
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkTextFieldPeer.h"
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_create
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
gpointer widget;
|
||||
|
||||
gdk_threads_enter ();
|
||||
widget = gtk_type_new (gtk_entry_get_type ());
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, widget);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_connectHooks
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_widget_realize (GTK_WIDGET (ptr));
|
||||
connect_awt_hook (env, obj, 2,
|
||||
GTK_WIDGET (ptr)->window,
|
||||
GTK_ENTRY (ptr)->text_area);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_old_create
|
||||
(JNIEnv *env, jobject obj, jobject parent_obj, jstring text)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
const char *str;
|
||||
void *parent;
|
||||
|
||||
parent = NSA_GET_PTR (env, parent_obj);
|
||||
|
||||
str = (*env)->GetStringUTFChars (env, text, NULL);
|
||||
gdk_threads_enter ();
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), str);
|
||||
|
||||
set_parent (entry, GTK_CONTAINER (parent));
|
||||
|
||||
gtk_widget_realize (entry);
|
||||
connect_awt_hook (env, obj, 2,
|
||||
entry->window, GTK_ENTRY (entry)->text_area);
|
||||
|
||||
NSA_SET_PTR (env, obj, entry);
|
||||
|
||||
gdk_threads_leave ();
|
||||
(*env)->ReleaseStringUTFChars (env, text, str);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetSize
|
||||
(JNIEnv *env, jobject obj, jint cols, jintArray jdims)
|
||||
{
|
||||
void *ptr;
|
||||
jint *dims;
|
||||
GtkRequisition myreq;
|
||||
GtkEntry *entry;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
dims = (*env)->GetIntArrayElements (env, jdims, 0);
|
||||
|
||||
gdk_threads_enter ();
|
||||
entry = GTK_ENTRY (ptr);
|
||||
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (entry), "size_request", &myreq);
|
||||
|
||||
dims[0]=myreq.width-150 + (cols *
|
||||
gdk_char_width (GTK_WIDGET (entry)->style->font,
|
||||
'W'));
|
||||
dims[1]=myreq.height;
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar
|
||||
(JNIEnv *env, jobject obj, jchar c)
|
||||
{
|
||||
void *ptr;
|
||||
GtkEntry *entry;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
entry = GTK_ENTRY (ptr);
|
||||
|
||||
if (c!=0)
|
||||
{
|
||||
/* gtk_entry_set_echo_char (entry, c); */
|
||||
gtk_entry_set_visibility (entry, FALSE);
|
||||
}
|
||||
else
|
||||
gtk_entry_set_visibility (entry, TRUE);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
87
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
Normal file
87
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
Normal file
@ -0,0 +1,87 @@
|
||||
/* gtktoolkit.c -- Native portion of GtkToolkit
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkToolkit.h"
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkToolkit_beep (JNIEnv *env, jobject obj)
|
||||
{
|
||||
gdk_threads_enter ();
|
||||
gdk_beep ();
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkToolkit_sync (JNIEnv *env, jobject obj)
|
||||
{
|
||||
gdk_threads_enter ();
|
||||
gdk_flush ();
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenSizeDimensions
|
||||
(JNIEnv *env, jobject obj, jintArray jdims)
|
||||
{
|
||||
jint *dims = (*env)->GetIntArrayElements (env, jdims, 0);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
dims[0] = gdk_screen_width ();
|
||||
dims[1] = gdk_screen_height ();
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseIntArrayElements(env, jdims, dims, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenResolution (JNIEnv *env,
|
||||
jobject obj)
|
||||
{
|
||||
jint res;
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
res = gdk_screen_width () / (gdk_screen_width_mm () / 25.4);
|
||||
|
||||
gdk_threads_leave ();
|
||||
return res;
|
||||
}
|
||||
|
365
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
Normal file
365
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
Normal file
@ -0,0 +1,365 @@
|
||||
/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer
|
||||
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gtkpeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkWindowPeer.h"
|
||||
#include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
static void setBounds (GtkWidget *, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Make a new window (any type)
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
|
||||
(JNIEnv *env, jobject obj, jint type)
|
||||
{
|
||||
gpointer window;
|
||||
GtkWidget *vbox, *layout;
|
||||
|
||||
gdk_threads_enter ();
|
||||
window = gtk_window_new (type);
|
||||
|
||||
vbox = gtk_vbox_new (0, 0);
|
||||
layout = gtk_layout_new (NULL, NULL);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
gtk_widget_show (layout);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
NSA_SET_PTR (env, obj, window);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisible
|
||||
(JNIEnv *env, jobject obj, jboolean visible)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
if (visible)
|
||||
gtk_widget_show (GTK_WIDGET (ptr));
|
||||
else
|
||||
gtk_widget_hide (GTK_WIDGET (ptr));
|
||||
|
||||
XFlush (GDK_DISPLAY ());
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
GtkWidget *layout;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
layout = GTK_WIDGET (gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child))->data);
|
||||
gtk_widget_realize (layout);
|
||||
connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
|
||||
|
||||
gtk_widget_realize (GTK_WIDGET (ptr));
|
||||
connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
void
|
||||
setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width,
|
||||
jint height, jboolean visible)
|
||||
{
|
||||
GtkWidget *layout, *vbox;
|
||||
gint x, y;
|
||||
|
||||
gtk_window_set_policy (GTK_WINDOW (window), 1, 1, 0);
|
||||
gtk_widget_set_usize (window, width, height);
|
||||
|
||||
vbox = gtk_vbox_new (0, 0);
|
||||
layout = gtk_layout_new (NULL, NULL);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_realize (layout);
|
||||
connect_awt_hook (env, obj, 1, GTK_LAYOUT(layout)->bin_window);
|
||||
gtk_widget_show (layout);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
gtk_widget_realize (window);
|
||||
/* setBounds (window, x, y, width, height); */
|
||||
|
||||
connect_awt_hook (env, obj, 1, window->window);
|
||||
set_visible (window, visible);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a frame's title
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setTitle
|
||||
(JNIEnv *env, jobject obj, jstring title)
|
||||
{
|
||||
void *ptr;
|
||||
const char *str;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
str = (*env)->GetStringUTFChars (env, title, NULL);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_window_set_title (GTK_WINDOW (ptr), str);
|
||||
gdk_threads_leave ();
|
||||
|
||||
(*env)->ReleaseStringUTFChars (env, title, str);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a window's resizing policy
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setResizable
|
||||
(JNIEnv *env, jobject obj, jboolean resize)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gtk_window_set_policy (GTK_WINDOW (ptr), resize, resize, 0);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Lower the z-level of a window.
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env,
|
||||
jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_window_lower (GTK_WIDGET (ptr)->window);
|
||||
|
||||
XFlush (GDK_DISPLAY ());
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Raise the z-level of a window.
|
||||
*/
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
|
||||
jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
gdk_window_raise (GTK_WIDGET (ptr)->window);
|
||||
|
||||
XFlush (GDK_DISPLAY ());
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
static void
|
||||
setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
gint current_x, current_y;
|
||||
gint origin_x, origin_y;
|
||||
|
||||
/* gdk_window_get_root_origin (widget->window, ¤t_x, ¤t_y); */
|
||||
|
||||
/* if (current_x != x || current_y != y) */
|
||||
/* { */
|
||||
/* gdk_window_set_hints (widget->window, x, y, 0, 0, 0, 0, GDK_HINT_POS); */
|
||||
/* gdk_window_move (widget->window, x, y); */
|
||||
/* } */
|
||||
|
||||
gtk_widget_set_usize (widget, width, height);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds
|
||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
void *ptr;
|
||||
GtkWidget *widget;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
widget = GTK_WIDGET (ptr);
|
||||
setBounds (widget, x, y, width, height);
|
||||
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
|
||||
(JNIEnv *env, jobject obj, jobject menubar)
|
||||
{
|
||||
void *wptr, *mptr;
|
||||
GtkBox *box;
|
||||
|
||||
if (!menubar) return;
|
||||
|
||||
wptr = NSA_GET_PTR (env, obj);
|
||||
mptr = NSA_GET_PTR (env, menubar);
|
||||
|
||||
if (!mptr) return; /* this case should remove a menu */
|
||||
|
||||
gdk_threads_enter ();
|
||||
box = GTK_BOX (GTK_BIN (wptr)->child);
|
||||
gtk_box_pack_start (box, GTK_WIDGET (mptr), 0, 0, 0);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
|
||||
(JNIEnv *env, jobject obj)
|
||||
{
|
||||
void *ptr;
|
||||
GList *children;
|
||||
jint height = 0;
|
||||
|
||||
ptr = NSA_GET_PTR (env, obj);
|
||||
|
||||
gdk_threads_enter ();
|
||||
children = gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child));
|
||||
if (g_list_length (children) == 2)
|
||||
{
|
||||
GtkWidget *menubar = GTK_WIDGET (children->data);
|
||||
height = menubar->allocation.height;
|
||||
|
||||
}
|
||||
gdk_threads_leave ();
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gdk_window_get_root_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *border,
|
||||
gint *depth)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
Window xwindow;
|
||||
Window xparent;
|
||||
Window root;
|
||||
Window *children;
|
||||
unsigned int nchildren;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
private = (GdkWindowPrivate*) window;
|
||||
if (x)
|
||||
*x = 0;
|
||||
if (y)
|
||||
*y = 0;
|
||||
if (width)
|
||||
*width = 0;
|
||||
if (height)
|
||||
*height = 0;
|
||||
if (border)
|
||||
*border = 0;
|
||||
if (depth)
|
||||
*depth = 0;
|
||||
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
|
||||
private = (GdkWindowPrivate*) private->parent;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
xparent = private->xwindow;
|
||||
do
|
||||
{
|
||||
xwindow = xparent;
|
||||
if (!XQueryTree (private->xdisplay, xwindow,
|
||||
&root, &xparent,
|
||||
&children, &nchildren))
|
||||
return;
|
||||
|
||||
if (children)
|
||||
XFree (children);
|
||||
}
|
||||
while (xparent != root);
|
||||
|
||||
if (xparent == root)
|
||||
{
|
||||
unsigned int ww, wh, wb, wd;
|
||||
int wx, wy;
|
||||
|
||||
if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
|
||||
{
|
||||
if (x)
|
||||
*x = wx;
|
||||
if (y)
|
||||
*y = wy;
|
||||
if (width)
|
||||
*width = ww;
|
||||
if (height)
|
||||
*height = wh;
|
||||
if (border)
|
||||
*border = wb;
|
||||
if (depth)
|
||||
*depth = wd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
169
libjava/jni/gtk-peer/gthread-jni.c
Normal file
169
libjava/jni/gtk-peer/gthread-jni.c
Normal file
@ -0,0 +1,169 @@
|
||||
/* gthread-jni.c -- JNI threading routines for GLIB
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include "gthread-jni.h"
|
||||
|
||||
/*
|
||||
* This code has been written specifically to be used with GTK+ 1.2.
|
||||
* `Real' GLIB threading is not supported. We fake things where necessary.
|
||||
* Once we know we're running on a 1.2 VM, we can write a real implementation.
|
||||
*/
|
||||
|
||||
static GMutex *
|
||||
g_mutex_new_jni_impl (void)
|
||||
{
|
||||
jclass obj_class;
|
||||
jobject *mutex;
|
||||
|
||||
obj_class = (*gdk_env)->FindClass (gdk_env, "java/lang/Object");
|
||||
if (obj_class == NULL)
|
||||
return NULL;
|
||||
|
||||
mutex = (jobject *) g_malloc (sizeof (jobject));
|
||||
*mutex = (*gdk_env)->AllocObject (gdk_env, obj_class);
|
||||
if (*mutex == NULL)
|
||||
{
|
||||
g_free (mutex);
|
||||
return NULL;
|
||||
}
|
||||
*mutex = (*gdk_env)->NewGlobalRef (gdk_env, *mutex);
|
||||
|
||||
return (GMutex *) mutex;
|
||||
}
|
||||
|
||||
static void
|
||||
g_mutex_lock_jni_impl (GMutex *mutex)
|
||||
{
|
||||
if (mutex && mutex == gdk_threads_mutex)
|
||||
(*gdk_env)->MonitorEnter (gdk_env, *((jobject *)mutex));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_mutex_trylock_jni_impl (GMutex *mutex)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
g_mutex_unlock_jni_impl (GMutex *mutex)
|
||||
{
|
||||
if (mutex && mutex == gdk_threads_mutex)
|
||||
(*gdk_env)->MonitorExit (gdk_env, *((jobject *)mutex));
|
||||
}
|
||||
|
||||
static void
|
||||
g_mutex_free_jni_impl (GMutex *mutex)
|
||||
{
|
||||
if (mutex && mutex == gdk_threads_mutex)
|
||||
{
|
||||
(*gdk_env)->DeleteGlobalRef (gdk_env, *((jobject *)mutex));
|
||||
g_free (mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static GPrivate *
|
||||
g_private_new_jni_impl (GDestroyNotify notify)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gpointer
|
||||
g_private_get_jni_impl (GPrivate *private)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
g_private_set_jni_impl (GPrivate *private, gpointer data)
|
||||
{
|
||||
}
|
||||
|
||||
static GCond *
|
||||
g_cond_new_jni_impl ()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
g_cond_signal_jni_impl (GCond *cond)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_cond_broadcast_jni_impl (GCond *cond)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_cond_wait_jni_impl (GCond *cond, GMutex *mutex)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_cond_timed_wait_jni_impl (GCond *cond, GMutex *mutex)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
g_cond_free_jni_impl (GCond *cond)
|
||||
{
|
||||
}
|
||||
|
||||
GThreadFunctions g_thread_jni_functions =
|
||||
{
|
||||
g_mutex_new_jni_impl, /* mutex_new */
|
||||
g_mutex_lock_jni_impl, /* mutex_lock */
|
||||
g_mutex_trylock_jni_impl, /* mutex_try_lock */
|
||||
g_mutex_unlock_jni_impl, /* mutex_unlock */
|
||||
g_mutex_free_jni_impl, /* mutex_free */
|
||||
g_cond_new_jni_impl, /* cond_new */
|
||||
g_cond_signal_jni_impl, /* cond_signal */
|
||||
g_cond_broadcast_jni_impl, /* cond_broadcast */
|
||||
g_cond_wait_jni_impl, /* cond_wait */
|
||||
g_cond_timed_wait_jni_impl, /* cond_timed_wait */
|
||||
g_cond_free_jni_impl, /* cond_free */
|
||||
g_private_new_jni_impl, /* private_new */
|
||||
g_private_get_jni_impl, /* private_get */
|
||||
g_private_set_jni_impl /* private_set */
|
||||
};
|
||||
|
||||
void
|
||||
gdk_threads_wake ()
|
||||
{
|
||||
}
|
47
libjava/jni/gtk-peer/gthread-jni.h
Normal file
47
libjava/jni/gtk-peer/gthread-jni.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* gthread-jni.h
|
||||
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
#ifndef __GTHREADJNI_H__
|
||||
#define __GTHREADJNI_H__
|
||||
|
||||
#include <jni.h>
|
||||
#include <glib.h>
|
||||
#include "gtkpeer.h"
|
||||
|
||||
extern GThreadFunctions g_thread_jni_functions;
|
||||
|
||||
#endif /* __GTHREADJNI_H__ */
|
299
libjava/jni/gtk-peer/gtkpeer.h
Normal file
299
libjava/jni/gtk-peer/gtkpeer.h
Normal file
@ -0,0 +1,299 @@
|
||||
/* gtkpeer.h -- Some global variables and #defines
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <config.h>
|
||||
#include "native_state.h"
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#define RC_FILE ".classpath-gtkrc"
|
||||
#define JVM_SUN
|
||||
/*
|
||||
#define JVM_JAPHAR
|
||||
*/
|
||||
|
||||
#ifndef __GTKPEER_H__
|
||||
#define __GTKPEER_H__
|
||||
|
||||
#ifdef JVM_SUN
|
||||
|
||||
extern struct state_table *native_state_table;
|
||||
|
||||
#define NSA_INIT(env, clazz) \
|
||||
native_state_table = init_state_table (env, clazz)
|
||||
|
||||
#define NSA_GET_PTR(env, obj) \
|
||||
get_state (env, obj, native_state_table)
|
||||
|
||||
#define NSA_SET_PTR(env, obj, ptr) \
|
||||
set_state (env, obj, native_state_table, (void *)ptr)
|
||||
|
||||
#define NSA_DEL_PTR(env, obj) \
|
||||
remove_state_slot (env, obj, native_state_table)
|
||||
|
||||
#endif /* JVM_SUN */
|
||||
|
||||
struct graphics
|
||||
{
|
||||
GdkDrawable *drawable;
|
||||
GdkGC *gc;
|
||||
GdkColormap *cm;
|
||||
jint x_offset, y_offset;
|
||||
};
|
||||
|
||||
#define AWT_DEFAULT_CURSOR 0
|
||||
#define AWT_CROSSHAIR_CURSOR 1
|
||||
#define AWT_TEXT_CURSOR 2
|
||||
#define AWT_WAIT_CURSOR 3
|
||||
#define AWT_SW_RESIZE_CURSOR 4
|
||||
#define AWT_SE_RESIZE_CURSOR 5
|
||||
#define AWT_NW_RESIZE_CURSOR 6
|
||||
#define AWT_NE_RESIZE_CURSOR 7
|
||||
#define AWT_N_RESIZE_CURSOR 8
|
||||
#define AWT_S_RESIZE_CURSOR 9
|
||||
#define AWT_W_RESIZE_CURSOR 10
|
||||
#define AWT_E_RESIZE_CURSOR 11
|
||||
#define AWT_HAND_CURSOR 12
|
||||
#define AWT_MOVE_CURSOR 13
|
||||
|
||||
#define SYNTHETIC_EVENT_MASK (1 << 10)
|
||||
|
||||
#define AWT_SHIFT_MASK (1 << 0)
|
||||
#define AWT_CTRL_MASK (1 << 1)
|
||||
#define AWT_META_MASK (1 << 2)
|
||||
#define AWT_ALT_MASK (1 << 3)
|
||||
|
||||
#define AWT_BUTTON1_MASK (1 << 4)
|
||||
#define AWT_BUTTON2_MASK AWT_ALT_MASK
|
||||
#define AWT_BUTTON3_MASK AWT_META_MASK
|
||||
|
||||
#define MULTI_CLICK_TIME 250
|
||||
/* as opposed to a MULTI_PASS_TIME :) */
|
||||
|
||||
#define AWT_MOUSE_CLICKED 500
|
||||
#define AWT_MOUSE_PRESSED 501
|
||||
#define AWT_MOUSE_RELEASED 502
|
||||
#define AWT_MOUSE_MOVED 503
|
||||
#define AWT_MOUSE_ENTERED 504
|
||||
#define AWT_MOUSE_EXITED 505
|
||||
#define AWT_MOUSE_DRAGGED 506
|
||||
|
||||
#define AWT_ADJUSTMENT_UNIT_INCREMENT 1
|
||||
#define AWT_ADJUSTMENT_UNIT_DECREMENT 2
|
||||
#define AWT_ADJUSTMENT_BLOCK_DECREMENT 3
|
||||
#define AWT_ADJUSTMENT_BLOCK_INCREMENT 4
|
||||
#define AWT_ADJUSTMENT_TRACK 5
|
||||
|
||||
#define AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED 0
|
||||
#define AWT_SCROLLPANE_SCROLLBARS_ALWAYS 1
|
||||
#define AWT_SCROLLPANE_SCROLLBARS_NEVER 2
|
||||
|
||||
#define AWT_LABEL_LEFT 0
|
||||
#define AWT_LABEL_CENTER 1
|
||||
#define AWT_LABEL_RIGHT 2
|
||||
|
||||
#define AWT_TEXTAREA_SCROLLBARS_BOTH 0
|
||||
#define AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY 1
|
||||
#define AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY 2
|
||||
|
||||
#define AWT_ITEM_SELECTED 1
|
||||
#define AWT_ITEM_DESELECTED 2
|
||||
|
||||
#define AWT_KEY_TYPED 400
|
||||
#define AWT_KEY_PRESSED 401
|
||||
#define AWT_KEY_RELEASED 402
|
||||
|
||||
#define VK_UNDEFINED 0
|
||||
#define AWT_KEY_CHAR_UNDEFINED 0
|
||||
|
||||
#define VK_0 48
|
||||
#define VK_1 49
|
||||
#define VK_2 50
|
||||
#define VK_3 51
|
||||
#define VK_4 52
|
||||
#define VK_5 53
|
||||
#define VK_6 54
|
||||
#define VK_7 55
|
||||
#define VK_8 56
|
||||
#define VK_9 57
|
||||
#define VK_A 65
|
||||
#define VK_ACCEPT 30
|
||||
#define VK_ADD 107
|
||||
#define VK_ALT 18
|
||||
#define VK_B 66
|
||||
#define VK_BACK_QUOTE 192
|
||||
#define VK_BACK_SLASH 92
|
||||
#define VK_BACK_SPACE 8
|
||||
#define VK_C 67
|
||||
#define VK_CANCEL 3
|
||||
#define VK_CAPS_LOCK 20
|
||||
#define VK_CLEAR 12
|
||||
#define VK_CLOSE_BRACKET 93
|
||||
#define VK_COMMA 44
|
||||
#define VK_CONTROL 17
|
||||
#define VK_CONVERT 28
|
||||
#define VK_D 68
|
||||
#define VK_DECIMAL 110
|
||||
#define VK_DELETE 127
|
||||
#define VK_DIVIDE 111
|
||||
#define VK_DOWN 40
|
||||
#define VK_E 69
|
||||
#define VK_END 35
|
||||
#define VK_ENTER 10
|
||||
#define VK_ESCAPE 27
|
||||
#define VK_F 70
|
||||
#define VK_F1 112
|
||||
#define VK_F10 121
|
||||
#define VK_F11 122
|
||||
#define VK_F12 123
|
||||
#define VK_F2 113
|
||||
#define VK_F3 114
|
||||
#define VK_F4 115
|
||||
#define VK_F5 116
|
||||
#define VK_F6 117
|
||||
#define VK_F7 118
|
||||
#define VK_F8 119
|
||||
#define VK_F9 120
|
||||
#define VK_FINAL 24
|
||||
#define VK_G 71
|
||||
#define VK_H 72
|
||||
#define VK_HELP 156
|
||||
#define VK_HOME 36
|
||||
#define VK_I 73
|
||||
#define VK_INSERT 155
|
||||
#define VK_J 74
|
||||
#define VK_K 75
|
||||
#define VK_KANA 21
|
||||
#define VK_KANJI 25
|
||||
#define VK_L 76
|
||||
#define VK_LEFT 37
|
||||
#define VK_M 77
|
||||
#define VK_META 157
|
||||
#define VK_MODECHANGE 31
|
||||
#define VK_MULTIPLY 106
|
||||
#define VK_N 78
|
||||
#define VK_NONCONVERT 29
|
||||
#define VK_NUM_LOCK 144
|
||||
#define VK_NUMPAD0 96
|
||||
#define VK_NUMPAD1 97
|
||||
#define VK_NUMPAD2 98
|
||||
#define VK_NUMPAD3 99
|
||||
#define VK_NUMPAD4 100
|
||||
#define VK_NUMPAD5 101
|
||||
#define VK_NUMPAD6 102
|
||||
#define VK_NUMPAD7 103
|
||||
#define VK_NUMPAD8 104
|
||||
#define VK_NUMPAD9 105
|
||||
#define VK_O 79
|
||||
#define VK_OPEN_BRACKET 91
|
||||
#define VK_P 80
|
||||
#define VK_PAGE_DOWN 34
|
||||
#define VK_PAGE_UP 33
|
||||
#define VK_PAUSE 19
|
||||
#define VK_PERIOD 46
|
||||
#define VK_PRINTSCREEN 154
|
||||
#define VK_Q 81
|
||||
#define VK_QUOTE 222
|
||||
#define VK_R 82
|
||||
#define VK_RIGHT 39
|
||||
#define VK_S 83
|
||||
#define VK_SCROLL_LOCK 145
|
||||
#define VK_SEMICOLON 59
|
||||
#define VK_SEPARATOR 108
|
||||
#define VK_SHIFT 16
|
||||
#define VK_SLASH 47
|
||||
#define VK_SPACE 32
|
||||
#define VK_SUBTRACT 109
|
||||
#define VK_T 84
|
||||
#define VK_TAB 9
|
||||
#define VK_U 85
|
||||
#define VK_UP 38
|
||||
#define VK_V 86
|
||||
#define VK_W 87
|
||||
#define VK_X 88
|
||||
#define VK_Y 89
|
||||
#define VK_Z 90
|
||||
|
||||
#define AWT_FOCUS_LOST 1004
|
||||
#define AWT_FOCUS_GAINED 1005
|
||||
|
||||
extern jmethodID postActionEventID;
|
||||
extern jmethodID postMenuActionEventID;
|
||||
extern jmethodID postMouseEventID;
|
||||
extern jmethodID postConfigureEventID;
|
||||
extern jmethodID postExposeEventID;
|
||||
extern jmethodID postKeyEventID;
|
||||
extern jmethodID postFocusEventID;
|
||||
extern jmethodID postAdjustmentEventID;
|
||||
extern jmethodID postItemEventID;
|
||||
extern jmethodID postListItemEventID;
|
||||
extern jmethodID syncAttrsID;
|
||||
extern jclass gdkColor;
|
||||
extern jmethodID gdkColorID;
|
||||
extern JNIEnv *gdk_env;
|
||||
|
||||
void
|
||||
gdk_window_get_root_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *border,
|
||||
gint *depth);
|
||||
|
||||
void awt_event_handler (GdkEvent *event);
|
||||
|
||||
void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...);
|
||||
|
||||
void set_visible (GtkWidget *widget, jboolean visible);
|
||||
void set_parent (GtkWidget *widget, GtkContainer *parent);
|
||||
GtkLayout *find_gtk_layout (GtkWidget *parent);
|
||||
void setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width,
|
||||
jint height, jboolean visible);
|
||||
|
||||
struct item_event_hook_info
|
||||
{
|
||||
jobject peer_obj;
|
||||
jobject item_obj;
|
||||
};
|
||||
|
||||
#endif /* __GTKPEER_H */
|
165
libjava/libart.m4
Normal file
165
libjava/libart.m4
Normal file
@ -0,0 +1,165 @@
|
||||
# Configure paths for LIBART
|
||||
# Raph Levien 98-11-18
|
||||
# stolen from Manish Singh 98-9-30
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
dnl AM_PATH_LIBART([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for LIBART, and define LIBART_CFLAGS and LIBART_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AM_PATH_LIBART,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the libart-config script
|
||||
dnl
|
||||
AC_ARG_WITH(libart-prefix,[ --with-libart-prefix=PFX Prefix where LIBART is installed (optional)],
|
||||
libart_prefix="$withval", libart_prefix="")
|
||||
AC_ARG_WITH(libart-exec-prefix,[ --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)],
|
||||
libart_exec_prefix="$withval", libart_exec_prefix="")
|
||||
AC_ARG_ENABLE(libarttest, [ --disable-libarttest Do not try to compile and run a test LIBART program],
|
||||
, enable_libarttest=yes)
|
||||
|
||||
if test x$libart_exec_prefix != x ; then
|
||||
libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
|
||||
if test x${LIBART_CONFIG+set} != xset ; then
|
||||
LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
|
||||
fi
|
||||
fi
|
||||
if test x$libart_prefix != x ; then
|
||||
libart_args="$libart_args --prefix=$libart_prefix"
|
||||
if test x${LIBART_CONFIG+set} != xset ; then
|
||||
LIBART_CONFIG=$libart_prefix/bin/libart-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(LIBART_CONFIG, libart-config, no)
|
||||
min_libart_version=ifelse([$1], ,0.2.5,$1)
|
||||
AC_MSG_CHECKING(for LIBART - version >= $min_libart_version)
|
||||
no_libart=""
|
||||
if test "$LIBART_CONFIG" = "no" ; then
|
||||
no_libart=yes
|
||||
else
|
||||
LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
|
||||
LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
|
||||
|
||||
libart_major_version=`$LIBART_CONFIG $libart_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_libarttest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $LIBART_CFLAGS"
|
||||
LIBS="$LIBS $LIBART_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed LIBART is sufficiently new. (Also sanity
|
||||
dnl checks the results of libart-config to some extent
|
||||
dnl
|
||||
rm -f conf.libarttest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libart_lgpl/libart.h>
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.libarttest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_libart_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_libart_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($libart_major_version > major) ||
|
||||
(($libart_major_version == major) && ($libart_minor_version > minor)) ||
|
||||
(($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
|
||||
printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
|
||||
printf("*** to point to the correct copy of libart-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
],, no_libart=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_libart" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$LIBART_CONFIG" = "no" ; then
|
||||
echo "*** The libart-config script installed by LIBART could not be found"
|
||||
echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the LIBART_CONFIG environment variable to the"
|
||||
echo "*** full path to libart-config."
|
||||
else
|
||||
if test -f conf.libarttest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run LIBART test program, checking why..."
|
||||
CFLAGS="$CFLAGS $LIBART_CFLAGS"
|
||||
LIBS="$LIBS $LIBART_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <libart_lgpl/libart.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding LIBART or finding the wrong"
|
||||
echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
|
||||
echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the libart-config script: $LIBART_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
LIBART_CFLAGS=""
|
||||
LIBART_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(LIBART_CFLAGS)
|
||||
AC_SUBST(LIBART_LIBS)
|
||||
rm -f conf.libarttest
|
||||
])
|
@ -85,10 +85,19 @@ GCLIBS = @GCLIBS@
|
||||
GCOBJS = @GCOBJS@
|
||||
GCSPEC = @GCSPEC@
|
||||
GCTESTSPEC = @GCTESTSPEC@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_CONFIG = @GLIB_CONFIG@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GTK_CFLAGS = @GTK_CFLAGS@
|
||||
GTK_CONFIG = @GTK_CONFIG@
|
||||
GTK_LIBS = @GTK_LIBS@
|
||||
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
|
||||
INCLTDL = @INCLTDL@
|
||||
INTERPRETER = @INTERPRETER@
|
||||
JC1GCSPEC = @JC1GCSPEC@
|
||||
LIBART_CFLAGS = @LIBART_CFLAGS@
|
||||
LIBART_CONFIG = @LIBART_CONFIG@
|
||||
LIBART_LIBS = @LIBART_LIBS@
|
||||
LIBFFI = @LIBFFI@
|
||||
LIBFFIINCS = @LIBFFIINCS@
|
||||
LIBGCJDEBUG = @LIBGCJDEBUG@
|
||||
@ -118,6 +127,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
|
||||
THREADLIBS = @THREADLIBS@
|
||||
THREADOBJS = @THREADOBJS@
|
||||
THREADSPEC = @THREADSPEC@
|
||||
TOOLKIT = @TOOLKIT@
|
||||
VERSION = @VERSION@
|
||||
ZINCS = @ZINCS@
|
||||
ZLIBS = @ZLIBS@
|
||||
@ -129,6 +139,9 @@ here = @here@
|
||||
libgcj_basedir = @libgcj_basedir@
|
||||
mkinstalldirs = @mkinstalldirs@
|
||||
tool_include_dir = @tool_include_dir@
|
||||
toolexecdir = @toolexecdir@
|
||||
toolexeclibdir = @toolexeclibdir@
|
||||
toolexecmainlibdir = @toolexecmainlibdir@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign dejagnu
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user