classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] add SYNCHRONIZE_GDK macro


From: Thomas Fitzsimmons
Subject: [cp-patches] add SYNCHRONIZE_GDK macro
Date: Tue, 06 Sep 2005 00:25:32 -0400

Hi,

This patch adds a SYNCHRONIZE_GDK macro to gtkpeer.h for debugging X
Window System errors.  When an X protocol error occurs GDK prints a
message like this:

The program '.' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAtom (invalid Atom parameter)'.
  (Details: serial 117 error_code 5 request_code 20 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error()
function.)

Defining SYNCHRONIZE_GDK to a non-zero value is equivalent to specifying
--sync on the command line of a GTK program.

Tom

2005-09-06  Thomas Fitzsimmons  <address@hidden>

        * native/jni/gtk-peer/gtkpeer.h (SYNCHRONIZE_GDK): Define.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (gtkInit)
        [SYNCHRONIZE_GDK]: Make GDK synchronous.

Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
===================================================================
RCS file: 
/cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,v
retrieving revision 1.22
diff -u -r1.22 gnu_java_awt_peer_gtk_GtkToolkit.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c      18 Aug 2005 
01:22:00 -0000      1.22
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c      6 Sep 2005 
04:18:28 -0000
@@ -40,6 +40,7 @@
 #include "gnu_java_awt_peer_gtk_GtkToolkit.h"
 #include "gthread-jni.h"
 #include "jcl.h"
+#include <gdk/gdkx.h>
 
 #define RC_FILE ".classpath-gtkrc"
 
@@ -154,6 +155,10 @@
   gdk_threads_init();
 
   gtk_init (&argc, &argv);
+
+#if SYNCHRONIZE_GDK
+  XSynchronize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), True);
+#endif
 
   gdk_rgb_init ();
   gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
Index: native/jni/gtk-peer/gtkpeer.h
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gtkpeer.h,v
retrieving revision 1.39
diff -u -r1.39 gtkpeer.h
--- native/jni/gtk-peer/gtkpeer.h       22 Aug 2005 10:36:15 -0000      1.39
+++ native/jni/gtk-peer/gtkpeer.h       6 Sep 2005 04:18:28 -0000
@@ -206,6 +206,8 @@
 /* Debugging */
 void cp_gtk_print_current_thread (void);
 
+#define SYNCHRONIZE_GDK 0
+
 #define DEBUG_LOCKING 0
 
 #if DEBUG_LOCKING

reply via email to

[Prev in Thread] Current Thread [Next in Thread]