Skip to content
Permalink
Browse files

Merge PR #3270: Assorted MinGW fixes

  • Loading branch information...
mkrautz committed Nov 26, 2017
2 parents 48f3eb9 + b65b55c commit 2d895067a51f80884de985499453d0876261f2e3
Showing with 23 additions and 13 deletions.
  1. +12 −8 src/mumble/GlobalShortcut_win.cpp
  2. +9 −3 src/mumble/mumble.pro
  3. +2 −2 src/mumble/os_early_win.cpp
@@ -5,14 +5,18 @@

#include "mumble_pch.hpp"

// MinGW does not support boost::future/boost::promise
// at present. Use Boost's implementation for now.
#define BOOST_THREAD_VERSION 4
#include <boost/thread.hpp>
#include <boost/thread/future.hpp>

#include "GlobalShortcut_win.h"

#include "MainWindow.h"
#include "OverlayClient.h"
#include "Global.h"

#include <future>

// 3rdparty/xinputcheck-src.
#include <xinputcheck.h>

@@ -36,7 +40,7 @@ class InjectKeyboardMessageEvent : public QEvent {
Q_DISABLE_COPY(InjectKeyboardMessageEvent);

public:
std::promise<bool> m_suppressionPromise;
boost::promise<bool> m_suppressionPromise;
DWORD m_scancode;
DWORD m_vkcode;
bool m_extended;
@@ -58,7 +62,7 @@ class InjectKeyboardMessageEvent : public QEvent {
, m_extended(extended)
, m_down(down) {}

inline std::future<bool> shouldSuppress() {
inline boost::future<bool> shouldSuppress() {
return m_suppressionPromise.get_future();
}
};
@@ -70,7 +74,7 @@ class InjectMouseMessageEvent : public QEvent {
Q_DISABLE_COPY(InjectMouseMessageEvent);

public:
std::promise<bool> m_suppressionPromise;
boost::promise<bool> m_suppressionPromise;
unsigned int m_btn;
bool m_down;

@@ -83,7 +87,7 @@ class InjectMouseMessageEvent : public QEvent {
, m_btn(btn)
, m_down(down) {}

inline std::future<bool> shouldSuppress() {
inline boost::future<bool> shouldSuppress() {
return m_suppressionPromise.get_future();
}
};
@@ -252,7 +256,7 @@ bool GlobalShortcutWin::injectKeyboardMessage(MSG *msg) {
bool up = !!(msg->lParam & 0x80000000);

InjectKeyboardMessageEvent *ikme = new InjectKeyboardMessageEvent(scancode, vkcode, extended, !up);
std::future<bool> suppress = ikme->shouldSuppress();
boost::future<bool> suppress = ikme->shouldSuppress();
qApp->postEvent(this, ikme);
return suppress.get();
}
@@ -295,7 +299,7 @@ bool GlobalShortcutWin::injectMouseMessage(MSG *msg) {
}

InjectMouseMessageEvent *imme = new InjectMouseMessageEvent(btn, down);
std::future<bool> suppress = imme->shouldSuppress();
boost::future<bool> suppress = imme->shouldSuppress();
qApp->postEvent(this, imme);
return suppress.get();
}
@@ -386,6 +386,15 @@ win32 {
win32-msvc* {
LIBS *= -lsndfile -lvorbis -lvorbisfile -logg -lFLAC
}

# Boost
win32-msvc* {
LIBS *= -llibboost_system-mt -llibboost_thread-mt
}
win32-g++ {
LIBS *= -lboost_system-mt -lboost_thread_win32-mt
}

LIBS *= -ldelayimp -delayload:shell32.dll

DEFINES *= WIN32
@@ -624,9 +633,6 @@ wasapi {
HEADERS *= WASAPI.h WASAPINotificationClient.h
SOURCES *= WASAPI.cpp WASAPINotificationClient.cpp
LIBS *= -lavrt -delayload:avrt.DLL
win32-g++ {
LIBS *= -lboost_system-mt
}
}

g15 {
@@ -44,7 +44,7 @@ static bool UIAccessDisabledViaConfig() {
DWORD sz = sizeof(buf) - 1*sizeof(wchar_t);

HKEY key = NULL;
bool success = (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Mumble\\Mumble\\shortcut\\windows\\uiaccess", NULL, KEY_READ, &key) == ERROR_SUCCESS) &&
bool success = (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Mumble\\Mumble\\shortcut\\windows\\uiaccess", 0, KEY_READ, &key) == ERROR_SUCCESS) &&
(RegQueryValueExW(key, L"enable" , NULL, NULL, (LPBYTE)&buf, &sz) == ERROR_SUCCESS);
if (success && _wcsicmp(buf, L"false") == 0) {
return true;
@@ -96,7 +96,7 @@ static bool RelaunchWithoutUIAccessIfNecessary() {
// Store the original value of __COMPAT_LAYER so we can
// restore it (which may be equivalent to not setting it all)
// once we've been relaunched.
wchar_t *compat_layer_env = _wgetenv(L"__COMPAT_LAYER");
const wchar_t *compat_layer_env = _wgetenv(L"__COMPAT_LAYER");
if (compat_layer_env == NULL) {
compat_layer_env = L"mumble_exe_none";
}

0 comments on commit 2d89506

Please sign in to comment.
You can’t perform that action at this time.