changeset 14134:a1ebbdb060b8

(x_handle_selection_notify): Give an indication in reading_selection_reply of whether the request succeeded. (x_get_foreign_selection): Do error if foreign selection was cleared.
author Karl Heuer <kwzh@gnu.org>
date Tue, 09 Jan 1996 23:47:09 +0000
parents 7167b8612c52
children 51d3a3fa828c
files src/xselect.c
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/xselect.c	Tue Jan 09 23:46:53 1996 +0000
+++ b/src/xselect.c	Tue Jan 09 23:47:09 1996 +0000
@@ -558,7 +558,7 @@
 	}
 
       if (x_window_to_frame (dpyinfo, window)) /* #### debug */
-	error ("attempt to transfer an INCR to ourself!");
+	error ("Attempt to transfer an INCR to ourself!");
 #if 0
       fprintf (stderr, "\nINCR %d\n", bytes_remaining);
 #endif
@@ -967,7 +967,7 @@
       wait_reading_process_input (secs, usecs, property_change_reply, 0);
 
       if (NILP (XCONS (property_change_reply)->car))
-	error ("timed out waiting for property-notify event");
+	error ("Timed out waiting for property-notify event");
     }
 
   unbind_to (count, Qnil);
@@ -1138,7 +1138,9 @@
   UNBLOCK_INPUT;
 
   if (NILP (XCONS (reading_selection_reply)->car))
-    error ("timed out waiting for reply from selection owner");
+    error ("Timed out waiting for reply from selection owner");
+  if (EQ (XCONS (reading_selection_reply)->car, Qlambda))
+    error ("No `%s' selection", XSYMBOL (selection_symbol)->name->data);
 
   /* Otherwise, the selection is waiting for us on the requested property.  */
   return
@@ -1691,7 +1693,9 @@
 }
 
 /* Called from XTread_socket to handle SelectionNotify events.
-   If it's the selection we are waiting for, stop waiting.  */
+   If it's the selection we are waiting for, stop waiting
+   by setting the car of reading_selection_reply to non-nil.
+   We store t there if the reply is successful, lambda if not.  */
 
 void
 x_handle_selection_notify (event)
@@ -1702,7 +1706,8 @@
   if (event->selection != reading_which_selection)
     return;
 
-  XCONS (reading_selection_reply)->car = Qt;
+  XCONS (reading_selection_reply)->car
+    = (event->property != 0 ? Qt : Qlambda);
 }
 
 
@@ -1719,7 +1724,7 @@
 {
   check_x ();
   CHECK_SYMBOL (selection_name, 0);
-  if (NILP (selection_value)) error ("selection-value may not be nil.");
+  if (NILP (selection_value)) error ("selection-value may not be nil");
   x_own_selection (selection_name, selection_value);
   return selection_value;
 }