1
0
Fork 0
Commit graph

1474 commits

Author SHA1 Message Date
msizanoen1
8b3c1f4b87 cullable: Generalize actor coordinates space translation for regions
This allows MetaCullable to work with actors using arbitrary transforms
which will be needed for implementing surface pixel alignment for
fractional-scale-v1.

This also deletes meta_cullable_is_untransformed as it's no longer
necessary, and we can also stop manually scaling the region objects
while performing opaque region culling in surfaces since it's now
handled transparently by the new `meta_cullable_cull_out_children`
implementation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
2023-05-22 14:44:33 +00:00
msizanoen1
e94b527777 surface-actor/wayland: Implement stable size and position rounding
Implement the stable rounding algorithm as described in the discussions
for the fractional-scale-v1 protocol.

This adds an override of the ClutterActor::apply_transform vfunc for
MetaSurfaceActorWayland that ensures the size and position of the
contents of the surface are rounded according to the stable rounding
algorithm.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
2023-05-22 14:44:33 +00:00
msizanoen1
ed90c78872 window-actor/wayland: Align window content to physical pixel
Always ensure that the MetaSurfaceContainerActorWayland is aligned to physical
pixel boundary in preparation for fractional-scale-v1 protocol support.

This introduces an override of ClutterActor::apply_transform vfunc for
MetaSurfaceContainerActorWayland that always ensures the actor content is aligned
to physical pixel boundary.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
2023-05-22 14:44:33 +00:00
Bilal Elmoussaoui
15b25568b2 compositor/x11: Drop duplicated methods calls
Those are called in the handler of MetaDisplay::x11-display-opened

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
2023-05-15 20:41:54 +02:00
Bilal Elmoussaoui
3e95609073 compositor/dnd: Guard X11 types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
2023-05-15 20:36:23 +02:00
Bilal Elmoussaoui
aaa3f34cc0 compositor: Guard X11 types
This also moves meta_compositor_x11_redirect_windows to DisplayX11
where it makes more sense as meta_display_x11_redirection_windows

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2272
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
2023-05-15 20:23:37 +02:00
Marco Trevisan (Treviño)
8039b58410 x11/x11-display: Always set the compositor manager selection on init
Set the compositor manager selection during the initialization phase as
we do with the window manager selection

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2970>
2023-05-15 19:06:37 +02:00
Marco Trevisan (Treviño)
2625edec10 x11/x11-display: Set compositor selection earlier on XWayland
When the X11 display is actually XWayland there's no point to delay the
compositor selection, given that mutter itself is the compositor and
doing this may cause the first X11 client that starts not to receive the
right information (and in some cases misbehave).

Since some toolkits are not handling the compositor selection changes
properly at later times, let's make their life easier by just
initializing the selection as early as the other X11 properties, given
that in this case there's nothing to replace.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2472
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2970>
2023-05-15 19:04:59 +02:00
Jonas Ådahl
802c1baec7 compositor-view: Chain up finalize()
The chaining up to the GObject finalize() method was missing, fix that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2991>
2023-05-09 10:31:38 +00:00
Robert Mader
9884a2c3d2 shaped-texture: Move variable declaration to the top
Just a minor cleanup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2990>
2023-05-07 23:18:33 +02:00
Jonas Ådahl
61b42e5303 build: Use / operator instead of join_paths everywhere
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
msizanoen1
3f85158b85 surface-actor: Queue rectangles of update region separately
This aims to help reduce the amount of pixels redrawn on the screen in
case the damage rectangle is partially occluded by another surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2965>
2023-05-03 08:53:36 +00:00
msizanoen1
ce0d9ccb37 dnd: Clear Wayland drag source when cancelled from stage grab context
This ensures that applications are notified when a drag gets cancelled
because the user dropped or press ESC while in overview.

This fixes an issue with Chromium on Wayland refusing to acknowledge
wl_pointer::enter events after accidentally dropping a
Chromium-originated object in GNOME Shell overview.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2953>
2023-04-15 10:11:07 +00:00
Carlos Garnacho
f3f1db5e33 compositor: Drop anchor_window_pos field from MetaWindowDrag
This is now only set and never used. We can remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2942>
2023-03-29 16:36:28 +00:00
Carlos Garnacho
7eb0130425 compositor: Use relative anchor coordinates for window drags
The anchor position calculations are somewhat unnecessarily complex
based on root coordinates of pointer and frame positions. This requires
tracking both things, and we don't always get it quite right with the
latter (e.g. window repositions, resizes or overshrinks, leaving the
anchor position visually outside the window).

In order to improve this, capture the window-relative coordinates
when starting the window drag, and ensure the window is always repositioned
in that position, relative to its current size.

This avoids these glitches when unmaximizing a window (e.g. dragged from
the bottom through super+button1 press), or moving windows between monitors
with different scales.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2730
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2942>
2023-03-29 16:36:28 +00:00
Carlos Garnacho
179124dc61 compositor: Avoid use of variable during resize
Since we only track changes to window_drag->anchor_window_pos
during move operations through on_grab_window_size_changed(), this
rectangle is in essence the same than window_drag->initial_window_pos
all the time. Just use that and move away from the anchor_window_pos
rectangle.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2942>
2023-03-29 16:36:28 +00:00
Jonas Dreßler
7455c293c6 window-actor-x11: Check array bounds before accessing array
scan_visible_region() scans through each value of a uint8_t array and checks
whether that value is 255. Right now it always checks one value too much
though, resulting in a buffer overflow. Fix that by checking the array
bounds before actually accessing the array.

Found by running gnome-shell with address sanitizer and starting
GIMP.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2856>
2023-03-26 11:51:02 +00:00
Florian Müllner
f14dcb023d compositor/window-drag: Fix keyboard resize
Both GRAB_OP_KEYBOARD_MOVING and GRAB_OP_KEYBOARD_RESIZING_* are
defined as GRAB_OP_WINDOW_BASE with FLAG_KEYBOARD set, but the
latter have additional bits set to indicate the direction.

That is, the GRAB_OP_KEYBOARD_MOVING bitmask cannot be used to
differentiate between move- and resize operations. Instead,
check that no direction bits are set.

https://gitlab.gnome.org/GNOME/mutter/-/issues/2684

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2908>
2023-03-20 16:13:32 +00:00
msizanoen1
aad0baf70d shaped-texture: Account for linear sampling when calculating actor damage
Linear sampling can influence the value of surrounding pixels beyond
the scaled framebuffer extents calculated during stage view rendering,
resulting in flickering graphical artifacts due to unaccounted pixel
changes. This is exhibited in xfreerdp and wlfreerdp at 150% display
scaling.

Fix this by ensuring that all pixels that may be affected by linear
scaling is included in the framebuffer redraw clip by padding the actor
redraw clip.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2771>
2023-03-04 18:23:34 +00:00
Carlos Garnacho
1fbbb73343 compositor: Add utility function to convert region to cairo_t path
We were relying on gdk_cairo_region() to convert a cairo_region_t
into a path ready to fill/stroke in a cairo_t. This is a small
and detached helper that we can do ourselves, so put it together
with all other region helper functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Robert Mader
4409dd24b6 surface-actor/wayland: Ensure screen-casted surfaces have a primary view
Surfaces belonging to a screen-casted window should always be considered
visible even if they are not visible on any stage view - be it because
they are on a different workspace, minimized or occluded.

Doing this in an optimal fashion is highly complex right now -
interdependent with (and somewhat similar to) ClutterClones. Thus treat
stream-casted surfaces similar to those with clones, with the small
difference that even a fully invisible surface still gets a primary view
- the fastest one. This ensures that clients never refresh too slow for a
screen-cast, at the cost of sometimes refreshing too fast.
The later only happens on certain multi-monitor setups and should thus be
acceptable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2789>
2023-02-28 12:03:50 +01:00
Robert Mader
2d5dd06a50 screen-cast/window: Add API to check if stream-cast is active
Screen-casted windows need to be considered visible in various situations
but existing APIs such as `clutter_actor_is_effectively_on_stage_view()`
don't do so. Add new API that allows checking if a surface belongs to a
screen-casted window for the respective cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2789>
2023-02-28 12:01:17 +01:00
Carlos Garnacho
5bdc08099e compositor: Fix handling of keyboard-driven window resize
The introduction of the META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED
flag threw off some checks around keyboard-driven resize. This
was partly because there were some == checks that did not account
for that flag maybe being enabled, but also the handling
of META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN into a definite
resize direction was maybe unsetting that flag. Fix both things
at the same time.

Fixes: 2d8fa26c8e ("core: Pass "frame action" grab operations as an "unconstrained" grab op")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2629
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2871>
2023-02-27 18:28:44 +00:00
Jonas Ådahl
b2579750a7 cogl: Remove legacy OpenGL driver support
This means the two Cogl drivers left are OpenGL >= 3.1 and GLES >= 2.0.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2672>
2023-02-21 18:09:28 +00:00
Jonas Dreßler
65b93e1d45 window-drag: Check whether window is set when hiding tile preview
In the case where we early-out from meta_window_drag_begin(), the
effective_drag_window might not be set yet. In this case, we might finalize
the object before effective_drag_window is set, leading to a NULL pointer
when accessing window->display in hide_tile_preview().

To avoid that crash, add a check whether the window is set already. If no
window is set, we can just skip hiding the preview anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2858>
2023-02-20 17:16:56 +00:00
Sebastian Wick
17c52854b7 default-plugin: Handle unmanaging windows in switch_workspace
Also add a regression metatest.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2559
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2782>
2023-02-01 16:21:55 +01:00
Carlos Garnacho
c6d23f67f0 compositor: Move tiling preview management to MetaWindowDrag
And release MetaDisplay from handling this management. Window tiling
previews are only triggered from window drags, and are implicitly tied
to them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
f04d84de65 compositor: Move edge resistance data to MetaWindowDrag
At least indirectly, this is set as object qdata while the
window drag is ongoing, and reset/reconstructed if needed.

Consequently, this edge data does not need to be stored in
the MetaDisplay struct anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
675d0df09b compositor: Make cleaning cached edges go through MetaWindowDrag
Even though the data is still stored in the display, add a "high
level" meta_window_drag_update_edges() call, so that the cached
edges may be updated while a window drag operation is ongoing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
60f11e419f compositor: Pass MetaWindowDrag to edge resistance functions
This code will be poked exclusively from the MetaWindowDrag, so
change the API to start passing this object around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
36bda45888 core: Move edge-resistance handling to src/compositor
This is now something that is mainly handled from the compositor
side, so it makes sense to move it there. Following commits will
cut all ties with src/core.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
d687e5634d core: Pass device/sequence on meta_window_begin_grab_op()
This is a public API change. Add device/sequence parameters to this
operation, so that window dragging and resizing can stick to one
set of pointing events of them all.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
b2ebe9c262 core: Move accounting of "shaken_loose" to MetaWindowDrag
It's entirely accessed from there (besides reset and initialization),
so can be completely taken there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
bec8a5860a core,wayland,compositor,x11: Migrate to MetaWindowDrag
Flip the switch in using MetaWindowDrag, leaving display grab
ops and a bunch other code unused. Some places checked the grab op
and/or window in complex ways, others just checked for grab existence
and should now look for clutter ones, and others already were already
doing this in addition.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
db1c64fe06 compositor: Add window/grab_op getters to MetaWindowDrag
This will be useful in porting, since there's still places that
check the current grab operation, or check a window against the
currently dragged window.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
fc4287cd20 compositor: Add high level API to deal with MetaWindowDrag
This helper object (and the whole window drag operation) will be
requested to the compositor instead of created directly, and only
one of those can exist at a time, so the compositor will also
safeguard that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
e6d0e0fda6 compositor: Add method to update MetaWindowDrag after resizes
Since SSD X11 windows require synchronization between frame and client
windows on resizes, updates do not always happen immediately but in
control of external factors (i.e. when both windows become to have
a coherent size).

This method will be used to update the window position between
resize/sync operations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
14006adf6f compositor: Handle pointing events in window drags
This code is largely copied from src/core/window.c, taking care
of pointer/touch interaction during window drag operations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
dd3e5d2b52 compositor: Handle keyboard events in window drag operations
This is code largely copied from src/core/keybindings.c, taking
care of keyboard interaction during window drag operations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Carlos Garnacho
d8f6b4be9b compositor: Add MetaWindowDrag helper object
This compositor-side object will single-handedly drive a window
drag operation. Currently, this largely copies meta_display_begin_grab_op
and meta_display_end_grab_op, except grabbing is done through a
ClutterGrab instead of direct meta_backend_grab_device() calls. This
also means that the switch from passive to active keyboard grabs is
handled differently.

Currently, this object is dormant. It requires moving more code from
other places to become a fully functional replacement.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +00:00
Jonas Ådahl
08b0e563d4 clutter: Pass 'ClutterFrame' in all stage update signals
That means before-update, prepare-paint, before-paint, paint-view, after-paint,
after-update. While yet to be used, it will be used as a transient frame
book keeping object, to maintain object and state that is only valid
during a frame dispatch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 15:57:50 +01:00
Carlos Garnacho
2b6651327e compositor: Observe frame opaque region when updating shapes
Apply either frame or client window opaque regions (or both as
an union). For client windows without an alpha channel, the frame
shape already contains the client area. If the client window does
have an alpha channel, the client rectangle is cleared to let the
client's opaque region take care of it.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2555
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2758>
2023-01-20 22:23:55 +00:00
Carlos Garnacho
e4ee40d7ff compositor: Wrap x11 surface actor destruction in error trap
This does a number of X11 calls. For what it might happen, better
wrap these in error traps.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2793>
2023-01-19 13:57:35 +00:00
Carlos Garnacho
2be5662ee9 compositor: Wrap XDamageCreate call with error trap
I hit this rare error running the "x11" test from the suite locally:

(mutter:194027): Gdk-ERROR **: 18:21:52.525: The program 'mutter' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadDrawable (invalid Pixmap or Window parameter)'.
  (Details: serial 663 error_code 9 request_code 143 (DAMAGE) minor_code 1)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

The only call from the Damage extension in use by Mutter that could
return BadDrawable is XDamageCreate(), and it's likely to be this
call. Wrap this X11 in an error trap, in order to catch possible
failures.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2793>
2023-01-19 13:57:35 +00:00
Bilal Elmoussaoui
8b42bc77dc build: Make GTK dependency specific to X11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
4d7aedf90a compositor: Drop debug helpers
They can no longer be used as libmutter will drop it gdk/gtk
dependencies in the upcoming commits

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
b0b21e8274 default-plugin: Remove unnused field
This drops the usage of GdkRGBA

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:09:03 +01:00
Bilal Elmoussaoui
fb4161853f cleanup: Make GDK dependency specific to X11
This way, the dependencies on GTK/GDK could be completely dropped if
built with Wayland only.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:09:03 +01:00
Jonas Ådahl
d7f26136b4 later: Remove old API
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00
Jonas Ådahl
d7f5477103 compositor: Enable introspection
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 15:13:48 +01:00