mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-27 21:22:12 +03:00
Merge 1.4.1 r594:595 into trunk
This commit is contained in:
parent
a8eb2a3bfd
commit
b62582444e
@ -925,12 +925,7 @@ CMSWindowsKeyState::getKeyMap(CKeyMap& keyMap)
|
||||
// deal with certain virtual keys specially
|
||||
switch (vk) {
|
||||
case VK_SHIFT:
|
||||
if (MapVirtualKey(VK_RSHIFT, 0) == i) {
|
||||
vk = VK_RSHIFT;
|
||||
}
|
||||
else {
|
||||
vk = VK_LSHIFT;
|
||||
}
|
||||
vk = VK_LSHIFT;
|
||||
break;
|
||||
|
||||
case VK_CONTROL:
|
||||
|
@ -119,6 +119,12 @@ static const CKeyEntry s_controlKeys[] = {
|
||||
COSXKeyState::COSXKeyState() :
|
||||
m_deadKeyState(0)
|
||||
{
|
||||
// initialize modifier key values
|
||||
shiftPressed = false;
|
||||
controlPressed = false;
|
||||
altPressed = false;
|
||||
superPressed = false;
|
||||
capsPressed = false;
|
||||
|
||||
// build virtual key map
|
||||
for (size_t i = 0; i < sizeof(s_controlKeys) /
|
||||
@ -379,6 +385,27 @@ COSXKeyState::fakeKey(const Keystroke& keystroke)
|
||||
LOG((CLOG_CRIT "unable to create keyboard event for keystroke"));
|
||||
}
|
||||
|
||||
UInt32 vk = mapKeyButtonToVirtualKey(keystroke.m_data.m_button.m_button);
|
||||
UInt32 modifierDown = keystroke.m_data.m_button.m_press;
|
||||
|
||||
// check the key for specials and store the value (persistent until changed)
|
||||
if (vk == s_shiftVK) shiftPressed=modifierDown;
|
||||
if (vk == s_controlVK) controlPressed=modifierDown;
|
||||
if (vk == s_altVK) altPressed=modifierDown;
|
||||
if (vk == s_superVK) superPressed=modifierDown;
|
||||
if (vk == s_capsLockVK) capsPressed=modifierDown;
|
||||
|
||||
//Set the event flags for special keys - see following link:
|
||||
//http://stackoverflow.com/questions/2008126/cgeventpost-possible-bug-when-simulating-keyboard-events
|
||||
CGEventFlags modifiers = 0;
|
||||
if (shiftPressed) modifiers |= kCGEventFlagMaskShift;
|
||||
if (controlPressed) modifiers |= kCGEventFlagMaskControl;
|
||||
if (altPressed) modifiers |= kCGEventFlagMaskAlternate;
|
||||
if (superPressed) modifiers |= kCGEventFlagMaskCommand;
|
||||
if (capsPressed) modifiers |= kCGEventFlagMaskAlphaShift;
|
||||
|
||||
CGEventSetFlags(ref, modifiers);
|
||||
|
||||
CGEventPost(kCGHIDEventTap, ref);
|
||||
|
||||
// add a delay if client data isn't zero
|
||||
|
@ -201,6 +201,13 @@ private:
|
||||
mutable UInt32 m_deadKeyState;
|
||||
GroupList m_groups;
|
||||
GroupMap m_groupMap;
|
||||
|
||||
// Hold the current state of modifier keys
|
||||
bool shiftPressed;
|
||||
bool controlPressed;
|
||||
bool altPressed;
|
||||
bool superPressed;
|
||||
bool capsPressed;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -107,10 +107,11 @@ CXWindowsScreen::CXWindowsScreen(const char* displayName, bool isPrimary, int mo
|
||||
s_screen = this;
|
||||
|
||||
// initializes Xlib support for concurrent threads.
|
||||
if (XInitThreads() == 0)
|
||||
{
|
||||
throw XArch("XInitThreads() returned zero");
|
||||
}
|
||||
// ...which breaks badly on RHEL for some reason, upstream #194
|
||||
//if (XInitThreads() == 0)
|
||||
//{
|
||||
// throw XArch("XInitThreads() returned zero");
|
||||
//}
|
||||
|
||||
|
||||
// set the X I/O error handler so we catch the display disconnecting
|
||||
|
Loading…
Reference in New Issue
Block a user