mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-28 14:55:38 +08:00
Changes from mercurial repository.
This commit is contained in:
@@ -297,14 +297,14 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
||||
// map the key event to a character. we have to put the dead
|
||||
// key back first and this has the side effect of removing it.
|
||||
if (g_deadVirtKey != 0) {
|
||||
if(ToAscii(g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
if(ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
g_deadKeyState, &c, flags) == 2)
|
||||
{
|
||||
// If ToAscii returned 2, it means that we accidentally removed
|
||||
// a double dead key instead of restoring it. Thus, we call
|
||||
// ToAscii again with the same parameters to restore the
|
||||
// internal dead key state.
|
||||
ToAscii(g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
g_deadKeyState, &c, flags);
|
||||
|
||||
// We need to keep track of this because g_deadVirtKey will be
|
||||
@@ -315,7 +315,7 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
|
||||
UINT scanCode = ((lParam & 0x10ff0000u) >> 16);
|
||||
int n = ToAscii(wParam, scanCode, keys, &c, flags);
|
||||
int n = ToAscii((UINT)wParam, scanCode, keys, &c, flags);
|
||||
|
||||
// if mapping failed and ctrl and alt are pressed then try again
|
||||
// with both not pressed. this handles the case where ctrl and
|
||||
@@ -329,10 +329,10 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
||||
PostThreadMessage(g_threadID, SYNERGY_MSG_DEBUG,
|
||||
wParam | 0x05000000, lParam);
|
||||
if (g_deadVirtKey != 0) {
|
||||
if(ToAscii(g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
if(ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
g_deadKeyState, &c, flags) == 2)
|
||||
{
|
||||
ToAscii(g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
g_deadKeyState, &c, flags);
|
||||
g_deadRelease = g_deadVirtKey;
|
||||
}
|
||||
@@ -347,7 +347,7 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
||||
keys2[VK_LMENU] = 0;
|
||||
keys2[VK_RMENU] = 0;
|
||||
keys2[VK_MENU] = 0;
|
||||
n = ToAscii(wParam, scanCode, keys2, &c, flags);
|
||||
n = ToAscii((UINT)wParam, scanCode, keys2, &c, flags);
|
||||
}
|
||||
|
||||
PostThreadMessage(g_threadID, SYNERGY_MSG_DEBUG,
|
||||
@@ -378,12 +378,12 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
||||
case 0:
|
||||
// key doesn't map to a character. this can happen if
|
||||
// non-character keys are pressed after a dead key.
|
||||
charAndVirtKey = makeKeyMsg(wParam, (char)0, noAltGr);
|
||||
charAndVirtKey = makeKeyMsg((UINT)wParam, (char)0, noAltGr);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// key maps to a character composed with dead key
|
||||
charAndVirtKey = makeKeyMsg(wParam, (char)LOBYTE(c), noAltGr);
|
||||
charAndVirtKey = makeKeyMsg((UINT)wParam, (char)LOBYTE(c), noAltGr);
|
||||
clearDeadKey = true;
|
||||
break;
|
||||
|
||||
@@ -391,14 +391,14 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
||||
// previous dead key not composed. send a fake key press
|
||||
// and release for the dead key to our window.
|
||||
WPARAM deadCharAndVirtKey =
|
||||
makeKeyMsg(g_deadVirtKey, (char)LOBYTE(c), noAltGr);
|
||||
makeKeyMsg((UINT)g_deadVirtKey, (char)LOBYTE(c), noAltGr);
|
||||
PostThreadMessage(g_threadID, SYNERGY_MSG_KEY,
|
||||
deadCharAndVirtKey, g_deadLParam & 0x7fffffffu);
|
||||
PostThreadMessage(g_threadID, SYNERGY_MSG_KEY,
|
||||
deadCharAndVirtKey, g_deadLParam | 0x80000000u);
|
||||
|
||||
// use uncomposed character
|
||||
charAndVirtKey = makeKeyMsg(wParam, (char)HIBYTE(c), noAltGr);
|
||||
charAndVirtKey = makeKeyMsg((UINT)wParam, (char)HIBYTE(c), noAltGr);
|
||||
clearDeadKey = true;
|
||||
break;
|
||||
}
|
||||
@@ -406,7 +406,7 @@ doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
||||
|
||||
// put back the dead key, if any, for the application to use
|
||||
if (g_deadVirtKey != 0) {
|
||||
ToAscii(g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
|
||||
g_deadKeyState, &c, flags);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user