mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-20 20:45:02 -05:00
Chinese support patch from zmx@cdpa.nsysu.edu.tw
[originally from svn r740]
This commit is contained in:
parent
964e6407e1
commit
77c8e3c17c
49
window.c
49
window.c
@ -46,6 +46,11 @@
|
|||||||
#define WM_IGNORE_SIZE (WM_XUSER + 1)
|
#define WM_IGNORE_SIZE (WM_XUSER + 1)
|
||||||
#define WM_IGNORE_CLIP (WM_XUSER + 2)
|
#define WM_IGNORE_CLIP (WM_XUSER + 2)
|
||||||
|
|
||||||
|
/* Needed for Chinese support and apparently not always defined. */
|
||||||
|
#ifndef VK_PROCESSKEY
|
||||||
|
#define VK_PROCESSKEY 0xE5
|
||||||
|
#endif
|
||||||
|
|
||||||
static LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
static LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
||||||
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, unsigned char *output);
|
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, unsigned char *output);
|
||||||
static void cfgtopalette(void);
|
static void cfgtopalette(void);
|
||||||
@ -357,14 +362,14 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int winmode = WS_OVERLAPPEDWINDOW|WS_VSCROLL;
|
int winmode = WS_OVERLAPPEDWINDOW|WS_VSCROLL;
|
||||||
if (!cfg.scrollbar) winmode &= ~(WS_VSCROLL);
|
if (!cfg.scrollbar) winmode &= ~(WS_VSCROLL);
|
||||||
if (cfg.locksize) winmode &= ~(WS_THICKFRAME|WS_MAXIMIZEBOX);
|
if (cfg.locksize) winmode &= ~(WS_THICKFRAME|WS_MAXIMIZEBOX);
|
||||||
hwnd = CreateWindow (appname, appname,
|
hwnd = CreateWindow (appname, appname,
|
||||||
winmode,
|
winmode,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
guess_width, guess_height,
|
guess_width, guess_height,
|
||||||
NULL, NULL, inst, NULL);
|
NULL, NULL, inst, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1488,12 +1493,29 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
|||||||
unsigned char buf[20];
|
unsigned char buf[20];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = TranslateKey (message, wParam, lParam, buf);
|
if (wParam==VK_PROCESSKEY) {
|
||||||
if (len == -1)
|
MSG m;
|
||||||
return DefWindowProc (hwnd, message, wParam, lParam);
|
m.hwnd = hwnd;
|
||||||
ldisc->send (buf, len);
|
m.message = WM_KEYDOWN;
|
||||||
|
m.wParam = wParam;
|
||||||
|
m.lParam = lParam & 0xdfff;
|
||||||
|
TranslateMessage(&m);
|
||||||
|
} else {
|
||||||
|
len = TranslateKey (message, wParam, lParam, buf);
|
||||||
|
if (len == -1)
|
||||||
|
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||||
|
ldisc->send (buf, len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
case WM_IME_CHAR:
|
||||||
|
{
|
||||||
|
unsigned char buf[2];
|
||||||
|
|
||||||
|
buf[1] = wParam;
|
||||||
|
buf[0] = wParam >> 8;
|
||||||
|
ldisc->send (buf, 2);
|
||||||
|
}
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
case WM_SYSCHAR:
|
case WM_SYSCHAR:
|
||||||
/*
|
/*
|
||||||
@ -1774,7 +1796,8 @@ static int check_compose(int first, int second) {
|
|||||||
* codes. Returns number of bytes used or zero to drop the message
|
* codes. Returns number of bytes used or zero to drop the message
|
||||||
* or -1 to forward the message to windows.
|
* or -1 to forward the message to windows.
|
||||||
*/
|
*/
|
||||||
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, unsigned char *output) {
|
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
||||||
|
unsigned char *output) {
|
||||||
BYTE keystate[256];
|
BYTE keystate[256];
|
||||||
int scan, left_alt = 0, key_down, shift_state;
|
int scan, left_alt = 0, key_down, shift_state;
|
||||||
int r, i, code;
|
int r, i, code;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user