mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-18 16:31:44 +03:00
4521fe4990
events to other hook functions, which broke some tools like objectbar. Second, windows key processing was fixed. Previously pressing and release the key would only send a press event, locking the user onto the client window; also, the win32 server treated as a Meta modifier instead of a Super modifier, which broke any use of it as any kind of modifier key. Third, added hacks to support several key combinations on windows 95/98/me that are treated specially by windows, including Alt+Tab, Alt+Shift+Tab, Alt+Esc, Alt+Shift+Esc, Ctrl+Esc, and any combination using the windows key like Win+E and Win+F but not Ctrl+Alt+Del. Fourth, scroll lock only locking to the client (which only happened when using a synergy server on windows) has been fixed; unfortunately the solution causes a lot of screen redraws for some reason. Finally, there's been a fix to clipboard handling that may or may not fix a problem where the clipboard would stop transferring between systems after a little while. I can't be sure if it fixes the problem because I can't reproduce the problem.
137 lines
3.6 KiB
C++
137 lines
3.6 KiB
C++
/*
|
|
* synergy -- mouse and keyboard sharing utility
|
|
* 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 COPYING 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
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#ifndef CMSWINDOWSPRIMARYSCREEN_H
|
|
#define CMSWINDOWSPRIMARYSCREEN_H
|
|
|
|
#include "CPrimaryScreen.h"
|
|
#include "IMSWindowsScreenEventHandler.h"
|
|
#include "CSynergyHook.h"
|
|
#include "MouseTypes.h"
|
|
#include "CString.h"
|
|
|
|
class CMSWindowsScreen;
|
|
class IScreenReceiver;
|
|
class IPrimaryScreenReceiver;
|
|
|
|
//! Microsoft windows primary screen implementation
|
|
class CMSWindowsPrimaryScreen :
|
|
public CPrimaryScreen, public IMSWindowsScreenEventHandler {
|
|
public:
|
|
typedef bool (CMSWindowsPrimaryScreen::*HookMethod)(int, WPARAM, LPARAM);
|
|
|
|
CMSWindowsPrimaryScreen(IScreenReceiver*, IPrimaryScreenReceiver*);
|
|
virtual ~CMSWindowsPrimaryScreen();
|
|
|
|
// CPrimaryScreen overrides
|
|
virtual void reconfigure(UInt32 activeSides);
|
|
virtual void warpCursor(SInt32 x, SInt32 y);
|
|
virtual void resetOptions();
|
|
virtual void setOptions(const COptionsList& options);
|
|
virtual UInt32 addOneShotTimer(double timeout);
|
|
virtual KeyModifierMask getToggleMask() const;
|
|
virtual bool isLockedToScreen() const;
|
|
virtual IScreen* getScreen() const;
|
|
|
|
// IMSWindowsScreenEventHandler overrides
|
|
virtual void onScreensaver(bool activated);
|
|
virtual bool onPreDispatch(const CEvent* event);
|
|
virtual bool onEvent(CEvent* event);
|
|
virtual void onOneShotTimerExpired(UInt32 id);
|
|
virtual SInt32 getJumpZoneSize() const;
|
|
virtual void postCreateWindow(HWND);
|
|
virtual void preDestroyWindow(HWND);
|
|
|
|
protected:
|
|
// CPrimaryScreen overrides
|
|
virtual void onPreMainLoop();
|
|
virtual void onPreOpen();
|
|
virtual void onPostOpen();
|
|
virtual void onPostClose();
|
|
virtual void onPreEnter();
|
|
virtual void onPostEnter();
|
|
virtual void onPreLeave();
|
|
virtual void onPostLeave(bool);
|
|
|
|
virtual void createWindow();
|
|
virtual void destroyWindow();
|
|
virtual bool showWindow();
|
|
virtual void hideWindow();
|
|
virtual void warpCursorToCenter();
|
|
|
|
virtual void updateKeys();
|
|
|
|
private:
|
|
void enterNoWarp();
|
|
|
|
// warp cursor without discarding queued events
|
|
void warpCursorNoFlush(SInt32 x, SInt32 y);
|
|
|
|
// discard posted messages
|
|
void nextMark();
|
|
|
|
// test if event should be ignored
|
|
bool ignore() const;
|
|
|
|
// key and button queries
|
|
KeyID mapKey(WPARAM keycode, LPARAM info,
|
|
KeyModifierMask* maskOut);
|
|
ButtonID mapButton(WPARAM button) const;
|
|
void updateKey(UINT vkCode, bool press);
|
|
bool isModifier(UINT vkCode) const;
|
|
|
|
private:
|
|
IPrimaryScreenReceiver* m_receiver;
|
|
CMSWindowsScreen* m_screen;
|
|
|
|
// true if windows 95/98/me
|
|
bool m_is95Family;
|
|
|
|
// the main loop's thread id
|
|
DWORD m_threadID;
|
|
|
|
// our window
|
|
HWND m_window;
|
|
|
|
// used to discard queued messages that are no longer needed
|
|
UInt32 m_mark;
|
|
UInt32 m_markReceived;
|
|
|
|
// map of key state
|
|
BYTE m_keys[256];
|
|
|
|
// last mouse position
|
|
SInt32 m_x, m_y;
|
|
|
|
// position of center pixel of screen
|
|
SInt32 m_xCenter, m_yCenter;
|
|
|
|
// hook library stuff
|
|
HINSTANCE m_hookLibrary;
|
|
InitFunc m_init;
|
|
CleanupFunc m_cleanup;
|
|
InstallFunc m_install;
|
|
UninstallFunc m_uninstall;
|
|
SetSidesFunc m_setSides;
|
|
SetZoneFunc m_setZone;
|
|
SetRelayFunc m_setRelay;
|
|
|
|
// stuff for restoring active window
|
|
HWND m_lastForegroundWindow;
|
|
HWND m_lastActiveWindow;
|
|
DWORD m_lastActiveThread;
|
|
};
|
|
|
|
#endif
|