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 "event-msw.h"
|
|
39 #include "faces.h"
|
|
40 #include "frame.h"
|
|
41
|
|
42 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win;
|
|
43
|
|
44 static void
|
|
45 mswindows_init_device (struct device *d, Lisp_Object props)
|
|
46 {
|
223
|
47 WNDCLASS wc;
|
213
|
48 HWND desktop;
|
|
49 HDC hdc;
|
|
50
|
|
51 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
|
|
52 init_baud_rate (d);
|
|
53 init_one_device (d);
|
|
54
|
|
55 d->device_data = xnew_and_zero (struct mswindows_device);
|
|
56
|
|
57 desktop = GetDesktopWindow();
|
|
58 hdc = GetDC(desktop);
|
|
59 DEVICE_MSWINDOWS_LOGPIXELSX(d) = GetDeviceCaps(hdc, LOGPIXELSX);
|
|
60 DEVICE_MSWINDOWS_LOGPIXELSY(d) = GetDeviceCaps(hdc, LOGPIXELSY);
|
|
61 DEVICE_MSWINDOWS_PLANES(d) = GetDeviceCaps(hdc, PLANES);
|
|
62 /* FIXME: Only valid if RC_PALETTE bit set in RASTERCAPS,
|
|
63 what should we return for a non-palette-based device? */
|
|
64 DEVICE_MSWINDOWS_CELLS(d) = GetDeviceCaps(hdc, SIZEPALETTE);
|
|
65 DEVICE_MSWINDOWS_HORZRES(d) = GetDeviceCaps(hdc, HORZRES);
|
|
66 DEVICE_MSWINDOWS_VERTRES(d) = GetDeviceCaps(hdc, VERTRES);
|
|
67 DEVICE_MSWINDOWS_HORZSIZE(d) = GetDeviceCaps(hdc, HORZSIZE);
|
|
68 DEVICE_MSWINDOWS_VERTSIZE(d) = GetDeviceCaps(hdc, VERTSIZE);
|
|
69 ReleaseDC(desktop, hdc);
|
|
70
|
217
|
71 DEVICE_CLASS(d) = Qcolor;
|
223
|
72
|
|
73 /* Register the main window class */
|
|
74 wc.style = CS_OWNDC; /* One DC per window */
|
|
75 wc.lpfnWndProc = (WNDPROC) mswindows_wnd_proc;
|
|
76 wc.cbClsExtra = 0;
|
|
77 wc.cbWndExtra = MSWINDOWS_WINDOW_EXTRA_BYTES;
|
|
78 wc.hInstance = NULL; /* ? */
|
227
|
79 wc.hIcon = LoadIcon (GetModuleHandle(NULL), XEMACS_CLASS);
|
223
|
80 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
81 /* Background brush is only used during sizing, when XEmacs cannot
|
|
82 take over */
|
|
83 wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
|
|
84 wc.lpszMenuName = NULL;
|
|
85 wc.lpszClassName = XEMACS_CLASS;
|
|
86 RegisterClass(&wc); /* XXX FIXME: Should use RegisterClassEx */
|
213
|
87 }
|
|
88
|
|
89 static int
|
|
90 mswindows_device_pixel_width (struct device *d)
|
|
91 {
|
|
92 return(DEVICE_MSWINDOWS_HORZRES(d));
|
|
93 }
|
|
94
|
|
95 static int
|
|
96 mswindows_device_pixel_height (struct device *d)
|
|
97 {
|
|
98 return(DEVICE_MSWINDOWS_VERTRES(d));
|
|
99 }
|
|
100
|
|
101 static int
|
|
102 mswindows_device_mm_width (struct device *d)
|
|
103 {
|
|
104 return(DEVICE_MSWINDOWS_HORZSIZE(d));
|
|
105 }
|
|
106
|
|
107 static int
|
|
108 mswindows_device_mm_height (struct device *d)
|
|
109 {
|
|
110 return(DEVICE_MSWINDOWS_VERTSIZE(d));
|
|
111 }
|
|
112
|
|
113 static int
|
|
114 mswindows_device_bitplanes (struct device *d)
|
|
115 {
|
|
116 return(DEVICE_MSWINDOWS_PLANES(d));
|
|
117 }
|
|
118
|
|
119 static int
|
|
120 mswindows_device_color_cells (struct device *d)
|
|
121 {
|
|
122 return(DEVICE_MSWINDOWS_CELLS(d));
|
|
123 }
|
|
124
|
|
125
|
|
126 /************************************************************************/
|
|
127 /* initialization */
|
|
128 /************************************************************************/
|
|
129
|
|
130 void
|
|
131 syms_of_device_mswindows (void)
|
|
132 {
|
|
133 defsymbol (&Qinit_pre_mswindows_win, "init-pre-mswindows-win");
|
|
134 defsymbol (&Qinit_post_mswindows_win, "init-post-mswindows-win");
|
|
135 }
|
|
136
|
|
137 void
|
|
138 console_type_create_device_mswindows (void)
|
|
139 {
|
|
140 CONSOLE_HAS_METHOD (mswindows, init_device);
|
|
141 /* CONSOLE_HAS_METHOD (mswindows, finish_init_device); */
|
|
142 /* CONSOLE_HAS_METHOD (mswindows, mark_device); */
|
|
143 /* CONSOLE_HAS_METHOD (mswindows, delete_device); */
|
|
144 CONSOLE_HAS_METHOD (mswindows, device_pixel_width);
|
|
145 CONSOLE_HAS_METHOD (mswindows, device_pixel_height);
|
|
146 CONSOLE_HAS_METHOD (mswindows, device_mm_width);
|
|
147 CONSOLE_HAS_METHOD (mswindows, device_mm_height);
|
|
148 CONSOLE_HAS_METHOD (mswindows, device_bitplanes);
|
|
149 CONSOLE_HAS_METHOD (mswindows, device_color_cells);
|
|
150 }
|
|
151
|
|
152 void
|
|
153 vars_of_device_mswindows (void)
|
|
154 {
|
|
155 }
|