2018-12-21 15:35:18 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Endless, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* Written by:
|
|
|
|
* Georges Basile Stavracas Neto <gbsneto@gnome.org>
|
|
|
|
*/
|
|
|
|
|
2019-06-30 09:18:46 -04:00
|
|
|
#include "compositor/meta-surface-actor-wayland.h"
|
2018-12-21 15:35:18 -05:00
|
|
|
#include "compositor/meta-window-actor-wayland.h"
|
|
|
|
#include "meta/meta-window-actor.h"
|
2019-06-30 09:18:46 -04:00
|
|
|
#include "wayland/meta-wayland-surface.h"
|
2018-12-21 15:35:18 -05:00
|
|
|
|
|
|
|
struct _MetaWindowActorWayland
|
|
|
|
{
|
|
|
|
MetaWindowActor parent;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (MetaWindowActorWayland, meta_window_actor_wayland, META_TYPE_WINDOW_ACTOR)
|
|
|
|
|
2019-06-30 09:18:46 -04:00
|
|
|
static gboolean
|
|
|
|
remove_surface_actor_from_children (GNode *node,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
MetaWaylandSurface *surface = node->data;
|
|
|
|
MetaSurfaceActor *surface_actor = meta_wayland_surface_get_actor (surface);
|
|
|
|
MetaWindowActor *window_actor = data;
|
|
|
|
ClutterActor *parent;
|
|
|
|
|
|
|
|
parent = clutter_actor_get_parent (CLUTTER_ACTOR (surface_actor));
|
|
|
|
if (!parent)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (parent == CLUTTER_ACTOR (window_actor), FALSE);
|
|
|
|
|
|
|
|
clutter_actor_remove_child (CLUTTER_ACTOR (window_actor),
|
|
|
|
CLUTTER_ACTOR (surface_actor));
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
add_surface_actor_to_children (GNode *node,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
MetaWaylandSurface *surface = node->data;
|
|
|
|
MetaSurfaceActor *surface_actor = meta_wayland_surface_get_actor (surface);
|
|
|
|
MetaWindowActor *window_actor = data;
|
|
|
|
|
|
|
|
clutter_actor_add_child (CLUTTER_ACTOR (window_actor),
|
|
|
|
CLUTTER_ACTOR (surface_actor));
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_window_actor_wayland_rebuild_surface_tree (MetaWindowActor *actor)
|
|
|
|
{
|
|
|
|
MetaSurfaceActor *surface_actor =
|
|
|
|
meta_window_actor_get_surface (actor);
|
|
|
|
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (
|
|
|
|
META_SURFACE_ACTOR_WAYLAND (surface_actor));
|
|
|
|
GNode *root_node = surface->subsurface_branch_node;
|
|
|
|
|
|
|
|
g_node_traverse (root_node,
|
|
|
|
G_IN_ORDER,
|
|
|
|
G_TRAVERSE_LEAVES,
|
|
|
|
-1,
|
|
|
|
remove_surface_actor_from_children,
|
|
|
|
actor);
|
|
|
|
|
|
|
|
g_node_traverse (root_node,
|
|
|
|
G_IN_ORDER,
|
|
|
|
G_TRAVERSE_LEAVES,
|
|
|
|
-1,
|
|
|
|
add_surface_actor_to_children,
|
|
|
|
actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_wayland_assign_surface_actor (MetaWindowActor *actor,
|
|
|
|
MetaSurfaceActor *surface_actor)
|
|
|
|
{
|
|
|
|
MetaWindowActorClass *parent_class =
|
|
|
|
META_WINDOW_ACTOR_CLASS (meta_window_actor_wayland_parent_class);
|
|
|
|
|
2019-08-17 04:00:46 -04:00
|
|
|
g_warn_if_fail (!meta_window_actor_get_surface (actor));
|
|
|
|
|
2019-06-30 09:18:46 -04:00
|
|
|
parent_class->assign_surface_actor (actor, surface_actor);
|
|
|
|
|
|
|
|
meta_window_actor_wayland_rebuild_surface_tree (actor);
|
|
|
|
}
|
|
|
|
|
2018-12-21 15:51:02 -05:00
|
|
|
static void
|
|
|
|
meta_window_actor_wayland_frame_complete (MetaWindowActor *actor,
|
|
|
|
ClutterFrameInfo *frame_info,
|
|
|
|
int64_t presentation_time)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_wayland_queue_frame_drawn (MetaWindowActor *actor,
|
|
|
|
gboolean skip_sync_delay)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
clutter: Paint views with individual frame clocks
Replace the default master clock with multiple frame clocks, each
driving its own stage view. As each stage view represents one CRTC, this
means we draw each CRTC with its own designated frame clock,
disconnected from all the others.
For example this means we when using the native backend will never need
to wait for one monitor to vsync before painting another, so e.g. having
a 144 Hz monitor next to a 60 Hz monitor, things including both Wayland
and X11 applications and shell UI will be able to render at the
corresponding monitor refresh rate.
This also changes a warning about missed frames when sending
_NETWM_FRAME_TIMINGS messages to a debug log entry, as it's expected
that we'll start missing frames e.g. when a X11 window (via Xwayland) is
exclusively within a stage view that was not painted, while another one
was, still increasing the global frame clock.
Addititonally, this also requires the X11 window actor to schedule
timeouts for _NET_WM_FRAME_DRAWN/_NET_WM_FRAME_TIMINGS event emitting,
if the actor wasn't on any stage views, as now we'll only get the frame
callbacks on actors when they actually were painted, while in the past,
we'd invoke that vfunc when anything was painted.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/903
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-05-29 18:27:56 -04:00
|
|
|
meta_window_actor_wayland_before_paint (MetaWindowActor *actor,
|
|
|
|
ClutterStageView *stage_view)
|
2018-12-21 15:51:02 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
clutter: Paint views with individual frame clocks
Replace the default master clock with multiple frame clocks, each
driving its own stage view. As each stage view represents one CRTC, this
means we draw each CRTC with its own designated frame clock,
disconnected from all the others.
For example this means we when using the native backend will never need
to wait for one monitor to vsync before painting another, so e.g. having
a 144 Hz monitor next to a 60 Hz monitor, things including both Wayland
and X11 applications and shell UI will be able to render at the
corresponding monitor refresh rate.
This also changes a warning about missed frames when sending
_NETWM_FRAME_TIMINGS messages to a debug log entry, as it's expected
that we'll start missing frames e.g. when a X11 window (via Xwayland) is
exclusively within a stage view that was not painted, while another one
was, still increasing the global frame clock.
Addititonally, this also requires the X11 window actor to schedule
timeouts for _NET_WM_FRAME_DRAWN/_NET_WM_FRAME_TIMINGS event emitting,
if the actor wasn't on any stage views, as now we'll only get the frame
callbacks on actors when they actually were painted, while in the past,
we'd invoke that vfunc when anything was painted.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/903
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-05-29 18:27:56 -04:00
|
|
|
meta_window_actor_wayland_after_paint (MetaWindowActor *actor,
|
|
|
|
ClutterStageView *stage_view)
|
2018-12-21 15:51:02 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_wayland_queue_destroy (MetaWindowActor *actor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-12-09 09:06:58 -05:00
|
|
|
static void
|
|
|
|
meta_window_actor_wayland_set_frozen (MetaWindowActor *actor,
|
|
|
|
gboolean frozen)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-03-03 04:26:54 -05:00
|
|
|
static void
|
|
|
|
meta_window_actor_wayland_update_regions (MetaWindowActor *actor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-12-21 15:35:18 -05:00
|
|
|
static void
|
|
|
|
meta_window_actor_wayland_class_init (MetaWindowActorWaylandClass *klass)
|
|
|
|
{
|
2018-12-21 15:51:02 -05:00
|
|
|
MetaWindowActorClass *window_actor_class = META_WINDOW_ACTOR_CLASS (klass);
|
|
|
|
|
2019-06-30 09:18:46 -04:00
|
|
|
window_actor_class->assign_surface_actor = meta_window_actor_wayland_assign_surface_actor;
|
2018-12-21 15:51:02 -05:00
|
|
|
window_actor_class->frame_complete = meta_window_actor_wayland_frame_complete;
|
|
|
|
window_actor_class->queue_frame_drawn = meta_window_actor_wayland_queue_frame_drawn;
|
2020-05-29 18:02:42 -04:00
|
|
|
window_actor_class->before_paint = meta_window_actor_wayland_before_paint;
|
|
|
|
window_actor_class->after_paint = meta_window_actor_wayland_after_paint;
|
2018-12-21 15:51:02 -05:00
|
|
|
window_actor_class->queue_destroy = meta_window_actor_wayland_queue_destroy;
|
2019-12-09 09:06:58 -05:00
|
|
|
window_actor_class->set_frozen = meta_window_actor_wayland_set_frozen;
|
2020-03-03 04:26:54 -05:00
|
|
|
window_actor_class->update_regions = meta_window_actor_wayland_update_regions;
|
2018-12-21 15:35:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_window_actor_wayland_init (MetaWindowActorWayland *self)
|
|
|
|
{
|
|
|
|
}
|