1
0
Fork 0
Commit graph

2466 commits

Author SHA1 Message Date
Jonas Ådahl
89053cc6f7 display: Make meta_display_open() report errors
Instead of just exit():ing, report the error, so the caller can decide
how to deal with the error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
c9992a2953 main: Initialize Wayland just before MetaDisplay
Wayland support is not really a "backend" thing, it just lacked a better
place to store its instance pointer. Eventually we'll have a better
place, but prepare for that by initializing it together with the more
similar subsystems.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
6c1793b7d3 Rename MetaDisplayPolicy to MetaX11DisplayPolicy
This lack of X11 in the name was a bit confusing, since this is about
the X11 policy, not some policy of MetaDisplay.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
f677e0cbfb display: Make the display handle its own prefs handlers
Two prefs were handled by display.c itself, and another in main.c.
Unscattter things a bit by moving the one in main.c to the others in
display.c.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
9cd99ee7ac main: Move away debug flag management to util.c
The rest of debug flag details are in util.c and util.h, make things
less scattered by moving the rest to util.c too.

While at it, put the coredump:ability setting needed for being suid
there too, so we have a common place for initializing "debug utils".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
62ef293cdb main: Let session management code deal with DESKTOP_AUTOSTART_ID
No need to have that outside of meta_session_init().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1833>
2021-05-17 16:08:42 +00:00
Jonas Ådahl
799c6dcf2f main: Tear down Wayland support before MetaDisplay
MetaDisplay does a lot of things, and is a central part to anything
window management. To let Wayland units have an easier time tearing
down, make it so that the Wayland infrastructure is terminated before
MetaDisplay.

This also makes sure that X11 support is turned off, so that we don't
stumble upon Xwayland terminating due to the Wayland socket connection
being broken. Will mitigate that in a better way in a later commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
2021-05-05 19:52:04 +00:00
Carlos Garnacho
1d82e0f236 core: Drop X11 error trap from pointer warping code
This code is backend-agnostic, and should not do anything special
about X11. Drop these error traps, and let the backend deal with
the possible errors.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1725
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1807>
2021-03-29 13:54:06 +02:00
Jonas Ådahl
12f2fcd332 main: Expose hooks to manage context with more granularity
This is to allow gnome-shell to tear down more gracefully. It's a stop
gap solution until there is a better context handling system, but will
have to do for now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1775>
2021-03-13 18:56:21 +00:00
Marco Trevisan (Treviño)
42287a5f04 restart: Request to hide the restart message if not accepted
In case the shell ignores or can't accept the restart request we should
hide the message that has been just requested to be shown.

As per ::show-restart-message signal documentation, this has to be done by
emitting the signal with a NULL message.

So follow the API properly in such case

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1780>
2021-03-13 15:12:36 +00:00
Benjamin Berg
9b25248c96 main: Force Xwayland startup if not on systemd
In non-systemd managed session we are unable to start services on
demand. Instead, gnome-session will start everything at login time,
including any X11 related service (i.e. gsd-xsettings).

However, in order to start gsd-xsettings, Xwayland needs to be started
already. Otherwise it will connect to GNOME_SETUP_DISPLAY and login will
hang at that point.

Fix this by detecting whether mutter is running in a systemd unit. If it
is, we assume that we are systemd managed and the machinery to start the
services works fine. If not, we assume that the session management may
unconditionally try to start X11 related services and Xwayland must be
started in order to not block this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1771>
2021-03-12 19:28:25 +01:00
Jonas Ådahl
005c49063d main: Add --virtual-monitor argument
Make it possible to create persintent virtual monitors using command
line argument. This will not be the only way to create virtual monitors,
the primary way will be using the screen cast API, but using command
line argumenst is convenient for debugging purposes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
b31a639378 backend: Add 'prepare-shutdown' signal
This will be used to avoid doing various work when we're shutting down,
e.g. react to changes triggering monitor reconfigurations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
a0e4f5226c workspace: Nag less about tiny but sane work areas
It's useful to be able to have very very tiny monitors (e.g. 60x60
pixels) when doing reference testing, as tests have reference images
that the output is compared to. Smaller reference images the less
storage they use.

To avoid annoying pointless warnings when this is done, change the
pedantic workspace work area code to be more forgiving if the work area
happens to match the display size.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
9bf57f82d3 main: Make it possible to set properties when overriding configuration
This makes it possible to pass custom properties to backends when
constructing tests. This will be used to create "headless" native
backend instances for testing the headless native backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Ådahl
42d614f6fa backend-native: Add non-functional 'headless' mode
Make it possible to pass --headless as a command line argument in order
to turn the native backend "headless". This currently doesn't do
anything, but the intention is that it should not use logind nor KMS,
and work completely headless with only virtual outputs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
2021-03-12 15:09:45 +00:00
Jonas Dreßler
504af40c69 window: Don't stop irrelevant TOUCH_END events during window grab ops
During window grab ops we only react to touch events that have the
pointer emulating sequence, all other events should be propagated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/427>
2021-03-04 22:46:20 +00:00
Jonas Dreßler
ef1b101821 window: Handle TOUCH_BEGIN events separately during grab ops
Handle the case of a TOUCH_BEGIN event during window dragging separately
instead of treating it like a TOUCH_UPDATE event: Simply return TRUE to
make Clutter stop event propagation if it's the pointer emulating
sequence and let Clutter propagate the event if it isn't.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/427>
2021-03-04 22:46:20 +00:00
Jonas Dreßler
9889e6dadd window: Cancel window grab ops on TOUCH_CANCEL events
Window dragging should be cancelled when the touch sequences we're using
are no longer available. Also listen to TOUCH_CANCEL events if the
window is grabbed and cancel the grab op when a TOUCH_CANCEL event
happens.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/427>
2021-03-04 22:46:20 +00:00
Jonas Dreßler
91d03f1c96 display: Reset all grab properties after a grab op
Make sure to reset all the state that was set for an interactive grab op
back to the defaults after a grab op has ended.

Especially important here is setting grab_frame_action back to FALSE,
since this will constrain window-titlebars to the panel. We set this to
TRUE on some grabs, for example when resizing, but not when moving
windows. Since this remained being set to TRUE, it would also constrain
non-grab window movements, like calling MetaWindow.move_frame(), which
is used by gnome-shells OSK. By resetting it back to FALSE after a grab,
the OSK can now always move non-maximized windows to the position it
wants.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1736>
2021-02-26 14:53:32 +00:00
Olivier Fourdan
2432508db7 core: Account for the globally active input case
Commit afa43154 tried to make sure the focus was properly changed when
calling focus_default_window() by checking the focused window just after
trying to set the focus.

However, the X11 “Inter-Client Communication Conventions Manual” version
2.0 (ICCCM 2 for short) states that some X11 client may want to use a so
called “globally active input” model in which case the client expects
keyboard input and set input focus even when it's not one of its own
window.

To comply with this, when dealing with such clients, mutter will not
change the focus and send a WM_TAKE_FOCUS message instead.

That mechanism will defeat the logic introduced by commit afa43154
because the focused window is not changed in this case. As a result, the
input focus will fallback to the no-focus window.

To avoid this, only check that the focus change occurred for windows
using a synchronous focus model.

v2: Split specific test for "globally active input" model (Florian).
v3: Remove the check for window->unmanaging which is useless (Jonas).

Fixes: afa43154 - "core: Make sure focus_default_window() worked"
Close: https://gitlab.gnome.org/GNOME/mutter/-/issues/1620
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1716>
2021-02-23 11:08:59 +00:00
Olivier Fourdan
6438919a89 window: Add "is_focus_async" API
X11 clients can use different models of input handling, of which some
may not result focus being set synchronously.

For such clients, meta_focus_window() will not change the focus itself
but rely on the client itself to set the input focus on the desired
window.

Add a new MetaWindow API to check when dealing with such a window.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1716>
2021-02-23 11:08:59 +00:00
Robert Mader
6eeeffdc68 src: Stop using GSlice
It has been inofficially deprecated for years, is known to cause issues
with valgrind and potentially hides memory corruption.
Lets stop using it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1512>
2021-02-22 13:52:27 +01:00
Jonas Dreßler
9512d58c28 display: Don't add MetaDisplay argument to grab-op-* signals twice
GObject signals pass the emitting GObject as the first argument to
signal handler callbacks. When refactoring the grab-op-begin/end signals
to remove MetaScreen with commit 1d5e37050d,
the "screen" argument was replaced with a "display" argument instead of
being removed completely. This made us call the signal handlers with two
identical MetaDisplay arguments, which is very confusing and actually
wasn't handled in a grab-op-begin handler in gnome-shell.

So fix this by not adding the MetaDisplay as an argument to those
signals, GObject will take care of that for us.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1734>
2021-02-19 14:52:22 +01:00
Björn Daase
7a75c7ea1f core: Don't show copyright when printing version
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/86
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1702>
2021-02-09 07:46:10 +00:00
Jonas Ådahl
5104a9b2ce remote-desktop/session: Add support for SelectionTransfer/Write
When a transfer request is done to the MetaSelectionSourceRemote source,
it's translated to a SelectionTransfer signal, which the remote desktop
server is supposed to respond to with SelectionWrite.

A timeout (set to 15 seconds) is added to handle too long timeouts,
which cancels the transfer request.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1552>
2021-02-05 16:44:27 +00:00
Jonas Ådahl
a220506bf7 remote-desktop: Add dummy remote selection source
It doesn't yet fetch data from the remote desktop session, but hooks up
correctly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1552>
2021-02-05 16:44:27 +00:00
Jonas Ådahl
54b024465e util: Add 'remote-desktop' debug topic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1552>
2021-02-05 16:44:27 +00:00
Jonas Dreßler
a869df1dd7 util: Add a SCREEN_CAST debug topic
This is going to be useful to log dropped frames and other more common
errors about screencasting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1709>
2021-02-05 09:27:38 +00:00
Florian Müllner
ee3d26f228 keybindings: Reset modifier-only-pressed on scroll
Since commit c255031b6d, we allow some modifier+scroll events to
pass through to Clutter to enable gnome-shell to handle them. That
action shouldn't trigger a modifier-only action at the same time, so
reset the corresponding tracking just like we do for modifier+click.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1695>
2021-02-04 19:26:18 +00:00
Florian Müllner
ac3d9a0641 events: Process modifier+scroll after keybindings
Allowing the keybindings code to see the event enables it to
process it for its internal modifier-only-pressed state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1695>
2021-02-04 19:26:18 +00:00
Florian Müllner
7901b98808 display: Expose window_grab_modifiers
Since commit c255031b6d we pass scroll-events through to
the compositor if the window_grab_modifiers are pressed;
in order to allow gnome-shell to check for those events,
expose the struct member as a MetaDisplay property.

Also take the opportunity to pick a more generic name, now
that the modifier is no longer used exclusively for mouse
clicks (unless we maintain the notion of scroll events as
button 4 and 5 "clicks").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1695>
2021-02-04 19:26:18 +00:00
Jonas Ådahl
30e1c51b33 Change all g_memdup() to g_memdup2()
Using g_memdup() is dangerous due to the type of the size argument. See
https://gitlab.gnome.org/GNOME/glib/-/issues/2319 and
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1926 for details.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1708>
2021-02-04 19:16:28 +01:00
Jonas Ådahl
b55b26661f workspace: Downgrade assert to warning when adding window
An extension can by accident cause us to end up in a state where we try
to add the same window to a workspace twice. When this happens we
shouldn't crash, but instead complain loudly.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/992
Related: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/157
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1692>
2021-01-29 17:14:08 +00:00
Florian Müllner
81f3694804 window: Guard can_ping() against unmanaging windows
We remove pending pings when unmanaging a window, but currently
don't prevent new pings to be scheduled after that.

The previous commit fixed a code path where this did indeed happen,
but as the result of gnome-shell trying to attach a Clutter actor
to a non-existent window actor is pretty bad, also guard can_ping()
against being called for an unmanaging window.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2467

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1676>
2021-01-28 14:47:28 +00:00
Florian Müllner
e7b58c23b8 window: Do not handle ungrabbed events when unmanaging
Once we are no longer managing a window, we have no business in
dealing with it anymore, and operations like focusing, raising or
pinging the window aren't expected to work, and can go horribly
wrong if we try.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2467

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1676>
2021-01-28 14:47:28 +00:00
Georges Basile Stavracas Neto
4927452b84 workspace-manager, x11-display: Default to a single row
This seems to have been the default in the past, but was (accidentally?) modified
by 8adab0275.

For GNOME 40, we'll be returning to our root with horizontal workspaces, so instead
of overriding it in GNOME Shell side, change the default back to what it once was.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1684>
2021-01-27 11:48:10 -03:00
Jonas Ådahl
02859221ea tests/test-runner: Hook up async waiter on demand
Not all tests will spawn Xwayland; so don't expect it to be there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1681>
2021-01-25 15:14:35 +00:00
Jonas Ådahl
b7441514fe kms: Add some basic debug logging
Enabled using MUTTER_DEBUG=kms or via
Meta.add_verbose_topic(Meta.DebugTopic.KMS) in looking glass.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
2021-01-22 16:47:08 +00:00
Olivier Fourdan
cde0cd5d23 xwayland: Enable Xwayland on demand by default
Make "Xwayland on demand" the default policy when Xwayland supports
"initfd" and remove the corresponding experimental feature.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1673>
2021-01-19 09:33:33 +01:00
Florian Müllner
c255031b6d events: Bypass wayland when scrolling with mouse-button modifier pressed
<super> is considered a system modifier, and applications cannot use it
for keyboard shortcuts or as button modifier. It doesn't seem too much
of a loss taking <super>+scroll-event away as well, so that it becomes
available to gnome-shell/extensions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1674>
2021-01-18 20:59:17 +01:00
Carlos Garnacho
6011562aa9 backends: Update pointer drag-threshold/double-click settings location
Following recent gsettings-desktop-schemas changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1416>
2021-01-14 13:58:16 +00:00
Carlos Garnacho
b938749cce core: Trigger repick via ClutterStage
This is equivalent now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1654>
2020-12-23 12:54:49 +01:00
Olivier Fourdan
76d1a64204 core: Be more selective looking for a focusable ancestor
find_focusable_ancestor() may pick an ancestor window which is not
mapped or hidden, and setting focus on that window will fail.

Be a tad more selective when looking for a focusable ancestor, to reduce
the chance of meta_window_focus() not focusing the happy chosen one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1643>
2020-12-18 17:17:50 +00:00
Olivier Fourdan
afa431547b core: Make sure focus_default_window() worked
The function focus_default_window() optionally takes a MetaWindow
argument denoting a window that should not be focused.

That function calls focus_ancestor_or_top_window() which in turn
calls meta_window_focus() to pass focus to another window.

However meta_window_focus() gives no guarantee that the given window
will end up being the one focused, and can fail in various and creative
ways.

If that fails, we could possibly end up with the focus window being the
one to avoid, while the caller assumes focus was changed, going as far
as asserting that fact like meta_window_unmanage() does.

As a result, mutter may abort simply because meta_window_focus() failed
to set focus on the expected window.

To avoid that issue, check that the focus did not end up on the window
that we explicitly did not want, and if that's the case, simply fallback
to the default focus window.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/862
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1643>
2020-12-18 17:17:50 +00:00
Jonas Dreßler
ae6d83fb47 clutter: Switch to storing device->actor associations in ClutterStage
As planned and prepared with the last commits, let ClutterStage take
care of tracking input devices and their respective actors. This means
we now can remove the old infrastructure for this from
ClutterInputDevice.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1633>
2020-12-18 16:17:00 +01:00
Carlos Garnacho
4a0c56f928 clutter: Simplify stage state management
Making this an event is overly convoluted, accounting that we
emit the event, then convert it to a ClutterStage signal, then
its only consumer (a11y) sets the active ATK state.

Take the event out of the equation, unify activation/deactivation
of the stage in MetaStage, and use it from the X11 backend too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1623>
2020-12-08 15:37:38 +00:00
Carlos Garnacho
96e320ba5a clutter: Drop CLUTTER_DESTROY_NOTIFY event
Stop propagating this as a Clutter event. DestroyNotify is only
relevant on nested X11 sessions, so handle it specifically in place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1623>
2020-12-08 15:37:38 +00:00
Carlos Garnacho
49b3ac2f86 clutter: Drop CLUTTER_CLIENT_MESSAGE event
This is used nowhere and emitted nowhere. We can do without it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1623>
2020-12-08 15:37:38 +00:00
Jonas Ådahl
7eb20b2c39 window: Add some trace instrumentation to implement show/hide
Showing and hiding caused several second stalls, and still cause large
enough stalls to cause missed frames, makes this visible to Sysprof.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1616>
2020-12-01 11:41:11 +00:00