chore: commit G3.2+G3.3 deploy binaries + debug scripts; ignore debug run artifacts
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import subprocess
|
||||
|
||||
def load(p):
|
||||
return open(p, encoding='utf-8', newline='').read()
|
||||
|
||||
def save(p, s):
|
||||
open(p, 'w', encoding='utf-8', newline='').write(s)
|
||||
|
||||
def rep(s, needle, repl, tag):
|
||||
n = s.count(needle)
|
||||
if n != 1:
|
||||
raise SystemExit("FAIL %s: needle count=%d" % (tag, n))
|
||||
return s.replace(needle, repl)
|
||||
|
||||
cr = '\r\n'
|
||||
mp = load('native_bridge/src/main.cpp')
|
||||
|
||||
# 1. forward-declare helper near post_close_gui fwd decl
|
||||
mp = rep(mp,
|
||||
"static void post_close_gui(uint32_t ch, HWND hwnd); // defined after ChannelWorker",
|
||||
"static void post_close_gui(uint32_t ch, HWND hwnd); // defined after ChannelWorker" + cr + "static void post_resize_view(uint32_t ch, int w, int h); // defined after ChannelWorker",
|
||||
"fwd")
|
||||
|
||||
# 2. define helper after ChannelWorker class, before same-plugin helpers
|
||||
anchor = "// --- same-plugin-DLL silence helpers"
|
||||
helper = (
|
||||
"// resizeView() must run on the channel worker (the view was attached in its" + cr +
|
||||
"// COM STA apartment), never on the main pump thread." + cr +
|
||||
"static void post_resize_view(uint32_t ch, int w, int h) {" + cr +
|
||||
" if (g_workers) {" + cr +
|
||||
" auto wit = g_workers->find(ch);" + cr +
|
||||
" if (wit != g_workers->end()) {" + cr +
|
||||
" wit->second->post([ch, w, h]() {" + cr +
|
||||
" if (!g_engine) return;" + cr +
|
||||
" auto* i = g_engine->get(ch);" + cr +
|
||||
" if (i) i->resizeView(w, h);" + cr +
|
||||
" });" + cr +
|
||||
" }" + cr +
|
||||
" }" + cr +
|
||||
"}" + cr + cr + anchor)
|
||||
mp = rep(mp, anchor, helper, "helper")
|
||||
|
||||
# 3. WM_SIZE: call helper instead of inline g_workers block
|
||||
mp = rep(mp,
|
||||
" if (ch != UINT32_MAX && g_workers) {" + cr + " auto wit = g_workers->find(ch);" + cr + " if (wit != g_workers->end()) {" + cr + " // onSize() must run on the channel worker (the view was attached" + cr + " // in its COM STA apartment), not on the main pump thread." + cr + " wit->second->post([ch, w, h]() {" + cr + " if (!g_engine) return;" + cr + " auto* i = g_engine->get(ch);" + cr + " if (i) i->resizeView(w, h);" + cr + " });" + cr + " }" + cr + " }" + cr + " return 0;",
|
||||
" if (ch != UINT32_MAX) {" + cr + " post_resize_view(ch, w, h);" + cr + " }" + cr + " return 0;",
|
||||
"wmsize")
|
||||
|
||||
save('native_bridge/src/main.cpp', mp)
|
||||
print("OK")
|
||||
Reference in New Issue
Block a user