1
0
Fork 0
Commit graph

20 commits

Author SHA1 Message Date
Bilal Elmoussaoui
a955f0e47c cleanup: Make include macro usages consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3157>
2023-08-07 22:24:36 +00:00
Bilal Elmoussaoui
b852bbba47 cleanup: Stop translating nick/blurb for pspecs
As those strings are intended to be used by some UI but nothing uses
that in reality except GStreamer.
So drop them similar to what GTK did at
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4717

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3101>
2023-07-19 11:33:59 +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
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
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 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
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
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
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