summaryrefslogtreecommitdiff
path: root/gdk/x11
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2023-04-21 20:43:54 +0200
committerBenjamin Otte <otte@redhat.com>2023-04-26 21:03:34 +0200
commit83faacabe3e66d02ae32a76b718abeca05ecb985 (patch)
treef9bdce2a7c5380823bd800c49e367950cb244de5 /gdk/x11
parent31aae62f9ae7510b1cb5a9de6bf4d384eb37825a (diff)
downloadgtk+-83faacabe3e66d02ae32a76b718abeca05ecb985.tar.gz
x11: Set frame clock in ::constructed
Diffstat (limited to 'gdk/x11')
-rw-r--r--gdk/x11/gdksurface-x11.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 5488b3fd7b..2cb30b6ac6 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -1245,32 +1245,23 @@ gdk_x11_display_create_surface (GdkDisplay *display,
GdkSurface *parent)
{
GdkSurface *surface;
- GdkFrameClock *frame_clock;
-
- if (parent)
- frame_clock = g_object_ref (gdk_surface_get_frame_clock (parent));
- else
- frame_clock = _gdk_frame_clock_idle_new ();
switch (surface_type)
{
case GDK_SURFACE_TOPLEVEL:
surface = g_object_new (GDK_TYPE_X11_TOPLEVEL,
"display", display,
- "frame-clock", frame_clock,
NULL);
break;
case GDK_SURFACE_POPUP:
surface = g_object_new (GDK_TYPE_X11_POPUP,
"parent", parent,
"display", display,
- "frame-clock", frame_clock,
NULL);
break;
case GDK_SURFACE_DRAG:
surface = g_object_new (GDK_TYPE_X11_DRAG_SURFACE,
"display", display,
- "frame-clock", frame_clock,
NULL);
break;
default:
@@ -1278,8 +1269,6 @@ gdk_x11_display_create_surface (GdkDisplay *display,
break;
}
- g_object_unref (frame_clock);
-
return surface;
}
@@ -4887,6 +4876,8 @@ gdk_x11_popup_constructed (GObject *object)
x11_surface->override_redirect = TRUE;
+ gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
+
G_OBJECT_CLASS (gdk_x11_popup_parent_class)->constructed (object);
gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_MENU);
@@ -5013,6 +5004,7 @@ gdk_x11_toplevel_constructed (GObject *object)
{
GdkX11Surface *x11_surface = GDK_X11_SURFACE (object);
GdkSurface *surface = GDK_SURFACE (x11_surface);
+ GdkFrameClock *frame_clock;
XSetWindowAttributes xattributes;
long xattributes_mask;
@@ -5020,6 +5012,10 @@ gdk_x11_toplevel_constructed (GObject *object)
gdk_x11_surface_create_window (x11_surface, &xattributes, xattributes_mask);
+ frame_clock = _gdk_frame_clock_idle_new ();
+ gdk_surface_set_frame_clock (surface, frame_clock);
+ g_object_unref (frame_clock);
+
G_OBJECT_CLASS (gdk_x11_toplevel_parent_class)->constructed (object);
gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_NORMAL);
@@ -5404,6 +5400,8 @@ static void
gdk_x11_drag_surface_constructed (GObject *object)
{
GdkX11Surface *x11_surface = GDK_X11_SURFACE (object);
+ GdkSurface *surface = GDK_SURFACE (object);
+ GdkFrameClock *frame_clock;
XSetWindowAttributes xattributes;
long xattributes_mask;
@@ -5415,6 +5413,10 @@ gdk_x11_drag_surface_constructed (GObject *object)
x11_surface->override_redirect = TRUE;
+ frame_clock = _gdk_frame_clock_idle_new ();
+ gdk_surface_set_frame_clock (surface, frame_clock);
+ g_object_unref (frame_clock);
+
G_OBJECT_CLASS (gdk_x11_drag_surface_parent_class)->constructed (object);
}