annotate src/device-msw.c @ 428:3ecd8885ac67 r21-2-22

Import from CVS: tag r21-2-22
author cvs
date Mon, 13 Aug 2007 11:28:15 +0200
parents
children 8de8e3f6228a
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 /* device functions for mswindows.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 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
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 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
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* Authorship:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 Original authors: Jamie Zawinski and the FSF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 Rewritten by Ben Wing and Chuck Thompson.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0.
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "console-msw.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "console-stream.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "events.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "faces.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "sysdep.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 /* win32 DDE management library globals */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #ifdef HAVE_DRAGNDROP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 DWORD mswindows_dde_mlid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 HSZ mswindows_dde_service;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 HSZ mswindows_dde_topic_system;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 HSZ mswindows_dde_item_open;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 /* Control conversion of upper case file names to lower case.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 nil means no, t means yes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 Lisp_Object Vmswindows_downcase_file_names;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 /* Control whether stat() attempts to determine file type and link count
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 exactly, at the expense of slower operation. Since true hard links
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 are supported on NTFS volumes, this is only relevant on NT. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Lisp_Object Vmswindows_get_true_file_attributes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 /* helpers */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 build_syscolor_string (int index)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 DWORD clr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 char buf[16];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 if (index < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 clr = GetSysColor (index);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 sprintf (buf, "#%02X%02X%02X",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 GetRValue (clr),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 GetGValue (clr),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 GetBValue (clr));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 return build_string (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 build_syscolor_cons (int index1, int index2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 Lisp_Object color1, color2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 GCPRO1 (color1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 color1 = build_syscolor_string (index1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 color2 = build_syscolor_string (index2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 RETURN_UNGCPRO (Fcons (color1, color2));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 build_sysmetrics_cons (int index1, int index2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 return Fcons (index1 < 0 ? Qnil : make_int (GetSystemMetrics (index1)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 index2 < 0 ? Qnil : make_int (GetSystemMetrics (index2)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 /* methods */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 mswindows_init_device (struct device *d, Lisp_Object props)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 WNDCLASSEX wc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 HDC hdc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 DEVICE_CLASS (d) = Qcolor;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 init_baud_rate (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 init_one_device (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 d->device_data = xnew_and_zero (struct mswindows_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 hdc = CreateCompatibleDC (NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 assert (hdc!=NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 DEVICE_MSWINDOWS_LOGPIXELSX(d) = GetDeviceCaps(hdc, LOGPIXELSX);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 DEVICE_MSWINDOWS_LOGPIXELSY(d) = GetDeviceCaps(hdc, LOGPIXELSY);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 DEVICE_MSWINDOWS_PLANES(d) = GetDeviceCaps(hdc, PLANES);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 /* #### SIZEPALETTE only valid if RC_PALETTE bit set in RASTERCAPS,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 what should we return for a non-palette-based device? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 DEVICE_MSWINDOWS_CELLS(d) = GetDeviceCaps(hdc, SIZEPALETTE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 DEVICE_MSWINDOWS_HORZRES(d) = GetDeviceCaps(hdc, HORZRES);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 DEVICE_MSWINDOWS_VERTRES(d) = GetDeviceCaps(hdc, VERTRES);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 DEVICE_MSWINDOWS_HORZSIZE(d) = GetDeviceCaps(hdc, HORZSIZE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 DEVICE_MSWINDOWS_VERTSIZE(d) = GetDeviceCaps(hdc, VERTSIZE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 DEVICE_MSWINDOWS_BITSPIXEL(d) = GetDeviceCaps(hdc, BITSPIXEL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 DeleteDC (hdc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 mswindows_enumerate_fonts (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 /* Register the main window class */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 wc.cbSize = sizeof (WNDCLASSEX);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 wc.style = CS_OWNDC; /* One DC per window */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 wc.lpfnWndProc = (WNDPROC) mswindows_wnd_proc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 wc.cbClsExtra = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 wc.cbWndExtra = MSWINDOWS_WINDOW_EXTRA_BYTES;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 /* This must match whatever is passed to CreateWIndowEx, NULL is ok
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 for this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 wc.hInstance = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 wc.hIcon = LoadIcon (GetModuleHandle(NULL), XEMACS_CLASS);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 /* Background brush is only used during sizing, when XEmacs cannot
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 take over */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 wc.lpszMenuName = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 wc.lpszClassName = XEMACS_CLASS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 wc.hIconSm = LoadImage (GetModuleHandle (NULL), XEMACS_CLASS,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 IMAGE_ICON, 16, 16, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 RegisterClassEx (&wc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 #ifdef HAVE_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 xzero (wc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 /* Register the main window class */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 wc.cbSize = sizeof (WNDCLASSEX);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 wc.lpfnWndProc = (WNDPROC) mswindows_control_wnd_proc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 wc.lpszClassName = XEMACS_CONTROL_CLASS;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 wc.hInstance = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 RegisterClassEx (&wc);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 InitCommonControls ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 mswindows_finish_init_device (struct device *d, Lisp_Object props)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 /* Initialize DDE management library and our related globals. We execute a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 * dde Open("file") by simulating a drop, so this depends on dnd support. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 #ifdef HAVE_DRAGNDROP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 mswindows_dde_mlid = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 DdeInitialize (&mswindows_dde_mlid, (PFNCALLBACK)mswindows_dde_callback,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 APPCMD_FILTERINITS|CBF_FAIL_SELFCONNECTIONS|CBF_FAIL_ADVISES|
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 CBF_FAIL_POKES|CBF_FAIL_REQUESTS|CBF_SKIP_ALLNOTIFICATIONS, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 mswindows_dde_service = DdeCreateStringHandle (mswindows_dde_mlid, XEMACS_CLASS, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 mswindows_dde_topic_system = DdeCreateStringHandle (mswindows_dde_mlid, SZDDESYS_TOPIC, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 mswindows_dde_item_open = DdeCreateStringHandle (mswindows_dde_mlid,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 TEXT(MSWINDOWS_DDE_ITEM_OPEN), 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 DdeNameService (mswindows_dde_mlid, mswindows_dde_service, 0L, DNS_REGISTER);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 mswindows_delete_device (struct device *d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 struct mswindows_font_enum *fontlist, *next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 fontlist = DEVICE_MSWINDOWS_FONTLIST (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 while (fontlist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 next = fontlist->next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 free (fontlist);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 fontlist = next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 #ifdef HAVE_DRAGNDROP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 DdeNameService (mswindows_dde_mlid, 0L, 0L, DNS_REGISTER);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 DdeUninitialize (mswindows_dde_mlid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 free (d->device_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 mswindows_device_system_metrics (struct device *d,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 enum device_metrics m)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 switch (m)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 case DM_size_device:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 return Fcons (make_int (DEVICE_MSWINDOWS_HORZRES(d)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 make_int (DEVICE_MSWINDOWS_VERTRES(d)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 case DM_size_device_mm:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 return Fcons (make_int (DEVICE_MSWINDOWS_HORZSIZE(d)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 make_int (DEVICE_MSWINDOWS_VERTSIZE(d)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 case DM_num_bit_planes:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 /* this is what X means by bitplanes therefore we ought to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 consistent. num planes is always 1 under mswindows and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 therefore useless */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 return make_int (DEVICE_MSWINDOWS_BITSPIXEL(d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 case DM_num_color_cells:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 return make_int (DEVICE_MSWINDOWS_CELLS(d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 /*** Colors ***/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 #define FROB(met, index1, index2) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 case DM_##met: \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 return build_syscolor_cons (index1, index2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 FROB (color_default, COLOR_WINDOW, COLOR_WINDOWTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 FROB (color_select, COLOR_HIGHLIGHT, COLOR_HIGHLIGHTTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 FROB (color_balloon, COLOR_INFOBK, COLOR_INFOTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 FROB (color_3d_face, COLOR_3DFACE, COLOR_BTNTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 FROB (color_3d_light, COLOR_3DLIGHT, COLOR_3DHILIGHT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 FROB (color_3d_dark, COLOR_3DSHADOW, COLOR_3DDKSHADOW);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 FROB (color_menu, COLOR_MENU, COLOR_MENUTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 FROB (color_menu_highlight, COLOR_HIGHLIGHT, COLOR_HIGHLIGHTTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 FROB (color_menu_button, COLOR_MENU, COLOR_MENUTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 FROB (color_menu_disabled, COLOR_MENU, COLOR_GRAYTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 FROB (color_toolbar, COLOR_BTNFACE, COLOR_BTNTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 FROB (color_scrollbar, COLOR_SCROLLBAR, COLOR_CAPTIONTEXT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 FROB (color_desktop, -1, COLOR_DESKTOP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 FROB (color_workspace, -1, COLOR_APPWORKSPACE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 #undef FROB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 /*** Sizes ***/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 #define FROB(met, index1, index2) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 case DM_##met: \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 return build_sysmetrics_cons (index1, index2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 FROB (size_cursor, SM_CXCURSOR, SM_CYCURSOR);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 FROB (size_scrollbar, SM_CXVSCROLL, SM_CYHSCROLL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 FROB (size_menu, -1, SM_CYMENU);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 FROB (size_icon, SM_CXICON, SM_CYICON);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 FROB (size_icon_small, SM_CXSMICON, SM_CYSMICON);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 #undef FROB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 case DM_size_workspace:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 RECT rc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 SystemParametersInfo (SPI_GETWORKAREA, 0, &rc, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 return Fcons (make_int (rc.right - rc.left),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 make_int (rc.bottom - rc.top));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 case DM_size_toolbar:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 case DM_size_toolbar_button:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 case DM_size_toolbar_border:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 /*** Features ***/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 #define FROB(met, index) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 case DM_##met: \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 return make_int (GetSystemMetrics (index));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 FROB (mouse_buttons, SM_CMOUSEBUTTONS);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 FROB (swap_buttons, SM_SWAPBUTTON);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 FROB (show_sounds, SM_SHOWSOUNDS);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 FROB (slow_device, SM_SLOWMACHINE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 FROB (security, SM_SECURE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 #undef FROB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 /* Do not know such property */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 return Qunbound;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 static unsigned int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 mswindows_device_implementation_flags (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 return XDEVIMPF_PIXEL_GEOMETRY;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 syms_of_device_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 defsymbol (&Qinit_pre_mswindows_win, "init-pre-mswindows-win");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 defsymbol (&Qinit_post_mswindows_win, "init-post-mswindows-win");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 console_type_create_device_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 CONSOLE_HAS_METHOD (mswindows, init_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 CONSOLE_HAS_METHOD (mswindows, finish_init_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 /* CONSOLE_HAS_METHOD (mswindows, mark_device); */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 CONSOLE_HAS_METHOD (mswindows, delete_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 CONSOLE_HAS_METHOD (mswindows, device_system_metrics);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 CONSOLE_HAS_METHOD (mswindows, device_implementation_flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 vars_of_device_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 DEFVAR_LISP ("mswindows-downcase-file-names", &Vmswindows_downcase_file_names /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 Non-nil means convert all-upper case file names to lower case.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 This applies when performing completions and file name expansion.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 Vmswindows_downcase_file_names = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 DEFVAR_LISP ("mswindows-get-true-file-attributes", &Vmswindows_get_true_file_attributes /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 Non-nil means determine accurate link count in file-attributes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 This option slows down file-attributes noticeably, so is disabled by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 default. Note that it is only useful for files on NTFS volumes,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 where hard links are supported.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 Vmswindows_get_true_file_attributes = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 }