mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
VBlank: Avoid hogging the message queue with repaint messages when repaints take longer than a vblank period
This commit is contained in:
parent
fae3e2c010
commit
b1861dc25c
37 changed files with 416 additions and 241 deletions
|
|
@ -2249,6 +2249,7 @@ add_library( ${BINARY_NAME}
|
|||
"../../../../../modules/juce_gui_basics/native/juce_ScopedThreadDPIAwarenessSetter_windows.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_ScopedWindowAssociation_linux.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_VBlank_windows.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_android.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_linux.cpp"
|
||||
|
|
@ -4731,6 +4732,7 @@ set_source_files_properties(
|
|||
"../../../../../modules/juce_gui_basics/native/juce_ScopedThreadDPIAwarenessSetter_windows.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_ScopedWindowAssociation_linux.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_VBlank_windows.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_android.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_linux.cpp"
|
||||
|
|
|
|||
|
|
@ -2726,6 +2726,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3517,6 +3517,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2726,6 +2726,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3517,6 +3517,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2726,6 +2726,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3517,6 +3517,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2011,6 +2011,7 @@ add_library( ${BINARY_NAME}
|
|||
"../../../../../modules/juce_gui_basics/native/juce_ScopedThreadDPIAwarenessSetter_windows.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_ScopedWindowAssociation_linux.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_VBlank_windows.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_android.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_linux.cpp"
|
||||
|
|
@ -4175,6 +4176,7 @@ set_source_files_properties(
|
|||
"../../../../../modules/juce_gui_basics/native/juce_ScopedThreadDPIAwarenessSetter_windows.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_ScopedWindowAssociation_linux.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_VBlank_windows.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_android.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_linux.cpp"
|
||||
|
|
|
|||
|
|
@ -2419,6 +2419,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3061,6 +3061,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2141,6 +2141,7 @@ add_library( ${BINARY_NAME}
|
|||
"../../../../../modules/juce_gui_basics/native/juce_ScopedThreadDPIAwarenessSetter_windows.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_ScopedWindowAssociation_linux.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_VBlank_windows.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_android.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_linux.cpp"
|
||||
|
|
@ -4458,6 +4459,7 @@ set_source_files_properties(
|
|||
"../../../../../modules/juce_gui_basics/native/juce_ScopedThreadDPIAwarenessSetter_windows.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_ScopedWindowAssociation_linux.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_VBlank_windows.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_android.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_linux.cpp"
|
||||
|
|
|
|||
|
|
@ -2553,6 +2553,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3268,6 +3268,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2553,6 +2553,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3268,6 +3268,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2553,6 +2553,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3268,6 +3268,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2030,6 +2030,7 @@ add_library( ${BINARY_NAME}
|
|||
"../../../../../modules/juce_gui_basics/native/juce_ScopedThreadDPIAwarenessSetter_windows.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_ScopedWindowAssociation_linux.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_VBlank_windows.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_android.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_linux.cpp"
|
||||
|
|
@ -4274,6 +4275,7 @@ set_source_files_properties(
|
|||
"../../../../../modules/juce_gui_basics/native/juce_ScopedThreadDPIAwarenessSetter_windows.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_ScopedWindowAssociation_linux.h"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_VBlank_windows.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_android.cpp"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_ios.mm"
|
||||
"../../../../../modules/juce_gui_basics/native/juce_Windowing_linux.cpp"
|
||||
|
|
|
|||
|
|
@ -2440,6 +2440,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3115,6 +3115,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -1622,6 +1622,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2059,6 +2059,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -1622,6 +1622,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2059,6 +2059,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -1622,6 +1622,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2059,6 +2059,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2561,6 +2561,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3289,6 +3289,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2561,6 +2561,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3289,6 +3289,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2561,6 +2561,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3289,6 +3289,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -2439,6 +2439,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_ScopedDPIAwarenessDisabler.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -3112,6 +3112,9 @@
|
|||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_UIViewComponentPeer_ios.mm">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_VBlank_windows.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\modules\juce_gui_basics\native\juce_Windowing_android.cpp">
|
||||
<Filter>JUCE Modules\juce_gui_basics\native</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@
|
|||
#include "native/accessibility/juce_Accessibility_windows.cpp"
|
||||
#include "native/juce_WindowsHooks_windows.h"
|
||||
#include "native/juce_WindowUtils_windows.cpp"
|
||||
#include "native/juce_VBlank_windows.cpp"
|
||||
#include "native/juce_Windowing_windows.cpp"
|
||||
#include "native/juce_WindowsHooks_windows.cpp"
|
||||
#include "native/juce_NativeMessageBox_windows.cpp"
|
||||
|
|
|
|||
316
modules/juce_gui_basics/native/juce_VBlank_windows.cpp
Normal file
316
modules/juce_gui_basics/native/juce_VBlank_windows.cpp
Normal file
|
|
@ -0,0 +1,316 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE framework.
|
||||
Copyright (c) Raw Material Software Limited
|
||||
|
||||
JUCE is an open source framework subject to commercial or open source
|
||||
licensing.
|
||||
|
||||
By downloading, installing, or using the JUCE framework, or combining the
|
||||
JUCE framework with any other source code, object code, content or any other
|
||||
copyrightable work, you agree to the terms of the JUCE End User Licence
|
||||
Agreement, and all incorporated terms including the JUCE Privacy Policy and
|
||||
the JUCE Website Terms of Service, as applicable, which will bind you. If you
|
||||
do not agree to the terms of these agreements, we will not license the JUCE
|
||||
framework to you, and you must discontinue the installation or download
|
||||
process and cease use of the JUCE framework.
|
||||
|
||||
JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/
|
||||
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
|
||||
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
|
||||
|
||||
Or:
|
||||
|
||||
You may also use this code under the terms of the AGPLv3:
|
||||
https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
|
||||
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
|
||||
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
class VBlankThread : private Thread,
|
||||
private AsyncUpdater
|
||||
{
|
||||
public:
|
||||
using VBlankListener = ComponentPeer::VBlankListener;
|
||||
|
||||
VBlankThread (ComSmartPtr<IDXGIOutput> out,
|
||||
HMONITOR mon,
|
||||
VBlankListener& listener)
|
||||
: Thread ("VBlankThread"),
|
||||
output (out),
|
||||
monitor (mon)
|
||||
{
|
||||
listeners.push_back (listener);
|
||||
startThread (Priority::highest);
|
||||
}
|
||||
|
||||
~VBlankThread() override
|
||||
{
|
||||
cancelPendingUpdate();
|
||||
|
||||
{
|
||||
const std::scoped_lock lock { mutex };
|
||||
threadState = ThreadState::exit;
|
||||
}
|
||||
|
||||
condvar.notify_one();
|
||||
|
||||
stopThread (-1);
|
||||
}
|
||||
|
||||
void updateMonitor()
|
||||
{
|
||||
monitor = getMonitorFromOutput (output);
|
||||
}
|
||||
|
||||
HMONITOR getMonitor() const noexcept { return monitor; }
|
||||
|
||||
void addListener (VBlankListener& listener)
|
||||
{
|
||||
listeners.push_back (listener);
|
||||
}
|
||||
|
||||
bool removeListener (const VBlankListener& listener)
|
||||
{
|
||||
auto it = std::find_if (listeners.cbegin(),
|
||||
listeners.cend(),
|
||||
[&listener] (const auto& l) { return &(l.get()) == &listener; });
|
||||
|
||||
if (it != listeners.cend())
|
||||
{
|
||||
listeners.erase (it);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasNoListeners() const noexcept
|
||||
{
|
||||
return listeners.empty();
|
||||
}
|
||||
|
||||
bool hasListener (const VBlankListener& listener) const noexcept
|
||||
{
|
||||
return std::any_of (listeners.cbegin(),
|
||||
listeners.cend(),
|
||||
[&listener] (const auto& l) { return &(l.get()) == &listener; });
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
static HMONITOR getMonitorFromOutput (ComSmartPtr<IDXGIOutput> output)
|
||||
{
|
||||
DXGI_OUTPUT_DESC desc = {};
|
||||
return (FAILED (output->GetDesc (&desc)) || ! desc.AttachedToDesktop)
|
||||
? nullptr
|
||||
: desc.Monitor;
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
void run() override
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (output->WaitForVBlank() == S_OK)
|
||||
{
|
||||
std::unique_lock lock { mutex };
|
||||
condvar.wait (lock, [this] { return threadState != ThreadState::sleep; });
|
||||
|
||||
if (threadState == ThreadState::exit)
|
||||
return;
|
||||
|
||||
threadState = ThreadState::sleep;
|
||||
triggerAsyncUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
Thread::sleep (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handleAsyncUpdate() override
|
||||
{
|
||||
for (auto& listener : listeners)
|
||||
listener.get().onVBlank();
|
||||
|
||||
{
|
||||
const std::scoped_lock lock { mutex };
|
||||
|
||||
if (threadState == ThreadState::sleep)
|
||||
threadState = ThreadState::paint;
|
||||
}
|
||||
|
||||
condvar.notify_one();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
ComSmartPtr<IDXGIOutput> output;
|
||||
HMONITOR monitor = nullptr;
|
||||
std::vector<std::reference_wrapper<VBlankListener>> listeners;
|
||||
|
||||
enum class ThreadState
|
||||
{
|
||||
sleep,
|
||||
paint,
|
||||
exit,
|
||||
};
|
||||
|
||||
ThreadState threadState = ThreadState::paint;
|
||||
std::condition_variable condvar;
|
||||
std::mutex mutex;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VBlankThread)
|
||||
JUCE_DECLARE_NON_MOVEABLE (VBlankThread)
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
class VBlankDispatcher final : public DeletedAtShutdown
|
||||
{
|
||||
public:
|
||||
void updateDisplay (ComponentPeer::VBlankListener& listener, HMONITOR monitor)
|
||||
{
|
||||
if (monitor == nullptr)
|
||||
{
|
||||
removeListener (listener);
|
||||
return;
|
||||
}
|
||||
|
||||
auto threadWithListener = threads.end();
|
||||
auto threadWithMonitor = threads.end();
|
||||
|
||||
for (auto it = threads.begin(); it != threads.end(); ++it)
|
||||
{
|
||||
if ((*it)->hasListener (listener))
|
||||
threadWithListener = it;
|
||||
|
||||
if ((*it)->getMonitor() == monitor)
|
||||
threadWithMonitor = it;
|
||||
|
||||
if (threadWithListener != threads.end()
|
||||
&& threadWithMonitor != threads.end())
|
||||
{
|
||||
if (threadWithListener == threadWithMonitor)
|
||||
return;
|
||||
|
||||
(*threadWithMonitor)->addListener (listener);
|
||||
|
||||
// This may invalidate iterators, so be careful!
|
||||
removeListener (threadWithListener, listener);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (threadWithMonitor != threads.end())
|
||||
{
|
||||
(*threadWithMonitor)->addListener (listener);
|
||||
return;
|
||||
}
|
||||
|
||||
if (threadWithListener != threads.end())
|
||||
removeListener (threadWithListener, listener);
|
||||
|
||||
for (auto adapter : adapters)
|
||||
{
|
||||
UINT i = 0;
|
||||
ComSmartPtr<IDXGIOutput> output;
|
||||
|
||||
while (adapter->EnumOutputs (i, output.resetAndGetPointerAddress()) != DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
if (VBlankThread::getMonitorFromOutput (output) == monitor)
|
||||
{
|
||||
threads.emplace_back (std::make_unique<VBlankThread> (output, monitor, listener));
|
||||
return;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void removeListener (const ComponentPeer::VBlankListener& listener)
|
||||
{
|
||||
for (auto it = threads.begin(); it != threads.end(); ++it)
|
||||
if (removeListener (it, listener))
|
||||
return;
|
||||
}
|
||||
|
||||
void reconfigureDisplays()
|
||||
{
|
||||
adapters.clear();
|
||||
|
||||
ComSmartPtr<IDXGIFactory> factory;
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
|
||||
CreateDXGIFactory (__uuidof (IDXGIFactory), (void**)factory.resetAndGetPointerAddress());
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
UINT i = 0;
|
||||
ComSmartPtr<IDXGIAdapter> adapter;
|
||||
|
||||
while (factory->EnumAdapters (i, adapter.resetAndGetPointerAddress()) != DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
adapters.push_back (adapter);
|
||||
++i;
|
||||
}
|
||||
|
||||
for (auto& thread : threads)
|
||||
thread->updateMonitor();
|
||||
|
||||
threads.erase (std::remove_if (threads.begin(),
|
||||
threads.end(),
|
||||
[] (const auto& thread) { return thread->getMonitor() == nullptr; }),
|
||||
threads.end());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED (VBlankDispatcher, false)
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
using Threads = std::vector<std::unique_ptr<VBlankThread>>;
|
||||
|
||||
VBlankDispatcher()
|
||||
{
|
||||
reconfigureDisplays();
|
||||
}
|
||||
|
||||
~VBlankDispatcher() override
|
||||
{
|
||||
threads.clear();
|
||||
clearSingletonInstance();
|
||||
}
|
||||
|
||||
// This may delete the corresponding thread and invalidate iterators,
|
||||
// so be careful!
|
||||
bool removeListener (Threads::iterator it, const ComponentPeer::VBlankListener& listener)
|
||||
{
|
||||
if ((*it)->removeListener (listener))
|
||||
{
|
||||
if ((*it)->hasNoListeners())
|
||||
threads.erase (it);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
std::vector<ComSmartPtr<IDXGIAdapter>> adapters;
|
||||
Threads threads;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VBlankDispatcher)
|
||||
JUCE_DECLARE_NON_MOVEABLE (VBlankDispatcher)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (VBlankDispatcher)
|
||||
|
||||
} // namespace juce
|
||||
|
|
@ -1422,249 +1422,9 @@ private:
|
|||
WindowsDeleteStringFuncPtr deleteHString;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
static HMONITOR getMonitorFromOutput (ComSmartPtr<IDXGIOutput> output)
|
||||
{
|
||||
DXGI_OUTPUT_DESC desc = {};
|
||||
return (FAILED (output->GetDesc (&desc)) || ! desc.AttachedToDesktop)
|
||||
? nullptr
|
||||
: desc.Monitor;
|
||||
}
|
||||
|
||||
using VBlankListener = ComponentPeer::VBlankListener;
|
||||
|
||||
//==============================================================================
|
||||
class VSyncThread final : private Thread,
|
||||
private AsyncUpdater
|
||||
{
|
||||
public:
|
||||
VSyncThread (ComSmartPtr<IDXGIOutput> out,
|
||||
HMONITOR mon,
|
||||
VBlankListener& listener)
|
||||
: Thread ("VSyncThread"),
|
||||
output (out),
|
||||
monitor (mon)
|
||||
{
|
||||
listeners.push_back (listener);
|
||||
startThread (Priority::highest);
|
||||
}
|
||||
|
||||
~VSyncThread() override
|
||||
{
|
||||
stopThread (-1);
|
||||
cancelPendingUpdate();
|
||||
}
|
||||
|
||||
void updateMonitor()
|
||||
{
|
||||
monitor = getMonitorFromOutput (output);
|
||||
}
|
||||
|
||||
HMONITOR getMonitor() const noexcept { return monitor; }
|
||||
|
||||
void addListener (VBlankListener& listener)
|
||||
{
|
||||
listeners.push_back (listener);
|
||||
}
|
||||
|
||||
bool removeListener (const VBlankListener& listener)
|
||||
{
|
||||
auto it = std::find_if (listeners.cbegin(),
|
||||
listeners.cend(),
|
||||
[&listener] (const auto& l) { return &(l.get()) == &listener; });
|
||||
|
||||
if (it != listeners.cend())
|
||||
{
|
||||
listeners.erase (it);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasNoListeners() const noexcept
|
||||
{
|
||||
return listeners.empty();
|
||||
}
|
||||
|
||||
bool hasListener (const VBlankListener& listener) const noexcept
|
||||
{
|
||||
return std::any_of (listeners.cbegin(),
|
||||
listeners.cend(),
|
||||
[&listener] (const auto& l) { return &(l.get()) == &listener; });
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
void run() override
|
||||
{
|
||||
while (! threadShouldExit())
|
||||
{
|
||||
if (output->WaitForVBlank() == S_OK)
|
||||
triggerAsyncUpdate();
|
||||
else
|
||||
Thread::sleep (1);
|
||||
}
|
||||
}
|
||||
|
||||
void handleAsyncUpdate() override
|
||||
{
|
||||
for (auto& listener : listeners)
|
||||
listener.get().onVBlank();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
ComSmartPtr<IDXGIOutput> output;
|
||||
HMONITOR monitor = nullptr;
|
||||
std::vector<std::reference_wrapper<VBlankListener>> listeners;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VSyncThread)
|
||||
JUCE_DECLARE_NON_MOVEABLE (VSyncThread)
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
class VBlankDispatcher final : public DeletedAtShutdown
|
||||
{
|
||||
public:
|
||||
void updateDisplay (VBlankListener& listener, HMONITOR monitor)
|
||||
{
|
||||
if (monitor == nullptr)
|
||||
{
|
||||
removeListener (listener);
|
||||
return;
|
||||
}
|
||||
|
||||
auto threadWithListener = threads.end();
|
||||
auto threadWithMonitor = threads.end();
|
||||
|
||||
for (auto it = threads.begin(); it != threads.end(); ++it)
|
||||
{
|
||||
if ((*it)->hasListener (listener))
|
||||
threadWithListener = it;
|
||||
|
||||
if ((*it)->getMonitor() == monitor)
|
||||
threadWithMonitor = it;
|
||||
|
||||
if (threadWithListener != threads.end()
|
||||
&& threadWithMonitor != threads.end())
|
||||
{
|
||||
if (threadWithListener == threadWithMonitor)
|
||||
return;
|
||||
|
||||
(*threadWithMonitor)->addListener (listener);
|
||||
|
||||
// This may invalidate iterators, so be careful!
|
||||
removeListener (threadWithListener, listener);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (threadWithMonitor != threads.end())
|
||||
{
|
||||
(*threadWithMonitor)->addListener (listener);
|
||||
return;
|
||||
}
|
||||
|
||||
if (threadWithListener != threads.end())
|
||||
removeListener (threadWithListener, listener);
|
||||
|
||||
for (auto adapter : adapters)
|
||||
{
|
||||
UINT i = 0;
|
||||
ComSmartPtr<IDXGIOutput> output;
|
||||
|
||||
while (adapter->EnumOutputs (i, output.resetAndGetPointerAddress()) != DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
if (getMonitorFromOutput (output) == monitor)
|
||||
{
|
||||
threads.emplace_back (std::make_unique<VSyncThread> (output, monitor, listener));
|
||||
return;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void removeListener (const VBlankListener& listener)
|
||||
{
|
||||
for (auto it = threads.begin(); it != threads.end(); ++it)
|
||||
if (removeListener (it, listener))
|
||||
return;
|
||||
}
|
||||
|
||||
void reconfigureDisplays()
|
||||
{
|
||||
adapters.clear();
|
||||
|
||||
ComSmartPtr<IDXGIFactory> factory;
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token")
|
||||
CreateDXGIFactory (__uuidof (IDXGIFactory), (void**)factory.resetAndGetPointerAddress());
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
UINT i = 0;
|
||||
ComSmartPtr<IDXGIAdapter> adapter;
|
||||
|
||||
while (factory->EnumAdapters (i, adapter.resetAndGetPointerAddress()) != DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
adapters.push_back (adapter);
|
||||
++i;
|
||||
}
|
||||
|
||||
for (auto& thread : threads)
|
||||
thread->updateMonitor();
|
||||
|
||||
threads.erase (std::remove_if (threads.begin(),
|
||||
threads.end(),
|
||||
[] (const auto& thread) { return thread->getMonitor() == nullptr; }),
|
||||
threads.end());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_SINGLETON_SINGLETHREADED (VBlankDispatcher, false)
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
using Threads = std::vector<std::unique_ptr<VSyncThread>>;
|
||||
|
||||
VBlankDispatcher()
|
||||
{
|
||||
reconfigureDisplays();
|
||||
}
|
||||
|
||||
~VBlankDispatcher() override
|
||||
{
|
||||
threads.clear();
|
||||
clearSingletonInstance();
|
||||
}
|
||||
|
||||
// This may delete the corresponding thread and invalidate iterators,
|
||||
// so be careful!
|
||||
bool removeListener (Threads::iterator it, const VBlankListener& listener)
|
||||
{
|
||||
if ((*it)->removeListener (listener))
|
||||
{
|
||||
if ((*it)->hasNoListeners())
|
||||
threads.erase (it);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
std::vector<ComSmartPtr<IDXGIAdapter>> adapters;
|
||||
Threads threads;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VBlankDispatcher)
|
||||
JUCE_DECLARE_NON_MOVEABLE (VBlankDispatcher)
|
||||
};
|
||||
|
||||
JUCE_IMPLEMENT_SINGLETON (VBlankDispatcher)
|
||||
|
||||
//==============================================================================
|
||||
class HWNDComponentPeer final : public ComponentPeer,
|
||||
private VBlankListener,
|
||||
private ComponentPeer::VBlankListener,
|
||||
private Timer
|
||||
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client
|
||||
, public ModifierKeyReceiver
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue