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>
This commit is contained in:
Ivan Molodetskikh 2020-10-08 15:41:31 +03:00 committed by Marge Bot
parent bb57f35296
commit 0c3490223e
4 changed files with 33 additions and 0 deletions

View File

@ -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);

View File

@ -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 ())

View File

@ -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)

View File

@ -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);