From 0366e3d724ec4a305b69857f1aecd1d65281c3bc Mon Sep 17 00:00:00 2001 From: martinfouilleul Date: Wed, 21 Jun 2023 15:48:26 +0200 Subject: [PATCH] [win32, graphics] experiments with multisurface with transparent top-level windows --- examples/multi_surface/main.c | 1 + src/win32_app.c | 9 ++++++++- src/win32_app.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/multi_surface/main.c b/examples/multi_surface/main.c index cd50b97..f826f01 100644 --- a/examples/multi_surface/main.c +++ b/examples/multi_surface/main.c @@ -47,6 +47,7 @@ int main() } //*/ // start app + mp_window_center(window); mp_window_bring_to_front(window); mp_window_focus(window); diff --git a/src/win32_app.c b/src/win32_app.c index 32cb448..14e11d9 100644 --- a/src/win32_app.c +++ b/src/win32_app.c @@ -272,7 +272,7 @@ static void win32_update_child_layers(mp_window_data* window) point.y + clipped.y, clipped.w, clipped.h, - SWP_NOACTIVATE|SWP_NOOWNERZORDER); + SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER); insertAfter = layer->hWnd; } @@ -313,6 +313,11 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) } break; //TODO: enter/exit size & move + case WM_WINDOWPOSCHANGED: + { + win32_update_child_layers(mpWindow); + result = DefWindowProc(windowHandle, message, wParam, lParam); + } break; case WM_SIZING: { @@ -995,6 +1000,7 @@ void mg_win32_surface_host_connect(mg_surface_data* surface, mg_surface_id remot void mg_surface_cleanup(mg_surface_data* surface) { + list_remove(&surface->layer.parent->win32.layers, &surface->layer.listElt); DestroyWindow(surface->layer.hWnd); } @@ -1060,6 +1066,7 @@ void mg_surface_init_for_window(mg_surface_data* surface, mp_window_data* window } surface->layer.frame = (mp_rect){0, 0, width, height}; + surface->layer.parent = window; list_append(&window->win32.layers, &surface->layer.listElt); } diff --git a/src/win32_app.h b/src/win32_app.h index bb0ed90..e6783e0 100644 --- a/src/win32_app.h +++ b/src/win32_app.h @@ -23,8 +23,10 @@ typedef struct win32_window_data list_info layers; } win32_window_data; +typedef struct mp_window_data mp_window_data; typedef struct mp_layer { + mp_window_data* parent; list_elt listElt; mp_rect frame; HWND hWnd;