annotate src/device-msw.c @ 296:5a79be0ef6a8 r21-0b46

Import from CVS: tag r21-0b46
author cvs
date Mon, 13 Aug 2007 10:38:46 +0200
parents 4b85ae5eabfb
children afd57c14dfc8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
296
5a79be0ef6a8 Import from CVS: tag r21-0b46
cvs
parents: 294
diff changeset
1 /* device functions for mswindows.
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
4
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
5 This file is part of XEmacs.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
6
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
10 later version.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
11
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
15 for more details.
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
16
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
21
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
23
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
24 /* Authorship:
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
25
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
26 Original authors: Jamie Zawinski and the FSF
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
27 Rewritten by Ben Wing and Chuck Thompson.
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
28 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0.
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
29 */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
30
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
31
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
32 #include <config.h>
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
33 #include "lisp.h"
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
34
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
35 #include "console-msw.h"
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
36 #include "console-stream.h"
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
37 #include "events.h"
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
38 #include "faces.h"
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
39 #include "frame.h"
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
40 #include "sysdep.h"
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
41
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
42 #ifndef __CYGWIN32__
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
43 #include <commctrl.h>
296
5a79be0ef6a8 Import from CVS: tag r21-0b46
cvs
parents: 294
diff changeset
44 #else
5a79be0ef6a8 Import from CVS: tag r21-0b46
cvs
parents: 294
diff changeset
45 #define FONTENUMPROC FONTENUMEXPROC
5a79be0ef6a8 Import from CVS: tag r21-0b46
cvs
parents: 294
diff changeset
46 #define ntmTm ntmentm
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
47 #endif
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
48
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
49 /* win32 DDE management library globals */
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
50 #ifdef HAVE_DRAGNDROP
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
51 DWORD mswindows_dde_mlid;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
52 HSZ mswindows_dde_service;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
53 HSZ mswindows_dde_topic_system;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
54 HSZ mswindows_dde_item_open;
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
55 #endif
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
56
263
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
57 /* Control conversion of upper case file names to lower case.
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
58 nil means no, t means yes. */
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
59 Lisp_Object Vmswindows_downcase_file_names;
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
60
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
61 /* Control whether stat() attempts to determine file type and link count
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
62 exactly, at the expense of slower operation. Since true hard links
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
63 are supported on NTFS volumes, this is only relevant on NT. */
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
64 Lisp_Object Vmswindows_get_true_file_attributes;
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
65
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
66 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
67
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
68 struct font_enum_t
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
69 {
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
70 HDC hdc;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
71 struct device *d;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
72 };
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
73
296
5a79be0ef6a8 Import from CVS: tag r21-0b46
cvs
parents: 294
diff changeset
74
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
75 /************************************************************************/
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
76 /* helpers */
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
77 /************************************************************************/
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
78
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
79 static int CALLBACK
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
80 font_enum_callback_2 (ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
81 int FontType, struct font_enum_t *font_enum)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
82 {
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
83 struct mswindows_font_enum *fontlist, **fonthead;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
84 char fontname[MSW_FONTSIZE];
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
85
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
86 /* The enumerated font weights are not to be trusted because:
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
87 * a) lpelfe->elfStyle is only filled in for TrueType fonts.
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
88 * b) Not all Bold and Italic styles of all fonts (inluding some Vector,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
89 * Truetype and Raster fonts) are enumerated.
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
90 * I guess that fonts for which Bold and Italic styles are generated
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
91 * 'on-the-fly' are not enumerated. It would be overly restrictive to
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
92 * disallow Bold And Italic weights for these fonts, so we just leave
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
93 * weights unspecified. This means that we have to weed out duplicates of
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
94 * those fonts that do get enumerated with different weights. */
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
95
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
96 if (FontType == 0 /*vector*/ || FontType == TRUETYPE_FONTTYPE)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
97 /* Scalable, so leave pointsize blank */
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
98 sprintf (fontname, "%s::::%s", lpelfe->elfLogFont.lfFaceName,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
99 lpelfe->elfScript);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
100 else
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
101 /* Formula for pointsize->height from LOGFONT docs in Platform SDK */
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
102 sprintf (fontname, "%s::%d::%s", lpelfe->elfLogFont.lfFaceName,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
103 MulDiv (lpntme->ntmTm.tmHeight - lpntme->ntmTm.tmInternalLeading,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
104 72, DEVICE_MSWINDOWS_LOGPIXELSY (font_enum->d)),
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
105 lpelfe->elfScript);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
106
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
107 fonthead = &DEVICE_MSWINDOWS_FONTLIST (font_enum->d);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
108 fontlist = *fonthead;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
109 while (fontlist)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
110 if (!strcmp (fontname, fontlist->fontname))
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
111 return 1; /* found a duplicate */
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
112 else
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
113 fontlist = fontlist->next;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
114
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
115 /* Insert entry at head */
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
116 fontlist = *fonthead;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
117 *fonthead = xmalloc (sizeof (struct mswindows_font_enum));
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
118 if (*fonthead == NULL)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
119 {
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
120 *fonthead = fontlist;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
121 return 0;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
122 }
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
123 strcpy ((*fonthead)->fontname, fontname);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
124 (*fonthead)->next = fontlist;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
125 return 1;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
126 }
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
127
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
128 static int CALLBACK
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
129 font_enum_callback_1 (ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
130 int FontType, struct font_enum_t *font_enum)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
131 {
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
132 /* This function gets called once per facename per character set.
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
133 * We call a second callback to enumerate the fonts in each facename */
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
134 return EnumFontFamiliesEx (font_enum->hdc, &lpelfe->elfLogFont,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
135 (FONTENUMPROC) font_enum_callback_2,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
136 (LPARAM) font_enum, 0);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
137 }
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
138
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
139 static Lisp_Object
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
140 build_syscolor_string (int index)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
141 {
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
142 DWORD clr;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
143 char buf[16];
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
144
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
145 if (index < 0)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
146 return Qnil;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
147
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
148 clr = GetSysColor (index);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
149 sprintf (buf, "#%02X%02X%02X",
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
150 GetRValue (clr),
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
151 GetGValue (clr),
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
152 GetBValue (clr));
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
153 return build_string (buf);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
154 }
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
155
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
156 static Lisp_Object
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
157 build_syscolor_cons (int index1, int index2)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
158 {
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
159 Lisp_Object color1, color2;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
160 struct gcpro gcpro1;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
161 GCPRO1 (color1);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
162 color1 = build_syscolor_string (index1);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
163 color2 = build_syscolor_string (index2);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
164 RETURN_UNGCPRO (Fcons (color1, color2));
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
165 }
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
166
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
167 static Lisp_Object
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
168 build_sysmetrics_cons (int index1, int index2)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
169 {
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
170 return Fcons (index1 < 0 ? Qnil : make_int (GetSystemMetrics (index1)),
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
171 index2 < 0 ? Qnil : make_int (GetSystemMetrics (index2)));
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
172 }
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
173
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
174
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
175
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
176 /************************************************************************/
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
177 /* methods */
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
178 /************************************************************************/
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
179
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
180 static void
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
181 mswindows_init_device (struct device *d, Lisp_Object props)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
182 {
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
183 WNDCLASSEX wc;
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
184 HDC hdc;
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
185 LOGFONT logfont;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
186 struct font_enum_t font_enum;
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
187
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
188 DEVICE_CLASS (d) = Qcolor;
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
189 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
190 init_baud_rate (d);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
191 init_one_device (d);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
192
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
193 d->device_data = xnew_and_zero (struct mswindows_device);
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
194 hdc = CreateCompatibleDC (NULL);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
195 assert (hdc!=NULL);
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
196 DEVICE_MSWINDOWS_LOGPIXELSX(d) = GetDeviceCaps(hdc, LOGPIXELSX);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
197 DEVICE_MSWINDOWS_LOGPIXELSY(d) = GetDeviceCaps(hdc, LOGPIXELSY);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
198 DEVICE_MSWINDOWS_PLANES(d) = GetDeviceCaps(hdc, PLANES);
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
199 /* #### SIZEPALETTE only valid if RC_PALETTE bit set in RASTERCAPS,
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
200 what should we return for a non-palette-based device? */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
201 DEVICE_MSWINDOWS_CELLS(d) = GetDeviceCaps(hdc, SIZEPALETTE);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
202 DEVICE_MSWINDOWS_HORZRES(d) = GetDeviceCaps(hdc, HORZRES);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
203 DEVICE_MSWINDOWS_VERTRES(d) = GetDeviceCaps(hdc, VERTRES);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
204 DEVICE_MSWINDOWS_HORZSIZE(d) = GetDeviceCaps(hdc, HORZSIZE);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
205 DEVICE_MSWINDOWS_VERTSIZE(d) = GetDeviceCaps(hdc, VERTSIZE);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 263
diff changeset
206 DEVICE_MSWINDOWS_BITSPIXEL(d) = GetDeviceCaps(hdc, BITSPIXEL);
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
207
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
208 DEVICE_MSWINDOWS_FONTLIST (d) = NULL;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
209 logfont.lfCharSet = DEFAULT_CHARSET;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
210 logfont.lfFaceName[0] = '\0';
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
211 logfont.lfPitchAndFamily = DEFAULT_PITCH;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
212 font_enum.hdc = hdc;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
213 font_enum.d = d;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
214 EnumFontFamiliesEx (hdc, &logfont, (FONTENUMPROC) font_enum_callback_1,
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
215 (LPARAM) (&font_enum), 0);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
216 DeleteDC (hdc);
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
217
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
218 /* Register the main window class */
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
219 wc.cbSize = sizeof (WNDCLASSEX);
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
220 wc.style = CS_OWNDC; /* One DC per window */
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
221 wc.lpfnWndProc = (WNDPROC) mswindows_wnd_proc;
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
222 wc.cbClsExtra = 0;
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
223 wc.cbWndExtra = MSWINDOWS_WINDOW_EXTRA_BYTES;
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
224 wc.hInstance = NULL; /* ? */
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 223
diff changeset
225 wc.hIcon = LoadIcon (GetModuleHandle(NULL), XEMACS_CLASS);
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
226 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
227 /* Background brush is only used during sizing, when XEmacs cannot
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
228 take over */
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
229 wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
230 wc.lpszMenuName = NULL;
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
231
223
2c611d1463a6 Import from CVS: tag r20-4b10
cvs
parents: 217
diff changeset
232 wc.lpszClassName = XEMACS_CLASS;
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
233 wc.hIconSm = LoadImage (GetModuleHandle (NULL), XEMACS_CLASS,
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
234 IMAGE_ICON, 16, 16, 0);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
235 RegisterClassEx (&wc);
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 272
diff changeset
236 #ifdef HAVE_TOOLBARS
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 272
diff changeset
237 InitCommonControls ();
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 272
diff changeset
238 #endif
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
239 }
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
240
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
241 static void
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
242 mswindows_finish_init_device (struct device *d, Lisp_Object props)
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
243 {
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
244 /* Initialise DDE management library and our related globals. We execute a
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
245 * dde Open("file") by simulating a drop, so this depends on dnd support. */
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
246 #ifdef HAVE_DRAGNDROP
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
247 mswindows_dde_mlid = 0;
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 272
diff changeset
248 DdeInitialize (&mswindows_dde_mlid, (PFNCALLBACK)mswindows_dde_callback,
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
249 APPCMD_FILTERINITS|CBF_FAIL_SELFCONNECTIONS|CBF_FAIL_ADVISES|
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
250 CBF_FAIL_POKES|CBF_FAIL_REQUESTS|CBF_SKIP_ALLNOTIFICATIONS, 0);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
251
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
252 mswindows_dde_service = DdeCreateStringHandle (mswindows_dde_mlid, XEMACS_CLASS, 0);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
253 mswindows_dde_topic_system = DdeCreateStringHandle (mswindows_dde_mlid, SZDDESYS_TOPIC, 0);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
254 mswindows_dde_item_open = DdeCreateStringHandle (mswindows_dde_mlid,
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
255 TEXT(MSWINDOWS_DDE_ITEM_OPEN), 0);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
256 DdeNameService (mswindows_dde_mlid, mswindows_dde_service, 0L, DNS_REGISTER);
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
257 #endif
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
258 }
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
259
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
260 static void
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
261 mswindows_delete_device (struct device *d)
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
262 {
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
263 struct mswindows_font_enum *fontlist, *next;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
264
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
265 fontlist = DEVICE_MSWINDOWS_FONTLIST (d);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
266 while (fontlist)
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
267 {
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
268 next = fontlist->next;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
269 free (fontlist);
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
270 fontlist = next;
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
271 }
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
272
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
273 #ifdef HAVE_DRAGNDROP
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
274 DdeNameService (mswindows_dde_mlid, 0L, 0L, DNS_REGISTER);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
275 DdeUninitialize (mswindows_dde_mlid);
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
276 #endif
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
277
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
278 free (d->device_data);
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
279 }
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
280
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
281 static Lisp_Object
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
282 mswindows_device_system_metrics (struct device *d,
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
283 enum device_metrics m)
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
284 {
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
285 switch (m)
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
286 {
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
287 case DM_size_device:
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
288 return Fcons (make_int (DEVICE_MSWINDOWS_HORZRES(d)),
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
289 make_int (DEVICE_MSWINDOWS_VERTRES(d)));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
290 break;
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
291 case DM_size_device_mm:
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
292 return Fcons (make_int (DEVICE_MSWINDOWS_HORZSIZE(d)),
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
293 make_int (DEVICE_MSWINDOWS_VERTSIZE(d)));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
294 break;
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
295 case DM_num_bit_planes:
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
296 /* this is what X means by bitplanes therefore we ought to be
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
297 consistent. num planes is always 1 under mswindows and
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
298 therefore useless */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
299 return make_int (DEVICE_MSWINDOWS_BITSPIXEL(d));
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
300 break;
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
301 case DM_num_color_cells:
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
302 return make_int (DEVICE_MSWINDOWS_CELLS(d));
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
303 break;
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
304
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
305 /*** Colors ***/
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
306 #define FROB(met, index1, index2) \
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
307 case DM_##met: \
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
308 return build_syscolor_cons (index1, index2);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
309
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
310 FROB (color_default, COLOR_WINDOW, COLOR_WINDOWTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
311 FROB (color_select, COLOR_HIGHLIGHT, COLOR_HIGHLIGHTTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
312 FROB (color_balloon, COLOR_INFOBK, COLOR_INFOTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
313 FROB (color_3d_face, COLOR_3DFACE, COLOR_BTNTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
314 FROB (color_3d_light, COLOR_3DLIGHT, COLOR_3DHILIGHT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
315 FROB (color_3d_dark, COLOR_3DSHADOW, COLOR_3DDKSHADOW);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
316 FROB (color_menu, COLOR_MENU, COLOR_MENUTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
317 FROB (color_menu_highlight, COLOR_HIGHLIGHT, COLOR_HIGHLIGHTTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
318 FROB (color_menu_button, COLOR_MENU, COLOR_MENUTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
319 FROB (color_menu_disabled, COLOR_MENU, COLOR_GRAYTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
320 FROB (color_toolbar, COLOR_BTNFACE, COLOR_BTNTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
321 FROB (color_scrollbar, COLOR_SCROLLBAR, COLOR_CAPTIONTEXT);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
322 FROB (color_desktop, -1, COLOR_DESKTOP);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
323 FROB (color_workspace, -1, COLOR_APPWORKSPACE);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
324 #undef FROB
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
325
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
326 /*** Sizes ***/
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
327 #define FROB(met, index1, index2) \
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
328 case DM_##met: \
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
329 return build_sysmetrics_cons (index1, index2);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
330
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
331 FROB (size_cursor, SM_CXCURSOR, SM_CYCURSOR);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
332 FROB (size_scrollbar, SM_CXVSCROLL, SM_CYHSCROLL);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
333 FROB (size_menu, -1, SM_CYMENU);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
334 FROB (size_icon, SM_CXICON, SM_CYICON);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
335 FROB (size_icon_small, SM_CXSMICON, SM_CYSMICON);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
336 #undef FROB
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
337
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
338 case DM_size_workspace:
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
339 {
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
340 RECT rc;
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
341 SystemParametersInfo (SPI_GETWORKAREA, 0, &rc, 0);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
342 return Fcons (make_int (rc.right - rc.left),
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
343 make_int (rc.bottom - rc.top));
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
344 }
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
345 /*
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
346 case DM_size_toolbar:
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
347 case DM_size_toolbar_button:
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
348 case DM_size_toolbar_border:
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
349 */
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
350
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
351 /*** Features ***/
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
352 #define FROB(met, index) \
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
353 case DM_##met: \
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
354 return make_int (GetSystemMetrics (index));
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
355
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
356 FROB (mouse_buttons, SM_CMOUSEBUTTONS);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
357 FROB (swap_buttons, SM_SWAPBUTTON);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
358 FROB (show_sounds, SM_SHOWSOUNDS);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
359 FROB (slow_device, SM_SLOWMACHINE);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
360 FROB (security, SM_SECURE);
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
361 #undef FROB
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
362
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
363 }
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
364
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
365 /* Do not know such property */
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 282
diff changeset
366 return Qunbound;
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
367 }
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
368
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
369 static unsigned int
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
370 mswindows_device_implementation_flags (void)
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
371 {
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
372 return XDEVIMPF_PIXEL_GEOMETRY;
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
373 }
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 288
diff changeset
374
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
375
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
376 /************************************************************************/
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
377 /* initialization */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
378 /************************************************************************/
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
379
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
380 void
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
381 syms_of_device_mswindows (void)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
382 {
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
383 defsymbol (&Qinit_pre_mswindows_win, "init-pre-mswindows-win");
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
384 defsymbol (&Qinit_post_mswindows_win, "init-post-mswindows-win");
263
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
385
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
386 DEFVAR_LISP ("mswindows-downcase-file-names", &Vmswindows_downcase_file_names /*
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
387 Non-nil means convert all-upper case file names to lower case.
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
388 This applies when performing completions and file name expansion.*/ );
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
389 Vmswindows_downcase_file_names = Qnil;
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
390
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
391 DEFVAR_LISP ("mswindows-get-true-file-attributes", &Vmswindows_get_true_file_attributes /*
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
392 "Non-nil means determine accurate link count in file-attributes.
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
393 This option slows down file-attributes noticeably, so is disabled by
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
394 default. Note that it is only useful for files on NTFS volumes,
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
395 where hard links are supported.
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
396 */ );
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 249
diff changeset
397 Vmswindows_get_true_file_attributes = Qnil;
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
398 }
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
399
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
400 void
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
401 console_type_create_device_mswindows (void)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
402 {
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
403 CONSOLE_HAS_METHOD (mswindows, init_device);
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
404 CONSOLE_HAS_METHOD (mswindows, finish_init_device);
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
405 /* CONSOLE_HAS_METHOD (mswindows, mark_device); */
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 245
diff changeset
406 CONSOLE_HAS_METHOD (mswindows, delete_device);
282
c42ec1d1cded Import from CVS: tag r21-0b39
cvs
parents: 280
diff changeset
407 CONSOLE_HAS_METHOD (mswindows, device_system_metrics);
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 267
diff changeset
408 CONSOLE_HAS_METHOD (mswindows, device_implementation_flags);
213
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
409 }
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
410
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
411 void
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
412 vars_of_device_mswindows (void)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
413 {
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
414 }