[gtk/wip/chergert/for-main: 6/6] 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: 6/6] macos: use new frame-clock for toplevel only
- Date: Tue, 1 Mar 2022 09:16:34 +0000 (UTC)
commit 181be89eadaff9bf32ec78e0dc68f09fe5d3a383
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 04c56e0704..9a5a1adbfb 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]