Windows: Mapped VK_SNAPSHOT to KEY_SYSRQ and added workaround to a windows bug where WM_KEYDOWN is never generated for VK_SNAPSHOT
This commit is contained in:
parent
659a1cf4c7
commit
7a49d5ce8f
|
@ -706,7 +706,17 @@ final class WindowsDisplay implements DisplayImplementation {
|
||||||
return true;
|
return true;
|
||||||
case WM_SYSKEYDOWN: /* Fall through */
|
case WM_SYSKEYDOWN: /* Fall through */
|
||||||
case WM_SYSKEYUP: /* Fall through */
|
case WM_SYSKEYUP: /* Fall through */
|
||||||
case WM_KEYUP: /* Fall through */
|
case WM_KEYUP:
|
||||||
|
// SysRq apparently only generates WM_KEYUP, so we'll fake a WM_KEYDOWN
|
||||||
|
if (wParam == WindowsKeycodes.VK_SNAPSHOT && keyboard != null &&
|
||||||
|
!keyboard.isKeyDown(org.lwjgl.input.Keyboard.KEY_SYSRQ)) {
|
||||||
|
// Set key state to pressed
|
||||||
|
long fake_lparam = lParam & ~(1 << 31);
|
||||||
|
// Set key previous state to released
|
||||||
|
fake_lparam = fake_lparam & ~(1 << 30);
|
||||||
|
handleKeyButton(wParam, fake_lparam, millis);
|
||||||
|
}
|
||||||
|
/* Fall through */
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
handleKeyButton(wParam, lParam, millis);
|
handleKeyButton(wParam, lParam, millis);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -74,6 +74,10 @@ final class WindowsKeyboard {
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isKeyDown(int lwjgl_keycode) {
|
||||||
|
return key_down_buffer[lwjgl_keycode] == 1;
|
||||||
|
}
|
||||||
|
|
||||||
public void grab(boolean grab) {
|
public void grab(boolean grab) {
|
||||||
if(grab) {
|
if(grab) {
|
||||||
if (!grabbed) {
|
if (!grabbed) {
|
||||||
|
|
|
@ -534,7 +534,7 @@ final class WindowsKeycodes {
|
||||||
return Keyboard.KEY_NUMPADCOMMA;
|
return Keyboard.KEY_NUMPADCOMMA;
|
||||||
case VK_DIVIDE:
|
case VK_DIVIDE:
|
||||||
return Keyboard.KEY_DIVIDE;
|
return Keyboard.KEY_DIVIDE;
|
||||||
case VK_PRINT:
|
case VK_SNAPSHOT:
|
||||||
return Keyboard.KEY_SYSRQ;
|
return Keyboard.KEY_SYSRQ;
|
||||||
case VK_RMENU:
|
case VK_RMENU:
|
||||||
return Keyboard.KEY_RMENU;
|
return Keyboard.KEY_RMENU;
|
||||||
|
|
Loading…
Reference in New Issue