Mercurial > hg > xemacs-beta
comparison src/device-w32.c @ 209:41ff10fd062f r20-4b3
Import from CVS: tag r20-4b3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:04:58 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
208:f427b8ec4379 | 209:41ff10fd062f |
---|---|
1 /* Device functions for win32. | |
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 win32 by Jonathan Harris, November 1997 for 20.4. | |
29 */ | |
30 | |
31 | |
32 #include <config.h> | |
33 #include "lisp.h" | |
34 | |
35 #include "console-w32.h" | |
36 #include "console-stream.h" | |
37 #include "events.h" | |
38 #include "event-w32.h" | |
39 #include "faces.h" | |
40 #include "frame.h" | |
41 | |
42 Lisp_Object Qinit_pre_w32_win, Qinit_post_w32_win; | |
43 | |
44 DWORD w32_main_thread_id; | |
45 DWORD w32_win_thread_id; | |
46 | |
47 static void | |
48 w32_init_device (struct device *d, Lisp_Object props) | |
49 { | |
50 struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); | |
51 HWND desktop; | |
52 HDC hdc; | |
53 MSG msg; | |
54 HANDLE handle; | |
55 | |
56 /* Ensure our message queue is created */ | |
57 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); | |
58 | |
59 w32_main_thread_id = GetCurrentThreadId (); | |
60 #if 0 | |
61 DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), | |
62 GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS); | |
63 #endif | |
64 handle = CreateThread (NULL, 0, | |
65 (LPTHREAD_START_ROUTINE) w32_win_thread, | |
66 0, 0, &w32_win_thread_id); | |
67 AttachThreadInput (w32_main_thread_id, w32_win_thread_id, TRUE); | |
68 | |
69 d->device_data = xnew_and_zero (struct w32_device); | |
70 | |
71 desktop = GetDesktopWindow(); | |
72 hdc = GetDC(desktop); | |
73 DEVICE_W32_LOGPIXELSX(d) = GetDeviceCaps(hdc, LOGPIXELSX); | |
74 DEVICE_W32_LOGPIXELSY(d) = GetDeviceCaps(hdc, LOGPIXELSY); | |
75 DEVICE_W32_PLANES(d) = GetDeviceCaps(hdc, PLANES); | |
76 /* FIXME: Only valid if RC_PALETTE bit set in RASTERCAPS, | |
77 what should we return for a non-palette-based device? */ | |
78 DEVICE_W32_CELLS(d) = GetDeviceCaps(hdc, SIZEPALETTE); | |
79 DEVICE_W32_HORZRES(d) = GetDeviceCaps(hdc, HORZRES); | |
80 DEVICE_W32_VERTRES(d) = GetDeviceCaps(hdc, VERTRES); | |
81 DEVICE_W32_HORZSIZE(d) = GetDeviceCaps(hdc, HORZSIZE); | |
82 DEVICE_W32_VERTSIZE(d) = GetDeviceCaps(hdc, VERTSIZE); | |
83 ReleaseDC(desktop, hdc); | |
84 | |
85 /* Wait for windows thread to be ready */ | |
86 GetMessage (&msg, NULL, WM_XEMACS_ACK, WM_XEMACS_ACK); | |
87 } | |
88 | |
89 static int | |
90 w32_device_pixel_width (struct device *d) | |
91 { | |
92 return(DEVICE_W32_HORZRES(d)); | |
93 } | |
94 | |
95 static int | |
96 w32_device_pixel_height (struct device *d) | |
97 { | |
98 return(DEVICE_W32_VERTRES(d)); | |
99 } | |
100 | |
101 static int | |
102 w32_device_mm_width (struct device *d) | |
103 { | |
104 return(DEVICE_W32_HORZSIZE(d)); | |
105 } | |
106 | |
107 static int | |
108 w32_device_mm_height (struct device *d) | |
109 { | |
110 return(DEVICE_W32_VERTSIZE(d)); | |
111 } | |
112 | |
113 static int | |
114 w32_device_bitplanes (struct device *d) | |
115 { | |
116 return(DEVICE_W32_PLANES(d)); | |
117 } | |
118 | |
119 static int | |
120 w32_device_color_cells (struct device *d) | |
121 { | |
122 return(DEVICE_W32_CELLS(d)); | |
123 } | |
124 | |
125 | |
126 /************************************************************************/ | |
127 /* initialization */ | |
128 /************************************************************************/ | |
129 | |
130 void | |
131 syms_of_device_w32 (void) | |
132 { | |
133 defsymbol (&Qinit_pre_w32_win, "init-pre-w32-win"); | |
134 defsymbol (&Qinit_post_w32_win, "init-post-w32-win"); | |
135 } | |
136 | |
137 void | |
138 console_type_create_device_w32 (void) | |
139 { | |
140 CONSOLE_HAS_METHOD (w32, init_device); | |
141 /* CONSOLE_HAS_METHOD (w32, finish_init_device); */ | |
142 /* CONSOLE_HAS_METHOD (w32, mark_device); */ | |
143 /* CONSOLE_HAS_METHOD (w32, delete_device); */ | |
144 CONSOLE_HAS_METHOD (w32, device_pixel_width); | |
145 CONSOLE_HAS_METHOD (w32, device_pixel_height); | |
146 CONSOLE_HAS_METHOD (w32, device_mm_width); | |
147 CONSOLE_HAS_METHOD (w32, device_mm_height); | |
148 CONSOLE_HAS_METHOD (w32, device_bitplanes); | |
149 CONSOLE_HAS_METHOD (w32, device_color_cells); | |
150 } | |
151 | |
152 void | |
153 vars_of_device_w32 (void) | |
154 { | |
155 } |