X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a64bfdfa5a90731b804c057f2bcc74a8ba02937c..881aae56532c30d56d2f5eb021a11cc9c980b261:/src/w16select.c diff --git a/src/w16select.c b/src/w16select.c index cae7a6f82d..1e4d35b721 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -1,6 +1,6 @@ /* 16-bit Windows Selection processing for emacs on MS-Windows -Copyright (C) 1996-1997, 2001-2011 Free Software Foundation, Inc. +Copyright (C) 1996-1997, 2001-2014 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -31,13 +31,12 @@ along with GNU Emacs. If not, see . */ #include #include #include -#include #include "lisp.h" #include "dispextern.h" /* frame.h seems to want this */ #include "frame.h" /* Need this to get the X window of selected_frame */ #include "blockinput.h" -#include "buffer.h" #include "character.h" +#include "buffer.h" #include "coding.h" #include "composite.h" @@ -114,7 +113,7 @@ identify_winoldap_version (void) return regs.x.ax; } -/* Open the clipboard, return non-zero if successfull. */ +/* Open the clipboard, return non-zero if successful. */ unsigned open_clipboard (void) { @@ -137,7 +136,7 @@ open_clipboard (void) return regs.x.ax; } -/* Empty clipboard, return non-zero if successfull. */ +/* Empty clipboard, return non-zero if successful. */ unsigned empty_clipboard (void) { @@ -207,7 +206,7 @@ free_xfer_buf (void) } } -/* Copy data into the clipboard, return zero if successfull. */ +/* Copy data into the clipboard, return zero if successful. */ unsigned set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) { @@ -405,7 +404,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) return (unsigned) (dp - (unsigned char *)Data - 1); } -/* Close clipboard, return non-zero if successfull. */ +/* Close clipboard, return non-zero if successful. */ unsigned close_clipboard (void) { @@ -453,14 +452,10 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat CHECK_STRING (string); - if (NILP (frame)) - frame = Fselected_frame (); - - CHECK_LIVE_FRAME (frame); - if ( !FRAME_MSDOS_P (XFRAME (frame))) + if (!FRAME_MSDOS_P (decode_live_frame (frame))) goto done; - BLOCK_INPUT; + block_input (); if (!open_clipboard ()) goto error; @@ -493,7 +488,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat setup_coding_system (Fcheck_coding_system (coding_system), &coding); coding.dst_bytes = nbytes * 4; - coding.destination = (unsigned char *) xmalloc (coding.dst_bytes); + coding.destination = xmalloc (coding.dst_bytes); Vnext_selection_coding_system = Qnil; coding.mode |= CODING_MODE_LAST_BLOCK; dst = coding.destination; @@ -521,7 +516,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat unblock: xfree (dst); - UNBLOCK_INPUT; + unblock_input (); /* Notify user if the text is too large to fit into DOS memory. (This will happen somewhere after 600K bytes (470K in DJGPP v1.x), @@ -533,13 +528,13 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat switch (put_status) { case 1: - message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0); + message3 (make_unibyte_string (no_mem_msg, sizeof (no_mem_msg) - 1)); break; case 2: - message2 (binary_msg, sizeof (binary_msg) - 1, 0); + message3 (make_unibyte_string (binary_msg, sizeof (binary_msg) - 1)); break; case 3: - message2 (system_error_msg, sizeof (system_error_msg) - 1, 0); + message3 (make_unibyte_string (system_error_msg, sizeof (system_error_msg) - 1)); break; } sit_for (make_number (2), 0, 2); @@ -559,20 +554,16 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat Lisp_Object ret = Qnil; int require_decoding = 0; - if (NILP (frame)) - frame = Fselected_frame (); - - CHECK_LIVE_FRAME (frame); - if ( !FRAME_MSDOS_P (XFRAME (frame))) + if (!FRAME_MSDOS_P (decode_live_frame (frame))) goto done; - BLOCK_INPUT; + block_input (); if (!open_clipboard ()) goto unblock; if ((data_size = get_clipboard_data_size (CF_OEMTEXT)) == 0 || - (htext = (unsigned char *)xmalloc (data_size)) == 0) + (htext = xmalloc (data_size)) == 0) goto closeclip; /* need to know final size after '\r' chars are removed because @@ -627,7 +618,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat close_clipboard (); unblock: - UNBLOCK_INPUT; + unblock_input (); done: @@ -637,14 +628,17 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat /* Support checking for a clipboard selection. */ DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, - 0, 1, 0, - doc: /* Whether there is an owner for the given X Selection. -The arg should be the name of the selection in question, typically one of -the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. -\(Those are literal upper-case symbol names, since that's what X expects.) -For convenience, the symbol nil is the same as `PRIMARY', -and t is the same as `SECONDARY'. */) - (Lisp_Object selection) + 0, 2, 0, + doc: /* Whether there is an owner for the given X selection. +SELECTION should be the name of the selection in question, typically +one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects +these literal upper-case names.) The symbol nil is the same as +`PRIMARY', and t is the same as `SECONDARY'. + +TERMINAL should be a terminal object or a frame specifying the X +server to query. If omitted or nil, that stands for the selected +frame's display, or the first available X display. */) + (Lisp_Object selection, Lisp_Object terminal) { CHECK_SYMBOL (selection); @@ -730,4 +724,3 @@ After the communication, this variable is set to nil. */); } #endif /* MSDOS */ -