1 /* window.cc: hidden windows for signals/itimer support
3 Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2010,
6 Written by Sergey Okhapkin <sos@prospect.com.ru>
8 This file is part of Cygwin.
10 This software is a copyrighted work licensed under the terms of the
11 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
18 #define USE_SYS_TYPES_FD_SET
20 #include "perprocess.h"
25 wininfo NO_COPY winmsg;
27 muto NO_COPY wininfo::_lock;
30 wininfo::process (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
33 strace.wm (uMsg, wParam, lParam);
43 if (WSAGETSELECTEVENT (lParam) == FD_OOB)
49 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
53 static LRESULT CALLBACK
54 process_window_events (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
56 return winmsg.process (hwnd, uMsg, wParam, lParam);
59 /* Handle windows events. Inherits ownership of the wininfo lock */
65 static NO_COPY WCHAR classname[] = L"CygwinWndClass";
68 /* Register the window class for the main window. */
71 wc.lpfnWndProc = (WNDPROC) process_window_events;
74 wc.hInstance = user_data->hmodule;
77 wc.hbrBackground = NULL;
78 wc.lpszMenuName = NULL;
79 wc.lpszClassName = classname;
81 if (!RegisterClassW (&wc))
82 api_fatal ("cannot register window class, %E");
84 /* Create hidden window. */
85 hwnd = CreateWindowExW (0, classname, classname, WS_POPUP, CW_USEDEFAULT,
86 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
87 (HWND) NULL, (HMENU) NULL, user_data->hmodule,
90 api_fatal ("couldn't create window, %E");
94 while ((ret = (int) GetMessageW (&msg, hwnd, 0, 0)) > 0)
95 DispatchMessageW (&msg);
101 winthread (VOID *arg)
103 return ((wininfo *) arg)->winthread ();
116 cygthread *h = new cygthread (::winthread, this, "win");
117 h->SetThreadPriority (THREAD_PRIORITY_HIGHEST);
128 _lock.init ("wininfo_lock")->acquire ();