aboutsummaryrefslogtreecommitdiffstats
path: root/src/xselect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xselect.c')
-rw-r--r--src/xselect.c54
1 files changed, 43 insertions, 11 deletions
diff --git a/src/xselect.c b/src/xselect.c
index 3fe109a5b85..cb00903c41e 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -398,12 +398,19 @@ x_own_selection (selection_name, selection_value)
398 Lisp_Object selection_name, selection_value; 398 Lisp_Object selection_name, selection_value;
399{ 399{
400 struct frame *sf = SELECTED_FRAME (); 400 struct frame *sf = SELECTED_FRAME ();
401 Window selecting_window = FRAME_X_WINDOW (sf); 401 Window selecting_window;
402 Display *display = FRAME_X_DISPLAY (sf); 402 Display *display;
403 Time time = last_event_timestamp; 403 Time time = last_event_timestamp;
404 Atom selection_atom; 404 Atom selection_atom;
405 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf); 405 struct x_display_info *dpyinfo;
406
407 if (! FRAME_X_P (sf))
408 return;
406 409
410 selecting_window = FRAME_X_WINDOW (sf);
411 display = FRAME_X_DISPLAY (sf);
412 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
413
407 CHECK_SYMBOL (selection_name); 414 CHECK_SYMBOL (selection_name);
408 selection_atom = symbol_to_x_atom (dpyinfo, display, selection_name); 415 selection_atom = symbol_to_x_atom (dpyinfo, display, selection_name);
409 416
@@ -671,7 +678,8 @@ some_frame_on_display (dpyinfo)
671 678
672 FOR_EACH_FRAME (list, frame) 679 FOR_EACH_FRAME (list, frame)
673 { 680 {
674 if (FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo) 681 if (FRAME_X_P (XFRAME (frame))
682 && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
675 return frame; 683 return frame;
676 } 684 }
677 685
@@ -1021,7 +1029,7 @@ x_handle_selection_clear (event)
1021 to see if this Emacs job now owns the selection 1029 to see if this Emacs job now owns the selection
1022 through that display. */ 1030 through that display. */
1023 for (t_dpyinfo = x_display_list; t_dpyinfo; t_dpyinfo = t_dpyinfo->next) 1031 for (t_dpyinfo = x_display_list; t_dpyinfo; t_dpyinfo = t_dpyinfo->next)
1024 if (t_dpyinfo->kboard == dpyinfo->kboard) 1032 if (t_dpyinfo->terminal->kboard == dpyinfo->terminal->kboard)
1025 { 1033 {
1026 Window owner_window 1034 Window owner_window
1027 = XGetSelectionOwner (t_dpyinfo->display, selection); 1035 = XGetSelectionOwner (t_dpyinfo->display, selection);
@@ -1380,17 +1388,26 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
1380 Lisp_Object selection_symbol, target_type, time_stamp; 1388 Lisp_Object selection_symbol, target_type, time_stamp;
1381{ 1389{
1382 struct frame *sf = SELECTED_FRAME (); 1390 struct frame *sf = SELECTED_FRAME ();
1383 Window requestor_window = FRAME_X_WINDOW (sf); 1391 Window requestor_window;
1384 Display *display = FRAME_X_DISPLAY (sf); 1392 Display *display;
1385 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf); 1393 struct x_display_info *dpyinfo;
1386 Time requestor_time = last_event_timestamp; 1394 Time requestor_time = last_event_timestamp;
1387 Atom target_property = dpyinfo->Xatom_EMACS_TMP; 1395 Atom target_property;
1388 Atom selection_atom = symbol_to_x_atom (dpyinfo, display, selection_symbol); 1396 Atom selection_atom;
1389 Atom type_atom; 1397 Atom type_atom;
1390 int secs, usecs; 1398 int secs, usecs;
1391 int count = SPECPDL_INDEX (); 1399 int count = SPECPDL_INDEX ();
1392 Lisp_Object frame; 1400 Lisp_Object frame;
1393 1401
1402 if (! FRAME_X_P (sf))
1403 return Qnil;
1404
1405 requestor_window = FRAME_X_WINDOW (sf);
1406 display = FRAME_X_DISPLAY (sf);
1407 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
1408 target_property = dpyinfo->Xatom_EMACS_TMP;
1409 selection_atom = symbol_to_x_atom (dpyinfo, display, selection_symbol);
1410
1394 if (CONSP (target_type)) 1411 if (CONSP (target_type))
1395 type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type)); 1412 type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type));
1396 else 1413 else
@@ -2206,6 +2223,9 @@ Disowning it means there is no such selection. */)
2206 struct frame *sf = SELECTED_FRAME (); 2223 struct frame *sf = SELECTED_FRAME ();
2207 2224
2208 check_x (); 2225 check_x ();
2226 if (! FRAME_X_P (sf))
2227 return Qnil;
2228
2209 display = FRAME_X_DISPLAY (sf); 2229 display = FRAME_X_DISPLAY (sf);
2210 dpyinfo = FRAME_X_DISPLAY_INFO (sf); 2230 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
2211 CHECK_SYMBOL (selection); 2231 CHECK_SYMBOL (selection);
@@ -2367,6 +2387,10 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
2367 struct frame *sf = SELECTED_FRAME (); 2387 struct frame *sf = SELECTED_FRAME ();
2368 2388
2369 check_x (); 2389 check_x ();
2390
2391 if (! FRAME_X_P (sf))
2392 return Qnil;
2393
2370 display = FRAME_X_DISPLAY (sf); 2394 display = FRAME_X_DISPLAY (sf);
2371 dpyinfo = FRAME_X_DISPLAY_INFO (sf); 2395 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
2372 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ 2396 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
@@ -2407,6 +2431,10 @@ DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal,
2407 struct frame *sf = SELECTED_FRAME (); 2431 struct frame *sf = SELECTED_FRAME ();
2408 2432
2409 check_x (); 2433 check_x ();
2434
2435 if (! FRAME_X_P (sf))
2436 return Qnil;
2437
2410 display = FRAME_X_DISPLAY (sf); 2438 display = FRAME_X_DISPLAY (sf);
2411 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ 2439 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
2412 2440
@@ -2463,8 +2491,12 @@ Positive means shift the values forward, negative means backward. */)
2463 Atom props[8]; 2491 Atom props[8];
2464 Display *display; 2492 Display *display;
2465 struct frame *sf = SELECTED_FRAME (); 2493 struct frame *sf = SELECTED_FRAME ();
2466 2494
2467 check_x (); 2495 check_x ();
2496
2497 if (! FRAME_X_P (sf))
2498 return Qnil;
2499
2468 display = FRAME_X_DISPLAY (sf); 2500 display = FRAME_X_DISPLAY (sf);
2469 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */ 2501 window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
2470 CHECK_NUMBER (n); 2502 CHECK_NUMBER (n);