remove *very* old support code for mouse wheels

This commit is contained in:
walker0643 2018-02-23 15:42:09 -05:00
parent a71779647d
commit 30304255ea
1 changed files with 4 additions and 80 deletions

View File

@ -68,7 +68,6 @@ setImmuneKeys(const DWORD *list, std::size_t size)
#include "barrier/protocol_types.h"
#include <zmouse.h>
#include <tchar.h>
#undef assert
@ -93,7 +92,6 @@ setImmuneKeys(const DWORD *list, std::size_t size)
enum EWheelSupport {
kWheelNone,
kWheelOld,
kWheelWin2000,
kWheelModern
};
@ -116,8 +114,6 @@ typedef struct tagMOUSEHOOKSTRUCTWin2000 {
static HINSTANCE g_hinstance = NULL;
static DWORD g_processID = 0;
static EWheelSupport g_wheelSupport = kWheelNone;
static UINT g_wmMouseWheel = 0;
static DWORD g_threadID = 0;
static HHOOK g_getMessage = NULL;
static HHOOK g_keyboardLL = NULL;
@ -578,19 +574,6 @@ getMessageHook(int code, WPARAM wParam, LPARAM lParam)
BARRIER_MSG_SCREEN_SAVER, TRUE, 0);
}
}
if (g_mode == kHOOK_RELAY_EVENTS) {
MSG* msg = reinterpret_cast<MSG*>(lParam);
if (g_wheelSupport == kWheelOld && msg->message == g_wmMouseWheel) {
// post message to our window
PostThreadMessage(g_threadID,
BARRIER_MSG_MOUSE_WHEEL,
static_cast<SInt16>(msg->wParam & 0xffffu), 0);
// zero out the delta in the message so it's (hopefully)
// ignored
msg->wParam = 0;
}
}
}
return CallNextHookEx(g_getMessage, code, wParam, lParam);
@ -661,52 +644,6 @@ mouseLLHook(int code, WPARAM wParam, LPARAM lParam)
return CallNextHookEx(g_mouseLL, code, wParam, lParam);
}
static
EWheelSupport
getWheelSupport()
{
// see if modern wheel is present
if (GetSystemMetrics(SM_MOUSEWHEELPRESENT)) {
OSVERSIONINFOEX osvi;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwPlatformId = VER_PLATFORM_WIN32_NT;
osvi.dwMajorVersion = 5;
osvi.dwMinorVersion = 0;
ULONGLONG condMask = 0;
VER_SET_CONDITION (condMask, VER_MAJORVERSION, VER_EQUAL);
VER_SET_CONDITION (condMask, VER_MINORVERSION, VER_EQUAL);
VER_SET_CONDITION (condMask, VER_PLATFORMID, VER_EQUAL);
if (VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION |
VER_PLATFORMID, condMask)) {
return kWheelWin2000;
}
return kWheelModern;
}
// not modern. see if we've got old-style support.
#if defined(MSH_WHEELSUPPORT)
UINT wheelSupportMsg = RegisterWindowMessage(MSH_WHEELSUPPORT);
HWND wheelSupportWindow = FindWindow(MSH_WHEELMODULE_CLASS,
MSH_WHEELMODULE_TITLE);
if (wheelSupportWindow != NULL && wheelSupportMsg != 0) {
if (SendMessage(wheelSupportWindow, wheelSupportMsg, 0, 0) != 0) {
g_wmMouseWheel = RegisterWindowMessage(MSH_MOUSEWHEEL);
if (g_wmMouseWheel != 0) {
return kWheelOld;
}
}
}
#endif
// assume modern. we don't do anything special in this case
// except respond to WM_MOUSEWHEEL messages. GetSystemMetrics()
// can apparently return FALSE even if a mouse wheel is present
// though i'm not sure exactly when it does that (WinME returns
// FALSE for my logitech USB trackball).
return kWheelModern;
}
//
// external functions
//
@ -831,7 +768,6 @@ init(DWORD threadID)
// removed the hooks so we just need to reset our state.
g_hinstance = GetModuleHandle(_T("synwinhk"));
g_processID = GetCurrentProcessId();
g_wheelSupport = kWheelNone;
g_threadID = 0;
g_getMessage = NULL;
g_keyboardLL = NULL;
@ -885,17 +821,6 @@ install()
// reset fake input flag
g_fakeInput = false;
// check for mouse wheel support
g_wheelSupport = getWheelSupport();
// install GetMessage hook (unless already installed)
if (g_wheelSupport == kWheelOld && g_getMessage == NULL) {
g_getMessage = SetWindowsHookEx(WH_GETMESSAGE,
&getMessageHook,
g_hinstance,
0);
}
// install low-level hooks. we require that they both get installed.
g_mouseLL = SetWindowsHookEx(WH_MOUSE_LL,
&mouseLLHook,
@ -919,11 +844,11 @@ install()
#endif
// check that we got all the hooks we wanted
if ((g_getMessage == NULL && g_wheelSupport == kWheelOld) ||
if ((g_mouseLL == NULL) ||
#if !NO_GRAB_KEYBOARD
(g_keyboardLL == NULL) ||
(g_keyboardLL == NULL)
#endif
(g_mouseLL == NULL)) {
) {
uninstall();
return kHOOK_FAILED;
}
@ -958,7 +883,6 @@ uninstall(void)
UnhookWindowsHookEx(g_getMessage);
g_getMessage = NULL;
}
g_wheelSupport = kWheelNone;
return 1;
}
@ -993,7 +917,7 @@ uninstallScreenSaver(void)
assert(g_hinstance != NULL);
// uninstall hook unless the mouse wheel hook is installed
if (g_getMessage != NULL && g_wheelSupport != kWheelOld) {
if (g_getMessage != NULL) {
UnhookWindowsHookEx(g_getMessage);
g_getMessage = NULL;
}