[gtk/wip.win32.fixes: 645/646] gdksurface-win32.c: Decouple mapped state from surface creation
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip.win32.fixes: 645/646] gdksurface-win32.c: Decouple mapped state from surface creation
- Date: Fri, 11 Dec 2020 08:39:13 +0000 (UTC)
commit f2956de0ed1f6893e01cdc1c9e406231d4093b4d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Fri Dec 11 10:29:28 2020 +0800
gdksurface-win32.c: Decouple mapped state from surface creation
In line with what is done with the Wayland backend, enable the mapped state
independently as needed from the toplevel surface presentation, and also enable
the mapped state if necessary when presenting the popup surface.
gdk/win32/gdksurface-win32.c | 42 +++++++++++++++++++-----------------------
1 file changed, 19 insertions(+), 23 deletions(-)
---
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 35d40cee60..c22b3dfb60 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -1246,11 +1246,24 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
}
}
+static void
+maybe_notify_mapped (GdkSurface *surface)
+{
+ if (surface->destroyed)
+ return;
+
+ if (!GDK_SURFACE_IS_MAPPED (surface))
+ {
+ gdk_surface_set_is_mapped (surface, TRUE);
+ gdk_surface_invalidate_rect (surface, NULL);
+ }
+}
+
static void
show_popup (GdkSurface *surface)
{
gdk_win32_surface_raise (surface);
- gdk_surface_set_is_mapped (surface, TRUE);
+ maybe_notify_mapped (surface);
show_window_internal (surface, FALSE, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -4749,25 +4762,6 @@ gdk_win32_toplevel_class_init (GdkWin32ToplevelClass *class)
gdk_toplevel_install_properties (object_class, 1);
}
-static void
-show_surface (GdkSurface *surface)
-{
- gboolean was_mapped;
-
- if (surface->destroyed)
- return;
-
- was_mapped = GDK_SURFACE_IS_MAPPED (surface);
-
- if (!was_mapped)
- gdk_surface_set_is_mapped (surface, TRUE);
-
- gdk_win32_surface_show (surface, FALSE);
-
- if (!was_mapped)
- gdk_surface_invalidate_rect (surface, NULL);
-}
-
static gboolean
gdk_win32_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
@@ -4829,7 +4823,8 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
else
gdk_win32_surface_unfullscreen (surface);
- show_surface (surface);
+ gdk_win32_surface_show (surface, FALSE);
+ maybe_notify_mapped (surface);
if (size.shadow.is_valid)
{
@@ -4923,8 +4918,9 @@ gdk_win32_drag_surface_present (GdkDragSurface *drag_surface,
{
GdkSurface *surface = GDK_SURFACE (drag_surface);
- gdk_win32_surface_resize (surface, width, height);
- show_surface (surface);
+ gdk_win32_surface_resize (surface, width, height);
+ gdk_win32_surface_show (surface, FALSE);
+ maybe_notify_mapped (surface);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]