mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
support ctrl-v again
This commit is contained in:
parent
ade89730c6
commit
9d2ff6b5b2
@ -1710,42 +1710,41 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_KEYDOWN: {
|
case WM_KEYDOWN: {
|
||||||
POINT point;
|
POINT point;
|
||||||
|
|
||||||
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))) {
|
HGLOBAL hglb;
|
||||||
handle_keypress(lookup_key(wparam), point.x, point.y);
|
char *lptstr;
|
||||||
} else {
|
|
||||||
HGLOBAL hglb;
|
|
||||||
char *lptstr;
|
|
||||||
|
|
||||||
if (!IsClipboardFormatAvailable(CF_TEXT))
|
if (!IsClipboardFormatAvailable(CF_TEXT))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!OpenClipboard(NULL))
|
if (!OpenClipboard(NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hglb = GetClipboardData(CF_TEXT);
|
// Maybe we should support CF_UNICODETEXT if it is available
|
||||||
if (hglb!=NULL) {
|
// too?
|
||||||
lptstr = (char *) GlobalLock(hglb);
|
hglb = GetClipboardData(CF_TEXT);
|
||||||
if (lptstr != NULL) {
|
if (hglb!=NULL) {
|
||||||
char *pChar;
|
lptstr = (char *) GlobalLock(hglb);
|
||||||
for(pChar=lptstr;*pChar!=NULL;pChar++) {
|
if (lptstr != NULL) {
|
||||||
handle_keypress(KeyboardButton::ascii_key((uchar)*pChar), point.x, point.y);
|
char *pChar;
|
||||||
}
|
for(pChar=lptstr;*pChar!=NULL;pChar++) {
|
||||||
GlobalUnlock(hglb);
|
_input_devices[0].keystroke((uchar)*pChar);
|
||||||
}
|
|
||||||
}
|
|
||||||
CloseClipboard();
|
|
||||||
}
|
}
|
||||||
#endif
|
GlobalUnlock(hglb);
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
CloseClipboard();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_SYSKEYUP:
|
case WM_SYSKEYUP:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user