support ctrl-v again

This commit is contained in:
David Rose 2002-02-16 19:58:15 +00:00
parent ade89730c6
commit 9d2ff6b5b2

View File

@ -1714,14 +1714,12 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
GetCursorPos(&point); GetCursorPos(&point);
ScreenToClient(hwnd, &point); ScreenToClient(hwnd, &point);
handle_keypress(lookup_key(wparam), point.x, point.y);
#ifdef NDEBUG // Handle Cntrl-V paste from clipboard. Is there a better way
handle_keypress(lookup_key(wparam), point.x, point.y); // to detect this hotkey?
#else if ((wparam=='V') && (GetKeyState(VK_CONTROL) < 0) &&
// handle Cntrl-V paste from clipboard !_input_devices.empty()) {
if (!((wparam=='V') && (GetKeyState(VK_CONTROL) < 0))) {
handle_keypress(lookup_key(wparam), point.x, point.y);
} else {
HGLOBAL hglb; HGLOBAL hglb;
char *lptstr; char *lptstr;
@ -1731,20 +1729,21 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
if (!OpenClipboard(NULL)) if (!OpenClipboard(NULL))
return 0; return 0;
// Maybe we should support CF_UNICODETEXT if it is available
// too?
hglb = GetClipboardData(CF_TEXT); hglb = GetClipboardData(CF_TEXT);
if (hglb!=NULL) { if (hglb!=NULL) {
lptstr = (char *) GlobalLock(hglb); lptstr = (char *) GlobalLock(hglb);
if (lptstr != NULL) { if (lptstr != NULL) {
char *pChar; char *pChar;
for(pChar=lptstr;*pChar!=NULL;pChar++) { for(pChar=lptstr;*pChar!=NULL;pChar++) {
handle_keypress(KeyboardButton::ascii_key((uchar)*pChar), point.x, point.y); _input_devices[0].keystroke((uchar)*pChar);
} }
GlobalUnlock(hglb); GlobalUnlock(hglb);
} }
} }
CloseClipboard(); CloseClipboard();
} }
#endif
break; break;
} }