Skip to content

Commit

Permalink
GlobalShortcut_win, mumble.pro: remove use of HardHook in GlobalShort…
Browse files Browse the repository at this point in the history
…cut_win.

This also lets us remove MinHook from the Mumble client itself.

This code is part of the client-in-overlay feature that we had
for Windows and OS X. However, that feature is broken for Qt 5
and never had good performance.
  • Loading branch information
mkrautz committed Dec 30, 2015
1 parent 17ddc1a commit ad6acf2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 40 deletions.
33 changes: 0 additions & 33 deletions src/mumble/GlobalShortcut_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "MainWindow.h"
#include "OverlayClient.h"
#include "Global.h"
#include "../../overlay/HardHook.h"

#undef FAILED
#define FAILED(Status) (static_cast<HRESULT>(Status)<0)
Expand All @@ -52,38 +51,6 @@ static uint qHash(const GUID &a) {
return val;
}

static HWND WINAPI HookWindowFromPoint(POINT p);
static BOOL WINAPI HookSetForegroundWindow(HWND hwnd);

static HardHook hhWindowFromPoint(reinterpret_cast<voidFunc>(::WindowFromPoint), reinterpret_cast<voidFunc>(HookWindowFromPoint));
static HardHook hhSetForegroundWindow(reinterpret_cast<voidFunc>(::SetForegroundWindow), reinterpret_cast<voidFunc>(HookSetForegroundWindow));

typedef HWND(__stdcall *WindowFromPointType)(POINT);
static HWND WINAPI HookWindowFromPoint(POINT p) {
if (g.ocIntercept)
return MumbleHWNDForQWidget(&g.ocIntercept->qgv);

WindowFromPointType oWindowFromPoint = (WindowFromPointType) hhWindowFromPoint.call;
hhWindowFromPoint.restore();
HWND hwnd = oWindowFromPoint(p);
hhWindowFromPoint.inject();

return hwnd;
}

typedef BOOL(__stdcall *SetForegroundWindowType)(HWND);
static BOOL WINAPI HookSetForegroundWindow(HWND hwnd) {
if (g.ocIntercept)
return TRUE;

SetForegroundWindowType oSetForegroundWindow = (SetForegroundWindowType) hhSetForegroundWindow.call;
hhSetForegroundWindow.restore();
BOOL ret = oSetForegroundWindow(hwnd);
hhSetForegroundWindow.inject();

return ret;
}

/**
* Returns a platform specific GlobalShortcutEngine object.
*
Expand Down
8 changes: 1 addition & 7 deletions src/mumble/mumble.pro
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,10 @@ win32 {
RC_FILE = mumble.rc
}
HEADERS *= GlobalShortcut_win.h Overlay_win.h TaskList.h UserLockFile.h
SOURCES *= GlobalShortcut_win.cpp TextToSpeech_win.cpp Overlay_win.cpp SharedMemory_win.cpp Log_win.cpp os_win.cpp TaskList.cpp ../../overlay/HardHook.cpp ../../overlay/ods.cpp UserLockFile_win.cpp
SOURCES *= GlobalShortcut_win.cpp TextToSpeech_win.cpp Overlay_win.cpp SharedMemory_win.cpp Log_win.cpp os_win.cpp TaskList.cpp ../../overlay/ods.cpp UserLockFile_win.cpp
LIBS *= -ldxguid -ldinput8 -lsapi -lole32 -lws2_32 -ladvapi32 -lwintrust -ldbghelp -llibsndfile-1 -lshell32 -lshlwapi -luser32 -lgdi32 -lpsapi
LIBS *= -ldelayimp -delayload:shell32.dll

equals(QMAKE_TARGET.arch, x86_64) {
DEFINES += USE_MINHOOK
INCLUDEPATH *= ../../3rdparty/minhook-src/include
LIBS *= -lminhook
}

DEFINES *= WIN32
!CONFIG(no-asio) {
CONFIG *= asio
Expand Down

0 comments on commit ad6acf2

Please sign in to comment.