aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-20 04:39:13 +0000
committerRichard M. Stallman1994-10-20 04:39:13 +0000
commit3834c318df27590426850ceaf1afab59be5ca2bf (patch)
tree3ca5ecc94bc51c7d5f69001d674534b4d5b20772 /src
parent9f6131cfa00eb9046a77a74d5fc3e2d8b24c2b9e (diff)
downloademacs-3834c318df27590426850ceaf1afab59be5ca2bf.tar.gz
emacs-3834c318df27590426850ceaf1afab59be5ca2bf.zip
(x_get_foreign_selection): Get display from
selected_frame. Pass frame to x_stop_queuing_selection_requests and x_start_queuing_selection_requests. (x_own_selection, Fx_disown_selection_internal, Fx_selection_exists_p) (Fx_store_cut_buffer_internal, Fx_get_cut_buffer_internal) (Fx_rotate_cut_buffers_internal): Get display from selected_frame.
Diffstat (limited to 'src')
-rw-r--r--src/xselect.c62
1 files changed, 39 insertions, 23 deletions
diff --git a/src/xselect.c b/src/xselect.c
index babd59a70ab..9b0eac1c3d0 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -236,8 +236,8 @@ static void
236x_own_selection (selection_name, selection_value) 236x_own_selection (selection_name, selection_value)
237 Lisp_Object selection_name, selection_value; 237 Lisp_Object selection_name, selection_value;
238{ 238{
239 Display *display = x_current_display;
240 Window selecting_window = FRAME_X_WINDOW (selected_frame); 239 Window selecting_window = FRAME_X_WINDOW (selected_frame);
240 Display *display = FRAME_X_DISPLAY (selected_frame);
241 Time time = last_event_timestamp; 241 Time time = last_event_timestamp;
242 Atom selection_atom; 242 Atom selection_atom;
243 243
@@ -245,10 +245,10 @@ x_own_selection (selection_name, selection_value)
245 selection_atom = symbol_to_x_atom (display, selection_name); 245 selection_atom = symbol_to_x_atom (display, selection_name);
246 246
247 BLOCK_INPUT; 247 BLOCK_INPUT;
248 x_catch_errors (); 248 x_catch_errors (selected_frame);
249 XSetSelectionOwner (display, selection_atom, selecting_window, time); 249 XSetSelectionOwner (display, selection_atom, selecting_window, time);
250 x_check_errors ("Can't set selection: %s"); 250 x_check_errors (selected_frame, "Can't set selection: %s");
251 x_uncatch_errors (); 251 x_uncatch_errors (selected_frame);
252 UNBLOCK_INPUT; 252 UNBLOCK_INPUT;
253 253
254 /* Now update the local cache */ 254 /* Now update the local cache */
@@ -1029,8 +1029,8 @@ static Lisp_Object
1029x_get_foreign_selection (selection_symbol, target_type) 1029x_get_foreign_selection (selection_symbol, target_type)
1030 Lisp_Object selection_symbol, target_type; 1030 Lisp_Object selection_symbol, target_type;
1031{ 1031{
1032 Display *display = x_current_display;
1033 Window requestor_window = FRAME_X_WINDOW (selected_frame); 1032 Window requestor_window = FRAME_X_WINDOW (selected_frame);
1033 Display *display = FRAME_X_DISPLAY (selected_frame);
1034 Time requestor_time = last_event_timestamp; 1034 Time requestor_time = last_event_timestamp;
1035 Atom target_property = Xatom_EMACS_TMP; 1035 Atom target_property = Xatom_EMACS_TMP;
1036 Atom selection_atom = symbol_to_x_atom (display, selection_symbol); 1036 Atom selection_atom = symbol_to_x_atom (display, selection_symbol);
@@ -1043,7 +1043,7 @@ x_get_foreign_selection (selection_symbol, target_type)
1043 type_atom = symbol_to_x_atom (display, target_type); 1043 type_atom = symbol_to_x_atom (display, target_type);
1044 1044
1045 BLOCK_INPUT; 1045 BLOCK_INPUT;
1046 x_catch_errors (); 1046 x_catch_errors (selected_frame);
1047 XConvertSelection (display, selection_atom, type_atom, target_property, 1047 XConvertSelection (display, selection_atom, type_atom, target_property,
1048 requestor_window, requestor_time); 1048 requestor_window, requestor_time);
1049 XFlushQueue (); 1049 XFlushQueue ();
@@ -1052,7 +1052,7 @@ x_get_foreign_selection (selection_symbol, target_type)
1052 reading_selection_window = requestor_window; 1052 reading_selection_window = requestor_window;
1053 reading_which_selection = selection_atom; 1053 reading_which_selection = selection_atom;
1054 XCONS (reading_selection_reply)->car = Qnil; 1054 XCONS (reading_selection_reply)->car = Qnil;
1055 x_start_queuing_selection_requests (); 1055 x_start_queuing_selection_requests (selected_frame);
1056 UNBLOCK_INPUT; 1056 UNBLOCK_INPUT;
1057 1057
1058 /* This allows quits. Also, don't wait forever. */ 1058 /* This allows quits. Also, don't wait forever. */
@@ -1061,9 +1061,9 @@ x_get_foreign_selection (selection_symbol, target_type)
1061 wait_reading_process_input (secs, usecs, reading_selection_reply, 0); 1061 wait_reading_process_input (secs, usecs, reading_selection_reply, 0);
1062 1062
1063 BLOCK_INPUT; 1063 BLOCK_INPUT;
1064 x_check_errors ("Cannot get selection: %s"); 1064 x_check_errors (selected_frame, "Cannot get selection: %s");
1065 x_uncatch_errors (); 1065 x_uncatch_errors (selected_frame);
1066 x_stop_queuing_selection_requests (); 1066 x_stop_queuing_selection_requests (selected_frame);
1067 UNBLOCK_INPUT; 1067 UNBLOCK_INPUT;
1068 1068
1069 if (NILP (XCONS (reading_selection_reply)->car)) 1069 if (NILP (XCONS (reading_selection_reply)->car))
@@ -1706,12 +1706,13 @@ Disowning it means there is no such selection.")
1706 Lisp_Object selection; 1706 Lisp_Object selection;
1707 Lisp_Object time; 1707 Lisp_Object time;
1708{ 1708{
1709 Display *display = x_current_display;
1710 Time timestamp; 1709 Time timestamp;
1711 Atom selection_atom; 1710 Atom selection_atom;
1712 XSelectionClearEvent event; 1711 XSelectionClearEvent event;
1712 Display *display;
1713 1713
1714 check_x (); 1714 check_x ();
1715 display = FRAME_X_DISPLAY (selected_frame);
1715 CHECK_SYMBOL (selection, 0); 1716 CHECK_SYMBOL (selection, 0);
1716 if (NILP (time)) 1717 if (NILP (time))
1717 timestamp = last_event_timestamp; 1718 timestamp = last_event_timestamp;
@@ -1795,8 +1796,10 @@ and t is the same as `SECONDARY'.)")
1795{ 1796{
1796 Window owner; 1797 Window owner;
1797 Atom atom; 1798 Atom atom;
1798 Display *dpy = x_current_display; 1799 Display *dpy;
1800
1799 check_x (); 1801 check_x ();
1802 dpy = FRAME_X_DISPLAY (selected_frame);
1800 CHECK_SYMBOL (selection, 0); 1803 CHECK_SYMBOL (selection, 0);
1801 if (!NILP (Fx_selection_owner_p (selection))) 1804 if (!NILP (Fx_selection_owner_p (selection)))
1802 return Qt; 1805 return Qt;
@@ -1857,8 +1860,7 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
1857 (buffer) 1860 (buffer)
1858 Lisp_Object buffer; 1861 Lisp_Object buffer;
1859{ 1862{
1860 Display *display = x_current_display; 1863 Window window;
1861 Window window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
1862 Atom buffer_atom; 1864 Atom buffer_atom;
1863 unsigned char *data; 1865 unsigned char *data;
1864 int bytes; 1866 int bytes;
@@ -1866,8 +1868,11 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
1866 int format; 1868 int format;
1867 unsigned long size; 1869 unsigned long size;
1868 Lisp_Object ret; 1870 Lisp_Object ret;
1871 Display *display;
1869 1872
1870 check_x (); 1873 check_x ();
1874 display = FRAME_X_DISPLAY (selected_frame);
1875 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
1871 CHECK_CUT_BUFFER (buffer, 0); 1876 CHECK_CUT_BUFFER (buffer, 0);
1872 buffer_atom = symbol_to_x_atom (display, buffer); 1877 buffer_atom = symbol_to_x_atom (display, buffer);
1873 1878
@@ -1893,16 +1898,22 @@ DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal,
1893 (buffer, string) 1898 (buffer, string)
1894 Lisp_Object buffer, string; 1899 Lisp_Object buffer, string;
1895{ 1900{
1896 Display *display = x_current_display; 1901 Window window;
1897 Window window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
1898 Atom buffer_atom; 1902 Atom buffer_atom;
1899 unsigned char *data; 1903 unsigned char *data;
1900 int bytes; 1904 int bytes;
1901 int bytes_remaining; 1905 int bytes_remaining;
1902 int max_bytes = SELECTION_QUANTUM (display); 1906 int max_bytes;
1903 if (max_bytes > MAX_SELECTION_QUANTUM) max_bytes = MAX_SELECTION_QUANTUM; 1907 Display *display;
1904 1908
1905 check_x (); 1909 check_x ();
1910 display = FRAME_X_DISPLAY (selected_frame);
1911 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
1912
1913 max_bytes = SELECTION_QUANTUM (display);
1914 if (max_bytes > MAX_SELECTION_QUANTUM)
1915 max_bytes = MAX_SELECTION_QUANTUM;
1916
1906 CHECK_CUT_BUFFER (buffer, 0); 1917 CHECK_CUT_BUFFER (buffer, 0);
1907 CHECK_STRING (string, 0); 1918 CHECK_STRING (string, 0);
1908 buffer_atom = symbol_to_x_atom (display, buffer); 1919 buffer_atom = symbol_to_x_atom (display, buffer);
@@ -1943,14 +1954,19 @@ positive means move values forward, negative means backward.")
1943 (n) 1954 (n)
1944 Lisp_Object n; 1955 Lisp_Object n;
1945{ 1956{
1946 Display *display = x_current_display; 1957 Window window;
1947 Window window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ 1958 Atom props[8];
1948 Atom props [8]; 1959 Display *display;
1949 1960
1950 check_x (); 1961 check_x ();
1962 display = FRAME_X_DISPLAY (selected_frame);
1963 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
1951 CHECK_NUMBER (n, 0); 1964 CHECK_NUMBER (n, 0);
1952 if (XINT (n) == 0) return n; 1965 if (XINT (n) == 0)
1953 if (! cut_buffers_initialized) initialize_cut_buffers (display, window); 1966 return n;
1967 if (! cut_buffers_initialized)
1968 initialize_cut_buffers (display, window);
1969
1954 props[0] = XA_CUT_BUFFER0; 1970 props[0] = XA_CUT_BUFFER0;
1955 props[1] = XA_CUT_BUFFER1; 1971 props[1] = XA_CUT_BUFFER1;
1956 props[2] = XA_CUT_BUFFER2; 1972 props[2] = XA_CUT_BUFFER2;