barrier/lib/platform/CSynergyHook.h

79 lines
2.5 KiB
C
Raw Normal View History

2002-08-02 19:57:46 +00:00
/*
* 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 CSYNERGYHOOK_H
#define CSYNERGYHOOK_H
#include "BasicTypes.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#if defined(SYNRGYHK_EXPORTS)
#define CSYNERGYHOOK_API __declspec(dllexport)
#else
#define CSYNERGYHOOK_API __declspec(dllimport)
#endif
#define SYNERGY_MSG_MARK WM_APP + 0x0011 // mark id; <unused>
#define SYNERGY_MSG_KEY WM_APP + 0x0012 // vk code; key data
#define SYNERGY_MSG_MOUSE_BUTTON WM_APP + 0x0013 // button msg; <unused>
#define SYNERGY_MSG_MOUSE_WHEEL WM_APP + 0x0014 // delta; <unused>
#define SYNERGY_MSG_MOUSE_MOVE WM_APP + 0x0015 // x; y
#define SYNERGY_MSG_POST_WARP WM_APP + 0x0016 // <unused>; <unused>
#define SYNERGY_MSG_PRE_WARP WM_APP + 0x0017 // x; y
#define SYNERGY_MSG_SCREEN_SAVER WM_APP + 0x0018 // activated; <unused>
#define SYNERGY_MSG_DEBUG WM_APP + 0x0019 // data, data
#define SYNERGY_MSG_INPUT_FIRST SYNERGY_MSG_KEY
#define SYNERGY_MSG_INPUT_LAST SYNERGY_MSG_PRE_WARP
#define SYNERGY_HOOK_LAST_MSG SYNERGY_MSG_DEBUG
extern "C" {
Fixed a few win32 keyboard/mouse problems. First, the mouse hook now captures non-client area mouse messages. Previously, these were ignored (because i forgot about them) and they caused all kinds of problems because they weren't forwarded. For example, clicking on a window border would cause the window to start resizing when the mouse came back to the server screen. Moving inside a title bar meant that the mouse wouldn't move on the client screen. Second, because non-client messages are now handled, the full screen transparent window is no longer necessary to capture input so it's never displayed. (The window is still necessary for clipboard ownership so it's still created.) No transparent window means no screen flashing. It also means we don't have to become the foreground and active window. This plays better with apps that minimize or restore when they're no longer the foreground application/active window. Third, fixed the low level keyboard hook to forward toggle key updates, which it was neglecting to do. Finally, keyboard and mouse input is always forwarded from the hook to the primary screen handler which then shadows the current key and mouse button state. If we're using low level hooks then this isn't really necessary and GetKeyState() always returns the right info but without low level hooks it means we can just use the shadow state. It also means we don't have to show our window in order to get the system's key state table up to date, fixing the screen flash when checking for the scroll lock state.
2003-05-03 12:54:22 +00:00
enum EHookResult {
kHOOK_FAILED,
kHOOK_OKAY,
kHOOK_OKAY_LL
};
enum EHookMode {
kHOOK_DISABLE,
kHOOK_WATCH_JUMP_ZONE,
kHOOK_RELAY_EVENTS
};
2002-06-23 21:53:31 +00:00
typedef int (*InitFunc)(DWORD targetQueueThreadID);
typedef int (*CleanupFunc)(void);
Fixed a few win32 keyboard/mouse problems. First, the mouse hook now captures non-client area mouse messages. Previously, these were ignored (because i forgot about them) and they caused all kinds of problems because they weren't forwarded. For example, clicking on a window border would cause the window to start resizing when the mouse came back to the server screen. Moving inside a title bar meant that the mouse wouldn't move on the client screen. Second, because non-client messages are now handled, the full screen transparent window is no longer necessary to capture input so it's never displayed. (The window is still necessary for clipboard ownership so it's still created.) No transparent window means no screen flashing. It also means we don't have to become the foreground and active window. This plays better with apps that minimize or restore when they're no longer the foreground application/active window. Third, fixed the low level keyboard hook to forward toggle key updates, which it was neglecting to do. Finally, keyboard and mouse input is always forwarded from the hook to the primary screen handler which then shadows the current key and mouse button state. If we're using low level hooks then this isn't really necessary and GetKeyState() always returns the right info but without low level hooks it means we can just use the shadow state. It also means we don't have to show our window in order to get the system's key state table up to date, fixing the screen flash when checking for the scroll lock state.
2003-05-03 12:54:22 +00:00
typedef EHookResult (*InstallFunc)(void);
typedef int (*UninstallFunc)(void);
2002-06-23 21:53:31 +00:00
typedef int (*InstallScreenSaverFunc)(void);
typedef int (*UninstallScreenSaverFunc)(void);
2002-07-11 13:13:37 +00:00
typedef void (*SetSidesFunc)(UInt32);
typedef void (*SetZoneFunc)(SInt32, SInt32, SInt32, SInt32, SInt32);
typedef void (*SetModeFunc)(int);
2002-06-23 21:53:31 +00:00
CSYNERGYHOOK_API int init(DWORD);
CSYNERGYHOOK_API int cleanup(void);
Fixed a few win32 keyboard/mouse problems. First, the mouse hook now captures non-client area mouse messages. Previously, these were ignored (because i forgot about them) and they caused all kinds of problems because they weren't forwarded. For example, clicking on a window border would cause the window to start resizing when the mouse came back to the server screen. Moving inside a title bar meant that the mouse wouldn't move on the client screen. Second, because non-client messages are now handled, the full screen transparent window is no longer necessary to capture input so it's never displayed. (The window is still necessary for clipboard ownership so it's still created.) No transparent window means no screen flashing. It also means we don't have to become the foreground and active window. This plays better with apps that minimize or restore when they're no longer the foreground application/active window. Third, fixed the low level keyboard hook to forward toggle key updates, which it was neglecting to do. Finally, keyboard and mouse input is always forwarded from the hook to the primary screen handler which then shadows the current key and mouse button state. If we're using low level hooks then this isn't really necessary and GetKeyState() always returns the right info but without low level hooks it means we can just use the shadow state. It also means we don't have to show our window in order to get the system's key state table up to date, fixing the screen flash when checking for the scroll lock state.
2003-05-03 12:54:22 +00:00
CSYNERGYHOOK_API EHookResult install(void);
CSYNERGYHOOK_API int uninstall(void);
2002-06-23 21:53:31 +00:00
CSYNERGYHOOK_API int installScreenSaver(void);
CSYNERGYHOOK_API int uninstallScreenSaver(void);
2002-07-11 13:13:37 +00:00
CSYNERGYHOOK_API void setSides(UInt32 sides);
CSYNERGYHOOK_API void setZone(SInt32 x, SInt32 y, SInt32 w, SInt32 h,
SInt32 jumpZoneSize);
CSYNERGYHOOK_API void setMode(EHookMode mode);
}
#endif