213
|
1 /* Device functions for mswindows.
|
|
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
|
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not in FSF. */
|
|
23
|
|
24 /* Authorship:
|
|
25
|
|
26 Original authors: Jamie Zawinski and the FSF
|
|
27 Rewritten by Ben Wing and Chuck Thompson.
|
|
28 Rewritten for mswindows by Jonathan Harris, November 1997 for 20.4.
|
|
29 */
|
|
30
|
|
31
|
|
32 #include <config.h>
|
|
33 #include "lisp.h"
|
|
34
|
|
35 #include "console-msw.h"
|
|
36 #include "console-stream.h"
|
|
37 #include "events.h"
|
|
38 #include "faces.h"
|
|
39 #include "frame.h"
|
249
|
40 #include "sysdep.h"
|
|
41
|
|
42 /* win32 DDE management library globals */
|
|
43 DWORD mswindows_dde_mlid;
|
|
44 HSZ mswindows_dde_service;
|
|
45 HSZ mswindows_dde_topic_system;
|
|
46 HSZ mswindows_dde_item_open;
|
213
|
47
|
263
|
48
|
|
49 /* Control conversion of upper case file names to lower case.
|
|
50 nil means no, t means yes. */
|
|
51 Lisp_Object Vmswindows_downcase_file_names;
|
|
52
|
|
53 /* Control whether stat() attempts to determine file type and link count
|
|
54 exactly, at the expense of slower operation. Since true hard links
|
|
55 are supported on NTFS volumes, this is only relevant on NT. */
|
|
56 Lisp_Object Vmswindows_get_true_file_attributes;
|
|
57
|
213
|
58 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win;
|
|
59
|
263
|
60
|
213
|
61 static void
|
|
62 mswindows_init_device (struct device *d, Lisp_Object props)
|
|
63 {
|
249
|
64 WNDCLASSEX wc;
|
213
|
65 HWND desktop;
|
|
66 HDC hdc;
|
|
67
|
|
68 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
|
|
69 init_baud_rate (d);
|
|
70 init_one_device (d);
|
|
71
|
|
72 d->device_data = xnew_and_zero (struct mswindows_device);
|
|
73
|
|
74 desktop = GetDesktopWindow();
|
|
75 hdc = GetDC(desktop);
|
|
76 DEVICE_MSWINDOWS_LOGPIXELSX(d) = GetDeviceCaps(hdc, LOGPIXELSX);
|
|
77 DEVICE_MSWINDOWS_LOGPIXELSY(d) = GetDeviceCaps(hdc, LOGPIXELSY);
|
|
78 DEVICE_MSWINDOWS_PLANES(d) = GetDeviceCaps(hdc, PLANES);
|
|
79 /* FIXME: Only valid if RC_PALETTE bit set in RASTERCAPS,
|
|
80 what should we return for a non-palette-based device? */
|
|
81 DEVICE_MSWINDOWS_CELLS(d) = GetDeviceCaps(hdc, SIZEPALETTE);
|
|
82 DEVICE_MSWINDOWS_HORZRES(d) = GetDeviceCaps(hdc, HORZRES);
|
|
83 DEVICE_MSWINDOWS_VERTRES(d) = GetDeviceCaps(hdc, VERTRES);
|
|
84 DEVICE_MSWINDOWS_HORZSIZE(d) = GetDeviceCaps(hdc, HORZSIZE);
|
|
85 DEVICE_MSWINDOWS_VERTSIZE(d) = GetDeviceCaps(hdc, VERTSIZE);
|
267
|
86 DEVICE_MSWINDOWS_BITSPIXEL(d) = GetDeviceCaps(hdc, BITSPIXEL);
|
213
|
87 ReleaseDC(desktop, hdc);
|
|
88
|
217
|
89 DEVICE_CLASS(d) = Qcolor;
|
223
|
90
|
|
91 /* Register the main window class */
|
249
|
92 wc.cbSize = sizeof (WNDCLASSEX);
|
223
|
93 wc.style = CS_OWNDC; /* One DC per window */
|
|
94 wc.lpfnWndProc = (WNDPROC) mswindows_wnd_proc;
|
|
95 wc.cbClsExtra = 0;
|
|
96 wc.cbWndExtra = MSWINDOWS_WINDOW_EXTRA_BYTES;
|
|
97 wc.hInstance = NULL; /* ? */
|
227
|
98 wc.hIcon = LoadIcon (GetModuleHandle(NULL), XEMACS_CLASS);
|
223
|
99 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
100 /* Background brush is only used during sizing, when XEmacs cannot
|
|
101 take over */
|
|
102 wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
|
|
103 wc.lpszMenuName = NULL;
|
|
104 wc.lpszClassName = XEMACS_CLASS;
|
249
|
105 wc.hIconSm = LoadImage (GetModuleHandle (NULL), XEMACS_CLASS,
|
|
106 IMAGE_ICON, 16, 16, 0);
|
|
107 RegisterClassEx (&wc);
|
|
108 }
|
|
109
|
|
110 static void
|
|
111 mswindows_finish_init_device (struct device *d, Lisp_Object props)
|
|
112 {
|
|
113 /* Initialise DDE management library and our related globals */
|
|
114 mswindows_dde_mlid = 0;
|
|
115 DdeInitialize (&mswindows_dde_mlid, mswindows_dde_callback,
|
|
116 APPCMD_FILTERINITS|CBF_FAIL_SELFCONNECTIONS|CBF_FAIL_ADVISES|
|
|
117 CBF_FAIL_POKES|CBF_FAIL_REQUESTS|CBF_SKIP_ALLNOTIFICATIONS, 0);
|
|
118
|
|
119 mswindows_dde_service = DdeCreateStringHandle (mswindows_dde_mlid, XEMACS_CLASS, 0);
|
|
120 mswindows_dde_topic_system = DdeCreateStringHandle (mswindows_dde_mlid, SZDDESYS_TOPIC, 0);
|
|
121 mswindows_dde_item_open = DdeCreateStringHandle (mswindows_dde_mlid,
|
|
122 TEXT(MSWINDOWS_DDE_ITEM_OPEN), 0);
|
|
123 DdeNameService (mswindows_dde_mlid, mswindows_dde_service, 0L, DNS_REGISTER);
|
|
124 }
|
|
125
|
|
126 static void
|
|
127 mswindows_delete_device (struct device *d)
|
|
128 {
|
|
129 DdeNameService (mswindows_dde_mlid, 0L, 0L, DNS_REGISTER);
|
|
130 DdeUninitialize (mswindows_dde_mlid);
|
213
|
131 }
|
|
132
|
|
133 static int
|
|
134 mswindows_device_pixel_width (struct device *d)
|
|
135 {
|
|
136 return(DEVICE_MSWINDOWS_HORZRES(d));
|
|
137 }
|
|
138
|
|
139 static int
|
|
140 mswindows_device_pixel_height (struct device *d)
|
|
141 {
|
|
142 return(DEVICE_MSWINDOWS_VERTRES(d));
|
|
143 }
|
|
144
|
|
145 static int
|
|
146 mswindows_device_mm_width (struct device *d)
|
|
147 {
|
|
148 return(DEVICE_MSWINDOWS_HORZSIZE(d));
|
|
149 }
|
|
150
|
|
151 static int
|
|
152 mswindows_device_mm_height (struct device *d)
|
|
153 {
|
|
154 return(DEVICE_MSWINDOWS_VERTSIZE(d));
|
|
155 }
|
|
156
|
|
157 static int
|
|
158 mswindows_device_bitplanes (struct device *d)
|
|
159 {
|
|
160 return(DEVICE_MSWINDOWS_PLANES(d));
|
|
161 }
|
|
162
|
|
163 static int
|
|
164 mswindows_device_color_cells (struct device *d)
|
|
165 {
|
|
166 return(DEVICE_MSWINDOWS_CELLS(d));
|
|
167 }
|
|
168
|
|
169
|
|
170 /************************************************************************/
|
|
171 /* initialization */
|
|
172 /************************************************************************/
|
|
173
|
|
174 void
|
|
175 syms_of_device_mswindows (void)
|
|
176 {
|
|
177 defsymbol (&Qinit_pre_mswindows_win, "init-pre-mswindows-win");
|
|
178 defsymbol (&Qinit_post_mswindows_win, "init-post-mswindows-win");
|
263
|
179
|
|
180 DEFVAR_LISP ("mswindows-downcase-file-names", &Vmswindows_downcase_file_names /*
|
|
181 Non-nil means convert all-upper case file names to lower case.
|
|
182 This applies when performing completions and file name expansion.*/ );
|
|
183 Vmswindows_downcase_file_names = Qnil;
|
|
184
|
|
185 DEFVAR_LISP ("mswindows-get-true-file-attributes", &Vmswindows_get_true_file_attributes /*
|
|
186 "Non-nil means determine accurate link count in file-attributes.
|
|
187 This option slows down file-attributes noticeably, so is disabled by
|
|
188 default. Note that it is only useful for files on NTFS volumes,
|
|
189 where hard links are supported.
|
|
190 */ );
|
|
191 Vmswindows_get_true_file_attributes = Qnil;
|
213
|
192 }
|
|
193
|
|
194 void
|
|
195 console_type_create_device_mswindows (void)
|
|
196 {
|
|
197 CONSOLE_HAS_METHOD (mswindows, init_device);
|
249
|
198 CONSOLE_HAS_METHOD (mswindows, finish_init_device);
|
213
|
199 /* CONSOLE_HAS_METHOD (mswindows, mark_device); */
|
249
|
200 CONSOLE_HAS_METHOD (mswindows, delete_device);
|
213
|
201 CONSOLE_HAS_METHOD (mswindows, device_pixel_width);
|
|
202 CONSOLE_HAS_METHOD (mswindows, device_pixel_height);
|
|
203 CONSOLE_HAS_METHOD (mswindows, device_mm_width);
|
|
204 CONSOLE_HAS_METHOD (mswindows, device_mm_height);
|
|
205 CONSOLE_HAS_METHOD (mswindows, device_bitplanes);
|
|
206 CONSOLE_HAS_METHOD (mswindows, device_color_cells);
|
|
207 }
|
|
208
|
|
209 void
|
|
210 vars_of_device_mswindows (void)
|
|
211 {
|
|
212 }
|