patches/qt3-0012-qclipboard_hack_80072.patch
author jurikm
Sun, 12 Feb 2012 14:04:10 +0000
changeset 8245 383896da4129
parent 782 a013313b88b4
permissions -rw-r--r--
SFEsauerbraten.spec: add IPS package name

--- qt-x11-free-3.3.8/src/kernel/qclipboard_x11.cpp.orig	2007-02-02 19:31:11.000000000 +0530
+++ qt-x11-free-3.3.8/src/kernel/qclipboard_x11.cpp	2008-01-08 22:26:21.861760315 +0530
@@ -109,6 +109,7 @@
 static bool pending_clipboard_changed = FALSE;
 static bool pending_selection_changed = FALSE;
 
+Q_EXPORT bool qt_qclipboard_bailout_hack = false;
 
 // event capture mechanism for qt_xclb_wait_for_event
 static bool waiting_for_data = FALSE;
@@ -461,6 +462,15 @@
                                               || e->xselectionclear.selection == qt_xa_clipboard)));
 }
 
+static bool selection_request_pending = false;
+
+static Bool check_selection_request_pending( Display*, XEvent* e, XPointer )
+    {
+    if( e->type == SelectionRequest && e->xselectionrequest.owner == owner->winId())
+        selection_request_pending = true;
+    return False;
+    }
+
 bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
 			     int timeout )
 {
@@ -512,6 +522,14 @@
     do {
         if ( XCheckTypedWindowEvent(dpy,win,type,event) )
 	    return TRUE;
+        if( qt_qclipboard_bailout_hack ) {
+            XEvent dummy;
+            selection_request_pending = false;
+            if ( owner != NULL )
+                XCheckIfEvent(dpy,&dummy,check_selection_request_pending,NULL);
+            if( selection_request_pending )
+	        return TRUE;
+        }
 
         // process other clipboard events, since someone is probably requesting data from us
         XEvent e;