annotate src/select-msw.c @ 410:de805c49cfc1 r21-2-35

Import from CVS: tag r21-2-35
author cvs
date Mon, 13 Aug 2007 11:19:21 +0200
parents 2f8bb876ab1d
children 697ef44129c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
1 /* mswindows selection processing for XEmacs
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
2 Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
3
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
4 This file is part of XEmacs.
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
5
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
9 later version.
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
10
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
14 for more details.
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
15
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
20
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
21 /* Synched up with: Not synched with FSF. */
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
22
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
23 /* Authorship:
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
24
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
25 Written by Kevin Gallo for FSF Emacs.
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 249
diff changeset
26 Rewritten for mswindows by Jonathan Harris, December 1997 for 21.0.
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
27 Hacked by Alastair Houghton, July 2000 for enhanced clipboard support.
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
28 */
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
29
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
30 #include <config.h>
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
31 #include "lisp.h"
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
32 #include "frame.h"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
33 #include "select.h"
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
34 #include "opaque.h"
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
35 #include "file-coding.h"
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
36 #include "buffer.h"
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
37
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
38 #include "console-msw.h"
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
39
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
40 /* A list of handles that we must release. Not accessible from Lisp. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
41 static Lisp_Object Vhandle_alist;
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
42
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
43 /* Test if this is an X symbol that we understand */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
44 static int
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
45 x_sym_p (Lisp_Object value)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
46 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
47 if (NILP (value) || INTP (value))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
48 return 0;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
49
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
50 /* Check for some of the X symbols */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
51 if (EQ (value, QSTRING)) return 1;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
52 if (EQ (value, QTEXT)) return 1;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
53 if (EQ (value, QCOMPOUND_TEXT)) return 1;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
54
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
55 return 0;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
56 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
57
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
58 /* This converts a Lisp symbol to an MS-Windows clipboard format.
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
59 We have symbols for all predefined clipboard formats, but that
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
60 doesn't mean we support them all ;-)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
61 The name of this function is actually a lie - it also knows about
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
62 integers and strings... */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
63 static UINT
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
64 symbol_to_ms_cf (Lisp_Object value)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
65 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
66 /* If it's NIL, we're in trouble. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
67 if (NILP (value)) return 0;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
68
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
69 /* If it's an integer, assume it's a format ID */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
70 if (INTP (value)) return (UINT) (XINT (value));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
71
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
72 /* If it's a string, register the format(!) */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
73 if (STRINGP (value))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
74 return RegisterClipboardFormat (XSTRING_DATA (value));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
75
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
76 /* Check for Windows clipboard format symbols */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
77 if (EQ (value, QCF_TEXT)) return CF_TEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
78 if (EQ (value, QCF_BITMAP)) return CF_BITMAP;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
79 if (EQ (value, QCF_METAFILEPICT)) return CF_METAFILEPICT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
80 if (EQ (value, QCF_SYLK)) return CF_SYLK;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
81 if (EQ (value, QCF_DIF)) return CF_DIF;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
82 if (EQ (value, QCF_TIFF)) return CF_TIFF;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
83 if (EQ (value, QCF_OEMTEXT)) return CF_OEMTEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
84 if (EQ (value, QCF_DIB)) return CF_DIB;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
85 if (EQ (value, QCF_PALETTE)) return CF_PALETTE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
86 if (EQ (value, QCF_PENDATA)) return CF_PENDATA;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
87 if (EQ (value, QCF_RIFF)) return CF_RIFF;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
88 if (EQ (value, QCF_WAVE)) return CF_WAVE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
89 if (EQ (value, QCF_UNICODETEXT)) return CF_UNICODETEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
90 if (EQ (value, QCF_ENHMETAFILE)) return CF_ENHMETAFILE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
91 if (EQ (value, QCF_HDROP)) return CF_HDROP;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
92 if (EQ (value, QCF_LOCALE)) return CF_LOCALE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
93 if (EQ (value, QCF_OWNERDISPLAY)) return CF_OWNERDISPLAY;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
94 if (EQ (value, QCF_DSPTEXT)) return CF_DSPTEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
95 if (EQ (value, QCF_DSPBITMAP)) return CF_DSPBITMAP;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
96 if (EQ (value, QCF_DSPMETAFILEPICT)) return CF_DSPMETAFILEPICT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
97 if (EQ (value, QCF_DSPENHMETAFILE)) return CF_DSPENHMETAFILE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
98
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
99 return 0;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
100 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
101
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
102 /* This converts an MS-Windows clipboard format to its corresponding
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
103 Lisp symbol, or a Lisp integer otherwise. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
104 static Lisp_Object
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
105 ms_cf_to_symbol (UINT format)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
106 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
107 switch (format)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
108 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
109 case CF_TEXT: return QCF_TEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
110 case CF_BITMAP: return QCF_BITMAP;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
111 case CF_METAFILEPICT: return QCF_METAFILEPICT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
112 case CF_SYLK: return QCF_SYLK;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
113 case CF_DIF: return QCF_DIF;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
114 case CF_TIFF: return QCF_TIFF;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
115 case CF_OEMTEXT: return QCF_OEMTEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
116 case CF_DIB: return QCF_DIB;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
117 case CF_PALETTE: return QCF_PALETTE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
118 case CF_PENDATA: return QCF_PENDATA;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
119 case CF_RIFF: return QCF_RIFF;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
120 case CF_WAVE: return QCF_WAVE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
121 case CF_UNICODETEXT: return QCF_UNICODETEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
122 case CF_ENHMETAFILE: return QCF_ENHMETAFILE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
123 case CF_HDROP: return QCF_HDROP;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
124 case CF_LOCALE: return QCF_LOCALE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
125 case CF_OWNERDISPLAY: return QCF_OWNERDISPLAY;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
126 case CF_DSPTEXT: return QCF_DSPTEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
127 case CF_DSPBITMAP: return QCF_DSPBITMAP;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
128 case CF_DSPMETAFILEPICT: return QCF_DSPMETAFILEPICT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
129 case CF_DSPENHMETAFILE: return QCF_DSPENHMETAFILE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
130 default: return make_int ((int) format);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
131 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
132 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
133
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
134 /* Test if the specified clipboard format is auto-released by the OS. If
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
135 not, we must remember the handle on Vhandle_alist, and free it if
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
136 the clipboard is emptied or if we set data with the same format. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
137 static int
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
138 cf_is_autofreed (UINT format)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
139 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
140 switch (format)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
141 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
142 /* This list comes from the SDK documentation */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
143 case CF_DSPENHMETAFILE:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
144 case CF_DSPMETAFILEPICT:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
145 case CF_ENHMETAFILE:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
146 case CF_BITMAP:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
147 case CF_DSPBITMAP:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
148 case CF_PALETTE:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
149 case CF_DIB:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
150 case CF_DSPTEXT:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
151 case CF_OEMTEXT:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
152 case CF_TEXT:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
153 case CF_UNICODETEXT:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
154 return TRUE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
155
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
156 default:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
157 return FALSE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
158 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
159 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
160
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
161 /* Do protocol to assert ourself as a selection owner.
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
162
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
163 Under mswindows, we:
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
164
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
165 * Only set the clipboard if (eq selection-name 'CLIPBOARD)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
166
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
167 * Check if an X atom name has been passed. If so, convert to CF_TEXT
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
168 (or CF_UNICODETEXT) remembering to perform LF -> CR-LF conversion.
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
169
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
170 * Otherwise assume the data is formatted appropriately for the data type
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
171 that was passed.
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
172
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
173 Then set the clipboard as necessary.
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
174 */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
175 static Lisp_Object
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
176 mswindows_own_selection (Lisp_Object selection_name,
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
177 Lisp_Object selection_value,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
178 Lisp_Object how_to_add,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
179 Lisp_Object selection_type)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
180 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
181 HGLOBAL hValue = NULL;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
182 UINT cfType;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
183 int is_X_type = FALSE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
184 Lisp_Object cfObject;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
185 Lisp_Object data = Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
186 int size;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
187 void *src, *dst;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
188 struct frame *f = NULL;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
189
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
190 /* Only continue if we're trying to set the clipboard - mswindows doesn't
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
191 use the same selection model as X */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
192 if (!EQ (selection_name, QCLIPBOARD))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
193 return Qnil;
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
194
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
195 /* If this is one of the X-style atom name symbols, or NIL, convert it
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
196 as appropriate */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
197 if (NILP (selection_type) || x_sym_p (selection_type))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
198 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
199 /* Should COMPOUND_TEXT map to CF_UNICODETEXT? */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
200 cfType = CF_TEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
201 cfObject = QCF_TEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
202 is_X_type = TRUE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
203 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
204 else
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
205 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
206 cfType = symbol_to_ms_cf (selection_type);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
207
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
208 /* Only continue if we can figure out a clipboard type */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
209 if (!cfType)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
210 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
211
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
212 cfObject = selection_type;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
213 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
214
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
215 /* Convert things appropriately */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
216 data = select_convert_out (selection_name,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
217 cfObject,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
218 selection_value);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
219
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
220 if (NILP (data))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
221 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
222
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
223 if (CONSP (data))
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
224 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
225 if (!EQ (XCAR (data), cfObject))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
226 cfType = symbol_to_ms_cf (XCAR (data));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
227
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
228 if (!cfType)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
229 return Qnil;
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
230
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
231 data = XCDR (data);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
232 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
233
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
234 /* We support opaque or string values, but we only mention string
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
235 values for now... */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
236 if (!OPAQUEP (data)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
237 && !STRINGP (data))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
238 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
239
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
240 /* Compute the data length */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
241 if (OPAQUEP (data))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
242 size = XOPAQUE_SIZE (data);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
243 else
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
244 size = XSTRING_LENGTH (data) + 1;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
245
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
246 /* Find the frame */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
247 f = selected_frame ();
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
248
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
249 /* Open the clipboard */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
250 if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
251 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
252
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
253 /* Allocate memory */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
254 hValue = GlobalAlloc (GMEM_DDESHARE | GMEM_MOVEABLE, size);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
255
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
256 if (!hValue)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
257 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
258 CloseClipboard ();
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
259
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
260 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
261 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
262
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
263 /* Copy the data */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
264 if (OPAQUEP (data))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
265 src = XOPAQUE_DATA (data);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
266 else
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
267 src = XSTRING_DATA (data);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
268
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
269 dst = GlobalLock (hValue);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
270
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
271 if (!dst)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
272 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
273 GlobalFree (hValue);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
274 CloseClipboard ();
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
275
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
276 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
277 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
278
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
279 memcpy (dst, src, size);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
280
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
281 GlobalUnlock (hValue);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
282
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
283 /* Empty the clipboard if we're replacing everything */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
284 if (NILP (how_to_add) || EQ (how_to_add, Qreplace_all))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
285 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
286 if (!EmptyClipboard ())
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
287 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
288 CloseClipboard ();
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
289 GlobalFree (hValue);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
290
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
291 return Qnil;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
292 }
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
293 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
294
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
295 /* Append is currently handled in select.el; perhaps this should change,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
296 but it only really makes sense for ordinary text in any case... */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
297
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
298 SetClipboardData (cfType, hValue);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
299
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
300 if (!cf_is_autofreed (cfType))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
301 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
302 Lisp_Object alist_elt = Qnil, rest;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
303 Lisp_Object cfType_int = make_int (cfType);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
304
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
305 /* First check if there's an element in the alist for this type
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
306 already. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
307 alist_elt = assq_no_quit (cfType_int, Vhandle_alist);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
308
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
309 /* Add an element to the alist */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
310 Vhandle_alist = Fcons (Fcons (cfType_int, make_opaque_ptr (hValue)),
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
311 Vhandle_alist);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
312
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
313 if (!NILP (alist_elt))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
314 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
315 /* Free the original handle */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
316 GlobalFree ((HGLOBAL) get_opaque_ptr (XCDR (alist_elt)));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
317
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
318 /* Remove the original one (adding first makes life easier, because
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
319 we don't have to special case this being the first element) */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
320 for (rest = Vhandle_alist; !NILP (rest); rest = Fcdr (rest))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
321 if (EQ (cfType_int, Fcar (XCDR (rest))))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
322 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
323 XCDR (rest) = Fcdr (XCDR (rest));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
324 break;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
325 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
326 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
327 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
328
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
329 CloseClipboard ();
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
330
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
331 /* #### Should really return a time, though this is because of the
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
332 X model (by the looks of things) */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
333 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
334 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
335
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
336 static Lisp_Object
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
337 mswindows_available_selection_types (Lisp_Object selection_name)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
338 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
339 Lisp_Object types = Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
340 UINT format = 0;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
341 struct frame *f = NULL;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
342
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
343 if (!EQ (selection_name, QCLIPBOARD))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
344 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
345
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
346 /* Find the frame */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
347 f = selected_frame ();
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
348
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
349 /* Open the clipboard */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
350 if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
351 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
352
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
353 /* #### ajh - Should there be an unwind-protect handler around this?
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
354 It could (well it probably won't, but it's always better to
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
355 be safe) run out of memory and leave the clipboard open... */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
356
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
357 while ((format = EnumClipboardFormats (format)))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
358 types = Fcons (ms_cf_to_symbol (format), types);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
359
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
360 /* Close it */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
361 CloseClipboard ();
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
362
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
363 return types;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
364 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
365
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
366 static Lisp_Object
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
367 mswindows_register_selection_data_type (Lisp_Object type_name)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
368 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
369 /* Type already checked in select.c */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
370 const char *name = XSTRING_DATA (type_name);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
371 UINT format;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
372
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
373 format = RegisterClipboardFormat (name);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
374
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
375 if (format)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
376 return make_int ((int) format);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
377 else
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
378 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
379 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
380
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
381 static Lisp_Object
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
382 mswindows_selection_data_type_name (Lisp_Object type_id)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
383 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
384 UINT format;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
385 int numchars;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
386 char name_buf[128];
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
387
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
388 /* If it's an integer, convert to a symbol if appropriate */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
389 if (INTP (type_id))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
390 type_id = ms_cf_to_symbol (XINT (type_id));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
391
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
392 /* If this is a symbol, return it */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
393 if (SYMBOLP (type_id))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
394 return type_id;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
395
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
396 /* Find the format code */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
397 format = symbol_to_ms_cf (type_id);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
398
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
399 if (!format)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
400 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
401
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
402 /* Microsoft, stupid Microsoft */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
403 numchars = GetClipboardFormatName (format, name_buf, 128);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
404
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
405 if (numchars)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
406 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
407 Lisp_Object name;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
408
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
409 /* Do this properly - though we could support UNICODE (UCS-2) if
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
410 MULE could hack it. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
411 name = make_ext_string (name_buf, numchars,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
412 Fget_coding_system (Qraw_text));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
413
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
414 return name;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
415 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
416
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
417 return Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
418 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
419
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
420 static Lisp_Object
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
421 mswindows_get_foreign_selection (Lisp_Object selection_symbol,
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
422 Lisp_Object target_type)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
423 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
424 HGLOBAL hValue = NULL;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
425 UINT cfType;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
426 Lisp_Object cfObject = Qnil, ret = Qnil, value = Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
427 int is_X_type = FALSE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
428 int size;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
429 void *data;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
430 struct frame *f = NULL;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
431 struct gcpro gcpro1;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
432
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
433 /* Only continue if we're trying to read the clipboard - mswindows doesn't
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
434 use the same selection model as X */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
435 if (!EQ (selection_symbol, QCLIPBOARD))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
436 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
437
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
438 /* If this is one fo the X-style atom name symbols, or NIL, convert it
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
439 as appropriate */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
440 if (NILP (target_type) || x_sym_p (target_type))
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
441 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
442 /* Should COMPOUND_TEXT map to CF_UNICODETEXT? */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
443 cfType = CF_TEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
444 cfObject = QCF_TEXT;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
445 is_X_type = TRUE;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
446 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
447 else
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
448 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
449 cfType = symbol_to_ms_cf (target_type);
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
450
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
451 /* Only continue if we can figure out a clipboard type */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
452 if (!cfType)
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
453 return Qnil;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
454
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
455 cfObject = ms_cf_to_symbol (cfType);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
456 }
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
457
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
458 /* Find the frame */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
459 f = selected_frame ();
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
460
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
461 /* Open the clipboard */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
462 if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
463 return Qnil;
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
464
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
465 /* Read the clipboard */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
466 hValue = GetClipboardData (cfType);
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
467
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
468 if (!hValue)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
469 {
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
470 CloseClipboard ();
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
471
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
472 return Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
473 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
474
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
475 /* Find the data */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
476 size = GlobalSize (hValue);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
477 data = GlobalLock (hValue);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
478
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
479 if (!data)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
480 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
481 CloseClipboard ();
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
482
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
483 return Qnil;
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
484 }
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
485
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
486 /* Place it in a Lisp string */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
487 TO_INTERNAL_FORMAT (DATA, (data, size),
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
488 LISP_STRING, ret,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
489 Qbinary);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
490
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
491 GlobalUnlock (data);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
492 CloseClipboard ();
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
493
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
494 GCPRO1 (ret);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
495
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
496 /* Convert this to the appropriate type. If we can't find anything,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
497 then we return a cons of the form (DATA-TYPE . STRING), where the
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
498 string contains the raw binary data. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
499 value = select_convert_in (selection_symbol,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
500 cfObject,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
501 ret);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
502
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
503 UNGCPRO;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
504
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
505 if (NILP (value))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
506 return Fcons (cfObject, ret);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
507 else
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
508 return value;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
509 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
510
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
511 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
512 mswindows_disown_selection (Lisp_Object selection, Lisp_Object timeval)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
513 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
514 if (EQ (selection, QCLIPBOARD))
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
515 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
516 BOOL success = OpenClipboard (NULL);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
517 if (success)
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
518 {
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
519 success = EmptyClipboard ();
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
520 /* Close it regardless of whether empty worked. */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
521 if (!CloseClipboard ())
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
522 success = FALSE;
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
523 }
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
524
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
525 /* #### return success ? Qt : Qnil; */
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
526 }
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
527 }
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
528
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
529 void
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
530 mswindows_destroy_selection (Lisp_Object selection)
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
531 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
532 Lisp_Object alist_elt;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
533
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
534 /* Do nothing if this isn't for the clipboard. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
535 if (!EQ (selection, QCLIPBOARD))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
536 return;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
537
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
538 /* Right. We need to delete everything in Vhandle_alist. */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
539 alist_elt = Vhandle_alist;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
540
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
541 for (alist_elt; !NILP (alist_elt); alist_elt = Fcdr (alist_elt))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
542 GlobalFree ((HGLOBAL) get_opaque_ptr (XCDR (alist_elt)));
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
543
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
544 Vhandle_alist = Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
545 }
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
546
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
547 static Lisp_Object
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
548 mswindows_selection_exists_p (Lisp_Object selection,
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
549 Lisp_Object selection_type)
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
550 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
551 /* We used to be picky about the format, but now we support anything. */
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
552 if (EQ (selection, QCLIPBOARD))
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
553 {
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
554 if (NILP (selection_type))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
555 return CountClipboardFormats () ? Qt : Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
556 else
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
557 return IsClipboardFormatAvailable (symbol_to_ms_cf (selection_type))
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
558 ? Qt : Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
559 }
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
560 else
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
561 return Qnil;
286
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 278
diff changeset
562 }
57709be46d1b Import from CVS: tag r21-0b41
cvs
parents: 278
diff changeset
563
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
564
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
565 /************************************************************************/
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
566 /* initialization */
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
567 /************************************************************************/
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
568
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
569 void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
570 console_type_create_select_mswindows (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
571 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
572 CONSOLE_HAS_METHOD (mswindows, own_selection);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
573 CONSOLE_HAS_METHOD (mswindows, disown_selection);
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
574 CONSOLE_HAS_METHOD (mswindows, selection_exists_p);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
575 CONSOLE_HAS_METHOD (mswindows, get_foreign_selection);
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
576 CONSOLE_HAS_METHOD (mswindows, available_selection_types);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
577 CONSOLE_HAS_METHOD (mswindows, register_selection_data_type);
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
578 CONSOLE_HAS_METHOD (mswindows, selection_data_type_name);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
579 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
580
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 288
diff changeset
581 void
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
582 syms_of_select_mswindows (void)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
583 {
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
584 }
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
585
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
586 void
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
587 vars_of_select_mswindows (void)
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
588 {
410
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
589 /* Initialise Vhandle_alist */
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
590 Vhandle_alist = Qnil;
de805c49cfc1 Import from CVS: tag r21-2-35
cvs
parents: 404
diff changeset
591 staticpro (&Vhandle_alist);
221
6c0ae1f9357f Import from CVS: tag r20-4b9
cvs
parents:
diff changeset
592 }