Files

40 lines
1.4 KiB
Plaintext

1| // native_bridge/src/gui_probe.cpp — standalone VST3 GUI attach probe.
2| // Debug tool (NOT shipped with the DAW): loads a VST3 with Vst3Instrument and
3| // tests openGUI under different thread/pump/parent-window setups so we can
4| // find why view->attached() hangs inside the bridge.
5| #include "Vst3Instrument.h"
6|
7| #ifdef _WIN32
8| #include <windows.h>
9| #include <imm.h>
10| #endif
11| #include <atomic>
12| #include <chrono>
13| #include <condition_variable>
14| #include <cstdio>
15| #include <cstdlib>
16| #include <deque>
17| #include <functional>
18| #include <mutex>
19| #include <string>
20| #include <thread>
21| #include <exception>
22|
23| #ifdef _WIN32
24| static void probe_invalid_param(const wchar_t* expr, const wchar_t* func, const wchar_t* file,
25| unsigned int line, uintptr_t reserved) {
26| printf("[probe] INVALID_PARAMETER expr=%ls func=%ls\n", expr ? expr : L"null", func ? func : L"null");
27| fflush(stdout);
28| }
29| #endif
30|
31| static void disable_ime_contexts(HWND w) {
32| if (w && IsWindow(w)) {
33| ImmAssociateContext(w, nullptr);
34| for (HWND c = GetWindow(w, GW_CHILD); c; c = GetWindow(c, GW_HWNDNEXT))
35| ImmAssociateContext(c, nullptr);
36| }
37| }
38|
39| static void pump_for(int secs) {
40| #ifdef _WIN32