1
0
Fork 0
Commit graph

13 commits

Author SHA1 Message Date
Jonas Ådahl
b5f50028f2 wayland: Untie MetaWindowXwayland lifetime from the wl_surface
For the most part, a MetaWindow is expected to live roughly as long as
the associated wl_surface, give or take asynchronous API discrepancies.

The exception to this rule is handling of reparenting when decorating or
undecorating a window, when a MetaWindow on X11 is made to survive the
unmap/map cycle. The fact that this didn't hold on Wayland caused
various issues, such as a feedback loop where the X11 window kept being
remapped. By making the MetaWindow lifetime for Xwayland windows being
the same as they are on plain X11, we remove the different semantics
here, which seem to lower the risk of hitting the race condition causing
the feedback loop mentioned above.

What this commit do is separate MetaWindow lifetime handling between
native Wayland windows and Xwayland windows. Wayland windows are handled
just as they were, i.e. unmanaged together as part of the wl_surface
destruction; while during the Xwayland wl_surface destruction, the
MetaWindow <-> MetaWaylandSurface association is simply broken.

Related: https://gitlab.freedesktop.org/xorg/xserver/issues/740
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/762

https://gitlab.gnome.org/GNOME/mutter/merge_requests/774
2019-10-07 20:25:20 +00:00
Robert Mader
bba8f6c53e wayland/actor-surface: Turn get_geometry_scale() into a vfunc
This allows us to implement more sophisticated logic for the different
cases. For DnD surfaces, use the geometry scale of the monitor where
the pointer is, instead of incorrectly assuming '1' as it was before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/780
2019-09-27 15:48:36 +00:00
Robert Mader
77229f99b8 wayland: Implement subsurface.place_below() for parents
Flatten the subsurface actor tree, making all surface actors children
of the window actor.
Save the subsurface state in a GNode tree in MetaWaylandSurface, where
each surface holds two nodes, one branch, which can be the tree root
or be attached to a parent surfaces branch, and a leaf, which is
used to save the position relative to child branch nodes.

Each time a surface is added or reordered in the tree, unparent all
surface actors from the window actor, traverse all leaves of the
tree and readd the corresponding surface actors back to the window
actor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/664
2019-08-27 11:31:00 +03:00
Georges Basile Stavracas Neto
d3f30d9ece wayland/actor-surface: Set geometry scale in surface actor
Now that MetaShapedTexture is a ClutterContent implemetation that
is aware of its own buffer scale, it is possible to simplify the
event translation routines.

Set the geometry scale in MetaSurfaceActor, and stop adjusting the
surface scale when translating points. Also remove the now obsoleted
meta_wayland_actor_surface_calculate_scale() function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
Robert Mader
7e2a0ede16 wayland: Move check for present window out of the actor-surface class
All child classes of `MetaWaylandShellSurface` as well as
`MetaWaylandSurfaceRoleXWayland` should only sync their actor if
their toplevel surface has a window. Currently this check is done
in the actor-surface class, but not all surface classes have a
toplevel window, e.g. dnd-surfaces.
Move the check to the right places.

For subsurfaces this assumes that the subsurface is not the child of
a window-less surface (like, as stated above, e.g. a dnd-surface).
If we want to support subsurfaces of window-less surfaces in the future
we have to extend the check here.
But as this is not a regression, ignore this case for now.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/537
2019-05-09 09:06:52 +00:00
Jonas Ådahl
252e64a0ea wayland: Move surface texture ownership to MetaWaylandSurface
Prior to this commit, MetaWaylandSurface held a reference to
MetaWaylandBuffer, who owned the texture drawn by the surface. When
switching buffer, the texture change with it.

This is problematic when dealing with SHM buffer damage management, as
when having one texture per buffer, damaged regions uploaded to one,
will not follow along to the next one attached. It also wasted GPU
memory as there would be one texture per buffer, instead of one one
texture per surface.

Instead, move the texture ownership to MetaWaylandSurface, and have the
SHM buffer damage management update the surface texture. This ensures
damage is processed properly, and that we won't end up with stale
texture content when doing partial texture uploads. If the same SHM
buffer is attached to multiple surfaces, each surface will get their own
copy, and damage is tracked and uploaded separately.

Non-SHM types of buffers still has their own texture reference, as the
texture is just a representation of the GPU memory associated with the
buffer. When such a buffer is attached to a surface, instead the surface
just gets a reference to that texture, instead of a separately allocated
one.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
Jonas Ådahl
f4d07caa38 window: Pass flag to meta_window_update_monitor() instead of bool
The bool determines whether the call was directly from a user operation
or not. To add more state into the call without having to add more
boolenas, change the boolean to a flag (so far with 'none' and 'user-op'
as possible values). No functional changes were made.

https://gitlab.gnome.org/GNOME/mutter/issues/192
2018-08-27 08:33:00 +00:00
Robert Mader
c7db234c11 wayland/xdg-shell: Intersect set geometry with subsurface tree geometry
Currently xdg-shell applies a geometry set with set_window_geometry
unconditionally. But the specification requires:

> When applied, the effective window geometry will be
> the set window geometry clamped to the bounding rectangle of the
> combined geometry of the surface of the xdg_surface and the
> associated subsurfaces.

This is especially important to implement viewporter and
transformation.
2018-08-20 14:37:10 +00:00
Robert Mader
db22c13c4f wayland: Use surface size helper functions
Use meta_wayland_surface_get_width / meta_wayland_surface_get_width
to determine the size of a surface.
2018-08-20 14:37:10 +00:00
Jonas Ådahl
4345906663 wayland: Define abstract role types as actually abstract
They should not be instantiated by themself, only as actual roles.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=791938
2018-02-23 19:07:49 +08:00
Jonas Ådahl
514c7028f4 wayland: Use helper to set shell surface window
The helper deals with updating the surface output state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=791938
2018-02-23 18:57:50 +08:00
Jonas Ådahl
44624736c5 wayland: Push actor state instead of itself pulling
Make the Wayland objects push the state relevant to their role to the
MetaSurfaceActor instead of MetaSurfaceActorWayland pulling the state
from the associated surface.

This makes the relationship between the actor and the objects that
constructs it more clear; the actor is a drawable that the protocol
objects control, not the other way around.

This will make it easier to "detach" a surface actor from a surface,
which is necessary when unmapping a window while the underlying surface
is yet to be destroyed and potentially reused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=791938
2018-02-23 18:57:47 +08:00
Jonas Ådahl
704b73b041 wayland: Restructure surface role building blocks code
This commit moves out non-core wl_surface related code into separate
code units, while renaming types to fit a common scheme. The changes
done are:

 * ClutterActor based surface roles built upon
   MetaWalyandSurfaceRoleActorSurface. This object has been renamed to
   MetaWaylandActorSurface and related functionality has moved into
   meta-wayland-actor-surface.c.

 * The code related to roles backed by a MetaWindow (i.e. built upon
   MetaWaylandShellSurface) was moved into meta-wayland-shell-surface.c

 * The majority of subsurface related code was moved into into
   meta-wayland-subsurface.c and the object was renamed
   MetaWaylandSubsurface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/5
https://bugzilla.gnome.org/show_bug.cgi?id=791938
2018-02-23 18:57:40 +08:00