mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-28 23:05:11 +08:00
Some work toward Issue 27 and Issue 319
This commit is contained in:
@@ -86,7 +86,7 @@
|
||||
//
|
||||
|
||||
CMSWindowsDesks::CMSWindowsDesks(
|
||||
bool isPrimary, HINSTANCE hookLibrary,
|
||||
bool isPrimary, bool noHooks, HINSTANCE hookLibrary,
|
||||
const IScreenSaver* screensaver, IJob* updateKeys) :
|
||||
m_isPrimary(isPrimary),
|
||||
m_is95Family(CArchMiscWindows::isWindows95Family()),
|
||||
@@ -361,7 +361,7 @@ void
|
||||
CMSWindowsDesks::queryHookLibrary(HINSTANCE hookLibrary)
|
||||
{
|
||||
// look up functions
|
||||
if (m_isPrimary) {
|
||||
if (m_isPrimary && !m_noHooks) {
|
||||
m_install = (InstallFunc)GetProcAddress(hookLibrary, "install");
|
||||
m_uninstall = (UninstallFunc)GetProcAddress(hookLibrary, "uninstall");
|
||||
m_installScreensaver =
|
||||
@@ -736,7 +736,7 @@ CMSWindowsDesks::deskThread(void* vdesk)
|
||||
continue;
|
||||
|
||||
case SYNERGY_MSG_SWITCH:
|
||||
if (m_isPrimary) {
|
||||
if (m_isPrimary && !m_noHooks) {
|
||||
m_uninstall();
|
||||
if (m_screensaverNotify) {
|
||||
m_uninstallScreensaver();
|
||||
@@ -816,11 +816,13 @@ CMSWindowsDesks::deskThread(void* vdesk)
|
||||
break;
|
||||
|
||||
case SYNERGY_MSG_SCREENSAVER:
|
||||
if (msg.wParam != 0) {
|
||||
m_installScreensaver();
|
||||
}
|
||||
else {
|
||||
m_uninstallScreensaver();
|
||||
if (!m_noHooks) {
|
||||
if (msg.wParam != 0) {
|
||||
m_installScreensaver();
|
||||
}
|
||||
else {
|
||||
m_uninstallScreensaver();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
updated in a thread attached to the current desk.
|
||||
\p hookLibrary must be a handle to the hook library.
|
||||
*/
|
||||
CMSWindowsDesks(bool isPrimary, HINSTANCE hookLibrary,
|
||||
CMSWindowsDesks(bool isPrimary, bool noHooks, HINSTANCE hookLibrary,
|
||||
const IScreenSaver* screensaver, IJob* updateKeys);
|
||||
~CMSWindowsDesks();
|
||||
|
||||
@@ -241,6 +241,9 @@ private:
|
||||
// true if screen is being used as a primary screen, false otherwise
|
||||
bool m_isPrimary;
|
||||
|
||||
// true if hooks are not to be installed (useful for debugging)
|
||||
bool m_noHooks;
|
||||
|
||||
// true if windows 95/98/me
|
||||
bool m_is95Family;
|
||||
|
||||
|
||||
@@ -77,8 +77,9 @@
|
||||
HINSTANCE CMSWindowsScreen::s_instance = NULL;
|
||||
CMSWindowsScreen* CMSWindowsScreen::s_screen = NULL;
|
||||
|
||||
CMSWindowsScreen::CMSWindowsScreen(bool isPrimary) :
|
||||
CMSWindowsScreen::CMSWindowsScreen(bool isPrimary, bool noHooks) :
|
||||
m_isPrimary(isPrimary),
|
||||
m_noHooks(noHooks),
|
||||
m_is95Family(CArchMiscWindows::isWindows95Family()),
|
||||
m_isOnScreen(m_isPrimary),
|
||||
m_class(0),
|
||||
@@ -118,7 +119,8 @@ CMSWindowsScreen::CMSWindowsScreen(bool isPrimary) :
|
||||
m_hookLibrary = openHookLibrary("synrgyhk");
|
||||
}
|
||||
m_screensaver = new CMSWindowsScreenSaver();
|
||||
m_desks = new CMSWindowsDesks(m_isPrimary,
|
||||
m_desks = new CMSWindowsDesks(
|
||||
m_isPrimary, m_noHooks,
|
||||
m_hookLibrary, m_screensaver,
|
||||
new TMethodJob<CMSWindowsScreen>(this,
|
||||
&CMSWindowsScreen::updateKeysCB));
|
||||
@@ -491,7 +493,7 @@ void CMSWindowsScreen::saveMousePosition(SInt32 x, SInt32 y) {
|
||||
m_xCursor = x;
|
||||
m_yCursor = y;
|
||||
|
||||
LOG((CLOG_DEBUG2 "saved mouse position for next delta: %+d,%+d", x,y));
|
||||
LOG((CLOG_DEBUG5 "saved mouse position for next delta: %+d,%+d", x,y));
|
||||
}
|
||||
|
||||
UInt32
|
||||
@@ -763,6 +765,7 @@ CMSWindowsScreen::createBlankCursor() const
|
||||
// create a transparent cursor
|
||||
int cw = GetSystemMetrics(SM_CXCURSOR);
|
||||
int ch = GetSystemMetrics(SM_CYCURSOR);
|
||||
|
||||
UInt8* cursorAND = new UInt8[ch * ((cw + 31) >> 2)];
|
||||
UInt8* cursorXOR = new UInt8[ch * ((cw + 31) >> 2)];
|
||||
memset(cursorAND, 0xff, ch * ((cw + 31) >> 2));
|
||||
@@ -916,7 +919,7 @@ bool
|
||||
CMSWindowsScreen::onPreDispatchPrimary(HWND,
|
||||
UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LOG((CLOG_DEBUG2 "handling pre-dispatch primary"));
|
||||
LOG((CLOG_DEBUG5 "handling pre-dispatch primary"));
|
||||
|
||||
// handle event
|
||||
switch (message) {
|
||||
@@ -1298,8 +1301,8 @@ CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
||||
SInt32 x = mx - m_xCursor;
|
||||
SInt32 y = my - m_yCursor;
|
||||
|
||||
LOG((CLOG_DEBUG2
|
||||
"handling mouse move; delta motion calc: %+d=(%+d - %+d),%+d=(%+d - %+d)",
|
||||
LOG((CLOG_DEBUG3
|
||||
"mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)",
|
||||
x, mx, m_xCursor, y, my, m_yCursor));
|
||||
|
||||
// ignore if the mouse didn't move or if message posted prior
|
||||
@@ -1324,7 +1327,7 @@ CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my)
|
||||
// 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_DEBUG2 "warping server cursor to center: %+d,%+d", m_xCenter, m_yCenter));
|
||||
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
|
||||
|
||||
@@ -32,7 +32,7 @@ class CThread;
|
||||
//! Implementation of IPlatformScreen for Microsoft Windows
|
||||
class CMSWindowsScreen : public CPlatformScreen {
|
||||
public:
|
||||
CMSWindowsScreen(bool isPrimary);
|
||||
CMSWindowsScreen(bool isPrimary, bool noHooks);
|
||||
virtual ~CMSWindowsScreen();
|
||||
|
||||
//! @name manipulators
|
||||
@@ -216,6 +216,9 @@ private:
|
||||
// true if screen is being used as a primary screen, false otherwise
|
||||
bool m_isPrimary;
|
||||
|
||||
// true if hooks are not to be installed (useful for debugging)
|
||||
bool m_noHooks;
|
||||
|
||||
// true if windows 95/98/me
|
||||
bool m_is95Family;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user