annotate src/select-msw.c @ 456:e7ef97881643 r21-2-43

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