]> code.delx.au - gnu-emacs/blobdiff - src/xselect.c
Merged in changes from CVS trunk.
[gnu-emacs] / src / xselect.c
index 8c8f1f986689e16f7155d39fd3504fe2751ce8e7..530bf060af4b1bf857592f1db34cae3b3e2fa926 100644 (file)
@@ -752,7 +752,15 @@ x_reply_selection_request (event, format, data, size, type)
      refering to the deleted window, and we'll get a BadWindow error
      in XTread_socket when processing the events.  I don't have
      an idea how to fix that.  gerd, 2001-01-98.   */
-  XFlush (display);
+  /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are
+     delivered before uncatch errors.  */
+  XSync (display, False);
+  UNBLOCK_INPUT;
+
+  /* GTK queues events in addition to the queue in Xlib.  So we
+     UNBLOCK to enter the event loop and get possible errors delivered,
+     and then BLOCK again because x_uncatch_errors requires it.  */
+  BLOCK_INPUT;
   x_uncatch_errors (display, count);
   UNBLOCK_INPUT;
 }
@@ -1117,7 +1125,8 @@ wait_for_property_change (location)
       secs = x_selection_timeout / 1000;
       usecs = (x_selection_timeout % 1000) * 1000;
       TRACE2 ("  Waiting %d secs, %d usecs", secs, usecs);
-      wait_reading_process_input (secs, usecs, property_change_reply, 0);
+      wait_reading_process_output (secs, usecs, 0, 0,
+                                  property_change_reply, NULL, 0);
 
       if (NILP (XCAR (property_change_reply)))
        {
@@ -1305,7 +1314,8 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
   secs = x_selection_timeout / 1000;
   usecs = (x_selection_timeout % 1000) * 1000;
   TRACE1 ("  Start waiting %d secs for SelectionNotify", secs);
-  wait_reading_process_input (secs, usecs, reading_selection_reply, 0);
+  wait_reading_process_output (secs, usecs, 0, 0,
+                              reading_selection_reply, NULL, 0);
   TRACE1 ("  Got event = %d", !NILP (XCAR (reading_selection_reply)));
 
   BLOCK_INPUT;