int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
{
- WNDCLASS wndclass;
MSG msg;
HRESULT hr;
int guess_width, guess_height;
}
if (!prev) {
+ WNDCLASSW wndclass;
+
wndclass.style = 0;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.hCursor = LoadCursor(NULL, IDC_IBEAM);
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = appname;
+ wndclass.lpszClassName = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, appname);
- RegisterClass(&wndclass);
+ RegisterClassW(&wndclass);
}
memset(&ucsdata, 0, sizeof(ucsdata));
{
int winmode = WS_OVERLAPPEDWINDOW | WS_VSCROLL;
int exwinmode = 0;
+ wchar_t *uappname = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, appname);
if (!conf_get_int(conf, CONF_scrollbar))
winmode &= ~(WS_VSCROLL);
if (conf_get_int(conf, CONF_resize_action) == RESIZE_DISABLED)
exwinmode |= WS_EX_TOPMOST;
if (conf_get_int(conf, CONF_sunken_edge))
exwinmode |= WS_EX_CLIENTEDGE;
- hwnd = CreateWindowEx(exwinmode, appname, appname,
- winmode, CW_USEDEFAULT, CW_USEDEFAULT,
- guess_width, guess_height,
- NULL, NULL, inst, NULL);
+ hwnd = CreateWindowExW(exwinmode, uappname, uappname,
+ winmode, CW_USEDEFAULT, CW_USEDEFAULT,
+ guess_width, guess_height,
+ NULL, NULL, inst, NULL);
+ sfree(uappname);
}
/*
} else
sfree(handles);
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT)
goto finished; /* two-level break */
if (!(IsWindow(logbox) && IsDialogMessage(logbox, &msg)))
- DispatchMessage(&msg);
+ DispatchMessageW(&msg);
/*
* WM_NETEVENT messages seem to jump ahead of others in
} else {
len = TranslateKey(message, wParam, lParam, buf);
if (len == -1)
- return DefWindowProc(hwnd, message, wParam, lParam);
+ return DefWindowProcW(hwnd, message, wParam, lParam);
if (len != 0) {
/*
* we're ready to cope.
*/
{
- char c = (unsigned char)wParam;
- term_seen_key_event(term);
- if (ldisc)
- lpage_send(ldisc, CP_ACP, &c, 1, 1);
+ static wchar_t pending_surrogate = 0;
+ wchar_t c = wParam;
+
+ if (IS_HIGH_SURROGATE(c)) {
+ pending_surrogate = c;
+ } else if (IS_SURROGATE_PAIR(pending_surrogate, c)) {
+ wchar_t pair[2];
+ pair[0] = pending_surrogate;
+ pair[1] = c;
+ term_seen_key_event(term);
+ luni_send(ldisc, pair, 2, 1);
+ } else if (!IS_SURROGATE(c)) {
+ term_seen_key_event(term);
+ luni_send(ldisc, &c, 1, 1);
+ }
}
return 0;
case WM_SYSCOLORCHANGE:
* Any messages we don't process completely above are passed through to
* DefWindowProc() for default processing.
*/
- return DefWindowProc(hwnd, message, wParam, lParam);
+ return DefWindowProcW(hwnd, message, wParam, lParam);
}
/*