aboutsummaryrefslogtreecommitdiffstats
path: root/src/xselect.c
diff options
context:
space:
mode:
authorStefan Monnier2011-03-21 12:42:16 -0400
committerStefan Monnier2011-03-21 12:42:16 -0400
commitcafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch)
tree7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /src/xselect.c
parenta08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff)
parent4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff)
downloademacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz
emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip
Merge from trunk
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/xselect.c b/src/xselect.c
index a502a74f904..5254fa96838 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -97,7 +97,6 @@ static Lisp_Object clean_local_selection_data (Lisp_Object);
97#define TRACE0(fmt) (void) 0 97#define TRACE0(fmt) (void) 0
98#define TRACE1(fmt, a0) (void) 0 98#define TRACE1(fmt, a0) (void) 0
99#define TRACE2(fmt, a0, a1) (void) 0 99#define TRACE2(fmt, a0, a1) (void) 0
100#define TRACE3(fmt, a0, a1) (void) 0
101#endif 100#endif
102 101
103 102
@@ -330,7 +329,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
330 struct frame *sf = SELECTED_FRAME (); 329 struct frame *sf = SELECTED_FRAME ();
331 Window selecting_window; 330 Window selecting_window;
332 Display *display; 331 Display *display;
333 Time time = last_event_timestamp; 332 Time timestamp = last_event_timestamp;
334 Atom selection_atom; 333 Atom selection_atom;
335 struct x_display_info *dpyinfo; 334 struct x_display_info *dpyinfo;
336 335
@@ -346,7 +345,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
346 345
347 BLOCK_INPUT; 346 BLOCK_INPUT;
348 x_catch_errors (display); 347 x_catch_errors (display);
349 XSetSelectionOwner (display, selection_atom, selecting_window, time); 348 XSetSelectionOwner (display, selection_atom, selecting_window, timestamp);
350 x_check_errors (display, "Can't set selection: %s"); 349 x_check_errors (display, "Can't set selection: %s");
351 x_uncatch_errors (); 350 x_uncatch_errors ();
352 UNBLOCK_INPUT; 351 UNBLOCK_INPUT;
@@ -357,7 +356,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
357 Lisp_Object selection_data; 356 Lisp_Object selection_data;
358 Lisp_Object prev_value; 357 Lisp_Object prev_value;
359 358
360 selection_time = long_to_cons ((unsigned long) time); 359 selection_time = long_to_cons ((unsigned long) timestamp);
361 selection_data = list4 (selection_name, selection_value, 360 selection_data = list4 (selection_name, selection_value,
362 selection_time, selected_frame); 361 selection_time, selected_frame);
363 prev_value = assq_no_quit (selection_name, Vselection_alist); 362 prev_value = assq_no_quit (selection_name, Vselection_alist);
@@ -2085,7 +2084,7 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
2085 Sx_disown_selection_internal, 1, 2, 0, 2084 Sx_disown_selection_internal, 1, 2, 0,
2086 doc: /* If we own the selection SELECTION, disown it. 2085 doc: /* If we own the selection SELECTION, disown it.
2087Disowning it means there is no such selection. */) 2086Disowning it means there is no such selection. */)
2088 (Lisp_Object selection, Lisp_Object time) 2087 (Lisp_Object selection, Lisp_Object time_object)
2089{ 2088{
2090 Time timestamp; 2089 Time timestamp;
2091 Atom selection_atom; 2090 Atom selection_atom;
@@ -2104,10 +2103,10 @@ Disowning it means there is no such selection. */)
2104 display = FRAME_X_DISPLAY (sf); 2103 display = FRAME_X_DISPLAY (sf);
2105 dpyinfo = FRAME_X_DISPLAY_INFO (sf); 2104 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
2106 CHECK_SYMBOL (selection); 2105 CHECK_SYMBOL (selection);
2107 if (NILP (time)) 2106 if (NILP (time_object))
2108 timestamp = last_event_timestamp; 2107 timestamp = last_event_timestamp;
2109 else 2108 else
2110 timestamp = cons_to_long (time); 2109 timestamp = cons_to_long (time_object);
2111 2110
2112 if (NILP (assq_no_quit (selection, Vselection_alist))) 2111 if (NILP (assq_no_quit (selection, Vselection_alist)))
2113 return Qnil; /* Don't disown the selection when we're not the owner. */ 2112 return Qnil; /* Don't disown the selection when we're not the owner. */
@@ -2131,26 +2130,6 @@ Disowning it means there is no such selection. */)
2131 return Qt; 2130 return Qt;
2132} 2131}
2133 2132
2134/* Get rid of all the selections in buffer BUFFER.
2135 This is used when we kill a buffer. */
2136
2137void
2138x_disown_buffer_selections (Lisp_Object buffer)
2139{
2140 Lisp_Object tail;
2141 struct buffer *buf = XBUFFER (buffer);
2142
2143 for (tail = Vselection_alist; CONSP (tail); tail = XCDR (tail))
2144 {
2145 Lisp_Object elt, value;
2146 elt = XCAR (tail);
2147 value = XCDR (elt);
2148 if (CONSP (value) && MARKERP (XCAR (value))
2149 && XMARKER (XCAR (value))->buffer == buf)
2150 Fx_disown_selection_internal (XCAR (elt), Qnil);
2151 }
2152}
2153
2154DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, 2133DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
2155 0, 1, 0, 2134 0, 1, 0,
2156 doc: /* Whether the current Emacs process owns the given X Selection. 2135 doc: /* Whether the current Emacs process owns the given X Selection.
@@ -2455,7 +2434,6 @@ x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, struct x_disp
2455 2434
2456 if (event->format == 32 && event->format < BITS_PER_LONG) 2435 if (event->format == 32 && event->format < BITS_PER_LONG)
2457 { 2436 {
2458 int i;
2459 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */ 2437 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
2460 idata[i] = (int) event->data.l[i]; 2438 idata[i] = (int) event->data.l[i];
2461 data = (unsigned char *) idata; 2439 data = (unsigned char *) idata;