[win32, graphics] experiments with multisurface with transparent top-level windows

This commit is contained in:
martinfouilleul 2023-06-21 15:48:26 +02:00
parent ae7a60b942
commit 0366e3d724
3 changed files with 11 additions and 1 deletions

View File

@ -47,6 +47,7 @@ int main()
} }
//*/ //*/
// start app // start app
mp_window_center(window);
mp_window_bring_to_front(window); mp_window_bring_to_front(window);
mp_window_focus(window); mp_window_focus(window);

View File

@ -272,7 +272,7 @@ static void win32_update_child_layers(mp_window_data* window)
point.y + clipped.y, point.y + clipped.y,
clipped.w, clipped.w,
clipped.h, clipped.h,
SWP_NOACTIVATE|SWP_NOOWNERZORDER); SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER);
insertAfter = layer->hWnd; insertAfter = layer->hWnd;
} }
@ -313,6 +313,11 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam)
} break; } break;
//TODO: enter/exit size & move //TODO: enter/exit size & move
case WM_WINDOWPOSCHANGED:
{
win32_update_child_layers(mpWindow);
result = DefWindowProc(windowHandle, message, wParam, lParam);
} break;
case WM_SIZING: 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) void mg_surface_cleanup(mg_surface_data* surface)
{ {
list_remove(&surface->layer.parent->win32.layers, &surface->layer.listElt);
DestroyWindow(surface->layer.hWnd); 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.frame = (mp_rect){0, 0, width, height};
surface->layer.parent = window;
list_append(&window->win32.layers, &surface->layer.listElt); list_append(&window->win32.layers, &surface->layer.listElt);
} }

View File

@ -23,8 +23,10 @@ typedef struct win32_window_data
list_info layers; list_info layers;
} win32_window_data; } win32_window_data;
typedef struct mp_window_data mp_window_data;
typedef struct mp_layer typedef struct mp_layer
{ {
mp_window_data* parent;
list_elt listElt; list_elt listElt;
mp_rect frame; mp_rect frame;
HWND hWnd; HWND hWnd;