1
0
Fork 0
Commit graph

2777 commits

Author SHA1 Message Date
Sebastian Keller
6b57ab8975 workspace: Only consider windows that should be showing as focusable
When selecting the default focus window, is_focusable() was not
considering the new conditions for whether a window should be shown or
hidden that were added to meta_window_should_be_showing() in 39942974.
As a result the default focus window could end up a window already
hidden or hidden once meta_window_flush_calc_showing() is called by
meta_window_focus() when focusing the default window. This would cause
meta_window_focus() to fail, which is an issue if it prevents us from
unfocusing a window when it is getting unmanaged.

Fixes: 399429742 ("x11: Integrate frames client into Mutter")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2644
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2962>
2023-04-16 11:48:37 +02:00
Carlos Garnacho
f744acefee core: Create passive button grab on topmost Window
With the frames client, we do no longer handle events for the
frame window inside Mutter. This means we do not get events
"for free" to handle focus on a just clicked frame window.
This results in a background window not ending up focused if
clicked on its frame.

In order to fix this, make the passive button grab extend to
the frame window if a window has one. This brings back
focus-on-click behavior, while treating windows further as
a unitary surface.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2727
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2954>
2023-04-12 11:28:50 +02:00
Carlos Garnacho
a42bc34e4d core: Pass MetaWindow on passive button grab machinery
In practical effects the passed Window is always window->xwindow,
so pass the MetaWindow and get the better X11 Window deep in the
call stack.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2954>
2023-04-12 11:28:50 +02:00
Carlos Garnacho
e30abee5a2 core: Minor refactor
Do not make code live before variable declarations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2954>
2023-04-12 11:28:50 +02:00
Ivan Molodetskikh
4f47ba26be Export meta_window_has_pointer ()
It is needed in gnome-shell in the screenshot UI to tell which window has a pointer over it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2928>
2023-03-20 20:23:02 +00:00
Jonas Ådahl
08bdee58c9 Revert "core: Avoid setting up frames on fullscreen windows"
This caused feedback loops with old statically compiled SDL
applications. The bug is fixed in upstream SDL, but that doesn't help
when the executables have old SDL's built into them.

This reverts commit beeeea546b.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2678
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2921>
2023-03-18 18:25:39 +00:00
Carlos Garnacho
5daddf0bc7 core: Retrieve DESKTOP_AUTOSTART_ID early on startup
With the move away from GTK3, and the indirect dependency on GTK4
grown in the GNOME Shell side, we've indirectly gotten a small sneaky
behavioral change: The GTK4 library will, right on dlopen, get
DESKTOP_AUTOSTART_ID for itself and delete it from the environment.

This happens before our own X11 session management code is
initialized, which confuses the hell out of it, into thinking
initialization is actually shutdown, gnome-session does not follow
along with this request, which leaves GNOME Shell into a confused
startup state where it never calls SmcSaveYourselfDone() and grinds
startup to a halt until gnome-session decides to move things forward.

In order to fix this, get the DESKTOP_AUTOSTART_ID before we lend
control to GNOME Shell bits and GTK4 is possibly initialized, and
feed it directly to our X11 session manager bits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2906>
2023-03-18 15:40:17 +00:00
Florian Müllner
f90749916a prefs: Add get_keybinding_label() method
Commit 7e9d9c7eb9 added new API to replace GTK for accelerator
parsing.

Unfortunately there is another case in gnome-shell, where we have
to get the label from the logical binding name rather than the
modifier+keysym combination.

Add another small method to cover that use case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2899>
2023-03-06 01:57:27 +01:00
Carlos Garnacho
3ac82a58c5 core: Avoid focusing windows on map during grabs
Normally, mutter implicitly allows a window being shown to take
focus. This is normally desired, except it steals input from
GNOME Shell self. Avoid focusing the just shown window in those
situations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2878>
2023-03-05 07:17:02 +00:00
Carlos Garnacho
7de834b915 Revert "x11: Do not move X11 input focus during grabs"
This reverts commit a68b8e9595.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2878>
2023-03-05 07:17:02 +00:00
Jonas Ådahl
65ef0cb9e8 constraints: Don't apply titlebar constraint on non-drag user-op move
2d8fa26c8e ("core: Pass "frame action" grab operations as an
"unconstrained" grab op") changed the behaviour to treat non-grab
related window moving that has the "user action" flag set to still apply
the "constrain_titlebar_visible" constraint.

The fact that it wasn't applied before was relied upon by some
extensions. While it should arguably exist a better API that for such
extensions to use that have a bit more predictable behavior, until that
is so, restore the old semantics.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2891>
2023-03-04 20:31:33 +00:00
Olivier Fourdan
32e173c3ce startup-notification: Delay cursor feedback updates
A Wayland client repeatedly requesting activation of its surface using
the xdg-activation protocol would make mutter constantly update the
cursor.

To avoid needlessly updating the cursor back and forth between busy and
default, add a timeout to delay the update.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2849>
2023-03-04 09:07:44 +00:00
Carlos Garnacho
beeeea546b core: Avoid setting up frames on fullscreen windows
Ensure we preserve the fast zero-copy paths in Xwayland fullscreen
windows, instead of maybe rendering the client surface on top of the
frame surface, and providing the latter to the compositor.

To achieve this, additionally synchronize frame state when
recalculating features (e.g. after fullscreen/unfullscreen), and
account for this new condition when creating or destroying frames.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2797>
2023-03-03 20:33:18 +00:00
Carlos Garnacho
2a182b91fb core: Sync after issuing key/button passive grabs
Try to collect any possible errors in place, instead of maybe
delegating asynchronous errors to maybe another error handler.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Carlos Garnacho
a7e89453a7 core: Trap errors during passive button/key grabs
These are done on the backend X11 connection, so it is unclear
what is the interplay through the borrowed global XSetErrorHandler()
that triggers issues for us here.

Anyways, better to be explicit, and use error traps the MetaBackendX11
style, in coherence with the rest of the things happening in that
display.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2864>
2023-03-03 20:17:01 +00:00
Robert Mader
b521747d81 Remove support for window shading
It's been broken for an unknown time and was never supported on Wayland.
Thus let's remove the leftovers.

Helpful command: `rg 'shade(?!r)' --pcre2`

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2884>
2023-03-03 19:17:51 +00:00
Robert Mader
92ac922519 window: Fix an if-block indentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2884>
2023-03-03 19:17:51 +00:00
Jonas Ådahl
f27ca241f9 renderer/native: Move per frame KMS update to MetaFrameNative
In order to make things more and more asynchronus and to each time we
paint be an isolated event, that can be potentially be applied
individually or together with other updates, make it so that each time
we draw, we use the transient MetaFrameNative (ClutterFrame) instance to
carry a KMS update for us.

For this to work, we also need to restructure how we apply mode sets.
Previously we'd amend the same KMS update each frame during mode set,
then after the last CRTC was composited, we'd apply the update that
contained updates for all CRTC.

Now each CRTC has its own KMS update, and instead we put them in a per
device table, and whenever we finished painting, we'll merge the new
update into any existing one, and then finally once all CRTCs have been
composited, we'll apply an update that contains all the mode sets for all
relevant CRTCs on a device.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:40:16 +01:00
Jonas Dreßler
256bdba309 constraints: Remove unnecessary if-check
One of those two must be TRUE because we're already inside exactly this
condition.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2873>
2023-03-01 09:48:14 +00:00
Jonas Dreßler
f68b1ff030 window: Allow can-maximize when size hints are exactly screen sized
This looks like a bug: There's no reason why windows which advertise
min-size hints that are exactly the size of the workarea should not be
allowed to maximize, so change the checks here to allow for that.

The commit message of 7f64d6b9 also makes the point that this was not
intended, as it says "larger than".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2873>
2023-03-01 09:48:14 +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 Ådahl
bac7b3f4e6 window: Add missing newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2867>
2023-02-23 22:26:02 +01:00
Florian Müllner
e74573e165 window: Add raise_and_make_recent() method
After !2489, the active workspace's MRU list is now used to pick
the next focus window instead of the stack order.

This list is currently only updated on focus, which can lead to
surprising behavior when closing a window after activating its
ShellApp in the shell.

That is because raising a window (as part of shell_app_activate())
will only change the stacking order, so when closing the active
app window, the focus will switch to whatever had focus before the
app was activated, not the app's next window.

In order to allow gnome-shell to address this, add a new
raise_and_make_recent() method that also adjust the MRU order.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2866>
2023-02-23 20:40:58 +00:00
Florian Müllner
79f5059df7 window: Fix compiler warning
Commit b5d873a8ac changed the flag parameter type in the
function definition, but not in the declaration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2865>
2023-02-23 20:33:49 +01:00
msizanoen1
dbf3584a9b window/xwayland: Handle _NET_WM_FULLSCREEN_MONITORS for XRandR emulation
Handle a specific case of _NET_WM_FULLSCREEN_MONITORS used by GLFW to
make XRandR emulation work with it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2725>
2023-02-20 16:55:36 +00:00
Jonas Ådahl
01353fdc08 profiler: Set 'persistent' state when persistent
This makes sure calling Start() and Stop() doesn't work, since we're
always recording.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2846>
2023-02-14 20:53:17 +00:00
Jonas Ådahl
f5176101cd window: Recalculate attachedness for Wayland window parent changes
When modal dialogs are attached, and we set the parent/transient-for
after setting the modal type, the attachedness isn't updated. This is
(apparently) not the case for X11 windows, as they go through a
unmanage/manage dance avoiding the issue.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
d870b08580 window: Simplify transient_for assignment
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Jonas Ådahl
74fcdb9a62 Introduce the 'service channel' D-Bus service
The service channel D-Bus interface aims to be a "back door" for
services that needs special casing in Mutter, e.g. have custom private
protocols only meant to be used by that particular service.

There are currently no special casing implemented; only the basic
service channel infrastructure is added. There is a single method on the
interface, that is meant to eventually be used by
xdg-desktop-portal-gnome to open a Wayland connection with a private
protocol needed for the portal backend's rather special window
management needs.

The service channel Wayland client works by allowing one instance of
each "type", where each time needs to be defined to work in parallel. If
a new service client connects, the old one will be disconnected.

MetaWaylandClient's are used to manage the service clients, and are
assigned the service client type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2810>
2023-02-13 15:34:24 +00:00
Carlos Garnacho
a68b8e9595 x11: Do not move X11 input focus during grabs
On X11, the stage itself is backed by an XWindow, and moving the
input focus elsewhere will bypass any Clutter-level grabs.

This effectively allows newly opened windows to steal the focus
from gnome-shell itself, which is clearly undesirable. To prevent
that, only allow moving the X11 focus to a Window when no grab is
in place, just like commit 50e89e376 did for the stage focus.

But particularly the updating of x11_display->focus_xwindow is not
prevented. Since it's more consistent to the MetaDisplay/MetaX11Display
dual focus tracking and across Wayland/X11 backends, ensure the X11
input focus is actually set on the last focus Window after the
grabs are gone and windows became interactable again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2832>
2023-02-13 12:45:37 +00:00
Carlos Garnacho
df16cb9fb7 Revert "display: Do not move X11 input focus during grabs"
This patch unfortunately results in situations where it is intended
that the focus change happens while a grab is present (e.g. Alt+tab
popup), resulting in confused focus state.

This commit is reverted in order to try a similar approach at a
different level.

This reverts commit 7531669b4f.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2832>
2023-02-13 12:45:37 +00:00
Carlos Garnacho
caf68a6563 x11: Handle accounting of ignored serials in X11 code
Move this out of MetaDisplay.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
2023-02-09 14:38:39 +01:00
Carlos Garnacho
67a69709b9 core: Make "adding ignored serials" private API
This sounds unnecessary from shell code, and possibly even harmful.
Make this API private and move it into the X11 parts where it belongs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
2023-02-09 14:38:39 +01:00
Carlos Garnacho
3356823ca2 x11: Reset ignored crossing serials from X11 code
They are only ever set and ignored from X11 code, we can also move
this bit of sloppy/mouse mode handling to the X11 parts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
2023-02-09 14:38:39 +01:00
Sebastian Wick
e38002b206 workspace: Do not raise default focus window with raise-on-click
This avoids raising a window when switching input methods or returning
from the overview when it is unwanted with raise-on-click disabled.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2545
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2742>
2023-02-03 17:09:12 +00:00
Jonas Dreßler
d374feb55f events: Make MetaGestureTracker work with the action event delivery
ClutterActions now no longer receive their events via
clutter_actor_event(), instead they get special treatment by the stage
now. Make the MetaGestureTracker work with this and stop emitting events
directly to Clutter via clutter_actor_event(), but instead let them get
through to Clutter (but still not to Wayland).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Sebastian Wick
ec58e74cc5 window: Keep proportional position in meta_window_move_between_rects
The previous logic tried to keep the position of the top left corner of
the window relative to the top left corner of the monitor. This allowed
the window to move out of the target monitor. This change keeps the
proportions of the distance between the window and the monitor borders
instead if possible. Otherwise it keeps the relative position of the
center of the window clamped to [0,1] to make sure the window lands on
the right output.

This also slightly changes what monitor is considered to be on: the
monitor which contains the center of the window and, if the center is on
no monitor, the monitor wich overlaps the most with the window.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2591>
2023-02-01 22:58:34 +00:00
Jonas Ådahl
e8e8a63054 core/delete: Avoid warnings when there is no close dialog
The "ensure dialog" function didn't ensure there was a dialog created,
so the function was renamed. The callers was updated to handle the
dialog not being created.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2807>
2023-01-30 13:17:19 +00:00
Carlos Garnacho
48dc8073de core: Drop META_GRAB_OP_GET_BASE_TYPE define
This was only left used to know whether a MetaGrabOp was about
a window drag operation, but all grab ops are about windows now.
This is redundant.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2683>
2023-01-30 10:56:29 +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
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
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
e88891a1d5 core: Cleanup header includes
There's some X11 includes we no longer need in these files.

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
f2ff317206 core: Drop unnecessary code
This is already handled by the meta_compositor_grab_begin/end
calls, for the Wayland cases.

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
39f1b6dca0 core: Delete now unused code
Since MetaWindowDrag took a lot of this code to handle window drags
internally with less interactions with the rest of the stack, this
code in display/window/keybindings is unused.

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