From fcce346e6787875e6526efea89e74055e447f889 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 8 May 2021 13:42:37 -0400 Subject: Send unmap/map events when the view is minimized/restored X11 Window managers set WM_STATE to notify about minimization, often without sending core X visibility events (which seems odd to me, but that's what Gnome does anyway). So, implement this protocol and send map/unmap events to the view, and adjust the Windows implementation to do the same for consistency across all platforms. --- src/win.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/win.c') diff --git a/src/win.c b/src/win.c index 448e053..d1a66cd 100644 --- a/src/win.c +++ b/src/win.c @@ -579,14 +579,17 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_INTERNALPAINT); } - if ((bool)wParam != view->visible) { - view->visible = wParam; - event.any.type = wParam ? PUGL_MAP : PUGL_UNMAP; - } + event.any.type = wParam ? PUGL_MAP : PUGL_UNMAP; break; case WM_SIZE: - handleConfigure(view, &event); - InvalidateRect(view->impl->hwnd, NULL, false); + if (wParam == SIZE_MINIMIZED) { + event.type = PUGL_UNMAP; + } else if (!view->visible) { + event.type = PUGL_MAP; + } else { + handleConfigure(view, &event); + InvalidateRect(view->impl->hwnd, NULL, false); + } break; case WM_SIZING: if (view->minAspectX) { -- cgit v1.2.1