diff 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
line wrap: on
line diff
--- a/src/device-msw.c	Mon Aug 13 10:10:03 2007 +0200
+++ b/src/device-msw.c	Mon Aug 13 10:10:54 2007 +0200
@@ -41,13 +41,12 @@
 
 Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win;
 
-DWORD mswindows_main_thread_id;
-DWORD mswindows_win_thread_id;
-
 static void
 mswindows_init_device (struct device *d, Lisp_Object props)
 {
   struct console *con = XCONSOLE (DEVICE_CONSOLE (d));
+  WNDCLASS wc;
+  mswindows_waitable_info_type info;
   HWND desktop;
   HDC hdc;
   MSG msg;
@@ -57,19 +56,6 @@
   init_baud_rate (d);
   init_one_device (d);
 
-  /* Ensure our message queue is created */
-  PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
-
-  mswindows_main_thread_id = GetCurrentThreadId ();
-#if 0
-  DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), 
-		   GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS);
-#endif
-  handle = CreateThread (NULL, 0, 
-			 (LPTHREAD_START_ROUTINE) mswindows_win_thread,
-			 0, 0, &mswindows_win_thread_id);
-  AttachThreadInput (mswindows_main_thread_id, mswindows_win_thread_id, TRUE);
-
   d->device_data = xnew_and_zero (struct mswindows_device);
 
   desktop = GetDesktopWindow();
@@ -87,8 +73,21 @@
   ReleaseDC(desktop, hdc);
 
   DEVICE_CLASS(d) = Qcolor;
-  /* Wait for windows thread to be ready */
-  GetMessage (&msg, NULL, WM_XEMACS_ACK, WM_XEMACS_ACK);
+
+  /* Register the main window class */
+  wc.style = CS_OWNDC;	/* One DC per window */
+  wc.lpfnWndProc = (WNDPROC) mswindows_wnd_proc;
+  wc.cbClsExtra = 0;
+  wc.cbWndExtra = MSWINDOWS_WINDOW_EXTRA_BYTES;
+  wc.hInstance = NULL;	/* ? */
+  wc.hIcon = LoadIcon (NULL, XEMACS_CLASS);
+  wc.hCursor = LoadCursor (NULL, IDC_ARROW);
+  /* Background brush is only used during sizing, when XEmacs cannot
+     take over */
+  wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
+  wc.lpszMenuName = NULL;
+  wc.lpszClassName = XEMACS_CLASS;
+  RegisterClass(&wc);		/* XXX FIXME: Should use RegisterClassEx */
 }
 
 static int