mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-28 21:54:03 +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
|
// deal with certain virtual keys specially
|
||||||
switch (vk) {
|
switch (vk) {
|
||||||
case VK_SHIFT:
|
case VK_SHIFT:
|
||||||
if (MapVirtualKey(VK_RSHIFT, 0) == i) {
|
|
||||||
vk = VK_RSHIFT;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vk = VK_LSHIFT;
|
vk = VK_LSHIFT;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VK_CONTROL:
|
case VK_CONTROL:
|
||||||
|
@ -119,6 +119,12 @@ static const CKeyEntry s_controlKeys[] = {
|
|||||||
COSXKeyState::COSXKeyState() :
|
COSXKeyState::COSXKeyState() :
|
||||||
m_deadKeyState(0)
|
m_deadKeyState(0)
|
||||||
{
|
{
|
||||||
|
// initialize modifier key values
|
||||||
|
shiftPressed = false;
|
||||||
|
controlPressed = false;
|
||||||
|
altPressed = false;
|
||||||
|
superPressed = false;
|
||||||
|
capsPressed = false;
|
||||||
|
|
||||||
// build virtual key map
|
// build virtual key map
|
||||||
for (size_t i = 0; i < sizeof(s_controlKeys) /
|
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"));
|
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);
|
CGEventPost(kCGHIDEventTap, ref);
|
||||||
|
|
||||||
// add a delay if client data isn't zero
|
// add a delay if client data isn't zero
|
||||||
|
@ -201,6 +201,13 @@ private:
|
|||||||
mutable UInt32 m_deadKeyState;
|
mutable UInt32 m_deadKeyState;
|
||||||
GroupList m_groups;
|
GroupList m_groups;
|
||||||
GroupMap m_groupMap;
|
GroupMap m_groupMap;
|
||||||
|
|
||||||
|
// Hold the current state of modifier keys
|
||||||
|
bool shiftPressed;
|
||||||
|
bool controlPressed;
|
||||||
|
bool altPressed;
|
||||||
|
bool superPressed;
|
||||||
|
bool capsPressed;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -107,10 +107,11 @@ CXWindowsScreen::CXWindowsScreen(const char* displayName, bool isPrimary, int mo
|
|||||||
s_screen = this;
|
s_screen = this;
|
||||||
|
|
||||||
// initializes Xlib support for concurrent threads.
|
// initializes Xlib support for concurrent threads.
|
||||||
if (XInitThreads() == 0)
|
// ...which breaks badly on RHEL for some reason, upstream #194
|
||||||
{
|
//if (XInitThreads() == 0)
|
||||||
throw XArch("XInitThreads() returned zero");
|
//{
|
||||||
}
|
// throw XArch("XInitThreads() returned zero");
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
// set the X I/O error handler so we catch the display disconnecting
|
// set the X I/O error handler so we catch the display disconnecting
|
||||||
|
Loading…
Reference in New Issue
Block a user