annotate src/select-msw.c @ 736:c84a9844ed2c

[xemacs-hg @ 2002-01-28 08:23:28 by michaels] Refer to OONEWS instead of ONEWS.
author michaels
date Mon, 28 Jan 2002 08:23:28 +0000
parents 5fd7ba8b56e7
children 943eaba38521
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))
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 456
diff changeset
74 /* !!#### more mule bogosity */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 456
diff changeset
75 return RegisterClipboardFormat ((Extbyte *) XSTRING_DATA (value));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
76
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
77 /* Check for Windows clipboard format symbols */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
78 if (EQ (value, QCF_TEXT)) return CF_TEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
79 if (EQ (value, QCF_BITMAP)) return CF_BITMAP;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
80 if (EQ (value, QCF_METAFILEPICT)) return CF_METAFILEPICT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
81 if (EQ (value, QCF_SYLK)) return CF_SYLK;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
82 if (EQ (value, QCF_DIF)) return CF_DIF;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
83 if (EQ (value, QCF_TIFF)) return CF_TIFF;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
84 if (EQ (value, QCF_OEMTEXT)) return CF_OEMTEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
85 if (EQ (value, QCF_DIB)) return CF_DIB;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
86 #ifdef CF_DIBV5
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
87 if (EQ (value, QCF_DIBV5)) return CF_DIBV5;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
88 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
89 if (EQ (value, QCF_PALETTE)) return CF_PALETTE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
90 if (EQ (value, QCF_PENDATA)) return CF_PENDATA;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
91 if (EQ (value, QCF_RIFF)) return CF_RIFF;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
92 if (EQ (value, QCF_WAVE)) return CF_WAVE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
93 if (EQ (value, QCF_UNICODETEXT)) return CF_UNICODETEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
94 if (EQ (value, QCF_ENHMETAFILE)) return CF_ENHMETAFILE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
95 if (EQ (value, QCF_HDROP)) return CF_HDROP;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
96 if (EQ (value, QCF_LOCALE)) return CF_LOCALE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
97 if (EQ (value, QCF_OWNERDISPLAY)) return CF_OWNERDISPLAY;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
98 if (EQ (value, QCF_DSPTEXT)) return CF_DSPTEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
99 if (EQ (value, QCF_DSPBITMAP)) return CF_DSPBITMAP;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
100 if (EQ (value, QCF_DSPMETAFILEPICT)) return CF_DSPMETAFILEPICT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
101 if (EQ (value, QCF_DSPENHMETAFILE)) return CF_DSPENHMETAFILE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
102
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
103 return 0;
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
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
106 /* This converts an MS-Windows clipboard format to its corresponding
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
107 Lisp symbol, or a Lisp integer otherwise. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
108 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
109 ms_cf_to_symbol (UINT format)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
110 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
111 switch (format)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
112 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
113 case CF_TEXT: return QCF_TEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
114 case CF_BITMAP: return QCF_BITMAP;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
115 case CF_METAFILEPICT: return QCF_METAFILEPICT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
116 case CF_SYLK: return QCF_SYLK;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
117 case CF_DIF: return QCF_DIF;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
118 case CF_TIFF: return QCF_TIFF;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
119 case CF_OEMTEXT: return QCF_OEMTEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
120 case CF_DIB: return QCF_DIB;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
121 #ifdef CF_DIBV5
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
122 case CF_DIBV5: return QCF_DIBV5;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
123 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
124 case CF_PALETTE: return QCF_PALETTE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
125 case CF_PENDATA: return QCF_PENDATA;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
126 case CF_RIFF: return QCF_RIFF;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
127 case CF_WAVE: return QCF_WAVE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
128 case CF_UNICODETEXT: return QCF_UNICODETEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
129 case CF_ENHMETAFILE: return QCF_ENHMETAFILE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
130 case CF_HDROP: return QCF_HDROP;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
131 case CF_LOCALE: return QCF_LOCALE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
132 case CF_OWNERDISPLAY: return QCF_OWNERDISPLAY;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
133 case CF_DSPTEXT: return QCF_DSPTEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
134 case CF_DSPBITMAP: return QCF_DSPBITMAP;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
135 case CF_DSPMETAFILEPICT: return QCF_DSPMETAFILEPICT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
136 case CF_DSPENHMETAFILE: return QCF_DSPENHMETAFILE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
137 default: return make_int ((int) format);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
138 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
139 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
141 /* 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
142 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
143 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
144 static int
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
145 cf_is_autofreed (UINT format)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
146 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
147 switch (format)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
148 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
149 /* This list comes from the SDK documentation */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
150 case CF_DSPENHMETAFILE:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
151 case CF_DSPMETAFILEPICT:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
152 case CF_ENHMETAFILE:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
153 case CF_METAFILEPICT:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
154 case CF_BITMAP:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
155 case CF_DSPBITMAP:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
156 case CF_PALETTE:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
157 case CF_DIB:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
158 #ifdef CF_DIBV5
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
159 case CF_DIBV5:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
160 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
161 case CF_DSPTEXT:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
162 case CF_OEMTEXT:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
163 case CF_TEXT:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
164 case CF_UNICODETEXT:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
165 return TRUE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
166
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
167 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
168 return FALSE;
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
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
172 /* Do protocol to assert ourself as a selection owner.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
173
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
174 Under mswindows, we:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
175
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
176 * Only set the clipboard if (eq selection-name 'CLIPBOARD)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
177
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
178 * 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
179 (or CF_UNICODETEXT) remembering to perform LF -> CR-LF conversion.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
180
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
181 * Otherwise assume the data is formatted appropriately for the data type
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
182 that was passed.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
183
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
184 Then set the clipboard as necessary.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
185 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
186 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
187 mswindows_own_selection (Lisp_Object selection_name,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
188 Lisp_Object selection_value,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
189 Lisp_Object how_to_add,
456
e7ef97881643 Import from CVS: tag r21-2-43
cvs
parents: 442
diff changeset
190 Lisp_Object selection_type,
e7ef97881643 Import from CVS: tag r21-2-43
cvs
parents: 442
diff changeset
191 int owned_p /* Not used */)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
192 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
193 HGLOBAL hValue = NULL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
194 UINT cfType;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
195 int is_X_type = FALSE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
196 Lisp_Object cfObject;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
197 Lisp_Object data = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
198 int size;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
199 void *src, *dst;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
200 struct frame *f = NULL;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
202 /* 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
203 use the same selection model as X */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
204 if (!EQ (selection_name, QCLIPBOARD))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
205 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
206
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
207 /* 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
208 as appropriate */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
209 if (NILP (selection_type) || x_sym_p (selection_type))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
210 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
211 /* Should COMPOUND_TEXT map to CF_UNICODETEXT? */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
212 cfType = CF_TEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
213 cfObject = QCF_TEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
214 is_X_type = TRUE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
215 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
216 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
217 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
218 cfType = symbol_to_ms_cf (selection_type);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
219
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
220 /* Only continue if we can figure out a clipboard type */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
221 if (!cfType)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
222 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
223
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
224 cfObject = selection_type;
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
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
227 /* Convert things appropriately */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
228 data = select_convert_out (selection_name,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
229 cfObject,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
230 selection_value);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
232 if (NILP (data))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
233 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
234
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
235 if (CONSP (data))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
236 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
237 if (!EQ (XCAR (data), cfObject))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
238 cfType = symbol_to_ms_cf (XCAR (data));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
239
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
240 if (!cfType)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
241 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
242
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
243 data = XCDR (data);
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
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
246 /* We support opaque or string values, but we only mention string
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
247 values for now... */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
248 if (!OPAQUEP (data)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
249 && !STRINGP (data))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
250 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
251
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
252 /* Compute the data length */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
253 if (OPAQUEP (data))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
254 size = XOPAQUE_SIZE (data);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
255 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
256 size = XSTRING_LENGTH (data) + 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
257
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
258 /* Find the frame */
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
259 f = selected_frame ();
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
260
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
261 /* Open the clipboard */
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
262 if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
265 /* Allocate memory */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
266 hValue = GlobalAlloc (GMEM_DDESHARE | GMEM_MOVEABLE, size);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
267
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
268 if (!hValue)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 CloseClipboard ();
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
271
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
272 return Qnil;
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
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
275 /* Copy the data */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
276 if (OPAQUEP (data))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
277 src = XOPAQUE_DATA (data);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
278 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
279 src = XSTRING_DATA (data);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
280
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
281 dst = GlobalLock (hValue);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
282
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
283 if (!dst)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
284 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
285 GlobalFree (hValue);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
286 CloseClipboard ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
287
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
290
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
291 memcpy (dst, src, size);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
292
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
293 GlobalUnlock (hValue);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
294
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
295 /* Empty the clipboard if we're replacing everything */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
296 if (NILP (how_to_add) || EQ (how_to_add, Qreplace_all))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
298 if (!EmptyClipboard ())
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
300 CloseClipboard ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
301 GlobalFree (hValue);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
302
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
303 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
304 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
306
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
307 /* Append is currently handled in select.el; perhaps this should change,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
308 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
309
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
310 SetClipboardData (cfType, hValue);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
311
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
312 if (!cf_is_autofreed (cfType))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
313 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
314 Lisp_Object alist_elt = Qnil, rest;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
315 Lisp_Object cfType_int = make_int (cfType);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
316
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
317 /* 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
318 already. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
319 alist_elt = assq_no_quit (cfType_int, Vhandle_alist);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
320
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
321 /* Add an element to the alist */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
322 Vhandle_alist = Fcons (Fcons (cfType_int, make_opaque_ptr (hValue)),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
323 Vhandle_alist);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
324
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
325 if (!NILP (alist_elt))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
326 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
327 /* Free the original handle */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
328 GlobalFree ((HGLOBAL) get_opaque_ptr (XCDR (alist_elt)));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
329
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
330 /* Remove the original one (adding first makes life easier, because
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
331 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
332 for (rest = Vhandle_alist; !NILP (rest); rest = Fcdr (rest))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
333 if (EQ (cfType_int, Fcar (XCDR (rest))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
334 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
335 XCDR (rest) = Fcdr (XCDR (rest));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
336 break;
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 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
340
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 CloseClipboard ();
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
342
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
343 /* #### Should really return a time, though this is because of the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
344 X model (by the looks of things) */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
345 return Qnil;
428
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 static Lisp_Object
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
349 mswindows_available_selection_types (Lisp_Object selection_name)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
350 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
351 Lisp_Object types = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
352 UINT format = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
353 struct frame *f = NULL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
354
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
355 if (!EQ (selection_name, QCLIPBOARD))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
356 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
357
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
358 /* Find the frame */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
359 f = selected_frame ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
360
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
361 /* Open the clipboard */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
362 if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
363 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
364
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
365 /* #### ajh - Should there be an unwind-protect handler around this?
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
366 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
367 be safe) run out of memory and leave the clipboard open... */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
368
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
369 while ((format = EnumClipboardFormats (format)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
370 types = Fcons (ms_cf_to_symbol (format), types);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
371
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
372 /* Close it */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
373 CloseClipboard ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
374
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
375 return types;
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
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
378 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
379 mswindows_register_selection_data_type (Lisp_Object type_name)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
381 /* Type already checked in select.c */
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 456
diff changeset
382 /* !!#### more mule bogosity */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 456
diff changeset
383 const char *name = (char *) XSTRING_DATA (type_name);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
384 UINT format;
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 format = RegisterClipboardFormat (name);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
387
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
388 if (format)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
389 return make_int ((int) format);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
390 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
391 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
392 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
393
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
394 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
395 mswindows_selection_data_type_name (Lisp_Object type_id)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
396 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
397 UINT format;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
398 int numchars;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
399 char name_buf[128];
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
400
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
401 /* If it's an integer, convert to a symbol if appropriate */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
402 if (INTP (type_id))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
403 type_id = ms_cf_to_symbol (XINT (type_id));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
404
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
405 /* If this is a symbol, return it */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
406 if (SYMBOLP (type_id))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
407 return type_id;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
408
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
409 /* Find the format code */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
410 format = symbol_to_ms_cf (type_id);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
411
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
412 if (!format)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
413 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
414
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
415 /* Microsoft, stupid Microsoft */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
416 numchars = GetClipboardFormatName (format, name_buf, 128);
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 if (numchars)
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 Lisp_Object name;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
421
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
422 /* Do this properly - though we could support UNICODE (UCS-2) if
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
423 MULE could hack it. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
424 name = make_ext_string (name_buf, numchars,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
425 Fget_coding_system (Qraw_text));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
426
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
427 return name;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
428 }
428
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 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
433 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
434 mswindows_get_foreign_selection (Lisp_Object selection_symbol,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
435 Lisp_Object target_type)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
437 HGLOBAL hValue = NULL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
438 UINT cfType;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
439 Lisp_Object cfObject = Qnil, ret = Qnil, value = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
440 int is_X_type = FALSE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
441 int size;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
442 void *data;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
443 struct frame *f = NULL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
444 struct gcpro gcpro1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
445
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
446 /* 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
447 use the same selection model as X */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
448 if (!EQ (selection_symbol, QCLIPBOARD))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
449 return Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
451 /* 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
452 as appropriate */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
453 if (NILP (target_type) || x_sym_p (target_type))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
454 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
455 /* Should COMPOUND_TEXT map to CF_UNICODETEXT? */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
456 cfType = CF_TEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
457 cfObject = QCF_TEXT;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
458 is_X_type = TRUE;
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 else
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 cfType = symbol_to_ms_cf (target_type);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
463
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
464 /* Only continue if we can figure out a clipboard type */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
465 if (!cfType)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
466 return Qnil;
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 cfObject = ms_cf_to_symbol (cfType);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
469 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
470
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
471 /* Find the frame */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
472 f = selected_frame ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
473
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
474 /* Open the clipboard */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
475 if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
478 /* Read the clipboard */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
479 hValue = GetClipboardData (cfType);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
480
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
481 if (!hValue)
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 CloseClipboard ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
485 return Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
486 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
488 /* Find the data */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
489 size = GlobalSize (hValue);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
490 data = GlobalLock (hValue);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
492 if (!data)
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 CloseClipboard ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
495
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
496 return Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
499 /* Place it in a Lisp string */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
500 TO_INTERNAL_FORMAT (DATA, (data, size),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
501 LISP_STRING, ret,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
502 Qbinary);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
503
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
504 GlobalUnlock (data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 CloseClipboard ();
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 GCPRO1 (ret);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
509 /* 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
510 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
511 string contains the raw binary data. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
512 value = select_convert_in (selection_symbol,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
513 cfObject,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
514 ret);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
516 UNGCPRO;
430
a5df635868b2 Import from CVS: tag r21-2-23
cvs
parents: 428
diff changeset
517
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
518 if (NILP (value))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
519 return Fcons (cfObject, ret);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
520 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
521 return value;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 mswindows_disown_selection (Lisp_Object selection, Lisp_Object timeval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 if (EQ (selection, QCLIPBOARD))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
528 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
529 BOOL success = OpenClipboard (NULL);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
530 if (success)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
531 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
532 success = EmptyClipboard ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
533 /* Close it regardless of whether empty worked. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
534 if (!CloseClipboard ())
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
535 success = FALSE;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
536 }
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 /* #### return success ? Qt : Qnil; */
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 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
541
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
542 void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
543 mswindows_destroy_selection (Lisp_Object selection)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
544 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
545 /* Do nothing if this isn't for the clipboard. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
546 if (!EQ (selection, QCLIPBOARD))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
547 return;
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 /* Right. We need to delete everything in Vhandle_alist. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
550 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
551 LIST_LOOP_2 (elt, Vhandle_alist)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
552 GlobalFree ((HGLOBAL) get_opaque_ptr (XCDR (elt)));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
553 }
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 Vhandle_alist = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
556 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
557
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
558 static Lisp_Object
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
559 mswindows_selection_exists_p (Lisp_Object selection,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
560 Lisp_Object selection_type)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
561 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
562 /* 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
563 if (EQ (selection, QCLIPBOARD))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
564 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
565 if (NILP (selection_type))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
566 return CountClipboardFormats () ? Qt : Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
567 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
568 return IsClipboardFormatAvailable (symbol_to_ms_cf (selection_type))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
569 ? Qt : Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
570 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
571 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
572 return Qnil;
428
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
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 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 console_type_create_select_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 CONSOLE_HAS_METHOD (mswindows, own_selection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 CONSOLE_HAS_METHOD (mswindows, disown_selection);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
585 CONSOLE_HAS_METHOD (mswindows, selection_exists_p);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 CONSOLE_HAS_METHOD (mswindows, get_foreign_selection);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
587 CONSOLE_HAS_METHOD (mswindows, available_selection_types);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
588 CONSOLE_HAS_METHOD (mswindows, register_selection_data_type);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
589 CONSOLE_HAS_METHOD (mswindows, selection_data_type_name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 syms_of_select_mswindows (void)
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 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 vars_of_select_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
600 /* Initialise Vhandle_alist */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
601 Vhandle_alist = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 430
diff changeset
602 staticpro (&Vhandle_alist);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 }