[mutter] wayland: Store list of presentation-time surfaces



commit 0c3490223ee11fd3ea9433e7976f8897ac14d563
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Thu Oct 8 15:41:31 2020 +0300

    wayland: Store list of presentation-time surfaces
    
    These are surfaces that might have registered presentation-time
    callbacks, similar to the frame callback surface list.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>

 src/wayland/meta-wayland-presentation-time-private.h |  5 +++++
 src/wayland/meta-wayland-private.h                   |  3 +++
 src/wayland/meta-wayland.c                           | 19 +++++++++++++++++++
 src/wayland/meta-wayland.h                           |  6 ++++++
 4 files changed, 33 insertions(+)
---
diff --git a/src/wayland/meta-wayland-presentation-time-private.h 
b/src/wayland/meta-wayland-presentation-time-private.h
index f13e42c0f7..234ac34956 100644
--- a/src/wayland/meta-wayland-presentation-time-private.h
+++ b/src/wayland/meta-wayland-presentation-time-private.h
@@ -36,6 +36,11 @@ typedef struct _MetaWaylandPresentationFeedback
   MetaWaylandSurface *surface;
 } MetaWaylandPresentationFeedback;
 
+typedef struct _MetaWaylandPresentationTime
+{
+  GList *feedback_surfaces;
+} MetaWaylandPresentationTime;
+
 void meta_wayland_init_presentation_time (MetaWaylandCompositor *compositor);
 
 void meta_wayland_presentation_feedback_discard (MetaWaylandPresentationFeedback *feedback);
diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h
index 82a256f60f..3306c192c9 100644
--- a/src/wayland/meta-wayland-private.h
+++ b/src/wayland/meta-wayland-private.h
@@ -27,6 +27,7 @@
 #include "core/window-private.h"
 #include "meta/meta-cursor-tracker.h"
 #include "wayland/meta-wayland-pointer-gestures.h"
+#include "wayland/meta-wayland-presentation-time-private.h"
 #include "wayland/meta-wayland-seat.h"
 #include "wayland/meta-wayland-surface.h"
 #include "wayland/meta-wayland-tablet-manager.h"
@@ -94,6 +95,8 @@ struct _MetaWaylandCompositor
   MetaWaylandTabletManager *tablet_manager;
 
   GHashTable *scheduled_surface_associations;
+
+  MetaWaylandPresentationTime presentation_time;
 };
 
 #define META_TYPE_WAYLAND_COMPOSITOR (meta_wayland_compositor_get_type ())
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 45bc7ace09..731e247273 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -291,6 +291,25 @@ meta_wayland_compositor_remove_frame_callback_surface (MetaWaylandCompositor *co
     g_list_remove (compositor->frame_callback_surfaces, surface);
 }
 
+void
+meta_wayland_compositor_add_presentation_feedback_surface (MetaWaylandCompositor *compositor,
+                                                           MetaWaylandSurface    *surface)
+{
+  if (g_list_find (compositor->presentation_time.feedback_surfaces, surface))
+    return;
+
+  compositor->presentation_time.feedback_surfaces =
+    g_list_prepend (compositor->presentation_time.feedback_surfaces, surface);
+}
+
+void
+meta_wayland_compositor_remove_presentation_feedback_surface (MetaWaylandCompositor *compositor,
+                                                              MetaWaylandSurface    *surface)
+{
+  compositor->presentation_time.feedback_surfaces =
+    g_list_remove (compositor->presentation_time.feedback_surfaces, surface);
+}
+
 static void
 set_gnome_env (const char *name,
               const char *value)
diff --git a/src/wayland/meta-wayland.h b/src/wayland/meta-wayland.h
index 454330e4f9..6c655e427b 100644
--- a/src/wayland/meta-wayland.h
+++ b/src/wayland/meta-wayland.h
@@ -66,6 +66,12 @@ void                    meta_wayland_compositor_add_frame_callback_surface (Meta
 void                    meta_wayland_compositor_remove_frame_callback_surface (MetaWaylandCompositor 
*compositor,
                                                                                MetaWaylandSurface    
*surface);
 
+void                    meta_wayland_compositor_add_presentation_feedback_surface (MetaWaylandCompositor 
*compositor,
+                                                                                   MetaWaylandSurface    
*surface);
+
+void                    meta_wayland_compositor_remove_presentation_feedback_surface (MetaWaylandCompositor 
*compositor,
+                                                                                      MetaWaylandSurface    
*surface);
+
 META_EXPORT_TEST
 const char             *meta_wayland_get_wayland_display_name   (MetaWaylandCompositor *compositor);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]