aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/platform')
-rw-r--r--src/lib/platform/CMakeLists.txt4
-rw-r--r--src/lib/platform/IMSWindowsClipboardFacade.h6
-rw-r--r--src/lib/platform/IOSXKeyResource.cpp6
-rw-r--r--src/lib/platform/IOSXKeyResource.h8
-rw-r--r--src/lib/platform/IXWindowsImpl.h58
-rw-r--r--src/lib/platform/ImmuneKeysReader.cpp2
-rw-r--r--src/lib/platform/ImmuneKeysReader.h4
-rw-r--r--src/lib/platform/MSWindowsClipboard.cpp6
-rw-r--r--src/lib/platform/MSWindowsClipboard.h4
-rw-r--r--src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp4
-rw-r--r--src/lib/platform/MSWindowsClipboardAnyTextConverter.h4
-rw-r--r--src/lib/platform/MSWindowsClipboardBitmapConverter.cpp4
-rw-r--r--src/lib/platform/MSWindowsClipboardBitmapConverter.h4
-rw-r--r--src/lib/platform/MSWindowsClipboardFacade.cpp4
-rw-r--r--src/lib/platform/MSWindowsClipboardFacade.h4
-rw-r--r--src/lib/platform/MSWindowsClipboardHTMLConverter.cpp4
-rw-r--r--src/lib/platform/MSWindowsClipboardHTMLConverter.h4
-rw-r--r--src/lib/platform/MSWindowsClipboardTextConverter.cpp4
-rw-r--r--src/lib/platform/MSWindowsClipboardTextConverter.h4
-rw-r--r--src/lib/platform/MSWindowsClipboardUTF16Converter.cpp4
-rw-r--r--src/lib/platform/MSWindowsClipboardUTF16Converter.h4
-rw-r--r--src/lib/platform/MSWindowsDebugOutputter.cpp4
-rw-r--r--src/lib/platform/MSWindowsDebugOutputter.h6
-rw-r--r--src/lib/platform/MSWindowsDesks.cpp25
-rw-r--r--src/lib/platform/MSWindowsDesks.h13
-rw-r--r--src/lib/platform/MSWindowsDropTarget.cpp10
-rw-r--r--src/lib/platform/MSWindowsDropTarget.h8
-rw-r--r--src/lib/platform/MSWindowsEventQueueBuffer.cpp4
-rw-r--r--src/lib/platform/MSWindowsEventQueueBuffer.h4
-rw-r--r--src/lib/platform/MSWindowsHook.cpp66
-rw-r--r--src/lib/platform/MSWindowsHook.h4
-rw-r--r--src/lib/platform/MSWindowsHookResource.cpp2
-rw-r--r--src/lib/platform/MSWindowsHookResource.h2
-rw-r--r--src/lib/platform/MSWindowsKeyState.cpp105
-rw-r--r--src/lib/platform/MSWindowsKeyState.h6
-rw-r--r--src/lib/platform/MSWindowsScreen.cpp92
-rw-r--r--src/lib/platform/MSWindowsScreen.h19
-rw-r--r--src/lib/platform/MSWindowsScreenSaver.cpp17
-rw-r--r--src/lib/platform/MSWindowsScreenSaver.h8
-rw-r--r--src/lib/platform/MSWindowsSession.cpp14
-rw-r--r--src/lib/platform/MSWindowsSession.h6
-rw-r--r--src/lib/platform/MSWindowsUtil.cpp4
-rw-r--r--src/lib/platform/MSWindowsUtil.h4
-rw-r--r--src/lib/platform/MSWindowsWatchdog.cpp60
-rw-r--r--src/lib/platform/MSWindowsWatchdog.h8
-rw-r--r--src/lib/platform/OSXClipboard.cpp14
-rw-r--r--src/lib/platform/OSXClipboard.h4
-rw-r--r--src/lib/platform/OSXClipboardAnyTextConverter.cpp4
-rw-r--r--src/lib/platform/OSXClipboardAnyTextConverter.h4
-rw-r--r--src/lib/platform/OSXClipboardHTMLConverter.cpp2
-rw-r--r--src/lib/platform/OSXClipboardTextConverter.cpp12
-rw-r--r--src/lib/platform/OSXClipboardTextConverter.h4
-rw-r--r--src/lib/platform/OSXClipboardUTF16Converter.cpp4
-rw-r--r--src/lib/platform/OSXClipboardUTF16Converter.h4
-rw-r--r--src/lib/platform/OSXDragSimulator.h2
-rw-r--r--src/lib/platform/OSXDragSimulator.mm (renamed from src/lib/platform/OSXDragSimulator.m)24
-rw-r--r--src/lib/platform/OSXDragView.mm (renamed from src/lib/platform/OSXDragView.m)0
-rw-r--r--src/lib/platform/OSXEventQueueBuffer.cpp18
-rw-r--r--src/lib/platform/OSXEventQueueBuffer.h4
-rw-r--r--src/lib/platform/OSXKeyState.cpp74
-rw-r--r--src/lib/platform/OSXKeyState.h8
-rw-r--r--src/lib/platform/OSXMediaKeySimulator.mm (renamed from src/lib/platform/OSXMediaKeySimulator.m)4
-rw-r--r--src/lib/platform/OSXMediaKeySupport.mm (renamed from src/lib/platform/OSXMediaKeySupport.m)4
-rw-r--r--src/lib/platform/OSXPasteboardPeeker.h2
-rw-r--r--src/lib/platform/OSXPasteboardPeeker.mm (renamed from src/lib/platform/OSXPasteboardPeeker.m)0
-rw-r--r--src/lib/platform/OSXScreen.h48
-rw-r--r--src/lib/platform/OSXScreen.mm218
-rw-r--r--src/lib/platform/OSXScreenSaver.cpp14
-rw-r--r--src/lib/platform/OSXScreenSaver.h8
-rw-r--r--src/lib/platform/OSXScreenSaverControl.h2
-rw-r--r--src/lib/platform/OSXScreenSaverUtil.h4
-rw-r--r--src/lib/platform/OSXScreenSaverUtil.mm (renamed from src/lib/platform/OSXScreenSaverUtil.m)0
-rw-r--r--src/lib/platform/OSXUchrKeyResource.cpp4
-rw-r--r--src/lib/platform/OSXUchrKeyResource.h12
-rw-r--r--src/lib/platform/XWindowsClipboard.cpp8
-rw-r--r--src/lib/platform/XWindowsClipboard.h10
-rw-r--r--src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp4
-rw-r--r--src/lib/platform/XWindowsClipboardAnyBitmapConverter.h4
-rw-r--r--src/lib/platform/XWindowsClipboardBMPConverter.cpp4
-rw-r--r--src/lib/platform/XWindowsClipboardBMPConverter.h4
-rw-r--r--src/lib/platform/XWindowsClipboardHTMLConverter.cpp4
-rw-r--r--src/lib/platform/XWindowsClipboardHTMLConverter.h4
-rw-r--r--src/lib/platform/XWindowsClipboardTextConverter.cpp4
-rw-r--r--src/lib/platform/XWindowsClipboardTextConverter.h4
-rw-r--r--src/lib/platform/XWindowsClipboardUCS2Converter.cpp4
-rw-r--r--src/lib/platform/XWindowsClipboardUCS2Converter.h4
-rw-r--r--src/lib/platform/XWindowsClipboardUTF8Converter.cpp4
-rw-r--r--src/lib/platform/XWindowsClipboardUTF8Converter.h4
-rw-r--r--src/lib/platform/XWindowsEventQueueBuffer.cpp8
-rw-r--r--src/lib/platform/XWindowsEventQueueBuffer.h10
-rw-r--r--src/lib/platform/XWindowsKeyState.cpp20
-rw-r--r--src/lib/platform/XWindowsKeyState.h24
-rw-r--r--src/lib/platform/XWindowsScreen.cpp12
-rw-r--r--src/lib/platform/XWindowsScreen.h10
-rw-r--r--src/lib/platform/XWindowsScreenSaver.cpp28
-rw-r--r--src/lib/platform/XWindowsScreenSaver.h12
-rw-r--r--src/lib/platform/XWindowsUtil.cpp49
-rw-r--r--src/lib/platform/XWindowsUtil.h12
-rw-r--r--src/lib/platform/synwinhk.h4
99 files changed, 674 insertions, 720 deletions
diff --git a/src/lib/platform/CMakeLists.txt b/src/lib/platform/CMakeLists.txt
index a1718a1..75551b7 100644
--- a/src/lib/platform/CMakeLists.txt
+++ b/src/lib/platform/CMakeLists.txt
@@ -1,11 +1,11 @@
# barrier -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
-#
+#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file LICENSE that should have accompanied this file.
-#
+#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/IMSWindowsClipboardFacade.h b/src/lib/platform/IMSWindowsClipboardFacade.h
index 03c6248..d848184 100644
--- a/src/lib/platform/IMSWindowsClipboardFacade.h
+++ b/src/lib/platform/IMSWindowsClipboardFacade.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -33,4 +33,4 @@ public:
virtual ~IMSWindowsClipboardFacade() { }
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/lib/platform/IOSXKeyResource.cpp b/src/lib/platform/IOSXKeyResource.cpp
index 0c5abe7..1866968 100644
--- a/src/lib/platform/IOSXKeyResource.cpp
+++ b/src/lib/platform/IOSXKeyResource.cpp
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2016 Symless Ltd.
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -128,7 +128,7 @@ IOSXKeyResource::getKeyID(UInt8 c)
// encoding with char value 214). if it did then make no key,
// otherwise CFStringCreateMutableCopy() will crash.
if (cfString == NULL) {
- return kKeyNone;
+ return kKeyNone;
}
// convert to precomposed
diff --git a/src/lib/platform/IOSXKeyResource.h b/src/lib/platform/IOSXKeyResource.h
index fc190ef..b032bd9 100644
--- a/src/lib/platform/IOSXKeyResource.h
+++ b/src/lib/platform/IOSXKeyResource.h
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2016 Symless Ltd.
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -27,10 +27,10 @@ public:
virtual UInt32 getNumButtons() const = 0;
virtual UInt32 getTableForModifier(UInt32 mask) const = 0;
virtual KeyID getKey(UInt32 table, UInt32 button) const = 0;
-
+
// Convert a character in the current script to the equivalent KeyID
static KeyID getKeyID(UInt8);
-
+
// Convert a unicode character to the equivalent KeyID.
static KeyID unicharToKeyID(UniChar);
};
diff --git a/src/lib/platform/IXWindowsImpl.h b/src/lib/platform/IXWindowsImpl.h
index ddcaf2f..37c59b2 100644
--- a/src/lib/platform/IXWindowsImpl.h
+++ b/src/lib/platform/IXWindowsImpl.h
@@ -3,39 +3,31 @@
#include "config.h"
-#if X_DISPLAY_MISSING
-# error X11 is required to build barrier
-#else
-# include <X11/X.h>
-# include <X11/Xutil.h>
-# define XK_MISCELLANY
-# define XK_XKB_KEYS
-# include <X11/keysymdef.h>
-# if HAVE_X11_EXTENSIONS_DPMS_H
- extern "C" {
-# include <X11/extensions/dpms.h>
- }
-# endif
-# if HAVE_X11_EXTENSIONS_XTEST_H
-# include <X11/extensions/XTest.h>
-# else
-# error The XTest extension is required to build barrier
-# endif
-# if HAVE_X11_EXTENSIONS_XINERAMA_H
- // Xinerama.h may lack extern "C" for inclusion by C++
- extern "C" {
-# include <X11/extensions/Xinerama.h>
- }
-# endif
-# if HAVE_X11_EXTENSIONS_XRANDR_H
-# include <X11/extensions/Xrandr.h>
-# endif
-# if HAVE_XKB_EXTENSION
-# include <X11/XKBlib.h>
-# endif
-# ifdef HAVE_XI2
-# include <X11/extensions/XInput2.h>
-# endif
+#include <X11/X.h>
+#include <X11/Xutil.h>
+#define XK_MISCELLANY
+#define XK_XKB_KEYS
+#include <X11/keysymdef.h>
+#if HAVE_X11_EXTENSIONS_DPMS_H
+ extern "C" {
+# include <X11/extensions/dpms.h>
+ }
+#endif
+#include <X11/extensions/XTest.h>
+#if HAVE_X11_EXTENSIONS_XINERAMA_H
+ // Xinerama.h may lack extern "C" for inclusion by C++
+ extern "C" {
+# include <X11/extensions/Xinerama.h>
+ }
+#endif
+#if HAVE_X11_EXTENSIONS_XRANDR_H
+# include <X11/extensions/Xrandr.h>
+#endif
+#if HAVE_XKB_EXTENSION
+# include <X11/XKBlib.h>
+#endif
+#ifdef HAVE_XI2
+# include <X11/extensions/XInput2.h>
#endif
class IXWindowsImpl {
diff --git a/src/lib/platform/ImmuneKeysReader.cpp b/src/lib/platform/ImmuneKeysReader.cpp
index 72baed3..eaeedc1 100644
--- a/src/lib/platform/ImmuneKeysReader.cpp
+++ b/src/lib/platform/ImmuneKeysReader.cpp
@@ -50,4 +50,4 @@ static void add_key(const char * const buffer, std::vector<DWORD> &keys)
}
}
return true;
-} \ No newline at end of file
+}
diff --git a/src/lib/platform/ImmuneKeysReader.h b/src/lib/platform/ImmuneKeysReader.h
index b46cbbe..536dd45 100644
--- a/src/lib/platform/ImmuneKeysReader.h
+++ b/src/lib/platform/ImmuneKeysReader.h
@@ -27,8 +27,4 @@ class ImmuneKeysReader
{
public:
static bool get_list(const char * const path, std::vector<DWORD> &keys, std::string &badLine);
-
-private:
- // static class
- explicit ImmuneKeysReader() {}
};
diff --git a/src/lib/platform/MSWindowsClipboard.cpp b/src/lib/platform/MSWindowsClipboard.cpp
index 20445d4..fa59c3e 100644
--- a/src/lib/platform/MSWindowsClipboard.cpp
+++ b/src/lib/platform/MSWindowsClipboard.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -70,7 +70,7 @@ MSWindowsClipboard::emptyUnowned()
// empty the clipboard (and take ownership)
if (!EmptyClipboard()) {
- // unable to cause this in integ tests, but this error has never
+ // unable to cause this in integ tests, but this error has never
// actually been reported by users.
LOG((CLOG_DEBUG "failed to grab clipboard"));
return false;
diff --git a/src/lib/platform/MSWindowsClipboard.h b/src/lib/platform/MSWindowsClipboard.h
index 35ccb56..415f31c 100644
--- a/src/lib/platform/MSWindowsClipboard.h
+++ b/src/lib/platform/MSWindowsClipboard.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp b/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp
index 85a7dbe..e46b1de 100644
--- a/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp
+++ b/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardAnyTextConverter.h b/src/lib/platform/MSWindowsClipboardAnyTextConverter.h
index 622d281..463a24a 100644
--- a/src/lib/platform/MSWindowsClipboardAnyTextConverter.h
+++ b/src/lib/platform/MSWindowsClipboardAnyTextConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp b/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp
index 7d38fda..bac8cb6 100644
--- a/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp
+++ b/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardBitmapConverter.h b/src/lib/platform/MSWindowsClipboardBitmapConverter.h
index 2733884..9ca27ee 100644
--- a/src/lib/platform/MSWindowsClipboardBitmapConverter.h
+++ b/src/lib/platform/MSWindowsClipboardBitmapConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardFacade.cpp b/src/lib/platform/MSWindowsClipboardFacade.cpp
index 3b6478f..a6e1207 100644
--- a/src/lib/platform/MSWindowsClipboardFacade.cpp
+++ b/src/lib/platform/MSWindowsClipboardFacade.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardFacade.h b/src/lib/platform/MSWindowsClipboardFacade.h
index a95e835..cdbd796 100644
--- a/src/lib/platform/MSWindowsClipboardFacade.h
+++ b/src/lib/platform/MSWindowsClipboardFacade.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp b/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp
index a1f1212..d2ac3dd 100644
--- a/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp
+++ b/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardHTMLConverter.h b/src/lib/platform/MSWindowsClipboardHTMLConverter.h
index 51607a7..87d7fda 100644
--- a/src/lib/platform/MSWindowsClipboardHTMLConverter.h
+++ b/src/lib/platform/MSWindowsClipboardHTMLConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardTextConverter.cpp b/src/lib/platform/MSWindowsClipboardTextConverter.cpp
index 1500e7e..15f2cc2 100644
--- a/src/lib/platform/MSWindowsClipboardTextConverter.cpp
+++ b/src/lib/platform/MSWindowsClipboardTextConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardTextConverter.h b/src/lib/platform/MSWindowsClipboardTextConverter.h
index 6e265a2..4ebfa36 100644
--- a/src/lib/platform/MSWindowsClipboardTextConverter.h
+++ b/src/lib/platform/MSWindowsClipboardTextConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp b/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp
index 4b72717..52c6d4c 100644
--- a/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp
+++ b/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsClipboardUTF16Converter.h b/src/lib/platform/MSWindowsClipboardUTF16Converter.h
index 1a9d435..7314678 100644
--- a/src/lib/platform/MSWindowsClipboardUTF16Converter.h
+++ b/src/lib/platform/MSWindowsClipboardUTF16Converter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsDebugOutputter.cpp b/src/lib/platform/MSWindowsDebugOutputter.cpp
index 43c38ad..22442ad 100644
--- a/src/lib/platform/MSWindowsDebugOutputter.cpp
+++ b/src/lib/platform/MSWindowsDebugOutputter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsDebugOutputter.h b/src/lib/platform/MSWindowsDebugOutputter.h
index 01fd97e..e8ba5e6 100644
--- a/src/lib/platform/MSWindowsDebugOutputter.h
+++ b/src/lib/platform/MSWindowsDebugOutputter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
+
#pragma once
#include "base/ILogOutputter.h"
diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp
index 768ccb4..d126e13 100644
--- a/src/lib/platform/MSWindowsDesks.cpp
+++ b/src/lib/platform/MSWindowsDesks.cpp
@@ -3,11 +3,11 @@
* Copyright (C) 2018 Debauchee Open Source Group
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -27,9 +27,7 @@
#include "arch/win32/ArchMiscWindows.h"
#include "base/Log.h"
#include "base/IEventQueue.h"
-#include "base/IJob.h"
#include "base/TMethodEventJob.h"
-#include "base/TMethodJob.h"
#include "base/IEventQueue.h"
#include <malloc.h>
@@ -97,10 +95,9 @@
// MSWindowsDesks
//
-MSWindowsDesks::MSWindowsDesks(
- bool isPrimary, bool noHooks,
+MSWindowsDesks::MSWindowsDesks(bool isPrimary, bool noHooks,
const IScreenSaver* screensaver, IEventQueue* events,
- IJob* updateKeys, bool stopOnDeskSwitch) :
+ const std::function<void()>& updateKeys, bool stopOnDeskSwitch) :
m_isPrimary(isPrimary),
m_noHooks(noHooks),
m_isOnScreen(m_isPrimary),
@@ -130,7 +127,6 @@ MSWindowsDesks::~MSWindowsDesks()
disable();
destroyClass(m_deskClass);
destroyCursor(m_cursor);
- delete m_updateKeys;
}
void
@@ -602,13 +598,11 @@ MSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout)
}
}
-void
-MSWindowsDesks::deskThread(void* vdesk)
+void MSWindowsDesks::desk_thread(Desk* desk)
{
MSG msg;
// use given desktop for this thread
- Desk* desk = static_cast<Desk*>(vdesk);
desk->m_threadID = GetCurrentThreadId();
desk->m_window = NULL;
desk->m_foregroundWindow = NULL;
@@ -709,7 +703,7 @@ MSWindowsDesks::deskThread(void* vdesk)
}
case BARRIER_MSG_SYNC_KEYS:
- m_updateKeys->run();
+ m_updateKeys();
break;
case BARRIER_MSG_SCREENSAVER:
@@ -752,8 +746,7 @@ MSWindowsDesks::Desk* MSWindowsDesks::addDesk(const std::string& name, HDESK hde
desk->m_name = name;
desk->m_desk = hdesk;
desk->m_targetID = GetCurrentThreadId();
- desk->m_thread = new Thread(new TMethodJob<MSWindowsDesks>(
- this, &MSWindowsDesks::deskThread, desk));
+ desk->m_thread = new Thread([this, desk]() { desk_thread(desk); });
waitForDesk();
m_desks.insert(std::make_pair(name, desk));
return desk;
@@ -793,7 +786,7 @@ MSWindowsDesks::checkDesk()
desk = index->second;
}
- // if we are told to shut down on desk switch, and this is not the
+ // if we are told to shut down on desk switch, and this is not the
// first switch, then shut down.
if (m_stopOnDeskSwitch && m_activeDesk != NULL && name != m_activeDeskName) {
LOG((CLOG_DEBUG "shutting down because of desk switch to \"%s\"", name.c_str()));
@@ -803,7 +796,7 @@ MSWindowsDesks::checkDesk()
// if active desktop changed then tell the old and new desk threads
// about the change. don't switch desktops when the screensaver is
- // active becaue we'd most likely switch to the screensaver desktop
+ // active because we'd most likely switch to the screensaver desktop
// which would have the side effect of forcing the screensaver to
// stop.
if (name != m_activeDeskName && !m_screensaver->isActive()) {
diff --git a/src/lib/platform/MSWindowsDesks.h b/src/lib/platform/MSWindowsDesks.h
index 6e5e709..6292f98 100644
--- a/src/lib/platform/MSWindowsDesks.h
+++ b/src/lib/platform/MSWindowsDesks.h
@@ -3,11 +3,11 @@
* Copyright (C) 2018 Debauchee Open Source Group
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -26,15 +26,16 @@
#include "mt/CondVar.h"
#include "mt/Mutex.h"
#include "common/stdmap.h"
+#include <functional>
#include <string>
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
+
class Event;
class EventQueueTimer;
class Thread;
-class IJob;
class IScreenSaver;
class IEventQueue;
@@ -68,7 +69,7 @@ public:
MSWindowsDesks(
bool isPrimary, bool noHooks,
const IScreenSaver* screensaver, IEventQueue* events,
- IJob* updateKeys, bool stopOnDeskSwitch);
+ const std::function<void()>& updateKeys, bool stopOnDeskSwitch);
~MSWindowsDesks();
//! @name manipulators
@@ -219,7 +220,7 @@ private:
void deskMouseRelativeMove(SInt32 dx, SInt32 dy) const;
void deskEnter(Desk* desk);
void deskLeave(Desk* desk, HKL keyLayout);
- void deskThread(void* vdesk);
+ void desk_thread(Desk* desk);
// desk switch checking and handling
Desk* addDesk(const std::string& name, HDESK hdesk);
@@ -284,7 +285,7 @@ private:
Desks m_desks;
// keyboard stuff
- IJob* m_updateKeys;
+ std::function<void()> m_updateKeys;
HKL m_keyLayout;
// options
diff --git a/src/lib/platform/MSWindowsDropTarget.cpp b/src/lib/platform/MSWindowsDropTarget.cpp
index d647808..095ab53 100644
--- a/src/lib/platform/MSWindowsDropTarget.cpp
+++ b/src/lib/platform/MSWindowsDropTarget.cpp
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2014-2016 Symless Ltd.
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -53,7 +53,7 @@ MSWindowsDropTarget::DragEnter(IDataObject* dataObject, DWORD keyState, POINTL p
if (m_allowDrop) {
getDropData(dataObject);
}
-
+
*effect = DROPEFFECT_NONE;
return S_OK;
@@ -132,7 +132,7 @@ getDropData(IDataObject* dataObject)
wcstombs(filename, wcData, wcslen(wcData));
MSWindowsDropTarget::instance().setDraggingFilename(filename);
-
+
GlobalUnlock(stgMed.hGlobal);
// release the data using the COM API
@@ -167,7 +167,7 @@ ULONG __stdcall
MSWindowsDropTarget::Release(void)
{
LONG count = InterlockedDecrement(&m_refCount);
-
+
if (count == 0) {
delete this;
return 0;
diff --git a/src/lib/platform/MSWindowsDropTarget.h b/src/lib/platform/MSWindowsDropTarget.h
index 6d60845..6c3bf69 100644
--- a/src/lib/platform/MSWindowsDropTarget.h
+++ b/src/lib/platform/MSWindowsDropTarget.h
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2014-2016 Symless Ltd.
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -44,7 +44,7 @@ public:
std::string getDraggingFilename();
void clearDraggingFilename();
- static MSWindowsDropTarget&
+ static MSWindowsDropTarget&
instance();
private:
@@ -53,7 +53,7 @@ private:
long m_refCount;
bool m_allowDrop;
std::string m_dragFilename;
-
+
static MSWindowsDropTarget*
s_instance;
};
diff --git a/src/lib/platform/MSWindowsEventQueueBuffer.cpp b/src/lib/platform/MSWindowsEventQueueBuffer.cpp
index 3111367..709d814 100644
--- a/src/lib/platform/MSWindowsEventQueueBuffer.cpp
+++ b/src/lib/platform/MSWindowsEventQueueBuffer.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsEventQueueBuffer.h b/src/lib/platform/MSWindowsEventQueueBuffer.h
index bc9bde1..6f918d4 100644
--- a/src/lib/platform/MSWindowsEventQueueBuffer.h
+++ b/src/lib/platform/MSWindowsEventQueueBuffer.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsHook.cpp b/src/lib/platform/MSWindowsHook.cpp
index b9b9740..3230d24 100644
--- a/src/lib/platform/MSWindowsHook.cpp
+++ b/src/lib/platform/MSWindowsHook.cpp
@@ -3,11 +3,11 @@
* Copyright (C) 2018 Debauchee Open Source Group
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2011 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -56,14 +56,13 @@ static BYTE g_deadKeyState[256] = { 0 };
static BYTE g_keyState[256] = { 0 };
static bool g_fakeServerInput = false;
static std::vector<DWORD> g_immuneKeys;
-
-static const std::string ImmuneKeysPath = DataDirectories::profile() + "\\ImmuneKeys.txt";
+static std::string g_immuneKeysPath;
static std::vector<DWORD> immune_keys_list()
{
std::vector<DWORD> keys;
std::string badLine;
- if (!ImmuneKeysReader::get_list(ImmuneKeysPath.c_str(), keys, badLine))
+ if (!ImmuneKeysReader::get_list(g_immuneKeysPath.c_str(), keys, badLine))
LOG((CLOG_ERR "Reading immune keys stopped at: %s", badLine.c_str()));
return keys;
}
@@ -144,9 +143,9 @@ keyboardGetState(BYTE keys[256], DWORD vkCode, bool kf_up)
static
WPARAM
-makeKeyMsg(UINT virtKey, char c, bool noAltGr)
+makeKeyMsg(UINT virtKey, WCHAR wc, bool noAltGr)
{
- return MAKEWPARAM(MAKEWORD(virtKey & 0xff, (BYTE)c), noAltGr ? 1 : 0);
+ return MAKEWPARAM((WORD)wc, MAKEWORD(virtKey & 0xff, noAltGr ? 1 : 0));
}
static
@@ -193,7 +192,7 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam)
(lParam & 0x80000000u) != 0) {
g_deadRelease = 0;
PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG,
- wParam | 0x04000000, lParam);
+ wParam | 0x40000000, lParam);
return false;
}
@@ -245,19 +244,19 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam)
}
}
- WORD c = 0;
+ WCHAR wc[2] = { 0, 0 };
// 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((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
- g_deadKeyState, &c, flags) == 2) {
- // If ToAscii returned 2, it means that we accidentally removed
+ if (ToUnicode((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
+ g_deadKeyState, wc, 2, flags) == 2) {
+ // If ToUnicode 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
+ // ToUnicode again with the same parameters to restore the
// internal dead key state.
- ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
- g_deadKeyState, &c, flags);
+ ToUnicode((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
+ g_deadKeyState, wc, 2, flags);
// We need to keep track of this because g_deadVirtKey will be
// cleared later on; this would cause the dead key release to
@@ -267,7 +266,7 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam)
}
UINT scanCode = ((lParam & 0x10ff0000u) >> 16);
- int n = ToAscii((UINT)wParam, scanCode, keys, &c, flags);
+ int n = ToUnicode((UINT)wParam, scanCode, keys, wc, 2, flags);
// if mapping failed and ctrl and alt are pressed then try again
// with both not pressed. this handles the case where ctrl and
@@ -279,12 +278,12 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam)
if (n == 0 && (control & 0x80) != 0 && (menu & 0x80) != 0) {
noAltGr = true;
PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG,
- wParam | 0x05000000, lParam);
+ wParam | 0x50000000, lParam);
if (g_deadVirtKey != 0) {
- if (ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
- g_deadKeyState, &c, flags) == 2) {
- ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
- g_deadKeyState, &c, flags);
+ if (ToUnicode((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
+ g_deadKeyState, wc, 2, flags) == 2) {
+ ToUnicode((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
+ g_deadKeyState, wc, 2, flags);
g_deadRelease = g_deadVirtKey;
}
}
@@ -298,12 +297,12 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam)
keys2[VK_LMENU] = 0;
keys2[VK_RMENU] = 0;
keys2[VK_MENU] = 0;
- n = ToAscii((UINT)wParam, scanCode, keys2, &c, flags);
+ n = ToUnicode((UINT)wParam, scanCode, keys2, wc, 2, flags);
}
PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG,
- wParam | ((c & 0xff) << 8) |
- ((n & 0xff) << 16) | 0x06000000,
+ (wc[0] & 0xffff) | ((wParam & 0xff) << 16) |
+ ((n & 0xf) << 24) | 0x60000000,
lParam);
WPARAM charAndVirtKey = 0;
bool clearDeadKey = false;
@@ -329,12 +328,12 @@ keyboardHookHandler(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((UINT)wParam, (char)0, noAltGr);
+ charAndVirtKey = makeKeyMsg((UINT)wParam, (WCHAR)0, noAltGr);
break;
case 1:
// key maps to a character composed with dead key
- charAndVirtKey = makeKeyMsg((UINT)wParam, (char)LOBYTE(c), noAltGr);
+ charAndVirtKey = makeKeyMsg((UINT)wParam, wc[0], noAltGr);
clearDeadKey = true;
break;
@@ -342,14 +341,14 @@ keyboardHookHandler(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((UINT)g_deadVirtKey, (char)LOBYTE(c), noAltGr);
+ makeKeyMsg((UINT)g_deadVirtKey, wc[0], noAltGr);
PostThreadMessage(g_threadID, BARRIER_MSG_KEY,
deadCharAndVirtKey, g_deadLParam & 0x7fffffffu);
PostThreadMessage(g_threadID, BARRIER_MSG_KEY,
deadCharAndVirtKey, g_deadLParam | 0x80000000u);
// use uncomposed character
- charAndVirtKey = makeKeyMsg((UINT)wParam, (char)HIBYTE(c), noAltGr);
+ charAndVirtKey = makeKeyMsg((UINT)wParam, wc[1], noAltGr);
clearDeadKey = true;
break;
}
@@ -357,8 +356,8 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam)
// put back the dead key, if any, for the application to use
if (g_deadVirtKey != 0) {
- ToAscii((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
- g_deadKeyState, &c, flags);
+ ToUnicode((UINT)g_deadVirtKey, (g_deadLParam & 0x10ff0000u) >> 16,
+ g_deadKeyState, wc, 2, flags);
}
// clear out old dead key state
@@ -375,7 +374,7 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam)
// forwarding.
if (charAndVirtKey != 0) {
PostThreadMessage(g_threadID, BARRIER_MSG_DEBUG,
- charAndVirtKey | 0x07000000, lParam);
+ charAndVirtKey | 0x70000000, lParam);
PostThreadMessage(g_threadID, BARRIER_MSG_KEY, charAndVirtKey, lParam);
}
@@ -575,8 +574,9 @@ MSWindowsHook::install()
g_fakeServerInput = false;
// setup immune keys
+ g_immuneKeysPath = (barrier::DataDirectories::profile() / "ImmuneKeys.txt").u8string();
g_immuneKeys = immune_keys_list();
- LOG((CLOG_DEBUG "Found %u immune keys in %s", g_immuneKeys.size(), ImmuneKeysPath.c_str()));
+ LOG((CLOG_DEBUG "Found %u immune keys in %s", g_immuneKeys.size(), g_immuneKeysPath.c_str()));
#if NO_GRAB_KEYBOARD
// we only need the mouse hook
@@ -638,4 +638,4 @@ void
MSWindowsHook::uninstallScreenSaver()
{
g_hkMessage.unset();
-} \ No newline at end of file
+}
diff --git a/src/lib/platform/MSWindowsHook.h b/src/lib/platform/MSWindowsHook.h
index 7b2121c..c6d91a2 100644
--- a/src/lib/platform/MSWindowsHook.h
+++ b/src/lib/platform/MSWindowsHook.h
@@ -3,11 +3,11 @@
* Copyright (C) 2018 Debauchee Open Source Group
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2011 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsHookResource.cpp b/src/lib/platform/MSWindowsHookResource.cpp
index ced5ff1..c6349ab 100644
--- a/src/lib/platform/MSWindowsHookResource.cpp
+++ b/src/lib/platform/MSWindowsHookResource.cpp
@@ -30,4 +30,4 @@ bool WindowsHookResource::unset()
}
bool WindowsHookResource::is_set() const { return _hook != NULL; }
-WindowsHookResource::operator HHOOK() const { return _hook; } \ No newline at end of file
+WindowsHookResource::operator HHOOK() const { return _hook; }
diff --git a/src/lib/platform/MSWindowsHookResource.h b/src/lib/platform/MSWindowsHookResource.h
index b66c4b8..a3c9d83 100644
--- a/src/lib/platform/MSWindowsHookResource.h
+++ b/src/lib/platform/MSWindowsHookResource.h
@@ -17,4 +17,4 @@ public:
private:
HHOOK _hook;
-}; \ No newline at end of file
+};
diff --git a/src/lib/platform/MSWindowsKeyState.cpp b/src/lib/platform/MSWindowsKeyState.cpp
index 2f29f72..c723d19 100644
--- a/src/lib/platform/MSWindowsKeyState.cpp
+++ b/src/lib/platform/MSWindowsKeyState.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -21,7 +21,6 @@
#include "platform/MSWindowsDesks.h"
#include "mt/Thread.h"
#include "arch/win32/ArchMiscWindows.h"
-#include "base/FunctionJob.h"
#include "base/Log.h"
#include "base/String.h"
#include "base/IEventQueue.h"
@@ -61,17 +60,17 @@ const KeyID MSWindowsKeyState::s_virtualKey[] =
/* 0x012 */ { kKeyAlt_L }, // VK_MENU
/* 0x013 */ { kKeyPause }, // VK_PAUSE
/* 0x014 */ { kKeyCapsLock }, // VK_CAPITAL
- /* 0x015 */ { kKeyKana }, // VK_HANGUL, VK_KANA
- /* 0x016 */ { kKeyNone }, // undefined
+ /* 0x015 */ { kKeyNone }, // undefined
+ /* 0x016 */ { kKeyKana }, // VK_HANGUL, VK_KANA, VK_IME_ON
/* 0x017 */ { kKeyNone }, // VK_JUNJA
/* 0x018 */ { kKeyNone }, // VK_FINAL
/* 0x019 */ { kKeyKanzi }, // VK_HANJA, VK_KANJI
- /* 0x01a */ { kKeyNone }, // undefined
+ /* 0x01a */ { kKeyEisuToggle }, // VK_IME_OFF
/* 0x01b */ { kKeyEscape }, // VK_ESCAPE
- /* 0x01c */ { kKeyHenkan }, // VK_CONVERT
- /* 0x01d */ { kKeyNone }, // VK_NONCONVERT
- /* 0x01e */ { kKeyNone }, // VK_ACCEPT
- /* 0x01f */ { kKeyNone }, // VK_MODECHANGE
+ /* 0x01c */ { kKeyHenkan }, // VK_CONVERT
+ /* 0x01d */ { kKeyMuhenkan }, // VK_NONCONVERT
+ /* 0x01e */ { kKeyNone }, // VK_ACCEPT
+ /* 0x01f */ { kKeyNone }, // VK_MODECHANGE
/* 0x020 */ { kKeyNone }, // VK_SPACE
/* 0x021 */ { kKeyKP_PageUp }, // VK_PRIOR
/* 0x022 */ { kKeyKP_PageDown },// VK_NEXT
@@ -286,15 +285,15 @@ const KeyID MSWindowsKeyState::s_virtualKey[] =
/* 0x0f3 */ { kKeyZenkaku }, // VK_OEM_AUTO
/* 0x0f4 */ { kKeyZenkaku }, // VK_OEM_ENLW
/* 0x0f5 */ { kKeyNone }, // OEM specific
- /* 0x0f6 */ { kKeyNone }, // VK_ATTN
- /* 0x0f7 */ { kKeyNone }, // VK_CRSEL
- /* 0x0f8 */ { kKeyNone }, // VK_EXSEL
- /* 0x0f9 */ { kKeyNone }, // VK_EREOF
- /* 0x0fa */ { kKeyNone }, // VK_PLAY
- /* 0x0fb */ { kKeyNone }, // VK_ZOOM
+ /* 0x0f6 */ { kKeyNone }, // VK_ATTN
+ /* 0x0f7 */ { kKeyNone }, // VK_CRSEL
+ /* 0x0f8 */ { kKeyNone }, // VK_EXSEL
+ /* 0x0f9 */ { kKeyNone }, // VK_EREOF
+ /* 0x0fa */ { kKeyNone }, // VK_PLAY
+ /* 0x0fb */ { kKeyNone }, // VK_ZOOM
/* 0x0fc */ { kKeyNone }, // reserved
- /* 0x0fd */ { kKeyNone }, // VK_PA1
- /* 0x0fe */ { kKeyNone }, // VK_OEM_CLEAR
+ /* 0x0fd */ { kKeyNone }, // VK_PA1
+ /* 0x0fe */ { kKeyNone }, // VK_OEM_CLEAR
/* 0x0ff */ { kKeyNone }, // reserved
/* 0x100 */ { kKeyNone }, // reserved
@@ -320,15 +319,15 @@ const KeyID MSWindowsKeyState::s_virtualKey[] =
/* 0x114 */ { kKeyNone }, // VK_CAPITAL
/* 0x115 */ { kKeyHangul }, // VK_HANGUL
/* 0x116 */ { kKeyNone }, // undefined
- /* 0x117 */ { kKeyNone }, // VK_JUNJA
- /* 0x118 */ { kKeyNone }, // VK_FINAL
+ /* 0x117 */ { kKeyNone }, // VK_JUNJA
+ /* 0x118 */ { kKeyNone }, // VK_FINAL
/* 0x119 */ { kKeyHanja }, // VK_HANJA
/* 0x11a */ { kKeyNone }, // undefined
/* 0x11b */ { kKeyNone }, // VK_ESCAPE
- /* 0x11c */ { kKeyNone }, // VK_CONVERT
- /* 0x11d */ { kKeyNone }, // VK_NONCONVERT
- /* 0x11e */ { kKeyNone }, // VK_ACCEPT
- /* 0x11f */ { kKeyNone }, // VK_MODECHANGE
+ /* 0x11c */ { kKeyNone }, // VK_CONVERT
+ /* 0x11d */ { kKeyNone }, // VK_NONCONVERT
+ /* 0x11e */ { kKeyNone }, // VK_ACCEPT
+ /* 0x11f */ { kKeyNone }, // VK_MODECHANGE
/* 0x120 */ { kKeyNone }, // VK_SPACE
/* 0x121 */ { kKeyPageUp }, // VK_PRIOR
/* 0x122 */ { kKeyPageDown }, // VK_NEXT
@@ -543,15 +542,15 @@ const KeyID MSWindowsKeyState::s_virtualKey[] =
/* 0x1f3 */ { kKeyNone }, // VK_OEM_AUTO
/* 0x1f4 */ { kKeyNone }, // VK_OEM_ENLW
/* 0x1f5 */ { kKeyNone }, // OEM specific
- /* 0x1f6 */ { kKeyNone }, // VK_ATTN
- /* 0x1f7 */ { kKeyNone }, // VK_CRSEL
- /* 0x1f8 */ { kKeyNone }, // VK_EXSEL
- /* 0x1f9 */ { kKeyNone }, // VK_EREOF
- /* 0x1fa */ { kKeyNone }, // VK_PLAY
- /* 0x1fb */ { kKeyNone }, // VK_ZOOM
+ /* 0x1f6 */ { kKeyNone }, // VK_ATTN
+ /* 0x1f7 */ { kKeyNone }, // VK_CRSEL
+ /* 0x1f8 */ { kKeyNone }, // VK_EXSEL
+ /* 0x1f9 */ { kKeyNone }, // VK_EREOF
+ /* 0x1fa */ { kKeyNone }, // VK_PLAY
+ /* 0x1fb */ { kKeyNone }, // VK_ZOOM
/* 0x1fc */ { kKeyNone }, // reserved
- /* 0x1fd */ { kKeyNone }, // VK_PA1
- /* 0x1fe */ { kKeyNone }, // VK_OEM_CLEAR
+ /* 0x1fd */ { kKeyNone }, // VK_PA1
+ /* 0x1fe */ { kKeyNone }, // VK_OEM_CLEAR
/* 0x1ff */ { kKeyNone } // reserved
};
@@ -688,34 +687,17 @@ MSWindowsKeyState::mapKeyFromEvent(WPARAM charAndVirtKey,
KeyModifierControl | KeyModifierAlt;
// extract character, virtual key, and if we didn't use AltGr
- char c = (char)((charAndVirtKey & 0xff00u) >> 8);
- UINT vkCode = (charAndVirtKey & 0xffu);
- bool noAltGr = ((charAndVirtKey & 0xff0000u) != 0);
+ WCHAR wc = (WCHAR)(charAndVirtKey & 0xffffu);
+ UINT vkCode = ((charAndVirtKey >> 16) & 0xffu);
+ bool noAltGr = ((charAndVirtKey & 0xff000000u) != 0);
// handle some keys via table lookup
KeyID id = getKeyID(vkCode, (KeyButton)((info >> 16) & 0x1ffu));
// check if not in table; map character to key id
- if (id == kKeyNone && c != 0) {
- if ((c & 0x80u) == 0) {
- // ASCII
- id = static_cast<KeyID>(c) & 0xffu;
- }
- else {
- // character is not really ASCII. instead it's some
- // character in the current ANSI code page. try to
- // convert that to a Unicode character. if we fail
- // then use the single byte character as is.
- char src = c;
- wchar_t unicode;
- if (MultiByteToWideChar(CP_THREAD_ACP, MB_PRECOMPOSED,
- &src, 1, &unicode, 1) > 0) {
- id = static_cast<KeyID>(unicode);
- }
- else {
- id = static_cast<KeyID>(c) & 0xffu;
- }
- }
+ if (id == kKeyNone && wc != 0) {
+ // UTF16
+ id = static_cast<KeyID>(wc) & 0xffffu;
}
// set modifier mask
@@ -821,15 +803,14 @@ MSWindowsKeyState::fakeCtrlAltDel()
CloseHandle(hEvtSendSas);
}
else {
- Thread cad(new FunctionJob(&MSWindowsKeyState::ctrlAltDelThread));
+ Thread cad([this](){ ctrl_alt_del_thread(); });
cad.wait();
}
return true;
}
-void
-MSWindowsKeyState::ctrlAltDelThread(void*)
+void MSWindowsKeyState::ctrl_alt_del_thread()
{
// get the Winlogon desktop at whatever privilege we can
HDESK desk = OpenDesktop("Winlogon", 0, FALSE, MAXIMUM_ALLOWED);
@@ -959,7 +940,7 @@ MSWindowsKeyState::getKeyMap(barrier::KeyMap& keyMap)
// deal with certain virtual keys specially
switch (vk) {
case VK_SHIFT:
- // this is important for sending the correct modifier to the
+ // this is important for sending the correct modifier to the
// client, a patch from bug #242 (right shift broken for ms
// remote desktop) removed this to just use left shift, which
// caused bug #2799 (right shift broken for osx).
@@ -1176,7 +1157,7 @@ MSWindowsKeyState::getKeyMap(barrier::KeyMap& keyMap)
}
}
}
-
+
// save each key. the map will automatically discard
// duplicates, like an unshift and shifted version of
// a key that's insensitive to shift.
@@ -1347,7 +1328,7 @@ MSWindowsKeyState::getKeyID(UINT virtualKey, KeyButton button) const
if ((LOWORD(m_keyLayout) & 0xffffu) == 0x0412u) { // 0x0412 : Korean Locale ID
if (virtualKey == VK_HANGUL || virtualKey == VK_HANJA) {
// If shift-space is used to change the input mode,
- // the extented bit is not set. So add it to get right key id.
+ // the extended bit is not set. So add it to get right key id.
button |= 0x100u;
}
}
@@ -1374,7 +1355,7 @@ MSWindowsKeyState::getIDForKey(barrier::KeyMap::KeyItem& item,
virtualKey, button, keyState, unicode,
sizeof(unicode) / sizeof(unicode[0]), 0, hkl);
KeyID id = static_cast<KeyID>(unicode[0]);
-
+
switch (n) {
case -1:
return barrier::KeyMap::getDeadKey(id);
diff --git a/src/lib/platform/MSWindowsKeyState.h b/src/lib/platform/MSWindowsKeyState.h
index 3c5fa40..eedcd85 100644
--- a/src/lib/platform/MSWindowsKeyState.h
+++ b/src/lib/platform/MSWindowsKeyState.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -169,7 +169,7 @@ private:
typedef std::vector<HKL> GroupList;
// send ctrl+alt+del hotkey event on NT family
- static void ctrlAltDelThread(void*);
+ static void ctrl_alt_del_thread();
bool getGroups(GroupList&) const;
void setWindowGroup(SInt32 group);
diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp
index df10270..c995a40 100644
--- a/src/lib/platform/MSWindowsScreen.cpp
+++ b/src/lib/platform/MSWindowsScreen.cpp
@@ -3,11 +3,11 @@
* Copyright (C) 2018 Debauchee Open Source Group
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -36,11 +36,9 @@
#include "mt/Thread.h"
#include "arch/win32/ArchMiscWindows.h"
#include "arch/Arch.h"
-#include "base/FunctionJob.h"
#include "base/Log.h"
#include "base/IEventQueue.h"
#include "base/TMethodEventJob.h"
-#include "base/TMethodJob.h"
#include <string.h>
#include <Shlobj.h>
@@ -134,8 +132,7 @@ MSWindowsScreen::MSWindowsScreen(
m_noHooks,
m_screensaver,
m_events,
- new TMethodJob<MSWindowsScreen>(
- this, &MSWindowsScreen::updateKeysCB),
+ [this]() { updateKeysCB(); },
stopOnDeskSwitch);
m_keyState = new MSWindowsKeyState(m_desks, getEventTarget(), m_events);
@@ -145,16 +142,6 @@ MSWindowsScreen::MSWindowsScreen(
forceShowCursor();
LOG((CLOG_DEBUG "screen shape: %d,%d %dx%d %s", m_x, m_y, m_w, m_h, m_multimon ? "(multi-monitor)" : ""));
LOG((CLOG_DEBUG "window is 0x%08x", m_window));
-
- // SHGetFolderPath is deprecated in vista, but use it for xp support.
- char desktopPath[MAX_PATH];
- if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktopPath))) {
- m_desktopPath = std::string(desktopPath);
- LOG((CLOG_DEBUG "using desktop for drop target: %s", m_desktopPath.c_str()));
- }
- else {
- LOG((CLOG_ERR "failed to get desktop path, no drop target available, error=%d", GetLastError()));
- }
OleInitialize(0);
m_dropWindow = createDropWindow(m_class, "DropWindow");
@@ -365,17 +352,13 @@ MSWindowsScreen::leave()
forceShowCursor();
if (isDraggingStarted() && !m_isPrimary) {
- m_sendDragThread = new Thread(
- new TMethodJob<MSWindowsScreen>(
- this,
- &MSWindowsScreen::sendDragThread));
+ m_sendDragThread = new Thread([this](){ send_drag_thread(); });
}
return true;
}
-void
-MSWindowsScreen::sendDragThread(void*)
+void MSWindowsScreen::send_drag_thread()
{
std::string& draggingFilename = getDraggingFilename();
size_t size = draggingFilename.size();
@@ -389,7 +372,7 @@ MSWindowsScreen::sendDragThread(void*)
LOG((CLOG_DEBUG "send dragging file to server"));
client->sendFileToServer(draggingFilename.c_str());
}
-
+
m_draggingStarted = false;
}
@@ -636,7 +619,7 @@ MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask)
LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", barrier::KeyMap::formatKey(key, mask).c_str(), key, mask));
return 0;
}
-
+
LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", barrier::KeyMap::formatKey(key, mask).c_str(), key, mask, id));
return id;
}
@@ -1114,7 +1097,7 @@ MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
static const KeyModifierMask s_ctrlAlt =
KeyModifierControl | KeyModifierAlt;
- LOG((CLOG_DEBUG1 "event: Key char=%d, vk=0x%02x, nagr=%d, lParam=0x%08x", (wParam & 0xff00u) >> 8, wParam & 0xffu, (wParam & 0x10000u) ? 1 : 0, lParam));
+ LOG((CLOG_DEBUG1 "event: Key char=%d, vk=0x%02x, nagr=%d, lParam=0x%08x", wParam & 0xffffu, (wParam >> 16) & 0xffu, (wParam & 0x1000000u) ? 1 : 0, lParam));
// get event info
KeyButton button = (KeyButton)((lParam & 0x01ff0000) >> 16);
@@ -1132,7 +1115,7 @@ MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
// that maps mouse buttons to keys is known to do this.
// alternatively, we could just throw these events out.
if (button == 0) {
- button = m_keyState->virtualKeyToButton(wParam & 0xffu);
+ button = m_keyState->virtualKeyToButton((wParam >> 16) & 0xffu);
if (button == 0) {
return true;
}
@@ -1198,7 +1181,7 @@ MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
if (!ignore()) {
// check for ctrl+alt+del. we do not want to pass that to the
// client. the user can use ctrl+alt+pause to emulate it.
- UINT virtKey = (wParam & 0xffu);
+ UINT virtKey = (wParam >> 16) & 0xffu;
if (virtKey == VK_DELETE && (state & s_ctrlAlt) == s_ctrlAlt) {
LOG((CLOG_DEBUG "discard ctrl+alt+del"));
return true;
@@ -1212,9 +1195,9 @@ MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam)
// pressed or released. when mapping the key we require that
// we not use AltGr (the 0x10000 flag in wParam) and we not
// use the keypad delete key (the 0x01000000 flag in lParam).
- wParam = VK_DELETE | 0x00010000u;
+ wParam = (VK_DELETE << 16) | 0x01000000u;
lParam &= 0xfe000000;
- lParam |= m_keyState->virtualKeyToButton(wParam & 0xffu) << 16;
+ lParam |= m_keyState->virtualKeyToButton(VK_DELETE) << 16;
lParam |= 0x01000001;
}
@@ -1242,7 +1225,7 @@ MSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam)
{
// get the key info
KeyModifierMask state = getActiveModifiers();
- UINT virtKey = (wParam & 0xffu);
+ UINT virtKey = (wParam >> 16) & 0xffu;
UINT modifiers = 0;
if ((state & KeyModifierShift) != 0) {
modifiers |= MOD_SHIFT;
@@ -1360,7 +1343,7 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
saveMousePosition(mx, my);
if (m_isOnScreen) {
-
+
// motion on primary screen
sendEvent(
m_events->forIPrimaryScreen().motionOnPrimary(),
@@ -1370,15 +1353,15 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
m_draggingStarted = true;
}
}
- else
+ else
{
// the motion is on the secondary screen, so we warp mouse back to
- // center on the server screen. if we don't do this, then the mouse
- // will always try to return to the original entry point on the
+ // center on the server screen. if we don't do this, then the mouse
+ // will always try to return to the original entry point on the
// secondary screen.
LOG((CLOG_DEBUG5 "warping server cursor to center: %+d,%+d", m_xCenter, m_yCenter));
warpCursorNoFlush(m_xCenter, m_yCenter);
-
+
// examine the motion. if it's about the distance
// from the center of the screen to an edge then
// it's probably a bogus motion that we want to
@@ -1389,7 +1372,7 @@ MSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
x + bogusZoneSize > m_x + m_w - m_xCenter ||
-y + bogusZoneSize > m_yCenter - m_y ||
y + bogusZoneSize > m_y + m_h - m_yCenter) {
-
+
LOG((CLOG_DEBUG "dropped bogus delta motion: %+d,%+d", x, y));
}
else {
@@ -1521,8 +1504,8 @@ MSWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
POINT cursorPos;
GetCursorPos(&cursorPos);
- // there is a bug or round error in SetCursorPos and GetCursorPos on
- // a high DPI setting. The check here is for Vista/7 login screen.
+ // there is a bug or round error in SetCursorPos and GetCursorPos on
+ // a high DPI setting. The check here is for Vista/7 login screen.
// since this feature is mainly for client, so only check on client.
if (!isPrimary()) {
if ((cursorPos.x != x) && (cursorPos.y != y)) {
@@ -1531,7 +1514,7 @@ MSWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
// when at Vista/7 login screen, SetCursorPos does not work (which could be
// an MS security feature). instead we can use fakeMouseMove, which calls
// mouse_event.
- // IMPORTANT: as of implementing this function, it has an annoying side
+ // IMPORTANT: as of implementing this function, it has an annoying side
// effect; instead of the mouse returning to the correct exit point, it
// returns to the center of the screen. this could have something to do with
// the center screen warping technique used (see comments for onMouseMove
@@ -1723,7 +1706,7 @@ MSWindowsScreen::mapPressFromEvent(WPARAM msg, LPARAM) const
}
void
-MSWindowsScreen::updateKeysCB(void*)
+MSWindowsScreen::updateKeysCB()
{
// record which keys we think are down
bool down[IKeyState::kNumButtons];
@@ -1888,6 +1871,7 @@ std::string& MSWindowsScreen::getDraggingFilename()
SWP_SHOWWINDOW);
// TODO: fake these keys properly
+ ARCH->sleep(.05f); // A tiny sleep here makes the DragEnter event on m_dropWindow trigger much more consistently
fakeKeyDown(kKeyEscape, 8192, 1);
fakeKeyUp(1);
fakeMouseButton(kButtonLeft, false);
@@ -1909,21 +1893,39 @@ std::string& MSWindowsScreen::getDraggingFilename()
m_draggingFilename = filename;
}
else {
- LOG((CLOG_DEBUG "drag file name is invalid: %s", filename.c_str()));
+ LOG((CLOG_ERR "drag file name is invalid: %s", filename.c_str()));
}
}
if (m_draggingFilename.empty()) {
- LOG((CLOG_DEBUG "failed to get drag file name from OLE"));
+ LOG((CLOG_ERR "failed to get drag file name from OLE"));
}
}
return m_draggingFilename;
}
-const std::string& MSWindowsScreen::getDropTarget() const
+const std::string&
+MSWindowsScreen::getDropTarget() const
+{
+ if (m_dropTargetPath.empty()) {
+ // SHGetFolderPath is deprecated in vista, but use it for xp support.
+ char desktopPath[MAX_PATH];
+ if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktopPath))) {
+ m_dropTargetPath = std::string(desktopPath);
+ LOG((CLOG_INFO "using desktop for drop target: %s", m_dropTargetPath.c_str()));
+ }
+ else {
+ LOG((CLOG_ERR "failed to get desktop path, no drop target available, error=%d", GetLastError()));
+ }
+ }
+ return m_dropTargetPath;
+}
+
+void
+MSWindowsScreen::setDropTarget(const std::string& target)
{
- return m_desktopPath;
+ m_dropTargetPath = target;
}
bool
@@ -1932,7 +1934,7 @@ MSWindowsScreen::isModifierRepeat(KeyModifierMask oldState, KeyModifierMask stat
bool result = false;
if (oldState == state && state != 0) {
- UINT virtKey = (wParam & 0xffu);
+ UINT virtKey = (wParam >> 16) & 0xffu;
if ((state & KeyModifierShift) != 0
&& (virtKey == VK_LSHIFT || virtKey == VK_RSHIFT)) {
result = true;
diff --git a/src/lib/platform/MSWindowsScreen.h b/src/lib/platform/MSWindowsScreen.h
index 49e09df..eaa7b88 100644
--- a/src/lib/platform/MSWindowsScreen.h
+++ b/src/lib/platform/MSWindowsScreen.h
@@ -3,11 +3,11 @@
* Copyright (C) 2018 Debauchee Open Source Group
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -120,6 +120,7 @@ public:
virtual void fakeDraggingFiles(DragFileList fileList);
virtual std::string& getDraggingFilename();
virtual const std::string& getDropTarget() const;
+ virtual void setDropTarget(const std::string&);
protected:
// IPlatformScreen overrides
@@ -198,7 +199,7 @@ private: // HACK
bool mapPressFromEvent(WPARAM msg, LPARAM button) const;
// job to update the key state
- void updateKeysCB(void*);
+ void updateKeysCB();
// determine whether the mouse is hidden by the system and force
// it to be displayed if user has entered this secondary screen.
@@ -212,16 +213,16 @@ private: // HACK
// our window proc
static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);
-
+
// save last position of mouse to compute next delta movement
void saveMousePosition(SInt32 x, SInt32 y);
// check if it is a modifier key repeating message
- bool isModifierRepeat(KeyModifierMask oldState,
+ bool isModifierRepeat(KeyModifierMask oldState,
KeyModifierMask state, WPARAM wParam) const;
// send drag info and data back to server
- void sendDragThread(void*);
+ void send_drag_thread();
private:
struct HotKeyItem {
@@ -324,15 +325,15 @@ private:
bool m_gotOldMouseKeys;
MOUSEKEYS m_mouseKeys;
MOUSEKEYS m_oldMouseKeys;
-
+
MSWindowsHook m_hook;
static MSWindowsScreen*
s_screen;
-
+
IEventQueue* m_events;
- std::string m_desktopPath;
+ mutable std::string m_dropTargetPath;
MSWindowsDropTarget*
m_dropTarget;
diff --git a/src/lib/platform/MSWindowsScreenSaver.cpp b/src/lib/platform/MSWindowsScreenSaver.cpp
index f9c15fb..9f93792 100644
--- a/src/lib/platform/MSWindowsScreenSaver.cpp
+++ b/src/lib/platform/MSWindowsScreenSaver.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -23,7 +23,6 @@
#include "arch/Arch.h"
#include "arch/win32/ArchMiscWindows.h"
#include "base/Log.h"
-#include "base/TMethodJob.h"
#include <malloc.h>
#include <tchar.h>
@@ -223,8 +222,7 @@ MSWindowsScreenSaver::watchDesktop()
// watch desktop in another thread
LOG((CLOG_DEBUG "watching screen saver desktop"));
m_active = true;
- m_watch = new Thread(new TMethodJob<MSWindowsScreenSaver>(this,
- &MSWindowsScreenSaver::watchDesktopThread));
+ m_watch = new Thread([this](){ watch_desktop_thread(); });
}
void
@@ -238,8 +236,7 @@ MSWindowsScreenSaver::watchProcess(HANDLE process)
LOG((CLOG_DEBUG "watching screen saver process"));
m_process = process;
m_active = true;
- m_watch = new Thread(new TMethodJob<MSWindowsScreenSaver>(this,
- &MSWindowsScreenSaver::watchProcessThread));
+ m_watch = new Thread([this](){ watch_process_thread(); });
}
}
@@ -260,8 +257,7 @@ MSWindowsScreenSaver::unwatchProcess()
}
}
-void
-MSWindowsScreenSaver::watchDesktopThread(void*)
+void MSWindowsScreenSaver::watch_desktop_thread()
{
DWORD reserved = 0;
TCHAR* name = NULL;
@@ -283,8 +279,7 @@ MSWindowsScreenSaver::watchDesktopThread(void*)
}
}
-void
-MSWindowsScreenSaver::watchProcessThread(void*)
+void MSWindowsScreenSaver::watch_process_thread()
{
for (;;) {
Thread::testCancel();
diff --git a/src/lib/platform/MSWindowsScreenSaver.h b/src/lib/platform/MSWindowsScreenSaver.h
index a117370..4f1dd5f 100644
--- a/src/lib/platform/MSWindowsScreenSaver.h
+++ b/src/lib/platform/MSWindowsScreenSaver.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -64,8 +64,8 @@ private:
void watchDesktop();
void watchProcess(HANDLE process);
void unwatchProcess();
- void watchDesktopThread(void*);
- void watchProcessThread(void*);
+ void watch_desktop_thread();
+ void watch_process_thread();
void setSecure(bool secure, bool saveSecureAsInt);
bool isSecure(bool* wasSecureAnInt) const;
diff --git a/src/lib/platform/MSWindowsSession.cpp b/src/lib/platform/MSWindowsSession.cpp
index 8d4f8ce..daa9276 100644
--- a/src/lib/platform/MSWindowsSession.cpp
+++ b/src/lib/platform/MSWindowsSession.cpp
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2013-2016 Symless Ltd.
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -45,7 +45,7 @@ MSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
PROCESSENTRY32 entry;
entry.dwSize = sizeof(PROCESSENTRY32);
- // get the first process, and if we can't do that then it's
+ // get the first process, and if we can't do that then it's
// unlikely we can go any further
BOOL gotEntry = Process32First(snapshot, &entry);
if (!gotEntry) {
@@ -94,7 +94,7 @@ MSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
}
std::string nameListJoin;
- for(std::list<std::string>::iterator it = nameList.begin();
+ for (std::list<std::string>::iterator it = nameList.begin();
it != nameList.end(); it++) {
nameListJoin.append(*it);
nameListJoin.append(", ");
@@ -119,7 +119,7 @@ MSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
}
}
-HANDLE
+HANDLE
MSWindowsSession::getUserToken(LPSECURITY_ATTRIBUTES security)
{
HANDLE sourceToken;
@@ -127,7 +127,7 @@ MSWindowsSession::getUserToken(LPSECURITY_ATTRIBUTES security)
LOG((CLOG_ERR "could not get token from session %d", m_activeSessionId));
throw XArch(new XArchEvalWindows);
}
-
+
HANDLE newToken;
if (!DuplicateTokenEx(
sourceToken, TOKEN_ASSIGN_PRIMARY | TOKEN_ALL_ACCESS, security,
@@ -136,7 +136,7 @@ MSWindowsSession::getUserToken(LPSECURITY_ATTRIBUTES security)
LOG((CLOG_ERR "could not duplicate token"));
throw XArch(new XArchEvalWindows);
}
-
+
LOG((CLOG_DEBUG "duplicated, new token: %i", newToken));
return newToken;
}
diff --git a/src/lib/platform/MSWindowsSession.h b/src/lib/platform/MSWindowsSession.h
index e14d7e2..c3fff9d 100644
--- a/src/lib/platform/MSWindowsSession.h
+++ b/src/lib/platform/MSWindowsSession.h
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2013-2016 Symless Ltd.
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -33,7 +33,7 @@ public:
Returns true if the session ID has changed since updateActiveSession was called.
*/
BOOL hasChanged();
-
+
bool isProcessInSession(const char* name, PHANDLE process);
HANDLE getUserToken(LPSECURITY_ATTRIBUTES security);
diff --git a/src/lib/platform/MSWindowsUtil.cpp b/src/lib/platform/MSWindowsUtil.cpp
index b6b809f..5a0778e 100644
--- a/src/lib/platform/MSWindowsUtil.cpp
+++ b/src/lib/platform/MSWindowsUtil.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsUtil.h b/src/lib/platform/MSWindowsUtil.h
index 59f2eac..df80f3f 100644
--- a/src/lib/platform/MSWindowsUtil.h
+++ b/src/lib/platform/MSWindowsUtil.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/MSWindowsWatchdog.cpp b/src/lib/platform/MSWindowsWatchdog.cpp
index 0aa5505..2d9a61c 100644
--- a/src/lib/platform/MSWindowsWatchdog.cpp
+++ b/src/lib/platform/MSWindowsWatchdog.cpp
@@ -6,7 +6,7 @@
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -29,7 +29,6 @@
#include "arch/win32/XArchWindows.h"
#include "arch/Arch.h"
#include "base/log_outputters.h"
-#include "base/TMethodJob.h"
#include "base/Log.h"
#include "common/Version.h"
@@ -81,21 +80,18 @@ MSWindowsWatchdog::MSWindowsWatchdog(
{
}
-void
+void
MSWindowsWatchdog::startAsync()
{
- m_thread = new Thread(new TMethodJob<MSWindowsWatchdog>(
- this, &MSWindowsWatchdog::mainLoop, nullptr));
-
- m_outputThread = new Thread(new TMethodJob<MSWindowsWatchdog>(
- this, &MSWindowsWatchdog::outputLoop, nullptr));
+ m_thread = new Thread([this](){ main_loop(); });
+ m_outputThread = new Thread([this](){ output_loop(); });
}
void
MSWindowsWatchdog::stop()
{
m_monitoring = false;
-
+
m_thread->wait(5);
delete m_thread;
@@ -117,7 +113,7 @@ MSWindowsWatchdog::duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES s
LOG((CLOG_ERR "could not open token, process handle: %d", process));
throw XArch(new XArchEvalWindows());
}
-
+
LOG((CLOG_DEBUG "got token %i, duplicating", sourceToken));
HANDLE newToken;
@@ -129,22 +125,22 @@ MSWindowsWatchdog::duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES s
LOG((CLOG_ERR "could not duplicate token %i", sourceToken));
throw XArch(new XArchEvalWindows());
}
-
+
LOG((CLOG_DEBUG "duplicated, new token: %i", newToken));
return newToken;
}
-HANDLE
+HANDLE
MSWindowsWatchdog::getUserToken(LPSECURITY_ATTRIBUTES security)
{
- // always elevate if we are at the vista/7 login screen. we could also
+ // always elevate if we are at the vista/7 login screen. we could also
// elevate for the uac dialog (consent.exe) but this would be pointless,
// since barrier would re-launch as non-elevated after the desk switch,
// and so would be unusable with the new elevated process taking focus.
if (m_elevateProcess || m_autoElevated) {
LOG((CLOG_DEBUG "getting elevated token, %s",
(m_elevateProcess ? "elevation required" : "at login screen")));
-
+
HANDLE process;
if (!m_session.isProcessInSession("winlogon.exe", &process)) {
throw XMSWindowsWatchdogError("cannot get user token without winlogon.exe");
@@ -157,8 +153,7 @@ MSWindowsWatchdog::getUserToken(LPSECURITY_ATTRIBUTES security)
}
}
-void
-MSWindowsWatchdog::mainLoop(void*)
+void MSWindowsWatchdog::main_loop()
{
shutdownExistingProcesses();
@@ -169,10 +164,10 @@ MSWindowsWatchdog::mainLoop(void*)
sendSasFunc = (SendSas)GetProcAddress(sasLib, "SendSAS");
}
- SECURITY_ATTRIBUTES saAttr;
- saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
- saAttr.bInheritHandle = TRUE;
- saAttr.lpSecurityDescriptor = NULL;
+ SECURITY_ATTRIBUTES saAttr;
+ saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
+ saAttr.bInheritHandle = TRUE;
+ saAttr.lpSecurityDescriptor = NULL;
if (!CreatePipe(&m_stdOutRead, &m_stdOutWrite, &saAttr, 0)) {
throw XArch(new XArchEvalWindows());
@@ -196,7 +191,7 @@ MSWindowsWatchdog::mainLoop(void*)
LOG((CLOG_INFO "backing off, wait=%ds, failures=%d", timeout, m_processFailures));
ARCH->sleep(timeout);
}
-
+
if (!getCommand().empty() && ((m_processFailures != 0) || m_session.hasChanged() || m_commandChanged)) {
startProcess();
}
@@ -205,7 +200,7 @@ MSWindowsWatchdog::mainLoop(void*)
m_processFailures++;
m_processRunning = false;
-
+
LOG((CLOG_WARN "detected application not running, pid=%d",
m_processInfo.dwProcessId));
}
@@ -228,7 +223,7 @@ MSWindowsWatchdog::mainLoop(void*)
// if the sas event failed, wait by sleeping.
ARCH->sleep(1);
-
+
}
catch (std::exception& e) {
LOG((CLOG_ERR "failed to launch, error: %s", e.what()));
@@ -248,7 +243,7 @@ MSWindowsWatchdog::mainLoop(void*)
LOG((CLOG_DEBUG "terminated running process on exit"));
shutdownProcess(m_processInfo.hProcess, m_processInfo.dwProcessId, 20);
}
-
+
LOG((CLOG_DEBUG "watchdog main thread finished"));
}
@@ -260,7 +255,7 @@ MSWindowsWatchdog::isProcessActive()
return exitCode == STILL_ACTIVE;
}
-void
+void
MSWindowsWatchdog::setFileLogOutputter(FileLogOutputter* outputter)
{
m_fileLogOutputter = outputter;
@@ -367,7 +362,7 @@ BOOL MSWindowsWatchdog::doStartProcessAsUser(std::string& command, HANDLE userTo
throw XArch(new XArchEvalWindows);
}
- DWORD creationFlags =
+ DWORD creationFlags =
NORMAL_PRIORITY_CLASS |
CREATE_NO_WINDOW |
CREATE_UNICODE_ENVIRONMENT;
@@ -421,14 +416,13 @@ MSWindowsWatchdog::getCommand() const
return cmd;
}
-void
-MSWindowsWatchdog::outputLoop(void*)
+void MSWindowsWatchdog::output_loop()
{
// +1 char for \0
CHAR buffer[kOutputBufferSize + 1];
while (m_monitoring) {
-
+
DWORD bytesRead;
BOOL success = ReadFile(m_stdOutRead, buffer, kOutputBufferSize, &bytesRead, NULL);
@@ -443,7 +437,7 @@ MSWindowsWatchdog::outputLoop(void*)
if (m_fileLogOutputter != NULL) {
m_fileLogOutputter->write(kINFO, buffer);
}
- }
+ }
}
}
@@ -470,7 +464,7 @@ MSWindowsWatchdog::shutdownProcess(HANDLE handle, DWORD pid, int timeout)
break;
}
else {
-
+
double elapsed = (ARCH->time() - start);
if (elapsed > timeout) {
// if timeout reached, kill forcefully.
@@ -500,7 +494,7 @@ MSWindowsWatchdog::shutdownExistingProcesses()
PROCESSENTRY32 entry;
entry.dwSize = sizeof(PROCESSENTRY32);
- // get the first process, and if we can't do that then it's
+ // get the first process, and if we can't do that then it's
// unlikely we can go any further
BOOL gotEntry = Process32First(snapshot, &entry);
if (!gotEntry) {
@@ -517,7 +511,7 @@ MSWindowsWatchdog::shutdownExistingProcesses()
if (_stricmp(entry.szExeFile, "barrierc.exe") == 0 ||
_stricmp(entry.szExeFile, "barriers.exe") == 0) {
-
+
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);
shutdownProcess(handle, entry.th32ProcessID, 10);
}
diff --git a/src/lib/platform/MSWindowsWatchdog.h b/src/lib/platform/MSWindowsWatchdog.h
index 0a81521..0595ca0 100644
--- a/src/lib/platform/MSWindowsWatchdog.h
+++ b/src/lib/platform/MSWindowsWatchdog.h
@@ -6,7 +6,7 @@
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -48,8 +48,8 @@ public:
void setFileLogOutputter(FileLogOutputter* outputter);
private:
- void mainLoop(void*);
- void outputLoop(void*);
+ void main_loop();
+ void output_loop();
void shutdownProcess(HANDLE handle, DWORD pid, int timeout);
void shutdownExistingProcesses();
HANDLE duplicateProcessToken(HANDLE process, LPSECURITY_ATTRIBUTES security);
@@ -81,7 +81,7 @@ private:
//! Relauncher error
/*!
-An error occured in the process watchdog.
+An error occurred in the process watchdog.
*/
class XMSWindowsWatchdogError : public XBarrier {
public:
diff --git a/src/lib/platform/OSXClipboard.cpp b/src/lib/platform/OSXClipboard.cpp
index e55c8e0..ff1779c 100644
--- a/src/lib/platform/OSXClipboard.cpp
+++ b/src/lib/platform/OSXClipboard.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -52,7 +52,7 @@ OSXClipboard::OSXClipboard() :
OSStatus syncErr = PasteboardSynchronize(m_pboard);
if (syncErr != noErr) {
- LOG((CLOG_DEBUG "failed to syncronize clipboard: error %i", syncErr));
+ LOG((CLOG_DEBUG "failed to synchronize clipboard: error %i", syncErr));
}
}
@@ -90,7 +90,7 @@ OSXClipboard::synchronize()
return true;
}
return false;
-}
+}
void OSXClipboard::add(EFormat format, const std::string& data)
{
@@ -126,15 +126,15 @@ void OSXClipboard::add(EFormat format, const std::string& data)
flavorType,
dataRef,
kPasteboardFlavorNoFlags);
-
+
LOG((CLOG_DEBUG "added %d bytes to clipboard format: %d", data.size(), format));
}
-
+
}
}
bool
-OSXClipboard::open(Time time) const
+OSXClipboard::open(Time time) const
{
if (m_pboard == NULL)
return false;
diff --git a/src/lib/platform/OSXClipboard.h b/src/lib/platform/OSXClipboard.h
index b1f9801..9d66600 100644
--- a/src/lib/platform/OSXClipboard.h
+++ b/src/lib/platform/OSXClipboard.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXClipboardAnyTextConverter.cpp b/src/lib/platform/OSXClipboardAnyTextConverter.cpp
index ae8dc4a..2513db5 100644
--- a/src/lib/platform/OSXClipboardAnyTextConverter.cpp
+++ b/src/lib/platform/OSXClipboardAnyTextConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXClipboardAnyTextConverter.h b/src/lib/platform/OSXClipboardAnyTextConverter.h
index f057bae..987f2c5 100644
--- a/src/lib/platform/OSXClipboardAnyTextConverter.h
+++ b/src/lib/platform/OSXClipboardAnyTextConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXClipboardHTMLConverter.cpp b/src/lib/platform/OSXClipboardHTMLConverter.cpp
index 46a3d0f..0a2f5ec 100644
--- a/src/lib/platform/OSXClipboardHTMLConverter.cpp
+++ b/src/lib/platform/OSXClipboardHTMLConverter.cpp
@@ -66,7 +66,7 @@ std::string OSXClipboardHTMLConverter::convertString(const std::string& data,
CFRelease(stringRef);
return {};
}
-
+
CFStringGetBytes(stringRef, entireString, toEncoding,
0, false, (UInt8*)buffer, buffSize, NULL);
diff --git a/src/lib/platform/OSXClipboardTextConverter.cpp b/src/lib/platform/OSXClipboardTextConverter.cpp
index a68258d..a4fb6ae 100644
--- a/src/lib/platform/OSXClipboardTextConverter.cpp
+++ b/src/lib/platform/OSXClipboardTextConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -24,7 +24,7 @@
// OSXClipboardTextConverter
//
-OSXClipboardTextConverter::OSXClipboardTextConverter()
+OSXClipboardTextConverter::OSXClipboardTextConverter()
{
// do nothing
}
@@ -59,12 +59,12 @@ std::string OSXClipboardTextConverter::convertString(const std::string& data,
0, false, NULL, 0, &buffSize);
char* buffer = new char[buffSize];
-
+
if (buffer == NULL) {
CFRelease(stringRef);
return {};
}
-
+
CFStringGetBytes(stringRef, entireString, toEncoding,
0, false, (UInt8*)buffer, buffSize, NULL);
@@ -72,7 +72,7 @@ std::string OSXClipboardTextConverter::convertString(const std::string& data,
delete[] buffer;
CFRelease(stringRef);
-
+
return result;
}
diff --git a/src/lib/platform/OSXClipboardTextConverter.h b/src/lib/platform/OSXClipboardTextConverter.h
index 8211f1e..5a4b51f 100644
--- a/src/lib/platform/OSXClipboardTextConverter.h
+++ b/src/lib/platform/OSXClipboardTextConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXClipboardUTF16Converter.cpp b/src/lib/platform/OSXClipboardUTF16Converter.cpp
index 8411e92..4f13cc0 100644
--- a/src/lib/platform/OSXClipboardUTF16Converter.cpp
+++ b/src/lib/platform/OSXClipboardUTF16Converter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXClipboardUTF16Converter.h b/src/lib/platform/OSXClipboardUTF16Converter.h
index b279c99..5e448df 100644
--- a/src/lib/platform/OSXClipboardUTF16Converter.h
+++ b/src/lib/platform/OSXClipboardUTF16Converter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXDragSimulator.h b/src/lib/platform/OSXDragSimulator.h
index cb361ca..6dd73f4 100644
--- a/src/lib/platform/OSXDragSimulator.h
+++ b/src/lib/platform/OSXDragSimulator.h
@@ -28,7 +28,7 @@ void runCocoaApp();
void stopCocoaLoop();
void fakeDragging(const char* str, int cursorX, int cursorY);
CFStringRef getCocoaDropTarget();
-
+
#if defined(__cplusplus)
}
#endif
diff --git a/src/lib/platform/OSXDragSimulator.m b/src/lib/platform/OSXDragSimulator.mm
index affed38..735aa4a 100644
--- a/src/lib/platform/OSXDragSimulator.m
+++ b/src/lib/platform/OSXDragSimulator.mm
@@ -30,9 +30,9 @@ void
runCocoaApp()
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-
+
[NSApplication sharedApplication];
-
+
NSWindow* window = [[NSWindow alloc]
initWithContentRect: NSMakeRect(0, 0, 3, 3)
styleMask: NSBorderlessWindowMask
@@ -41,16 +41,16 @@ runCocoaApp()
[window setTitle: @""];
[window setAlphaValue:0.1];
[window makeKeyAndOrderFront:nil];
-
+
OSXDragView* dragView = [[OSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 3, 3)];
-
+
g_dragWindow = window;
g_dragView = dragView;
[window setContentView: dragView];
-
+
NSLog(@"starting cocoa loop");
[NSApp run];
-
+
NSLog(@"cocoa: release");
[pool release];
}
@@ -65,25 +65,25 @@ void
fakeDragging(const char* str, int cursorX, int cursorY)
{
g_ext = [NSString stringWithUTF8String:str];
-
+
dispatch_async(dispatch_get_main_queue(), ^{
NSRect screen = [[NSScreen mainScreen] frame];
- NSLog ( @"screen size: witdh = %f height = %f", screen.size.width, screen.size.height);
+ NSLog ( @"screen size: width = %f height = %f", screen.size.width, screen.size.height);
NSLog ( @"mouseLocation: %d %d", cursorX, cursorY);
-
+
int newPosX = 0;
int newPosY = 0;
newPosX = cursorX - 1;
newPosY = screen.size.height - cursorY - 1;
-
+
NSRect rect = NSMakeRect(newPosX, newPosY, 3, 3);
NSLog ( @"newPosX: %d", newPosX);
NSLog ( @"newPosY: %d", newPosY);
-
+
[g_dragWindow setFrame:rect display:NO];
[g_dragWindow makeKeyAndOrderFront:nil];
[NSApp activateIgnoringOtherApps:YES];
-
+
[g_dragView setFileExt:g_ext];
CGEventRef down = CGEventCreateMouseEvent(CGEventSourceCreate(kCGEventSourceStateHIDSystemState), kCGEventLeftMouseDown, CGPointMake(cursorX, cursorY), kCGMouseButtonLeft);
diff --git a/src/lib/platform/OSXDragView.m b/src/lib/platform/OSXDragView.mm
index 67dac56..67dac56 100644
--- a/src/lib/platform/OSXDragView.m
+++ b/src/lib/platform/OSXDragView.mm
diff --git a/src/lib/platform/OSXEventQueueBuffer.cpp b/src/lib/platform/OSXEventQueueBuffer.cpp
index 8e18afc..e012c89 100644
--- a/src/lib/platform/OSXEventQueueBuffer.cpp
+++ b/src/lib/platform/OSXEventQueueBuffer.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -83,11 +83,11 @@ OSXEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
else {
UInt32 eventClass = GetEventClass(m_event);
switch (eventClass) {
- case 'Syne':
+ case 'Syne':
dataID = GetEventKind(m_event);
return kUser;
- default:
+ default:
event = Event(Event::kSystem,
m_eventQueue->getSystemTarget(), &m_event);
return kSystem;
@@ -101,24 +101,24 @@ OSXEventQueueBuffer::addEvent(UInt32 dataID)
EventRef event;
OSStatus error = CreateEvent(
kCFAllocatorDefault,
- 'Syne',
+ 'Syne',
dataID,
0,
kEventAttributeNone,
&event);
if (error == noErr) {
-
+
assert(m_carbonEventQueue != NULL);
-
+
error = PostEventToQueue(
m_carbonEventQueue,
event,
kEventPriorityStandard);
-
+
ReleaseEvent(event);
}
-
+
return (error == noErr);
}
diff --git a/src/lib/platform/OSXEventQueueBuffer.h b/src/lib/platform/OSXEventQueueBuffer.h
index 28c4a5d..8e0c903 100644
--- a/src/lib/platform/OSXEventQueueBuffer.h
+++ b/src/lib/platform/OSXEventQueueBuffer.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp
index 9db3c5d..aad2072 100644
--- a/src/lib/platform/OSXKeyState.cpp
+++ b/src/lib/platform/OSXKeyState.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -43,6 +43,9 @@ static const UInt32 s_launchpadVK = 131;
static const UInt32 s_osxNumLock = 1 << 16;
+static const UInt32 s_int4VK = 0x8a; // international4
+static const UInt32 s_int5VK = 0x8b; // international5
+
struct KeyEntry {
public:
KeyID m_keyID;
@@ -97,7 +100,7 @@ static const KeyEntry s_controlKeys[] = {
{ kKeyKP_Divide, kVK_ANSI_KeypadDivide },
{ kKeyKP_Subtract, kVK_ANSI_KeypadMinus },
{ kKeyKP_Enter, kVK_ANSI_KeypadEnter },
-
+
// virtual key 110 is fn+enter and i have no idea what that's supposed
// to map to. also the enter key with numlock on is a modifier but i
// don't know which.
@@ -118,11 +121,18 @@ static const KeyEntry s_controlKeys[] = {
// toggle modifiers
{ kKeyNumLock, s_numLockVK },
{ kKeyCapsLock, s_capsLockVK },
-
+
{ kKeyMissionControl, s_missionControlVK },
{ kKeyLaunchpad, s_launchpadVK },
{ kKeyBrightnessUp, s_brightnessUp },
- { kKeyBrightnessDown, s_brightnessDown }
+ { kKeyBrightnessDown, s_brightnessDown },
+
+ // JIS keyboards only
+ { kKeyEisuToggle, kVK_JIS_Eisu },
+ { kKeyKana, kVK_JIS_Kana },
+ { kKeyMuhenkan, s_int5VK },
+ { kKeyHenkan, s_int4VK },
+ { kKeyZenkaku, kVK_ANSI_Grave }
};
@@ -159,7 +169,7 @@ OSXKeyState::init()
// build virtual key map
for (size_t i = 0; i < sizeof(s_controlKeys) / sizeof(s_controlKeys[0]);
++i) {
-
+
m_virtualKeyMap[s_controlKeys[i].m_virtualKey] =
s_controlKeys[i].m_keyID;
}
@@ -214,11 +224,11 @@ OSXKeyState::mapModifiersToCarbon(UInt32 mask) const
if ((mask & kCGEventFlagMaskNumericPad) != 0) {
outMask |= s_osxNumLock;
}
-
+
return outMask;
}
-KeyButton
+KeyButton
OSXKeyState::mapKeyFromEvent(KeyIDs& ids,
KeyModifierMask* maskOut, CGEventRef event) const
{
@@ -253,7 +263,7 @@ OSXKeyState::mapKeyFromEvent(KeyIDs& ids,
}
// get keyboard info
- TISInputSourceRef currentKeyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
+ TISInputSourceRef currentKeyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
if (currentKeyboardLayout == NULL) {
return kKeyNone;
@@ -338,27 +348,27 @@ CGEventFlags
OSXKeyState::getModifierStateAsOSXFlags()
{
CGEventFlags modifiers = CGEventFlags(0);
-
+
if (m_shiftPressed) {
modifiers |= CGEventFlags(kCGEventFlagMaskShift);
}
-
+
if (m_controlPressed) {
modifiers |= CGEventFlags(kCGEventFlagMaskControl);
}
-
+
if (m_altPressed) {
modifiers |= CGEventFlags(kCGEventFlagMaskAlternate);
}
-
+
if (m_superPressed) {
modifiers |= CGEventFlags(kCGEventFlagMaskCommand);
}
-
+
if (m_capsPressed) {
modifiers |= CGEventFlags(kCGEventFlagMaskAlphaShift);
}
-
+
return modifiers;
}
@@ -400,12 +410,12 @@ OSXKeyState::pollActiveGroup() const
TISInputSourceRef keyboardLayout = TISCopyCurrentKeyboardLayoutInputSource();
CFDataRef id = (CFDataRef)TISGetInputSourceProperty(
keyboardLayout, kTISPropertyInputSourceID);
-
+
GroupMap::const_iterator i = m_groupMap.find(id);
if (i != m_groupMap.end()) {
return i->second;
}
-
+
LOG((CLOG_DEBUG "can't get the active group, use the first group instead"));
return 0;
@@ -447,7 +457,7 @@ OSXKeyState::getKeyMap(barrier::KeyMap& keyMap)
const void* resource;
bool layoutValid = false;
-
+
// add regular keys
// try uchr resource first
CFDataRef resourceRef = (CFDataRef)TISGetInputSourceProperty(
@@ -475,19 +485,19 @@ static io_connect_t getEventDriver(void)
static mach_port_t sEventDrvrRef = 0;
mach_port_t masterPort, service, iter;
kern_return_t kr;
-
+
if (!sEventDrvrRef) {
// Get master device port
kr = IOMasterPort(bootstrap_port, &masterPort);
assert(KERN_SUCCESS == kr);
-
+
kr = IOServiceGetMatchingServices(masterPort,
IOServiceMatching(kIOHIDSystemClass), &iter);
assert(KERN_SUCCESS == kr);
-
+
service = IOIteratorNext(iter);
assert(service);
-
+
kr = IOServiceOpen(service, mach_task_self(),
kIOHIDParamConnectType, &sEventDrvrRef);
assert(KERN_SUCCESS == kr);
@@ -495,7 +505,7 @@ static io_connect_t getEventDriver(void)
IOObjectRelease(service);
IOObjectRelease(iter);
}
-
+
return sEventDrvrRef;
}
@@ -504,7 +514,7 @@ OSXKeyState::postHIDVirtualKey(const UInt8 virtualKeyCode,
const bool postDown)
{
static UInt32 modifiers = 0;
-
+
NXEventData event;
IOGPoint loc = { 0, 0 };
UInt32 modifiersDelta = 0;
@@ -541,7 +551,7 @@ OSXKeyState::postHIDVirtualKey(const UInt8 virtualKeyCode,
m_capsPressed = postDown;
break;
}
-
+
// update the modifier bit
if (postDown) {
modifiers |= modifiersDelta;
@@ -549,7 +559,7 @@ OSXKeyState::postHIDVirtualKey(const UInt8 virtualKeyCode,
else {
modifiers &= ~modifiersDelta;
}
-
+
kern_return_t kr;
event.key.keyCode = virtualKeyCode;
kr = IOHIDPostEvent(getEventDriver(), NX_FLAGSCHANGED, loc,
@@ -575,11 +585,11 @@ OSXKeyState::fakeKey(const Keystroke& keystroke)
{
switch (keystroke.m_type) {
case Keystroke::kButton: {
-
+
KeyButton button = keystroke.m_data.m_button.m_button;
bool keyDown = keystroke.m_data.m_button.m_press;
CGKeyCode virtualKey = mapKeyButtonToVirtualKey(button);
-
+
LOG((CLOG_DEBUG1
" button=0x%04x virtualKey=0x%04x keyDown=%s",
button, virtualKey, keyDown ? "down" : "up"));
@@ -763,7 +773,7 @@ OSXKeyState::mapBarrierHotKeyToMac(KeyID key, KeyModifierMask mask,
return false;
}
macVirtualKey = mapKeyButtonToVirtualKey(button);
-
+
// calculate modifier mask
macModifierMask = 0;
if ((mask & KeyModifierShift) != 0) {
@@ -784,10 +794,10 @@ OSXKeyState::mapBarrierHotKeyToMac(KeyID key, KeyModifierMask mask,
if ((mask & KeyModifierNumLock) != 0) {
macModifierMask |= s_osxNumLock;
}
-
+
return true;
}
-
+
void
OSXKeyState::handleModifierKeys(void* target,
KeyModifierMask oldMask, KeyModifierMask newMask)
@@ -855,7 +865,7 @@ OSXKeyState::getGroups(GroupList& groups) const
groups.clear();
for (CFIndex i = 0; i < n; ++i) {
bool addToGroups = true;
- TISInputSourceRef keyboardLayout =
+ TISInputSourceRef keyboardLayout =
(TISInputSourceRef)CFArrayGetValueAtIndex(kbds, i);
if (addToGroups)
diff --git a/src/lib/platform/OSXKeyState.h b/src/lib/platform/OSXKeyState.h
index 4d92860..e688394 100644
--- a/src/lib/platform/OSXKeyState.h
+++ b/src/lib/platform/OSXKeyState.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -67,7 +67,7 @@ public:
Still required in a few places for translation calls.
*/
KeyModifierMask mapModifiersToCarbon(UInt32 mask) const;
-
+
//! Map key event to keys
/*!
Converts a key event into a sequence of KeyIDs and the shadow modifier
@@ -149,7 +149,7 @@ private:
static UInt32 mapKeyButtonToVirtualKey(KeyButton keyButton);
void init();
-
+
// Post a key event to HID manager. It posts an event to HID client, a
// much lower level than window manager which's the target from carbon
// CGEventPost
diff --git a/src/lib/platform/OSXMediaKeySimulator.m b/src/lib/platform/OSXMediaKeySimulator.mm
index 5aacd10..efc4251 100644
--- a/src/lib/platform/OSXMediaKeySimulator.m
+++ b/src/lib/platform/OSXMediaKeySimulator.mm
@@ -85,8 +85,8 @@ fakeNativeMediaKey(KeyID id)
data2:-1];
CGEventRef upEvent = [upRef CGEvent];
- CGEventPost(0, downEvent);
- CGEventPost(0, upEvent);
+ CGEventPost(kCGHIDEventTap, downEvent);
+ CGEventPost(kCGHIDEventTap, upEvent);
return true;
}
diff --git a/src/lib/platform/OSXMediaKeySupport.m b/src/lib/platform/OSXMediaKeySupport.mm
index 9c9dbc3..a4d5767 100644
--- a/src/lib/platform/OSXMediaKeySupport.m
+++ b/src/lib/platform/OSXMediaKeySupport.mm
@@ -147,8 +147,8 @@ fakeNativeMediaKey(KeyID id)
data2:-1];
CGEventRef upEvent = [upRef CGEvent];
- CGEventPost(0, downEvent);
- CGEventPost(0, upEvent);
+ CGEventPost(kCGHIDEventTap, downEvent);
+ CGEventPost(kCGHIDEventTap, upEvent);
return true;
}
diff --git a/src/lib/platform/OSXPasteboardPeeker.h b/src/lib/platform/OSXPasteboardPeeker.h
index 5105262..b69dba8 100644
--- a/src/lib/platform/OSXPasteboardPeeker.h
+++ b/src/lib/platform/OSXPasteboardPeeker.h
@@ -26,7 +26,7 @@ extern "C" {
#endif
CFStringRef getDraggedFileURL();
-
+
#if defined(__cplusplus)
}
#endif
diff --git a/src/lib/platform/OSXPasteboardPeeker.m b/src/lib/platform/OSXPasteboardPeeker.mm
index ab39e26..ab39e26 100644
--- a/src/lib/platform/OSXPasteboardPeeker.m
+++ b/src/lib/platform/OSXPasteboardPeeker.mm
diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h
index 68c7c68..691b74c 100644
--- a/src/lib/platform/OSXScreen.h
+++ b/src/lib/platform/OSXScreen.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -37,7 +37,7 @@ extern "C" {
typedef int CGSConnectionID;
CGError CGSSetConnectionProperty(CGSConnectionID cid, CGSConnectionID targetCID, CFStringRef key, CFTypeRef value);
int _CGSDefaultConnection();
-}
+}
template <class T>
@@ -98,10 +98,10 @@ public:
virtual bool isPrimary() const;
virtual void fakeDraggingFiles(DragFileList fileList);
virtual std::string& getDraggingFilename();
-
+
const std::string& getDropTarget() const { return m_dropTarget; }
void waitForCarbonLoop() const;
-
+
protected:
// IPlatformScreen overrides
virtual void handleSystemEvent(const Event&, void*);
@@ -112,7 +112,7 @@ private:
void updateScreenShape();
void updateScreenShape(const CGDirectDisplayID, const CGDisplayChangeSummaryFlags);
void postMouseEvent(CGPoint&) const;
-
+
// convenience function to send events
void sendEvent(Event::Type type, void* = NULL) const;
void sendClipboardEvent(Event::Type type, ClipboardID id) const;
@@ -124,16 +124,16 @@ private:
// of the button pressed using the mac button mapping.
bool onMouseButton(bool pressed, UInt16 macButton);
bool onMouseWheel(SInt32 xDelta, SInt32 yDelta) const;
-
+
void constructMouseButtonEventMap();
bool onKey(CGEventRef event);
void onMediaKey(CGEventRef event);
-
+
bool onHotKey(EventRef event) const;
-
- // Added here to allow the carbon cursor hack to be called.
+
+ // Added here to allow the carbon cursor hack to be called.
void showCursor();
void hideCursor();
@@ -172,9 +172,9 @@ private:
static pascal OSStatus
userSwitchCallback(EventHandlerCallRef nextHandler,
EventRef theEvent, void* inUserData);
-
+
// sleep / wakeup support
- void watchSystemPowerThread(void*);
+ void watchSystemPowerThread();
static void testCanceled(CFRunLoopTimerRef timer, void*info);
static void powerChangeCallback(void* refcon, io_service_t service,
natural_t messageType, void* messageArgument);
@@ -182,12 +182,12 @@ private:
void* messageArgument);
void handleConfirmSleep(const Event& event, void*);
-
+
// global hotkey operating mode
static bool isGlobalHotKeyOperatingModeAvailable();
static void setGlobalHotKeysEnabled(bool enabled);
static bool getGlobalHotKeysEnabled();
-
+
// Quartz event tap support
static CGEventRef handleCGInputEvent(CGEventTapProxy proxy,
CGEventType type,
@@ -197,12 +197,12 @@ private:
CGEventType type,
CGEventRef event,
void* refcon);
-
+
// convert CFString to char*
static char* CFStringRefToUTF8String(CFStringRef aString);
-
- void getDropTargetThread(void*);
-
+
+ void get_drop_target_thread();
+
private:
struct HotKeyItem {
public:
@@ -225,13 +225,13 @@ private:
kMouseButtonDown,
kMouseButtonStateMax
};
-
+
class MouseButtonState {
public:
void set(UInt32 button, EMouseButtonState state);
bool any();
- void reset();
+ void reset();
void overwrite(UInt32 buttons);
bool test(UInt32 button) const;
@@ -262,7 +262,7 @@ private:
// mouse state
mutable SInt32 m_xCursor, m_yCursor;
mutable bool m_cursorPosValid;
-
+
/* FIXME: this data structure is explicitly marked mutable due
to a need to track the state of buttons since the remote
side only lets us know of change events, and because the
@@ -321,7 +321,7 @@ private:
// global hotkey operating mode
static bool s_testedForGHOM;
static bool s_hasGHOM;
-
+
// Quartz input event support
CFMachPortRef m_eventTapPort;
CFRunLoopSourceRef m_eventTapRLSR;
@@ -336,10 +336,10 @@ private:
bool m_autoShowHideCursor;
IEventQueue* m_events;
-
+
Thread* m_getDropTargetThread;
std::string m_dropTarget;
-
+
#if defined(MAC_OS_X_VERSION_10_7)
Mutex* m_carbonLoopMutex;
CondVar<bool>* m_carbonLoopReady;
diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm
index 2b4594f..d41e321 100644
--- a/src/lib/platform/OSXScreen.mm
+++ b/src/lib/platform/OSXScreen.mm
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -38,7 +38,6 @@
#include "base/Log.h"
#include "base/IEventQueue.h"
#include "base/TMethodEventJob.h"
-#include "base/TMethodJob.h"
#include <math.h>
#include <mach-o/dyld.h>
@@ -110,10 +109,10 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso
updateScreenShape(m_displayID, 0);
m_screensaver = new OSXScreenSaver(m_events, getEventTarget());
m_keyState = new OSXKeyState(m_events);
-
+
// only needed when running as a server.
if (m_isPrimary) {
-
+
#if defined(MAC_OS_X_VERSION_10_9)
// we can't pass options to show the dialog, this must be done by the gui.
if (!AXIsProcessTrusted()) {
@@ -126,7 +125,7 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso
}
#endif
}
-
+
// install display manager notification handler
CGDisplayRegisterReconfigurationCallback(displayReconfigurationCallback, this);
@@ -157,8 +156,7 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso
m_carbonLoopReady = new CondVar<bool>(m_carbonLoopMutex, false);
#endif
LOG((CLOG_DEBUG "starting watchSystemPowerThread"));
- m_pmWatchThread = new Thread(new TMethodJob<OSXScreen>
- (this, &OSXScreen::watchSystemPowerThread));
+ m_pmWatchThread = new Thread([this](){ watchSystemPowerThread(); });
}
catch (...) {
m_events->removeHandler(m_events->forOSXScreen().confirmSleep(),
@@ -166,7 +164,7 @@ OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCurso
if (m_switchEventHandlerRef != 0) {
RemoveEventHandler(m_switchEventHandlerRef);
}
-
+
CGDisplayRemoveReconfigurationCallback(displayReconfigurationCallback, this);
delete m_keyState;
@@ -217,7 +215,7 @@ OSXScreen::~OSXScreen()
delete m_keyState;
delete m_screensaver;
-
+
#if defined(MAC_OS_X_VERSION_10_7)
delete m_carbonLoopMutex;
delete m_carbonLoopReady;
@@ -273,7 +271,7 @@ OSXScreen::warpCursor(SInt32 x, SInt32 y)
pos.x = x;
pos.y = y;
CGWarpMouseCursorPosition(pos);
-
+
// save new cursor position
m_xCursor = x;
m_yCursor = y;
@@ -325,7 +323,7 @@ OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask)
LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask));
return 0;
}
-
+
// choose hotkey id
UInt32 id;
if (!m_oldHotKeyIDs.empty()) {
@@ -351,7 +349,7 @@ OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask)
}
else {
EventHotKeyID hkid = { 'SNRG', (UInt32)id };
- OSStatus status = RegisterEventHotKey(macKey, macMask, hkid,
+ OSStatus status = RegisterEventHotKey(macKey, macMask, hkid,
GetApplicationEventTarget(), 0,
&ref);
okay = (status == noErr);
@@ -366,7 +364,7 @@ OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask)
}
m_hotKeys.insert(std::make_pair(id, HotKeyItem(ref, macKey, macMask)));
-
+
LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", barrier::KeyMap::formatKey(key, mask).c_str(), key, mask, id));
return id;
}
@@ -468,7 +466,7 @@ OSXScreen::postMouseEvent(CGPoint& pos) const
}
}
}
-
+
CGEventType type = kCGEventMouseMoved;
SInt8 button = m_buttonState.getFirstButtonDown();
@@ -478,10 +476,10 @@ OSXScreen::postMouseEvent(CGPoint& pos) const
}
CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, static_cast<CGMouseButton>(button));
-
+
// Dragging events also need the click state
CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState);
-
+
// Fix for sticky keys
CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags();
CGEventSetFlags(event, modifiers);
@@ -503,7 +501,7 @@ OSXScreen::postMouseEvent(CGPoint& pos) const
CGEventSetDoubleValueField(event, kCGMouseEventDeltaY, deltaFY);
CGEventPost(kCGHIDEventTap, event);
-
+
CFRelease(event);
}
@@ -515,7 +513,7 @@ OSXScreen::fakeMouseButton(ButtonID id, bool press)
if (index >= NumButtonIDs) {
return;
}
-
+
CGPoint pos;
if (!m_cursorPosValid) {
SInt32 x, y;
@@ -533,79 +531,77 @@ OSXScreen::fakeMouseButton(ButtonID id, bool press)
// since we don't have double click distance in NX APIs
// we define our own defaults.
const double maxDiff = sqrt(2) + 0.0001;
-
+
double clickTime = [NSEvent doubleClickInterval];
-
+
// As long as the click is within the time window and distance window
// increase clickState (double click, triple click, etc)
- // This will allow for higher than triple click but the quartz documenation
+ // This will allow for higher than triple click but the quartz documentation
// does not specify that this should be limited to triple click
if (press) {
- if ((ARCH->time() - m_lastClickTime) <= clickTime && diff <= maxDiff){
+ if ((ARCH->time() - m_lastClickTime) <= clickTime && diff <= maxDiff) {
m_clickState++;
}
else {
m_clickState = 1;
}
-
+
m_lastClickTime = ARCH->time();
}
-
- if (m_clickState == 1){
+
+ if (m_clickState == 1) {
m_lastSingleClickXCursor = m_xCursor;
m_lastSingleClickYCursor = m_yCursor;
}
-
+
EMouseButtonState state = press ? kMouseButtonDown : kMouseButtonUp;
-
+
LOG((CLOG_DEBUG1 "faking mouse button id: %d press: %s", index, press ? "pressed" : "released"));
-
+
MouseButtonEventMapType thisButtonMap = MouseButtonEventMap[index];
CGEventType type = thisButtonMap[state];
CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, static_cast<CGMouseButton>(index));
-
+
CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState);
-
+
// Fix for sticky keys
CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags();
CGEventSetFlags(event, modifiers);
-
+
m_buttonState.set(index, state);
CGEventPost(kCGHIDEventTap, event);
-
+
CFRelease(event);
-
+
if (!press && (id == kButtonLeft)) {
if (m_fakeDraggingStarted) {
- m_getDropTargetThread = new Thread(new TMethodJob<OSXScreen>(
- this, &OSXScreen::getDropTargetThread));
+ m_getDropTargetThread = new Thread([this](){ get_drop_target_thread(); });
}
-
+
m_draggingStarted = false;
}
}
-void
-OSXScreen::getDropTargetThread(void*)
+void OSXScreen::get_drop_target_thread()
{
#if defined(MAC_OS_X_VERSION_10_7)
char* cstr = NULL;
-
+
// wait for 5 secs for the drop destinaiton string to be filled.
UInt32 timeout = ARCH->time() + 5;
-
+
while (ARCH->time() < timeout) {
CFStringRef cfstr = getCocoaDropTarget();
cstr = CFStringRefToUTF8String(cfstr);
CFRelease(cfstr);
-
+
if (cstr != NULL) {
break;
}
ARCH->sleep(.1f);
}
-
+
if (cstr != NULL) {
LOG((CLOG_DEBUG "drop target: %s", cstr));
m_dropTarget = cstr;
@@ -626,12 +622,12 @@ OSXScreen::fakeMouseMove(SInt32 x, SInt32 y)
if (m_fakeDraggingStarted) {
m_buttonState.set(0, kMouseButtonDown);
}
-
+
// index 0 means left mouse button
if (m_buttonState.test(0)) {
m_draggingStarted = true;
}
-
+
// synthesize event
CGPoint pos;
pos.x = x;
@@ -679,11 +675,11 @@ OSXScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
NULL, kCGScrollEventUnitLine, 2,
mapScrollWheelFromBarrier(yDelta),
-mapScrollWheelFromBarrier(xDelta));
-
+
// Fix for sticky keys
CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags();
CGEventSetFlags(scrollEvent, modifiers);
-
+
CGEventPost(kCGHIDEventTap, scrollEvent);
CFRelease(scrollEvent);
}
@@ -754,11 +750,11 @@ OSXScreen::enable()
if (m_isPrimary) {
// FIXME -- start watching jump zones
-
+
// kCGEventTapOptionDefault = 0x00000000 (Missing in 10.4, so specified literally)
m_eventTapPort = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault,
- kCGEventMaskForAllEvents,
- handleCGInputEvent,
+ kCGEventMaskForAllEvents,
+ handleCGInputEvent,
this);
}
else {
@@ -773,10 +769,10 @@ OSXScreen::enable()
// there may be a better way to do this, but we register an event handler even if we're
// not on the primary display (acting as a client). This way, if a local event comes in
- // (either keyboard or mouse), we can make sure to show the cursor if we've hidden it.
+ // (either keyboard or mouse), we can make sure to show the cursor if we've hidden it.
m_eventTapPort = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault,
- kCGEventMaskForAllEvents,
- handleCGInputEventSecondary,
+ kCGEventMaskForAllEvents,
+ handleCGInputEventSecondary,
this);
}
@@ -798,9 +794,9 @@ OSXScreen::disable()
if (m_autoShowHideCursor) {
showCursor();
}
-
+
// FIXME -- stop watching jump zones, stop capturing input
-
+
if (m_eventTapRLSR) {
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_eventTapRLSR, kCFRunLoopDefaultMode);
CFRelease(m_eventTapRLSR);
@@ -846,7 +842,7 @@ OSXScreen::enter()
io_registry_entry_t entry = IORegistryEntryFromPath(
kIOMasterPortDefault,
"IOService:/IOResources/IODisplayWrangler");
-
+
if (entry != MACH_PORT_NULL) {
IORegistryEntrySetCFProperty(entry, CFSTR("IORequestIdle"), kCFBooleanFalse);
IOObjectRelease(entry);
@@ -863,15 +859,15 @@ bool
OSXScreen::leave()
{
hideCursor();
-
+
if (isDraggingStarted()) {
String& fileList = getDraggingFilename();
-
+
if (!m_isPrimary) {
if (fileList.empty() == false) {
ClientApp& app = ClientApp::instance();
Client* client = app.getClientPtr();
-
+
DragInformation di;
di.setFilename(fileList);
DragFileList dragFileList;
@@ -881,7 +877,7 @@ OSXScreen::leave()
dragFileList, info);
client->sendDragInfo(fileCount, info, info.size());
LOG((CLOG_DEBUG "send dragging file to server"));
-
+
// TODO: what to do with multiple file or even
// a folder
client->sendFileToServer(fileList.c_str());
@@ -889,7 +885,7 @@ OSXScreen::leave()
}
m_draggingStarted = false;
}
-
+
if (m_isPrimary) {
avoidHesitatingCursor();
@@ -906,8 +902,8 @@ OSXScreen::setClipboard(ClipboardID, const IClipboard* src)
{
if (src != NULL) {
LOG((CLOG_DEBUG "setting clipboard"));
- Clipboard::copy(&m_pasteboard, src);
- }
+ Clipboard::copy(&m_pasteboard, src);
+ }
return true;
}
@@ -1036,16 +1032,16 @@ OSXScreen::handleSystemEvent(const Event& event, void*)
}
break;
- case kEventClassKeyboard:
+ case kEventClassKeyboard:
switch (GetEventKind(*carbonEvent)) {
case kEventHotKeyPressed:
case kEventHotKeyReleased:
onHotKey(*carbonEvent);
break;
}
-
+
break;
-
+
case kEventClassWindow:
// 2nd param was formerly GetWindowEventTarget(m_userInputWindow) which is 32-bit only,
// however as m_userInputWindow is never initialized to anything we can take advantage of
@@ -1076,7 +1072,7 @@ OSXScreen::handleSystemEvent(const Event& event, void*)
}
}
-bool
+bool
OSXScreen::onMouseMove(CGFloat mx, CGFloat my)
{
LOG((CLOG_DEBUG2 "mouse move %+f,%+f", mx, my));
@@ -1140,7 +1136,7 @@ OSXScreen::onMouseMove(CGFloat mx, CGFloat my)
return true;
}
-bool
+bool
OSXScreen::onMouseButton(bool pressed, UInt16 macButton)
{
// Buttons 2 and 3 are inverted on the mac
@@ -1176,7 +1172,7 @@ OSXScreen::onMouseButton(bool pressed, UInt16 macButton)
}
}
}
-
+
if (macButton == kButtonLeft) {
EMouseButtonState state = pressed ? kMouseButtonDown : kMouseButtonUp;
m_buttonState.set(kButtonLeft - 1, state);
@@ -1186,10 +1182,9 @@ OSXScreen::onMouseButton(bool pressed, UInt16 macButton)
}
else {
if (m_fakeDraggingStarted) {
- m_getDropTargetThread = new Thread(new TMethodJob<OSXScreen>(
- this, &OSXScreen::getDropTargetThread));
+ m_getDropTargetThread = new Thread([this](){ get_drop_target_thread(); });
}
-
+
m_draggingStarted = false;
}
}
@@ -1218,16 +1213,16 @@ OSXScreen::displayReconfigurationCallback(CGDirectDisplayID displayID, CGDisplay
// Closing or opening the lid when an external monitor is
// connected causes an kCGDisplayBeginConfigurationFlag event
- CGDisplayChangeSummaryFlags mask = kCGDisplayBeginConfigurationFlag | kCGDisplayMovedFlag |
- kCGDisplaySetModeFlag | kCGDisplayAddFlag | kCGDisplayRemoveFlag |
- kCGDisplayEnabledFlag | kCGDisplayDisabledFlag |
- kCGDisplayMirrorFlag | kCGDisplayUnMirrorFlag |
+ CGDisplayChangeSummaryFlags mask = kCGDisplayBeginConfigurationFlag | kCGDisplayMovedFlag |
+ kCGDisplaySetModeFlag | kCGDisplayAddFlag | kCGDisplayRemoveFlag |
+ kCGDisplayEnabledFlag | kCGDisplayDisabledFlag |
+ kCGDisplayMirrorFlag | kCGDisplayUnMirrorFlag |
kCGDisplayDesktopShapeChangedFlag;
-
+
LOG((CLOG_DEBUG1 "event: display was reconfigured: %x %x %x", flags, mask, flags & mask));
if (flags & mask) { /* Something actually did change */
-
+
LOG((CLOG_DEBUG1 "event: screen changed shape; refreshing dimensions"));
screen->updateScreenShape(displayID, flags);
}
@@ -1274,7 +1269,7 @@ OSXScreen::onKey(CGEventRef event)
m_activeModifierHotKeyMask = 0;
}
}
-
+
return true;
}
@@ -1342,7 +1337,7 @@ OSXScreen::onKey(CGEventRef event)
}
void
-OSXScreen::onMediaKey(CGEventRef event)
+OSXScreen::onMediaKey(CGEventRef event)
{
KeyID keyID;
bool down;
@@ -1405,7 +1400,7 @@ OSXScreen::mapBarrierButtonToMac(UInt16 button) const
return static_cast<ButtonID>(button);
}
-ButtonID
+ButtonID
OSXScreen::mapMacButtonToBarrier(UInt16 macButton) const
{
switch (macButton) {
@@ -1418,7 +1413,7 @@ OSXScreen::mapMacButtonToBarrier(UInt16 macButton) const
case 3:
return kButtonMiddle;
}
-
+
return static_cast<ButtonID>(macButton);
}
@@ -1445,8 +1440,8 @@ OSXScreen::getScrollSpeed() const
double scaling = 0.0;
CFPropertyListRef pref = ::CFPreferencesCopyValue(
- CFSTR("com.apple.scrollwheel.scaling") ,
- kCFPreferencesAnyApplication,
+ CFSTR("com.apple.scrollwheel.scaling") ,
+ kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
if (pref != NULL) {
@@ -1535,7 +1530,7 @@ OSXScreen::updateScreenShape()
if (CGGetActiveDisplayList(0, NULL, &displayCount) != CGDisplayNoErr) {
return;
}
-
+
if (displayCount == 0) {
return;
}
@@ -1579,13 +1574,13 @@ OSXScreen::updateScreenShape()
(displayCount == 1) ? "display" : "displays"));
}
-#pragma mark -
+#pragma mark -
//
// FAST USER SWITCH NOTIFICATION SUPPORT
//
// OSXScreen::userSwitchCallback(void*)
-//
+//
// gets called if a fast user switch occurs
//
@@ -1611,18 +1606,17 @@ OSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler,
return (CallNextEventHandler(nextHandler, theEvent));
}
-#pragma mark -
+#pragma mark -
//
// SLEEP/WAKEUP NOTIFICATION SUPPORT
//
// OSXScreen::watchSystemPowerThread(void*)
-//
-// main of thread monitoring system power (sleep/wakup) using a CFRunLoop
+//
+// main of thread monitoring system power (sleep/wakeup) using a CFRunLoop
//
-void
-OSXScreen::watchSystemPowerThread(void*)
+void OSXScreen::watchSystemPowerThread()
{
io_object_t notifier;
IONotificationPortRef notificationPortRef;
@@ -1641,7 +1635,7 @@ OSXScreen::watchSystemPowerThread(void*)
CFRunLoopAddSource(m_pmRunloop, runloopSourceRef,
kCFRunLoopCommonModes);
}
-
+
// thread is ready
{
Lock lock(m_pmMutex);
@@ -1658,15 +1652,15 @@ OSXScreen::watchSystemPowerThread(void*)
}
LOG((CLOG_DEBUG "started watchSystemPowerThread"));
-
+
LOG((CLOG_DEBUG "waiting for event loop"));
m_events->waitForReady();
-
+
#if defined(MAC_OS_X_VERSION_10_7)
{
Lock lockCarbon(m_carbonLoopMutex);
if (*m_carbonLoopReady == false) {
-
+
// we signalling carbon loop ready before starting
// unless we know how to do it within the loop
LOG((CLOG_DEBUG "signalling carbon loop ready"));
@@ -1676,12 +1670,12 @@ OSXScreen::watchSystemPowerThread(void*)
}
}
#endif
-
+
// start the run loop
LOG((CLOG_DEBUG "starting carbon loop"));
CFRunLoopRun();
LOG((CLOG_DEBUG "carbon loop has stopped"));
-
+
// cleanup
if (notificationPortRef) {
CFRunLoopRemoveSource(m_pmRunloop,
@@ -1716,7 +1710,7 @@ OSXScreen::handlePowerChangeRequest(natural_t messageType, void* messageArg)
getEventTarget(), messageArg,
Event::kDontFreeData));
return;
-
+
case kIOMessageSystemHasPoweredOn:
LOG((CLOG_DEBUG "system wakeup"));
m_events->addEvent(Event(m_events->forIScreen().resume(),
@@ -1742,16 +1736,16 @@ OSXScreen::handleConfirmSleep(const Event& event, void*)
if (m_pmRootPort != 0) {
// deliver suspend event immediately.
m_events->addEvent(Event(m_events->forIScreen().suspend(),
- getEventTarget(), NULL,
+ getEventTarget(), NULL,
Event::kDeliverImmediately));
-
+
LOG((CLOG_DEBUG "system will sleep"));
IOAllowPowerChange(m_pmRootPort, messageArg);
}
}
}
-#pragma mark -
+#pragma mark -
//
// GLOBAL HOTKEY OPERATING MODE SUPPORT (10.3)
@@ -1941,7 +1935,7 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy,
case kCGEventMouseMoved:
pos = CGEventGetLocation(event);
screen->onMouseMove(pos.x, pos.y);
-
+
// The system ignores our cursor-centering calls if
// we don't return the event. This should be harmless,
// but might register as slight movement to other apps
@@ -1980,10 +1974,10 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy,
}
break;
}
-
+
LOG((CLOG_DEBUG3 "unknown quartz event type: 0x%02x", type));
}
-
+
if (screen->m_isOnScreen) {
return event;
} else {
@@ -1992,38 +1986,38 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy,
}
void
-OSXScreen::MouseButtonState::set(UInt32 button, EMouseButtonState state)
+OSXScreen::MouseButtonState::set(UInt32 button, EMouseButtonState state)
{
bool newState = (state == kMouseButtonDown);
m_buttons.set(button, newState);
}
bool
-OSXScreen::MouseButtonState::any()
+OSXScreen::MouseButtonState::any()
{
return m_buttons.any();
}
void
-OSXScreen::MouseButtonState::reset()
+OSXScreen::MouseButtonState::reset()
{
m_buttons.reset();
}
void
-OSXScreen::MouseButtonState::overwrite(UInt32 buttons)
+OSXScreen::MouseButtonState::overwrite(UInt32 buttons)
{
m_buttons = std::bitset<NumButtonIDs>(buttons);
}
bool
-OSXScreen::MouseButtonState::test(UInt32 button) const
+OSXScreen::MouseButtonState::test(UInt32 button) const
{
return m_buttons.test(button);
}
SInt8
-OSXScreen::MouseButtonState::getFirstButtonDown() const
+OSXScreen::MouseButtonState::getFirstButtonDown() const
{
if (m_buttons.any()) {
for (unsigned short button = 0; button < m_buttons.size(); button++) {
@@ -2041,7 +2035,7 @@ OSXScreen::CFStringRefToUTF8String(CFStringRef aString)
if (aString == NULL) {
return NULL;
}
-
+
CFIndex length = CFStringGetLength(aString);
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(
length,
diff --git a/src/lib/platform/OSXScreenSaver.cpp b/src/lib/platform/OSXScreenSaver.cpp
index a0282d9..4af761a 100644
--- a/src/lib/platform/OSXScreenSaver.cpp
+++ b/src/lib/platform/OSXScreenSaver.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -48,17 +48,17 @@ OSXScreenSaver::OSXScreenSaver(IEventQueue* events, void* eventTarget) :
launchEventTypes[0].eventKind = kEventAppLaunched;
launchEventTypes[1].eventClass = kEventClassApplication;
launchEventTypes[1].eventKind = kEventAppTerminated;
-
+
EventHandlerUPP launchTerminationEventHandler =
NewEventHandlerUPP(launchTerminationCallback);
InstallApplicationEventHandler(launchTerminationEventHandler, 2,
launchEventTypes, this,
&m_launchTerminationEventHandlerRef);
DisposeEventHandlerUPP(launchTerminationEventHandler);
-
+
m_screenSaverPSN.highLongOfPSN = 0;
m_screenSaverPSN.lowLongOfPSN = 0;
-
+
if (isActive()) {
getProcessSerialNumber("ScreenSaverEngine", m_screenSaverPSN);
}
@@ -128,7 +128,7 @@ OSXScreenSaver::processTerminated(ProcessSerialNumber psn)
Event(m_events->forIPrimaryScreen().screensaverDeactivated(),
m_eventTarget));
}
-
+
m_screenSaverPSN.highLongOfPSN = 0;
m_screenSaverPSN.lowLongOfPSN = 0;
}
@@ -140,7 +140,7 @@ OSXScreenSaver::launchTerminationCallback(
EventRef theEvent, void* userData)
{
OSStatus result;
- ProcessSerialNumber psn;
+ ProcessSerialNumber psn;
EventParamType actualType;
ByteCount actualSize;
diff --git a/src/lib/platform/OSXScreenSaver.h b/src/lib/platform/OSXScreenSaver.h
index 07f2a7b..9a040a7 100644
--- a/src/lib/platform/OSXScreenSaver.h
+++ b/src/lib/platform/OSXScreenSaver.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -36,11 +36,11 @@ public:
virtual void activate();
virtual void deactivate();
virtual bool isActive() const;
-
+
private:
void processLaunched(ProcessSerialNumber psn);
void processTerminated(ProcessSerialNumber psn);
-
+
static pascal OSStatus
launchTerminationCallback(
EventHandlerCallRef nextHandler,
diff --git a/src/lib/platform/OSXScreenSaverControl.h b/src/lib/platform/OSXScreenSaverControl.h
index 76f8875..ff9d4f0 100644
--- a/src/lib/platform/OSXScreenSaverControl.h
+++ b/src/lib/platform/OSXScreenSaverControl.h
@@ -6,7 +6,7 @@
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXScreenSaverUtil.h b/src/lib/platform/OSXScreenSaverUtil.h
index 045553d..2ccb3c0 100644
--- a/src/lib/platform/OSXScreenSaverUtil.h
+++ b/src/lib/platform/OSXScreenSaverUtil.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXScreenSaverUtil.m b/src/lib/platform/OSXScreenSaverUtil.mm
index 6d82f10..6d82f10 100644
--- a/src/lib/platform/OSXScreenSaverUtil.m
+++ b/src/lib/platform/OSXScreenSaverUtil.mm
diff --git a/src/lib/platform/OSXUchrKeyResource.cpp b/src/lib/platform/OSXUchrKeyResource.cpp
index e0230e9..8d16bfb 100644
--- a/src/lib/platform/OSXUchrKeyResource.cpp
+++ b/src/lib/platform/OSXUchrKeyResource.cpp
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2016 Symless Ltd.
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/OSXUchrKeyResource.h b/src/lib/platform/OSXUchrKeyResource.h
index 47b63c9..8e1a813 100644
--- a/src/lib/platform/OSXUchrKeyResource.h
+++ b/src/lib/platform/OSXUchrKeyResource.h
@@ -1,11 +1,11 @@
/*
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2016 Symless Ltd.
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -27,7 +27,7 @@ typedef TISInputSourceRef KeyLayout;
class OSXUchrKeyResource : public IOSXKeyResource {
public:
OSXUchrKeyResource(const void*, UInt32 keyboardType);
-
+
// KeyResource overrides
virtual bool isValid() const;
virtual UInt32 getNumModifierCombinations() const;
@@ -35,15 +35,15 @@ public:
virtual UInt32 getNumButtons() const;
virtual UInt32 getTableForModifier(UInt32 mask) const;
virtual KeyID getKey(UInt32 table, UInt32 button) const;
-
+
private:
typedef std::vector<KeyID> KeySequence;
-
+
bool getDeadKey(KeySequence& keys, UInt16 index) const;
bool getKeyRecord(KeySequence& keys,
UInt16 index, UInt16& state) const;
bool addSequence(KeySequence& keys, UCKeyCharSeq c) const;
-
+
private:
const UCKeyboardLayout* m_resource;
const UCKeyModifiersToTableNum* m_m;
diff --git a/src/lib/platform/XWindowsClipboard.cpp b/src/lib/platform/XWindowsClipboard.cpp
index b0da695..27321e5 100644
--- a/src/lib/platform/XWindowsClipboard.cpp
+++ b/src/lib/platform/XWindowsClipboard.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -84,10 +84,14 @@ XWindowsClipboard::XWindowsClipboard(IXWindowsImpl* impl, Display* display,
// add converters, most desired first
m_converters.push_back(new XWindowsClipboardHTMLConverter(m_display,
"text/html"));
+ m_converters.push_back(new XWindowsClipboardHTMLConverter(m_display,
+ "application/x-moz-nativehtml"));
m_converters.push_back(new XWindowsClipboardBMPConverter(m_display));
m_converters.push_back(new XWindowsClipboardUTF8Converter(m_display,
"text/plain;charset=UTF-8"));
m_converters.push_back(new XWindowsClipboardUTF8Converter(m_display,
+ "text/plain;charset=utf-8"));
+ m_converters.push_back(new XWindowsClipboardUTF8Converter(m_display,
"UTF8_STRING"));
m_converters.push_back(new XWindowsClipboardUCS2Converter(m_display,
"text/plain;charset=ISO-10646-UCS-2"));
diff --git a/src/lib/platform/XWindowsClipboard.h b/src/lib/platform/XWindowsClipboard.h
index 091036e..5f1b6cb 100644
--- a/src/lib/platform/XWindowsClipboard.h
+++ b/src/lib/platform/XWindowsClipboard.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -25,11 +25,7 @@
#include "common/stdvector.h"
#include "XWindowsImpl.h"
-#if X_DISPLAY_MISSING
-# error X11 is required to build barrier
-#else
-# include <X11/Xlib.h>
-#endif
+#include <X11/Xlib.h>
class IXWindowsClipboardConverter;
diff --git a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp
index f6fed1c..0190f1d 100644
--- a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp
+++ b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h
index 861b1b6..375d8cc 100644
--- a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h
+++ b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardBMPConverter.cpp b/src/lib/platform/XWindowsClipboardBMPConverter.cpp
index fcfdc69..fd3325e 100644
--- a/src/lib/platform/XWindowsClipboardBMPConverter.cpp
+++ b/src/lib/platform/XWindowsClipboardBMPConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardBMPConverter.h b/src/lib/platform/XWindowsClipboardBMPConverter.h
index 4afa788..12716d1 100644
--- a/src/lib/platform/XWindowsClipboardBMPConverter.h
+++ b/src/lib/platform/XWindowsClipboardBMPConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardHTMLConverter.cpp b/src/lib/platform/XWindowsClipboardHTMLConverter.cpp
index 6ae98a7..a13e80e 100644
--- a/src/lib/platform/XWindowsClipboardHTMLConverter.cpp
+++ b/src/lib/platform/XWindowsClipboardHTMLConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardHTMLConverter.h b/src/lib/platform/XWindowsClipboardHTMLConverter.h
index 9a4ce61..b2a1a1e 100644
--- a/src/lib/platform/XWindowsClipboardHTMLConverter.h
+++ b/src/lib/platform/XWindowsClipboardHTMLConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardTextConverter.cpp b/src/lib/platform/XWindowsClipboardTextConverter.cpp
index 2e18d91..ee34f13 100644
--- a/src/lib/platform/XWindowsClipboardTextConverter.cpp
+++ b/src/lib/platform/XWindowsClipboardTextConverter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardTextConverter.h b/src/lib/platform/XWindowsClipboardTextConverter.h
index 99cdbcb..14e6c0f 100644
--- a/src/lib/platform/XWindowsClipboardTextConverter.h
+++ b/src/lib/platform/XWindowsClipboardTextConverter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardUCS2Converter.cpp b/src/lib/platform/XWindowsClipboardUCS2Converter.cpp
index d3d5e04..75dd70e 100644
--- a/src/lib/platform/XWindowsClipboardUCS2Converter.cpp
+++ b/src/lib/platform/XWindowsClipboardUCS2Converter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardUCS2Converter.h b/src/lib/platform/XWindowsClipboardUCS2Converter.h
index 16d880a..0bedb7a 100644
--- a/src/lib/platform/XWindowsClipboardUCS2Converter.h
+++ b/src/lib/platform/XWindowsClipboardUCS2Converter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardUTF8Converter.cpp b/src/lib/platform/XWindowsClipboardUTF8Converter.cpp
index f470cf1..a452706 100644
--- a/src/lib/platform/XWindowsClipboardUTF8Converter.cpp
+++ b/src/lib/platform/XWindowsClipboardUTF8Converter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsClipboardUTF8Converter.h b/src/lib/platform/XWindowsClipboardUTF8Converter.h
index 2219ed2..bb6cafb 100644
--- a/src/lib/platform/XWindowsClipboardUTF8Converter.h
+++ b/src/lib/platform/XWindowsClipboardUTF8Converter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/platform/XWindowsEventQueueBuffer.cpp b/src/lib/platform/XWindowsEventQueueBuffer.cpp
index 8b8c3b5..397973f 100644
--- a/src/lib/platform/XWindowsEventQueueBuffer.cpp
+++ b/src/lib/platform/XWindowsEventQueueBuffer.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -104,7 +104,7 @@ XWindowsEventQueueBuffer::waitForEvent(double dtimeout)
char buf[16];
ssize_t read_response = read(m_pipefd[0], buf, 15);
-
+
// with linux automake, warnings are treated as errors by default
if (read_response < 0)
{
@@ -181,7 +181,7 @@ XWindowsEventQueueBuffer::waitForEvent(double dtimeout)
retval = poll(pfds, 2, TIMEOUT_DELAY); //16ms = 60hz, but we make it > to play nicely with the cpu
if (pfds[1].revents & POLLIN) {
ssize_t read_response = read(m_pipefd[0], buf, 15);
-
+
// with linux automake, warnings are treated as errors by default
if (read_response < 0)
{
diff --git a/src/lib/platform/XWindowsEventQueueBuffer.h b/src/lib/platform/XWindowsEventQueueBuffer.h
index 13f6b16..dc35bf0 100644
--- a/src/lib/platform/XWindowsEventQueueBuffer.h
+++ b/src/lib/platform/XWindowsEventQueueBuffer.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -23,11 +23,7 @@
#include "common/stdvector.h"
#include "XWindowsImpl.h"
-#if X_DISPLAY_MISSING
-# error X11 is required to build barrier
-#else
-# include <X11/Xlib.h>
-#endif
+#include <X11/Xlib.h>
class IEventQueue;
diff --git a/src/lib/platform/XWindowsKeyState.cpp b/src/lib/platform/XWindowsKeyState.cpp
index 9fb71ca..088adc6 100644
--- a/src/lib/platform/XWindowsKeyState.cpp
+++ b/src/lib/platform/XWindowsKeyState.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -24,18 +24,14 @@
#include <cstddef>
#include <algorithm>
-#if X_DISPLAY_MISSING
-# error X11 is required to build barrier
-#else
-# include <X11/X.h>
-# include <X11/Xutil.h>
-# define XK_MISCELLANY
-# define XK_XKB_KEYS
-# include <X11/keysymdef.h>
+#include <X11/X.h>
+#include <X11/Xutil.h>
+#define XK_MISCELLANY
+#define XK_XKB_KEYS
+#include <X11/keysymdef.h>
#if HAVE_XKB_EXTENSION
# include <X11/XKBlib.h>
#endif
-#endif
static const size_t ModifiersFromXDefaultSize = 32;
@@ -348,7 +344,7 @@ XWindowsKeyState::updateKeysymMap(barrier::KeyMap& keyMap)
else {
tmpKeysyms[maxKeysyms * i + j] = NoSymbol;
}
- }
+ }
}
m_impl->XFree(allKeysyms);
allKeysyms = tmpKeysyms;
diff --git a/src/lib/platform/XWindowsKeyState.h b/src/lib/platform/XWindowsKeyState.h
index f790390..ef35dd4 100644
--- a/src/lib/platform/XWindowsKeyState.h
+++ b/src/lib/platform/XWindowsKeyState.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -23,18 +23,10 @@
#include "common/stdvector.h"
#include "XWindowsImpl.h"
-#if X_DISPLAY_MISSING
-# error X11 is required to build barrier
-#else
-# include <X11/Xlib.h>
-# if HAVE_X11_EXTENSIONS_XTEST_H
-# include <X11/extensions/XTest.h>
-# else
-# error The XTest extension is required to build barrier
-# endif
-# if HAVE_XKB_EXTENSION
-# include <X11/extensions/XKBstr.h>
-# endif
+#include <X11/Xlib.h>
+#include <X11/extensions/XTest.h>
+#if HAVE_XKB_EXTENSION
+# include <X11/extensions/XKBstr.h>
#endif
class IEventQueue;
@@ -136,7 +128,7 @@ private:
bool m_lock;
};
-#ifdef TEST_ENV
+#ifdef BARRIER_TEST_ENV
public: // yuck
#endif
typedef std::vector<KeyModifierMask> KeyModifierMaskList;
@@ -169,7 +161,7 @@ private:
// autorepeat state
XKeyboardState m_keyboardState;
-#ifdef TEST_ENV
+#ifdef BARRIER_TEST_ENV
public:
SInt32 group() const { return m_group; }
void group(const SInt32& group) { m_group = group; }
diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp
index 5f1724c..8fb3569 100644
--- a/src/lib/platform/XWindowsScreen.cpp
+++ b/src/lib/platform/XWindowsScreen.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -97,7 +97,7 @@ XWindowsScreen::XWindowsScreen(
if (mouseScrollDelta==0) m_mouseScrollDelta=120;
s_screen = this;
-
+
if (!disableXInitThreads) {
// initializes Xlib support for concurrent threads.
if (m_impl->XInitThreads() == 0)
@@ -266,14 +266,14 @@ XWindowsScreen::enter()
m_impl->DPMSForceLevel(m_display, DPMSModeOn);
}
#endif
-
+
// unmap the hider/grab window. this also ungrabs the mouse and
// keyboard if they're grabbed.
m_impl->XUnmapWindow(m_display, m_window);
/* maybe call this if entering for the screensaver
// set keyboard focus to root window. the screensaver should then
- // pick up key events for when the user enters a password to unlock.
+ // pick up key events for when the user enters a password to unlock.
XSetInputFocus(m_display, PointerRoot, PointerRoot, CurrentTime);
*/
@@ -877,7 +877,7 @@ XWindowsScreen::openDisplay(const char* displayName)
{
// get the DISPLAY
if (displayName == NULL) {
- displayName = getenv("DISPLAY");
+ displayName = std::getenv("DISPLAY");
if (displayName == NULL) {
displayName = ":0.0";
}
diff --git a/src/lib/platform/XWindowsScreen.h b/src/lib/platform/XWindowsScreen.h
index 5573839..581e91f 100644
--- a/src/lib/platform/XWindowsScreen.h
+++ b/src/lib/platform/XWindowsScreen.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -24,11 +24,7 @@
#include "common/stdvector.h"
#include "XWindowsImpl.h"
-#if X_DISPLAY_MISSING
-# error X11 is required to build barrier
-#else
-# include <X11/Xlib.h>
-#endif
+#include <X11/Xlib.h>
class XWindowsClipboard;
class XWindowsKeyState;
diff --git a/src/lib/platform/XWindowsScreenSaver.cpp b/src/lib/platform/XWindowsScreenSaver.cpp
index 5c4ef91..d8787ab 100644
--- a/src/lib/platform/XWindowsScreenSaver.cpp
+++ b/src/lib/platform/XWindowsScreenSaver.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -26,31 +26,11 @@
#include "base/TMethodEventJob.h"
#include <X11/Xatom.h>
-#if HAVE_X11_EXTENSIONS_XTEST_H
-# include <X11/extensions/XTest.h>
-#else
-# error The XTest extension is required to build barrier
-#endif
+#include <X11/extensions/XTest.h>
#if HAVE_X11_EXTENSIONS_DPMS_H
extern "C" {
# include <X11/Xmd.h>
# include <X11/extensions/dpms.h>
-# if !HAVE_DPMS_PROTOTYPES
-# undef DPMSModeOn
-# undef DPMSModeStandby
-# undef DPMSModeSuspend
-# undef DPMSModeOff
-# define DPMSModeOn 0
-# define DPMSModeStandby 1
-# define DPMSModeSuspend 2
-# define DPMSModeOff 3
-extern Bool DPMSQueryExtension(Display *, int *, int *);
-extern Bool DPMSCapable(Display *);
-extern Status DPMSEnable(Display *);
-extern Status DPMSDisable(Display *);
-extern Status DPMSForceLevel(Display *, CARD16);
-extern Status DPMSInfo(Display *, CARD16 *, BOOL *);
-# endif
}
#endif
@@ -490,7 +470,7 @@ XWindowsScreenSaver::addWatchXScreenSaver(Window window)
}
// if successful and window uses override_redirect (like xscreensaver
- // does) then watch it for property changes.
+ // does) then watch it for property changes.
if (!error && attr.override_redirect == True) {
error = false;
{
diff --git a/src/lib/platform/XWindowsScreenSaver.h b/src/lib/platform/XWindowsScreenSaver.h
index 1761db2..00285ec 100644
--- a/src/lib/platform/XWindowsScreenSaver.h
+++ b/src/lib/platform/XWindowsScreenSaver.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -23,11 +23,7 @@
#include "common/stdmap.h"
#include "XWindowsImpl.h"
-#if X_DISPLAY_MISSING
-# error X11 is required to build barrier
-#else
-# include <X11/Xlib.h>
-#endif
+#include <X11/Xlib.h>
class Event;
class EventQueueTimer;
@@ -119,7 +115,7 @@ private:
// the X display
Display* m_display;
- // window to receive xscreensaver repsonses
+ // window to receive xscreensaver responses
Window m_xscreensaverSink;
// the target for the events we generate
diff --git a/src/lib/platform/XWindowsUtil.cpp b/src/lib/platform/XWindowsUtil.cpp
index 3c90bd6..7d4bb63 100644
--- a/src/lib/platform/XWindowsUtil.cpp
+++ b/src/lib/platform/XWindowsUtil.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -1250,7 +1250,7 @@ XK_uhorn
// map "Internet" keys to KeyIDs
static const KeySym s_map1008FF[] =
{
- /* 0x00 */ 0, 0, kKeyBrightnessUp, kKeyBrightnessDown, 0, 0, 0, 0,
+ /* 0x00 */ 0, 0, kKeyBrightnessUp, kKeyBrightnessDown, 0, kKeyKbdBrightnessUp, kKeyKbdBrightnessDown, 0,
/* 0x08 */ 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x10 */ 0, kKeyAudioDown, kKeyAudioMute, kKeyAudioUp,
/* 0x14 */ kKeyAudioPlay, kKeyAudioStop, kKeyAudioPrev, kKeyAudioNext,
@@ -1285,6 +1285,45 @@ static const KeySym s_map1008FF[] =
/* 0xf8 */ 0, 0, 0, 0, 0, 0, 0, 0
};
+// map Sun keyboard keys to KeyIDs
+// This is based on the the "Internet" keymap plus the missing keys
+// Copy/Cut/Open/Paste/Props/Front
+static const KeySym s_map1009FF[] =
+{
+ /* 0x00 */ 0, 0, kKeyBrightnessUp, kKeyBrightnessDown, 0, 0, 0, 0,
+ /* 0x08 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x10 */ 0, kKeyAudioDown, kKeyAudioMute, kKeyAudioUp,
+ /* 0x14 */ kKeyAudioPlay, kKeyAudioStop, kKeyAudioPrev, kKeyAudioNext,
+ /* 0x18 */ kKeyWWWHome, kKeyAppMail, 0, kKeyWWWSearch, 0, 0, 0, 0,
+ /* 0x20 */ 0, 0, 0, 0, 0, 0, kKeyWWWBack, kKeyWWWForward,
+ /* 0x28 */ kKeyWWWStop, kKeyWWWRefresh, 0, 0, kKeyEject, 0, 0, 0,
+ /* 0x30 */ kKeyWWWFavorites, 0, kKeyAppMedia, 0, 0, 0, 0, 0,
+ /* 0x38 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x40 */ kKeyAppUser1, kKeyAppUser2, 0, 0, 0, 0, 0, 0,
+ /* 0x48 */ 0, 0, kKeyMissionControl, kKeyLaunchpad, 0, 0, 0, 0,
+ /* 0x50 */ 0, 0, 0, 0, 0, 0, 0, kKeyCopy,
+ /* 0x58 */ kKeyCut, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x68 */ 0, 0, 0, kKeyOpen, 0, kKeyPaste, 0, 0,
+ /* 0x70 */ kKeyProps, kKeyFront, 0, 0, 0, 0, 0, 0,
+ /* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x88 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x98 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xa0 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xa8 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xb0 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xb8 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xc0 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xc8 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xd0 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xd8 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xe0 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xe8 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xf0 */ 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xf8 */ 0, 0, 0, 0, 0, 0, 0, 0
+};
//
// XWindowsUtil
@@ -1546,6 +1585,10 @@ XWindowsUtil::mapKeySymToKeyID(KeySym k)
// "Internet" keys
return s_map1008FF[k & 0xff];
+ case 0x1009ff00:
+ // Additional Left-side keys provided by Sun Microsystems USB keyboards
+ return s_map1009FF[k & 0xff];
+
default: {
// lookup character in table
KeySymMap::const_iterator index = s_keySymToUCS4.find(k);
diff --git a/src/lib/platform/XWindowsUtil.h b/src/lib/platform/XWindowsUtil.h
index f5b3ea8..938c332 100644
--- a/src/lib/platform/XWindowsUtil.h
+++ b/src/lib/platform/XWindowsUtil.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -22,11 +22,7 @@
#include "common/stdmap.h"
#include "common/stdvector.h"
-#if X_DISPLAY_MISSING
-# error X11 is required to build barrier
-#else
-# include <X11/Xlib.h>
-#endif
+#include <X11/Xlib.h>
#include <string>
@@ -123,7 +119,7 @@ public:
This class sets an X error handler in the c'tor and restores the
previous error handler in the d'tor. A lock should only be
installed while the display is locked by the thread.
-
+
ErrorLock() ignores errors
ErrorLock(bool* flag) sets *flag to true if any error occurs
*/
diff --git a/src/lib/platform/synwinhk.h b/src/lib/platform/synwinhk.h
index 4b2d8e3..8fc4290 100644
--- a/src/lib/platform/synwinhk.h
+++ b/src/lib/platform/synwinhk.h
@@ -3,11 +3,11 @@
* Copyright (C) 2018 Debauchee Open Source Group
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the