[gtk/wip/chergert/for-main] macos: use new frame-clock for toplevel only
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/for-main] macos: use new frame-clock for toplevel only
- Date: Tue, 1 Mar 2022 08:07:10 +0000 (UTC)
commit 443ca4ff0fc2dc8f16a0a06891b4a4707b74872f
Author: Christian Hergert <christian hergert me>
Date: Mon Feb 28 23:58:46 2022 -0800
macos: use new frame-clock for toplevel only
This is slightly different than what we had before. We want toplevels to
get their own frame clocks so they can move between monitors and achieve
higher frame rates. However, for popovers, we want them to be tied to
their parent so they can compute-size/layout on the same cycle.
gdk/macos/gdkmacossurface.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 5da25f2da1..27e9cd9cba 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -623,38 +623,41 @@ gdk_macos_surface_init (GdkMacosSurface *self)
}
GdkMacosSurface *
-_gdk_macos_surface_new (GdkMacosDisplay *display,
- GdkSurfaceType surface_type,
- GdkSurface *parent,
- int x,
- int y,
- int width,
- int height)
+_gdk_macos_surface_new (GdkMacosDisplay *display,
+ GdkSurfaceType surface_type,
+ GdkSurface *parent,
+ int x,
+ int y,
+ int width,
+ int height)
{
GdkFrameClock *frame_clock;
GdkMacosSurface *ret;
g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (display), NULL);
- frame_clock = _gdk_frame_clock_idle_new ();
-
switch (surface_type)
{
case GDK_SURFACE_TOPLEVEL:
+ frame_clock = _gdk_frame_clock_idle_new ();
ret = _gdk_macos_toplevel_surface_new (display, parent, frame_clock, x, y, width, height);
break;
case GDK_SURFACE_POPUP:
+ frame_clock = g_object_ref (parent->frame_clock);
ret = _gdk_macos_popup_surface_new (display, parent, frame_clock, x, y, width, height);
break;
case GDK_SURFACE_TEMP:
+ frame_clock = g_object_ref (parent->frame_clock);
ret = _gdk_macos_drag_surface_new (display, frame_clock, x, y, width, height);
break;
default:
g_warn_if_reached ();
+ frame_clock = NULL;
ret = NULL;
+ break;
}
if (ret != NULL)
@@ -663,7 +666,7 @@ _gdk_macos_surface_new (GdkMacosDisplay *display,
_gdk_macos_surface_monitor_changed (ret);
}
- g_object_unref (frame_clock);
+ g_clear_object (&frame_clock);
return g_steal_pointer (&ret);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]