Browse Source

Fix windows/mingw build

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.0
falkTX 2 years ago
parent
commit
db71588a88
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 21 additions and 1 deletions
  1. +1
    -1
      source/modules/juce_gui_basics/juce_gui_basics.cpp
  2. +20
    -0
      source/modules/juce_gui_basics/native/juce_win32_Windowing.cpp

+ 1
- 1
source/modules/juce_gui_basics/juce_gui_basics.cpp View File

@@ -68,9 +68,9 @@
#include <commdlg.h> #include <commdlg.h>
#include <commctrl.h> #include <commctrl.h>
#include <sapi.h> #include <sapi.h>
#include <Dxgi.h>
#if JUCE_MSVC #if JUCE_MSVC
#include <Dxgi.h>
#include <UIAutomation.h> #include <UIAutomation.h>
#endif #endif


+ 20
- 0
source/modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -1373,6 +1373,7 @@ private:
}; };
//============================================================================== //==============================================================================
#if JUCE_MSVC
static HMONITOR getMonitorFromOutput (ComSmartPtr<IDXGIOutput> output) static HMONITOR getMonitorFromOutput (ComSmartPtr<IDXGIOutput> output)
{ {
DXGI_OUTPUT_DESC desc = {}; DXGI_OUTPUT_DESC desc = {};
@@ -1614,10 +1615,13 @@ private:
}; };
JUCE_IMPLEMENT_SINGLETON (VBlankDispatcher) JUCE_IMPLEMENT_SINGLETON (VBlankDispatcher)
#endif
//============================================================================== //==============================================================================
class HWNDComponentPeer : public ComponentPeer, class HWNDComponentPeer : public ComponentPeer,
#if JUCE_MSVC
private VBlankListener, private VBlankListener,
#endif
private Timer private Timer
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client #if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client
, public ModifierKeyReceiver , public ModifierKeyReceiver
@@ -1656,13 +1660,19 @@ public:
return ModifierKeys::currentModifiers; return ModifierKeys::currentModifiers;
}; };
#if JUCE_MSVC
if (updateCurrentMonitor()) if (updateCurrentMonitor())
VBlankDispatcher::getInstance()->updateDisplay (*this, currentMonitor); VBlankDispatcher::getInstance()->updateDisplay (*this, currentMonitor);
#else
updateCurrentMonitor();
#endif
} }
~HWNDComponentPeer() override ~HWNDComponentPeer() override
{ {
#if JUCE_MSVC
VBlankDispatcher::getInstance()->removeListener (*this); VBlankDispatcher::getInstance()->removeListener (*this);
#endif
// do this first to avoid messages arriving for this window before it's destroyed // do this first to avoid messages arriving for this window before it's destroyed
JuceWindowIdentifier::setAsJUCEWindow (hwnd, false); JuceWindowIdentifier::setAsJUCEWindow (hwnd, false);
@@ -2072,10 +2082,12 @@ public:
} }
//============================================================================== //==============================================================================
#if JUCE_MSVC
void onVBlank() override void onVBlank() override
{ {
dispatchDeferredRepaints(); dispatchDeferredRepaints();
} }
#endif
//============================================================================== //==============================================================================
static HWNDComponentPeer* getOwnerOfWindow (HWND h) noexcept static HWNDComponentPeer* getOwnerOfWindow (HWND h) noexcept
@@ -3674,8 +3686,12 @@ private:
handleMovedOrResized(); handleMovedOrResized();
#if JUCE_MSVC
if (updateCurrentMonitor()) if (updateCurrentMonitor())
VBlankDispatcher::getInstance()->updateDisplay (*this, currentMonitor); VBlankDispatcher::getInstance()->updateDisplay (*this, currentMonitor);
#else
updateCurrentMonitor();
#endif
return ! dontRepaint; // to allow non-accelerated openGL windows to draw themselves correctly. return ! dontRepaint; // to allow non-accelerated openGL windows to draw themselves correctly.
} }
@@ -3831,10 +3847,14 @@ private:
.getDisplayForRect (component.getScreenBounds())->userArea), .getDisplayForRect (component.getScreenBounds())->userArea),
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING); SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOSENDCHANGING);
#if JUCE_MSVC
auto* dispatcher = VBlankDispatcher::getInstance(); auto* dispatcher = VBlankDispatcher::getInstance();
dispatcher->reconfigureDisplays(); dispatcher->reconfigureDisplays();
updateCurrentMonitor(); updateCurrentMonitor();
dispatcher->updateDisplay (*this, currentMonitor); dispatcher->updateDisplay (*this, currentMonitor);
#else
updateCurrentMonitor();
#endif
} }
//============================================================================== //==============================================================================


Loading…
Cancel
Save