Mercurial > hg > xemacs-beta
comparison src/device-msw.c @ 223:2c611d1463a6 r20-4b10
Import from CVS: tag r20-4b10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:10:54 +0200 |
parents | d44af0c54775 |
children | 0e522484dd2a |
comparison
equal
deleted
inserted
replaced
222:aae4c8b01452 | 223:2c611d1463a6 |
---|---|
39 #include "faces.h" | 39 #include "faces.h" |
40 #include "frame.h" | 40 #include "frame.h" |
41 | 41 |
42 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win; | 42 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win; |
43 | 43 |
44 DWORD mswindows_main_thread_id; | |
45 DWORD mswindows_win_thread_id; | |
46 | |
47 static void | 44 static void |
48 mswindows_init_device (struct device *d, Lisp_Object props) | 45 mswindows_init_device (struct device *d, Lisp_Object props) |
49 { | 46 { |
50 struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); | 47 struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); |
48 WNDCLASS wc; | |
49 mswindows_waitable_info_type info; | |
51 HWND desktop; | 50 HWND desktop; |
52 HDC hdc; | 51 HDC hdc; |
53 MSG msg; | 52 MSG msg; |
54 HANDLE handle; | 53 HANDLE handle; |
55 | 54 |
56 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1; | 55 DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1; |
57 init_baud_rate (d); | 56 init_baud_rate (d); |
58 init_one_device (d); | 57 init_one_device (d); |
59 | |
60 /* Ensure our message queue is created */ | |
61 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); | |
62 | |
63 mswindows_main_thread_id = GetCurrentThreadId (); | |
64 #if 0 | |
65 DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), | |
66 GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS); | |
67 #endif | |
68 handle = CreateThread (NULL, 0, | |
69 (LPTHREAD_START_ROUTINE) mswindows_win_thread, | |
70 0, 0, &mswindows_win_thread_id); | |
71 AttachThreadInput (mswindows_main_thread_id, mswindows_win_thread_id, TRUE); | |
72 | 58 |
73 d->device_data = xnew_and_zero (struct mswindows_device); | 59 d->device_data = xnew_and_zero (struct mswindows_device); |
74 | 60 |
75 desktop = GetDesktopWindow(); | 61 desktop = GetDesktopWindow(); |
76 hdc = GetDC(desktop); | 62 hdc = GetDC(desktop); |
85 DEVICE_MSWINDOWS_HORZSIZE(d) = GetDeviceCaps(hdc, HORZSIZE); | 71 DEVICE_MSWINDOWS_HORZSIZE(d) = GetDeviceCaps(hdc, HORZSIZE); |
86 DEVICE_MSWINDOWS_VERTSIZE(d) = GetDeviceCaps(hdc, VERTSIZE); | 72 DEVICE_MSWINDOWS_VERTSIZE(d) = GetDeviceCaps(hdc, VERTSIZE); |
87 ReleaseDC(desktop, hdc); | 73 ReleaseDC(desktop, hdc); |
88 | 74 |
89 DEVICE_CLASS(d) = Qcolor; | 75 DEVICE_CLASS(d) = Qcolor; |
90 /* Wait for windows thread to be ready */ | 76 |
91 GetMessage (&msg, NULL, WM_XEMACS_ACK, WM_XEMACS_ACK); | 77 /* Register the main window class */ |
78 wc.style = CS_OWNDC; /* One DC per window */ | |
79 wc.lpfnWndProc = (WNDPROC) mswindows_wnd_proc; | |
80 wc.cbClsExtra = 0; | |
81 wc.cbWndExtra = MSWINDOWS_WINDOW_EXTRA_BYTES; | |
82 wc.hInstance = NULL; /* ? */ | |
83 wc.hIcon = LoadIcon (NULL, XEMACS_CLASS); | |
84 wc.hCursor = LoadCursor (NULL, IDC_ARROW); | |
85 /* Background brush is only used during sizing, when XEmacs cannot | |
86 take over */ | |
87 wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1); | |
88 wc.lpszMenuName = NULL; | |
89 wc.lpszClassName = XEMACS_CLASS; | |
90 RegisterClass(&wc); /* XXX FIXME: Should use RegisterClassEx */ | |
92 } | 91 } |
93 | 92 |
94 static int | 93 static int |
95 mswindows_device_pixel_width (struct device *d) | 94 mswindows_device_pixel_width (struct device *d) |
96 { | 95 { |