X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/77ab81d0545e980c57c0a35510ade29a9e43b4cd..0dc8cf5002ba3f79bf840de5b83c0f4f2e4e6279:/src/w16select.c diff --git a/src/w16select.c b/src/w16select.c index 6882a8b7ed..2026de7421 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, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + +Copyright (C) 1996-1997, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -36,8 +36,8 @@ along with GNU Emacs. If not, see . */ #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" @@ -68,13 +68,6 @@ unsigned clipboard_compact (unsigned); Lisp_Object QCLIPBOARD, QPRIMARY; -/* Coding system for communicating with other Windows programs via the - clipboard. */ -static Lisp_Object Vselection_coding_system; - -/* Coding system for the next communicating with other Windows programs. */ -static Lisp_Object Vnext_selection_coding_system; - /* The segment address and the size of the buffer in low memory used to move data between us and WinOldAp module. */ static struct { @@ -117,11 +110,11 @@ identify_winoldap_version (void) <> 1700H: AL = Major version number AH = Minor version number */ regs.x.ax = 0x1700; - __dpmi_int(0x2f, ®s); + __dpmi_int (0x2f, ®s); return regs.x.ax; } -/* Open the clipboard, return non-zero if successfull. */ +/* Open the clipboard, return non-zero if successful. */ unsigned open_clipboard (void) { @@ -140,11 +133,11 @@ open_clipboard (void) Return Values AX == 0: Clipboard already open <> 0: Clipboard opened */ regs.x.ax = 0x1701; - __dpmi_int(0x2f, ®s); + __dpmi_int (0x2f, ®s); return regs.x.ax; } -/* Empty clipboard, return non-zero if successfull. */ +/* Empty clipboard, return non-zero if successful. */ unsigned empty_clipboard (void) { @@ -154,7 +147,7 @@ empty_clipboard (void) Return Values AX == 0: Error occurred <> 0: OK, Clipboard emptied */ regs.x.ax = 0x1702; - __dpmi_int(0x2f, ®s); + __dpmi_int (0x2f, ®s); return regs.x.ax; } @@ -214,7 +207,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) { @@ -301,7 +294,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) regs.x.cx = truelen & 0xffff; regs.x.es = xbuf_addr >> 4; regs.x.bx = xbuf_addr & 15; - __dpmi_int(0x2f, ®s); + __dpmi_int (0x2f, ®s); free_xfer_buf (); @@ -327,7 +320,7 @@ get_clipboard_data_size (unsigned Format) the clipboard. */ regs.x.ax = 0x1704; regs.x.dx = Format; - __dpmi_int(0x2f, ®s); + __dpmi_int (0x2f, ®s); return ( (((unsigned)regs.x.dx) << 16) | regs.x.ax); } @@ -360,7 +353,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) regs.x.dx = Format; regs.x.es = xbuf_addr >> 4; regs.x.bx = xbuf_addr & 15; - __dpmi_int(0x2f, ®s); + __dpmi_int (0x2f, ®s); if (regs.x.ax != 0) { unsigned char null_char = '\0'; @@ -412,7 +405,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) { @@ -422,7 +415,7 @@ close_clipboard (void) Return Values AX == 0: Error occurred <> 0: OK */ regs.x.ax = 0x1708; - __dpmi_int(0x2f, ®s); + __dpmi_int (0x2f, ®s); return regs.x.ax; } @@ -439,7 +432,7 @@ clipboard_compact (unsigned Size) regs.x.ax = 0x1709; regs.x.si = Size >> 16; regs.x.cx = Size & 0xffff; - __dpmi_int(0x2f, ®s); + __dpmi_int (0x2f, ®s); return ((unsigned)regs.x.dx << 16) | regs.x.ax; } @@ -500,7 +493,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; @@ -579,7 +572,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat 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 @@ -644,14 +637,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); @@ -692,7 +688,7 @@ syms_of_win16select (void) defsubr (&Sw16_get_clipboard_data); defsubr (&Sx_selection_exists_p); - DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, + DEFVAR_LISP ("selection-coding-system", Vselection_coding_system, doc: /* Coding system for communicating with other programs. For MS-Windows and MS-DOS: @@ -724,7 +720,7 @@ to control which data-type to request for receiving text. The default value is nil. */); Vselection_coding_system = intern ("iso-latin-1-dos"); - DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, + DEFVAR_LISP ("next-selection-coding-system", Vnext_selection_coding_system, doc: /* Coding system for the next communication with other programs. Usually, `selection-coding-system' is used for communicating with other programs (X Windows clients or MS Windows programs). But, if this @@ -737,4 +733,3 @@ After the communication, this variable is set to nil. */); } #endif /* MSDOS */ -