comparison src/select-msw.c @ 414:da8ed4261e83 r21-2-15

Import from CVS: tag r21-2-15
author cvs
date Mon, 13 Aug 2007 11:21:38 +0200
parents 697ef44129c6
children ebe98a74bd68
comparison
equal deleted inserted replaced
413:901169e5ca31 414:da8ed4261e83
27 */ 27 */
28 28
29 29
30 #include <config.h> 30 #include <config.h>
31 #include "lisp.h" 31 #include "lisp.h"
32 #include "select.h"
32 33
33 #include "console-msw.h" 34 #include "console-msw.h"
34 35
35 DEFUN ("mswindows-set-clipboard", Fmswindows_set_clipboard, 1, 1, 0, /* 36 DEFUN ("mswindows-set-clipboard", Fmswindows_set_clipboard, 1, 1, 0, /*
36 Copy STRING to the mswindows clipboard. 37 Copy STRING to the mswindows clipboard.
90 GlobalFree (h); 91 GlobalFree (h);
91 92
92 return i ? Qt : Qnil; 93 return i ? Qt : Qnil;
93 } 94 }
94 95
96 /* Do protocol to assert ourself as a selection owner. Under mswindows
97 this is easy, we just set the clipboard. */
98 static Lisp_Object
99 mswindows_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
100 {
101 Lisp_Object converted_value = get_local_selection (selection_name, QSTRING);
102 if (!NILP (converted_value) &&
103 CONSP (converted_value) &&
104 EQ (XCAR (converted_value), QSTRING))
105 Fmswindows_set_clipboard (XCDR (converted_value));
106
107 return Qnil;
108 }
109
95 DEFUN ("mswindows-get-clipboard", Fmswindows_get_clipboard, 0, 0, 0, /* 110 DEFUN ("mswindows-get-clipboard", Fmswindows_get_clipboard, 0, 0, 0, /*
96 Return the contents of the mswindows clipboard. 111 Return the contents of the mswindows clipboard.
97 */ 112 */
98 ()) 113 ())
99 { 114 {
142 CloseClipboard (); 157 CloseClipboard ();
143 158
144 return ret; 159 return ret;
145 } 160 }
146 161
162 static Lisp_Object
163 mswindows_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type)
164 {
165 return Fmswindows_get_clipboard ();
166 }
167
147 DEFUN ("mswindows-selection-exists-p", Fmswindows_selection_exists_p, 0, 0, 0, /* 168 DEFUN ("mswindows-selection-exists-p", Fmswindows_selection_exists_p, 0, 0, 0, /*
148 Whether there is an MS-Windows selection. 169 Whether there is an MS-Windows selection.
149 */ 170 */
150 ()) 171 ())
151 { 172 {
156 Remove the current MS-Windows selection from the clipboard. 177 Remove the current MS-Windows selection from the clipboard.
157 */ 178 */
158 ()) 179 ())
159 { 180 {
160 return EmptyClipboard () ? Qt : Qnil; 181 return EmptyClipboard () ? Qt : Qnil;
182 }
183
184 static void
185 mswindows_disown_selection (Lisp_Object selection, Lisp_Object timeval)
186 {
187 Fmswindows_delete_selection ();
161 } 188 }
162 189
163 190
164 /************************************************************************/ 191 /************************************************************************/
165 /* initialization */ 192 /* initialization */
166 /************************************************************************/ 193 /************************************************************************/
167 194
168 void 195 void
196 console_type_create_select_mswindows (void)
197 {
198 CONSOLE_HAS_METHOD (mswindows, own_selection);
199 CONSOLE_HAS_METHOD (mswindows, disown_selection);
200 CONSOLE_HAS_METHOD (mswindows, get_foreign_selection);
201 }
202
203 void
169 syms_of_select_mswindows (void) 204 syms_of_select_mswindows (void)
170 { 205 {
171 DEFSUBR (Fmswindows_set_clipboard); 206 DEFSUBR (Fmswindows_set_clipboard);
172 DEFSUBR (Fmswindows_get_clipboard); 207 DEFSUBR (Fmswindows_get_clipboard);
173 DEFSUBR (Fmswindows_selection_exists_p); 208 DEFSUBR (Fmswindows_selection_exists_p);