fd6abe4
qt-bugs@ issue : none, probably even won't be
fd6abe4
bugs.kde.org number : 80072
fd6abe4
applied: no
fd6abe4
author: Lubos Lunak <l.lunak@kde.org>
fd6abe4
fd6abe4
A crude hack for KDE #80072. No good idea how to fix it properly yet :(.
fd6abe4
fd6abe4
--- src/kernel/qclipboard_x11.cpp.sav	2004-04-30 12:00:06.000000000 +0200
fd6abe4
+++ src/kernel/qclipboard_x11.cpp	2004-05-09 21:18:10.269264304 +0200
fd6abe4
@@ -109,6 +109,7 @@ static int pending_timer_id = 0;
fd6abe4
 static bool pending_clipboard_changed = FALSE;
fd6abe4
 static bool pending_selection_changed = FALSE;
fd6abe4
 
fd6abe4
+Q_EXPORT bool qt_qclipboard_bailout_hack = false;
fd6abe4
 
fd6abe4
 // event capture mechanism for qt_xclb_wait_for_event
fd6abe4
 static bool waiting_for_data = FALSE;
fd6abe4
@@ -453,6 +454,15 @@ static int qt_xclb_event_filter(XEvent *
fd6abe4
     return 0;
fd6abe4
 }
fd6abe4
 
fd6abe4
+static bool selection_request_pending = false;
fd6abe4
+
fd6abe4
+static Bool check_selection_request_pending( Display*, XEvent* e, XPointer )
fd6abe4
+    {
fd6abe4
+    if( e->type == SelectionRequest && e->xselectionrequest.owner == owner->winId())
fd6abe4
+        selection_request_pending = true;
fd6abe4
+    return False;
fd6abe4
+    }
fd6abe4
+
fd6abe4
 bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
fd6abe4
 			     int timeout )
fd6abe4
 {
fd6abe4
@@ -504,6 +514,14 @@ bool qt_xclb_wait_for_event( Display *dp
fd6abe4
     do {
fd6abe4
         if ( XCheckTypedWindowEvent(dpy,win,type,event) )
fd6abe4
 	    return TRUE;
fd6abe4
+        if( qt_qclipboard_bailout_hack ) {
fd6abe4
+            XEvent dummy;
fd6abe4
+            selection_request_pending = false;
fd6abe4
+            if ( owner != NULL )
fd6abe4
+                XCheckIfEvent(dpy,&dummy,check_selection_request_pending,NULL);
fd6abe4
+            if( selection_request_pending )
fd6abe4
+	        return TRUE;
fd6abe4
+        }
fd6abe4
 
fd6abe4
 	now = QTime::currentTime();
fd6abe4
 	if ( started > now )			// crossed midnight