changeset 10748:64e58ac81653

8051857: OperationTimedOut exception inside from XToolkit.syncNativeQueue call Reviewed-by: alexsch, serb
author azvegint
date Fri, 26 Sep 2014 18:43:44 +0400
parents b9d4b8462039
children 137ef28aa2f8
files src/java.desktop/unix/native/common/awt/awt_util.h src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/native/common/awt/awt_util.h	Thu Sep 25 15:31:13 2014 -0700
+++ b/src/java.desktop/unix/native/common/awt/awt_util.h	Fri Sep 26 18:43:44 2014 +0400
@@ -52,6 +52,8 @@
  */
 extern XErrorHandler current_native_xerror_handler;
 
+Window get_xawt_root_shell(JNIEnv *env);
+
 #endif /* !HEADLESS */
 
 #ifndef INTERSECTS
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Thu Sep 25 15:31:13 2014 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Fri Sep 26 18:43:44 2014 +0400
@@ -2011,10 +2011,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;
 }
 
 
@@ -2025,8 +2029,11 @@
 
     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     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;