[cp-patches] FYI: GTK peers without X
Hi, This patch changes the GTK peers, so that they can be compiled and used on systems without X, for example on GTK for embedded or Windows systems. In many places this only removes imports that are unused, there are only two notable changes: - The GdkRobotPeer now has #ifdef HAVE_XTEST for all operations and does nothing if XTest is not present on compile time. - The code for fetching the frame extents now uses the (new?) GDK function gdk_window_get_frame_extents() rather than pulling the frame extents using the extended window property _NET_FRAME_EXTENTS. 2007-09-11 Roman Kennke [EMAIL PROTECTED] * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c Removed unusued excludes. Put Xrender includes in HAVE_XRENDER conditional. (flush): Use gdk_display_flush() instead of XFlush(). (initState): Use GDK/Cairo functions to get cairo_t object. (initFromVolatile): Likewise. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c Use HAVE_XTEST conditionals for code that uses XTest. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c Removed unused includes. Rewrote frame-extents code to use gdk_window_get_frame_extents() rather than the X window properties directly. * include/gnu_java_awt_peer_gtk_ComponentGraphics.h (initFromVolatile): Removed width and height parameters. * gnu/java/awt/peer/gtk/ComponentGraphics.java (initFromVolatile): Remove width and height parameters. * gnu/java/awt/peer/gtk/VolatileImageGraphics.java (VolatileImageGraphics): Use initFromVolatile without width and height. * configure.ac: Check for presence of XTest, and define HAVE_XTEST accordingly. /Roman -- Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org aicas Allerton Interworks Computer Automated Systems GmbH Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany http://www.aicas.com * Tel: +49-721-663 968-0 USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe Geschäftsführer: Dr. James J. Hunt Index: include/gnu_java_awt_peer_gtk_ComponentGraphics.h === RCS file: /cvsroot/classpath/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,v retrieving revision 1.11 diff -u -1 -0 -r1.11 gnu_java_awt_peer_gtk_ComponentGraphics.h --- include/gnu_java_awt_peer_gtk_ComponentGraphics.h 9 Apr 2007 21:34:27 - 1.11 +++ include/gnu_java_awt_peer_gtk_ComponentGraphics.h 11 Sep 2007 09:44:10 - @@ -4,21 +4,21 @@ #define __gnu_java_awt_peer_gtk_ComponentGraphics__ #include jni.h #ifdef __cplusplus extern C { #endif JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_initState (JNIEnv *env, jobject, jobject); -JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_initFromVolatile (JNIEnv *env, jobject, jlong, jint, jint); +JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_initFromVolatile (JNIEnv *env, jobject, jlong); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_start_1gdk_1drawing (JNIEnv *env, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_end_1gdk_1drawing (JNIEnv *env, jobject); JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_hasXRender (JNIEnv *env, jclass); JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_nativeGrab (JNIEnv *env, jclass, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_copyAreaNative (JNIEnv *env, jobject, jobject, jint, jint, jint, jint, jint, jint); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_ComponentGraphics_drawVolatile (JNIEnv *env, jobject, jobject, jlong, jint, jint, jint, jint, jint, jint, jint, jint); #ifdef __cplusplus } #endif Index: configure.ac === RCS file: /cvsroot/classpath/classpath/configure.ac,v retrieving revision 1.212 diff -u -1 -0 -r1.212 configure.ac --- configure.ac 9 Jul 2007 16:32:20 - 1.212 +++ configure.ac 11 Sep 2007 09:44:10 - @@ -478,25 +478,27 @@ AC_SUBST(XSLT_LIBS) AC_SUBST(XSLT_CFLAGS) fi dnl Check for AWT related gthread/gtk if test x${COMPILE_GTK_PEER} = xyes; then AC_PATH_XTRA if test
Re: [cp-patches] FYI: GTK peers without X
Roman Kennke wrote: Hi, This patch changes the GTK peers, so that they can be compiled and used on systems without X, for example on GTK for embedded or Windows systems. [...] - The code for fetching the frame extents now uses the (new?) GDK function gdk_window_get_frame_extents() rather than pulling the frame extents using the extended window property _NET_FRAME_EXTENTS. This will result in the wrong insets being calculated upon window realization, since gdk_window_get_frame_extents relies on the window being mapped. For now you can ifdef this code based on the presence or absence of X. Ideally though, _NET_FRAME_EXTENTS support would be added to the X11 implementation of gdk_window_get_frame_extents. Tom
Re: [cp-patches] FYI: GTK peers without X
Hi Tom, - The code for fetching the frame extents now uses the (new?) GDK function gdk_window_get_frame_extents() rather than pulling the frame extents using the extended window property _NET_FRAME_EXTENTS. This will result in the wrong insets being calculated upon window realization, since gdk_window_get_frame_extents relies on the window being mapped. For now you can ifdef this code based on the presence or absence of X. Ideally though, _NET_FRAME_EXTENTS support would be added to the X11 implementation of gdk_window_get_frame_extents. Not sure if I understand correctly. Window realization is when the window object is created, but not yet visible (==mapped), right? In this case, the _NET_FRAME_EXTENTS thing reports 0-extents, because it doesn't know yet about the real borders. This is exactly what gdk_window_get_frame_extents() does in this case. When the window is mapped, we receive a callback and fetch the real extents. What's the difference between _NET_FRAME_EXTENTS and gdk_window_get_frame_extents() then? /Roman -- Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org aicas Allerton Interworks Computer Automated Systems GmbH Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany http://www.aicas.com * Tel: +49-721-663 968-0 USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe Geschäftsführer: Dr. James J. Hunt
Re: [cp-patches] FYI: GTK peers without X
Roman Kennke wrote: Hi Tom, - The code for fetching the frame extents now uses the (new?) GDK function gdk_window_get_frame_extents() rather than pulling the frame extents using the extended window property _NET_FRAME_EXTENTS. This will result in the wrong insets being calculated upon window realization, since gdk_window_get_frame_extents relies on the window being mapped. For now you can ifdef this code based on the presence or absence of X. Ideally though, _NET_FRAME_EXTENTS support would be added to the X11 implementation of gdk_window_get_frame_extents. Not sure if I understand correctly. Window realization is when the window object is created, but not yet visible (==mapped), right? In this case, the _NET_FRAME_EXTENTS thing reports 0-extents, because it doesn't know yet about the real borders. The _NET_REQUEST_FRAME_EXTENTS and _NET_FRAME_EXTENTS hints will report all-zero extents on window managers that don't support them. But at least Metacity does support them and will return non-zero results. This is exactly what gdk_window_get_frame_extents() does in this case. When the window is mapped, we receive a callback and fetch the real extents. What's the difference between _NET_FRAME_EXTENTS and gdk_window_get_frame_extents() then? The purpose of the _NET_REQUEST_FRAME_EXTENTS and _NET_FRAME_EXTENTS hints is to provide, before the frame is mapped, the extents that the frame will have when it is mapped. http://standards.freedesktop.org/wm-spec/1.4/ar01s04.html#id2527060 This eliminates the need to estimate the frame size (guessing at the size of the frame that the window manager will add) then a) adjust the frame size to the correct size after the real-extents callback or b) leave the window at its estimated size. Tom
[cp-testresults] FAIL: regressions for mauve-jamvm on Tue Sep 11 13:48:59 UTC 2007
Baseline from: Mon Sep 10 20:47:37 UTC 2007 Regressions: FAIL: java.awt.ScrollPane.ScrollbarPaintTest FAIL: java.awt.Scrollbar.ScrollbarPaintTest FAIL: java.awt.TextArea.ScrollbarPaintTest Improvements: PASS: java.awt.Canvas.PaintTest PASS: java.awt.Label.PaintTest PASS: java.awt.Robot.mouseMove PASS: java.awt.TextField.PaintTest PASS: javax.swing.JFrame.HeavyweightComponent Totals: PASS: 2928 XPASS: 0 FAIL: 187 XFAIL: 0 ___ Classpath-testresults mailing list Classpath-testresults@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-testresults
[cp-testresults] FAIL: regressions for mauve-cacao on Tue Sep 11 14:18:21 UTC 2007
Baseline from: Fri Aug 31 19:03:14 UTC 2007 Regressions: FAIL: java.awt.ScrollPane.ScrollbarPaintTest FAIL: java.awt.Scrollbar.ScrollbarPaintTest FAIL: java.awt.TextArea.ScrollbarPaintTest Improvements: PASS: java.awt.Canvas.PaintTest PASS: java.awt.Label.PaintTest PASS: java.awt.Robot.mouseMove PASS: java.awt.TextField.PaintTest PASS: java.awt.Window.pack1 PASS: javax.swing.JFrame.HeavyweightComponent Totals: PASS: 2943 XPASS: 0 FAIL: 192 XFAIL: 0 ___ Classpath-testresults mailing list Classpath-testresults@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-testresults
[cp-testresults] FAIL: jikesrvm build on Wed Sep 12 05:48:19 UTC 2007
[javac] failed to read ecj.jar (reconfigure with --with-ecj-jar): [javac] failed to load org.eclipse.jdt.internal.compiler.batch.Main from ecj.jar: [javac] java.lang.ClassNotFoundException: org.eclipse.jdt.internal.compiler.batch.Main not found in java.net.URLClassLoader{urls=[file:/home/cpdev/Nightly/jikesrvm/jikesrvm], parent=java.lang.ClassLoader$1{urls=[file:/usr/share/ant/lib/ant-launcher.jar,file:/usr/share/java/xmlParserAPIs.jar,file:/usr/share/java/xercesImpl.jar], parent=null}} [javac]at java.net.URLClassLoader.findClass(URLClassLoader.java:529) [javac]at java.lang.ClassLoader.loadClass(ClassLoader.java:341) [javac]at java.lang.ClassLoader.loadClass(ClassLoader.java:293) [javac]at com.sun.tools.javac.Main.clinit(Main.java:91) [javac]at java.lang.VMClass.forName(Native Method) [javac]at java.lang.Class.forName(Class.java:187) [javac]at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.doesModernCompilerExist(CompilerAdapterFactory.java:139) [javac]at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:97) [javac]at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:925) [javac]at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) [javac]at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) [javac]at org.apache.tools.ant.Task.perform(Task.java:364) [javac]at org.apache.tools.ant.Target.execute(Target.java:341) [javac]at org.apache.tools.ant.Target.performTasks(Target.java:369) [javac]at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) [javac]at org.apache.tools.ant.Project.executeTarget(Project.java:1185) [javac]at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) [javac]at org.apache.tools.ant.Project.executeTargets(Project.java:1068) [javac]at org.apache.tools.ant.Main.runBuild(Main.java:668) [javac]at org.apache.tools.ant.Main.startAnt(Main.java:187) [javac]at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) [javac]at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) BUILD FAILED java.lang.ExceptionInInitializerError Total time: 4 seconds ___ Classpath-testresults mailing list Classpath-testresults@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-testresults
RE: SIGSEGV issue
David Sayada writes: I hope I am not top posting now :-) Apparently not. You need to look at your quoting, but keep it up. :-) I think I have identified what can be the source of the problem. Please look at the following scheme: This is the infinite loop of one my threads: while (true) { try { selectEventLoop(); } catch (Exception e) { Logger.logPrintln( e ); } } // of select loop And this is the way the selectEventLoop is implemented: void selectEventLoop() throws Exception { int nNumSelected = 0; while ( nNumSelected == 0 ) { signalSendChannels(); //Logger.logPrintln( X Before select ); nNumSelected = m_selector.select(); //Logger.logPrintln( X After select ); } Set readyKeys = m_selector.selectedKeys(); Iterator iterator = readyKeys.iterator(); while (iterator.hasNext()) { SelectionKey key = (SelectionKey) iterator.next(); iterator.remove(); try { ... } catch (IOException ex) { Logger.logPrintln( ex ); closeChannel( key ); } } // of selected keys iterator } May the parts of this function which are not under try and catch be problematic? Should the exception thrown in this area not be caught by the try and catch of the upper layer inside the infinite loop? There's nothing I can see that should cause any trouble, but I suppose the problem is that becasue stack traces on your version of gcj aren't working you have no way to know where the problem is? Andrew.
RE: SIGSEGV issue
There's nothing I can see that should cause any trouble, but I suppose the problem is that becasue stack traces on your version of gcj aren't working you have no way to know where the problem is? Yes, correct. Is there a way to make them work? Thanks, David Sayada.
[commit-cp] classpath include/gnu_java_awt_peer_gtk_Compone...
CVSROOT:/cvsroot/classpath Module name:classpath Changes by: Roman Kennke rabbit78 07/09/11 09:48:50 Modified files: include: gnu_java_awt_peer_gtk_ComponentGraphics.h . : configure.ac native/jni/gtk-peer: gnu_java_awt_peer_gtk_CairoGraphics2D.c gnu_java_awt_peer_gtk_CairoSurface.c gnu_java_awt_peer_gtk_ComponentGraphics.c gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c gnu_java_awt_peer_gtk_GdkRobotPeer.c gnu_java_awt_peer_gtk_GtkImage.c gnu_java_awt_peer_gtk_GtkToolkit.c gnu_java_awt_peer_gtk_GtkVolatileImage.c gnu_java_awt_peer_gtk_GtkWindowPeer.c gnu/java/awt/peer/gtk: ComponentGraphics.java VolatileImageGraphics.java Log message: 2007-09-11 Roman Kennke [EMAIL PROTECTED] * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c Removed unusued excludes. Put Xrender includes in HAVE_XRENDER conditional. (flush): Use gdk_display_flush() instead of XFlush(). (initState): Use GDK/Cairo functions to get cairo_t object. (initFromVolatile): Likewise. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c Use HAVE_XTEST conditionals for code that uses XTest. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c Removed unused includes. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c Removed unused includes. Rewrote frame-extents code to use gdk_window_get_frame_extents() rather than the X window properties directly. * include/gnu_java_awt_peer_gtk_ComponentGraphics.h (initFromVolatile): Removed width and height parameters. * gnu/java/awt/peer/gtk/ComponentGraphics.java (initFromVolatile): Remove width and height parameters. * gnu/java/awt/peer/gtk/VolatileImageGraphics.java (VolatileImageGraphics): Use initFromVolatile without width and height. * configure.ac: Check for presence of XTest, and define HAVE_XTEST accordingly. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h?cvsroot=classpathr1=1.11r2=1.12 http://cvs.savannah.gnu.org/viewcvs/classpath/configure.ac?cvsroot=classpathr1=1.212r2=1.213 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c?cvsroot=classpathr1=1.25r2=1.26 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c?cvsroot=classpathr1=1.24r2=1.25 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c?cvsroot=classpathr1=1.21r2=1.22 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphicsCopy.c?cvsroot=classpathr1=1.6r2=1.7 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkRobotPeer.c?cvsroot=classpathr1=1.6r2=1.7 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c?cvsroot=classpathr1=1.27r2=1.28 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c?cvsroot=classpathr1=1.37r2=1.38 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c?cvsroot=classpathr1=1.9r2=1.10 http://cvs.savannah.gnu.org/viewcvs/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c?cvsroot=classpathr1=1.72r2=1.73 http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java?cvsroot=classpathr1=1.28r2=1.29 http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java?cvsroot=classpathr1=1.13r2=1.14
RE: SIGSEGV issue
David Sayada writes: There's nothing I can see that should cause any trouble, but I suppose the problem is that becasue stack traces on your version of gcj aren't working you have no way to know where the problem is? Yes, correct. Is there a way to make them work? Upgrade gcc. They're known to work on gcc trunk, EABI, nowhere else. Andrew.
RE: SIGSEGV issue
Upgrade gcc. They're known to work on gcc trunk, EABI, nowhere else. Andrew. Will the latest gcc 4.1 fit my needs? Should I compile it with these options you gave me to support EABI? arm*-linux* ) slow_pthread_self=no can_unwind_signal=no CHECKREFSPEC=-fcheck-references DIVIDESPEC=-fuse-divide-subroutine ;; If not, can I please ask you to provide them to me? Many Thanks, David Sayada.
RE: SIGSEGV issue
David Sayada writes: Upgrade gcc. They're known to work on gcc trunk, EABI, nowhere else. Will the latest gcc 4.1 fit my needs? Should I compile it with these options you gave me to support EABI? No, just trunk, sorry. Jakub jelinek is going to do a backport of ARM EABI gcc but he hasn't doine it yet AFAIAA. You don't really need stack traces to debug this: you can used gdb instead. But I wouldn't consider using such an old gcj on ARM. Andrew.