changeset 8090:4a63bc29ab49

8051857: OperationTimedOut exception inside from XToolkit.syncNativeQueue call Reviewed-by: alexsch, serb
author dmarkov
date Thu, 23 Oct 2014 11:03:20 +0400
parents 2557d9bd981c
children 6c4164200421
files src/solaris/native/sun/awt/awt_util.h src/solaris/native/sun/xawt/XlibWrapper.c
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/sun/awt/awt_util.h	Thu Oct 23 11:00:19 2014 +0400
+++ b/src/solaris/native/sun/awt/awt_util.h	Thu Oct 23 11:03:20 2014 +0400
@@ -115,6 +115,8 @@
 
 extern int xerror_ignore_bad_window(Display *dpy, XErrorEvent *err);
 
+Window get_xawt_root_shell(JNIEnv *env);
+
 #endif /* !HEADLESS */
 
 #ifndef INTERSECTS
--- a/src/solaris/native/sun/xawt/XlibWrapper.c	Thu Oct 23 11:00:19 2014 +0400
+++ b/src/solaris/native/sun/xawt/XlibWrapper.c	Thu Oct 23 11:03:20 2014 +0400
@@ -1942,10 +1942,14 @@
  * Toolkit thread to process PropertyNotify or SelectionNotify events.
  */
 static Bool
-secondary_loop_event(Display* dpy, XEvent* event, char* arg) {
-    return (event->type == SelectionNotify ||
-            event->type == SelectionClear  ||
-            event->type == PropertyNotify) ? True : False;
+secondary_loop_event(Display* dpy, XEvent* event, XPointer xawt_root_window) {
+    return (
+                event->type == SelectionNotify ||
+                event->type == SelectionClear  ||
+                event->type == PropertyNotify  ||
+                (event->type == ConfigureNotify
+                    && event->xany.window == *(Window*) xawt_root_window)
+            ) ? True : False;
 }
 
 
@@ -1956,8 +1960,11 @@
 
     AWT_CHECK_HAVE_LOCK();
     exitSecondaryLoop = False;
+    Window xawt_root_window = get_xawt_root_shell(env);
+
     while (!exitSecondaryLoop) {
-        if (XCheckIfEvent((Display*) jlong_to_ptr(display), (XEvent*) jlong_to_ptr(ptr), secondary_loop_event, NULL)) {
+        if (XCheckIfEvent((Display*) jlong_to_ptr(display),
+                (XEvent*) jlong_to_ptr(ptr), secondary_loop_event, (XPointer) &xawt_root_window)) {
             return JNI_TRUE;
         }
         timeout = (timeout < AWT_SECONDARY_LOOP_TIMEOUT) ? (timeout << 1) : AWT_SECONDARY_LOOP_TIMEOUT;