1
0
Fork 0
Commit graph

3008 commits

Author SHA1 Message Date
Bilal Elmoussaoui
9e150fda42 window: Move xgroup_leader to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
7d6e7773bf window: Make Window.set_transient_for a vfunc
So we can move the xgroup_leader to WindowX11. See next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
c0685fe29b window: Move xclient_leader to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
bc9cd123e9 window: Move xwindow to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
d98b0eb71e window: Move xvisual to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
6f9e75b6f2 boxes: Move Rectangle.is_adjacent_to to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
fcc8cfff11 boxes: Move Rectangle.scale_double to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
59457dff81 boxes: Move Rectangle.crop_and_scale to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Zander Brown
b1dd6973df workspace-manager: Accessors for layout-{columns,rows}
This will allow C code in shell to avoid going though `g_object_get`,
and in future GJS will also be able to take advantage giving a slender
yet not unwelcome boost to perf in some animations

(Semi relates to https://gitlab.gnome.org/GNOME/mutter/-/issues/3083)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3351>
2024-01-09 16:38:25 +00:00
Bilal Elmoussaoui
346e9a7f2c docs: Remove remaining SECTIONs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
74cab06b72 core: Drop unused private functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3492>
2024-01-09 13:14:35 +00:00
Bilal Elmoussaoui
9e4d1f51ee misc: Drop remaining nick/blurbs
Those were added again after we dropped their usage in the codebase

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3498>
2024-01-08 11:54:58 +00:00
Bilal Elmoussaoui
5964ccb385 wayland: Fix building without native backend
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1026

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
2024-01-03 14:46:41 +01:00
Mart Raudsepp
d7db784b54 build: Fix building without wayland headers
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3046
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3471>
2024-01-03 10:48:00 +00:00
Carlos Garnacho
4081d409c6 core: Avoid checks for no_focus_window
This window is set as the key focus in the MetaX11Display when the
MetaDisplay focus is NULL, we can check for that directly instead of
its aftereffects.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
7fbc0ccc01 x11: Hook X11 focus management to MetaDisplay signal
This makes the MetaX11Display indirectly react to MetaDisplay changes,
rather than having the MetaDisplay also drive the MetaX11Display focus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
24344d8141 core: Add ::focus-window signal
This will be triggered whenever the input focus changes, so that
other pieces may hook to this place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
a36616f81d core: Drop focus_frame argument from meta_display_set_input_focus()
Sort that out in the X11 display, where it matters, without the need
of this argument in generic API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Florian Müllner
25d6e4524c window: Remove window icon properties
Window icons are X11 specific, and gnome-shell stopped using them
even as fallback.

Time for some cleanup …

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3452>
2023-12-15 14:14:33 +00:00
Ivan Molodetskikh
ff1ee92aa7 events: Add event name to trace description
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Jonas Ådahl
adc5489ba7 Add debug controller
The debug controller can optionally, when passing --debug-control,
enable manipulating debug state, so far enabling/disabling HDR, via
D-Bus.

It's always created, in order to have a place to store debug state and
emit signals etc when it changes, but so far, it doesn't have its own
state it tracks, it just mirrors that of the monitor manager.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Carlos Garnacho
8de30c3b6e core: Disconnect notify::is-grabbed signal when closing display
Given destruction order, the display goes away before the stage, so
this lingering signal connection may trigger unintended crashes.

Fixes: 05eeb684d1 ("window: Postpone focusing until grab ended if uninteractable")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3422>
2023-11-24 13:54:05 +01:00
Ivan Molodetskikh
2d1fc65b3a Adjust COGL_TRACE names to improve automatic processing
In profilers with a timeline or flame graph views it is a very common
scenario that a span name must be displayed in an area too short to fit
it. In this case, profilers may implement automatic shortening to show
the most important part of the span name in the available area. This
makes it easier to tell what's going on without having to zoom all the
way in.

The current trace span names in Mutter don't really follow any system
and cannot really be shortened automatically.

The Tracy profiler shortens with C++ in mind. Consider an example C++
name:

SomeNamespace::SomeClass::some_method(args)

The method name is the most important part, and the arguments with the
class name will be cut if necessary in the order of importance.

This logic makes sence for other languages too, like Rust. I can see it
being implemented in other profilers like Sysprof, since it's generally
useful.

Hence, this commit adjusts our trace names to look like C++ and arrange
the parts of the name in the respective order of importance.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3402>
2023-11-22 11:46:07 +00:00
Ivan Molodetskikh
47814fab71 Remove COGL_TRACE_BEGIN in favor of BEGIN_SCOPED
Scoped traces are less error prone, and they can still be ended
prematurely if needed (this commit makes that work). The only case this
doesn't support is starting a trace inside a scope but ending outside,
but this is pretty unusual, plus we have anchored traces for a limited
variation of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3396>
2023-11-15 13:57:43 +00:00
Sebastian Wick
ad7ce7c7ca tests/stacking: Add pointer rest and auto raise tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
49d1af2023 display: Deal with destroying windows in pointer rest callback
Take a reference to the window to make sure the MetaFocusData->window
pointer is not pointing to a freed object.

Also make sure that the window that we want to focus is not currently
unmanaging.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
44fcf33156 display: Handle entering NULL windows (desktop)
On X meta_window_handle_enter was called when the desktop window was
entered. On wayland the "desktop" is no window anymore. We still want to
inform the core that the desktop is focused, so it can unfocus windows
if focus-mode is mouse.

This commit prepares the core for handling a NULL windows to mean the
desktop.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
5a33b0075a core: Move window enter/leave to display
The following commits will make it possible to pass a NULL window to
display_handle_window_enter/leave to represent the cursor entering the
desktop. This means it can't be a method of the window class anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
c73e178a2d workspace: Refactor focus_default_window
The existing nested if-else statements are hard to follow. Handle cases
and return as early as possible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
8a1388c930 workspace: Focus on existing focused window if possible
If we have an existing focused window that may have focus, default focus
will leave the focus there. An unmanaging window for example must not
have focus and default focus will continue to select another window in
this case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Carlos Garnacho
91d70ad7a2 core: Query pad devices on MetaPadActionMapper initialization
This object might miss pad devices being made available too early
during seat construction at Mutter initialization, and not initialize
its own backing data properly for these.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3143
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3370>
2023-11-10 21:05:44 +00:00
Carlos Garnacho
2dec4dd088 core: Manage MetaPadActionMapper devices through events
Use the CLUTTER_DEVICE_ADDED/REMOVED set of events instead of the
ClutterSeat signals to track device availability.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3370>
2023-11-10 21:05:44 +00:00
Sebastian Keller
0807579cdd window: Add IS_ALIVE to get_property
This was causing looking glass to wrongly claim that is_alive = false
for all windows.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3367>
2023-11-08 09:02:32 +00:00
Sebastian Keller
d978ab1890 delete: Don't wrongly set window as not alive when pings are disabled
meta_display_ping_window() does nothing when check-alive-timeout is set
to 0, but meta_window_check_alive_on_event() was relying on it to reset
the events_during_ping. Without this events_during_ping was just
counting up until the threshold was reached and the window was marked as
not alive, preventing further pointer events from being sent to the
window.

Fix this by not doing anything in meta_window_check_alive_on_event() if
check-alive-timeout is 0, similar to meta_display_ping_window().

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3142
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3367>
2023-11-08 09:02:32 +00:00
Carlos Garnacho
8cae7ff0f6 core: Ignore locked modifiers in keycombo machinery
Locked modifiers should probably not have an effect on keybindings
while toggled. this is most relevant for modifiers that can be
either/both pressed or locked (e.g. Caps Lock key), if used in
keybindings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3369>
2023-11-08 08:07:41 +00:00
Corentin Noël
a772c709aa wayland/surface: Make MetaWaylandSurface public
Only expose the method to get the associated MetaWindow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3340>
2023-11-04 01:12:11 +00:00
Sebastian Wick
4e088cac0e core/window: Propagate focus appearance to all ancestors
The loop in meta_window_propagate_focus_appearance breaks if any
ancestor has attached_focus_window == focus_window but further ancestors
might still have a different attached_focus_window.

Continue the loop until the root ancestor instead.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2913
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3356>
2023-11-03 14:20:39 +00:00
Bilal Elmoussaoui
57cfd1ab75 cleanup: Remove unneeded ifdef
As it is just a comment

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3349>
2023-11-03 11:36:07 +00:00
Bilal Elmoussaoui
655b4a9c75 Port to MtkRegion
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Sebastian Wick
cfb3a20215 core/window: Don't mark comment as documentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3347>
2023-10-25 20:45:10 +00:00
Sebastian Wick
9a6ddd2dff window: Add a target workspace for raise_and_make_recent
The shell might raise and make windows recent for another workspace when
an app gets activated on another workspace. Making the windows only
recent on the current workspace thus results in inconsistent focus when
another window of the same app is closed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3315>
2023-10-25 13:44:27 +02:00
Florian Müllner
6a22b52579 window: Consider stickiness changes on feature recalc
Some properties like the window type can affect the stickiness.
Make sure workspaces are updated in that case to pick up the
change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3305>
2023-10-24 19:25:24 +00:00
Florian Müllner
b9008ee83d window: Handle layer of DESKTOP windows
Assigning the corresponding stack layer of DESKTOP windows is
currently X11 specific, because there is no way for wayland
clients to set the DESKTOP window type.

This is about to change, so move the code to the generic layer
handling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3305>
2023-10-24 19:25:24 +00:00
Carlos Garnacho
8b0da940cf x11: Simplify handling of focus-follows-mouse
Focus follows mouse is meant to avoid focusing windows that happened
to pop up under the pointer, e.g. due to mapping, workspace changes,
etc... On X11, this has been done since ancient times through a
moderately complex synchronization mechanism, so mutter would know
to ignore crossing events caused on those situations.

This mechanism is much prior to XInput 2 though, where we may know
this in a more straightforward way: If the sourceid of the crossing
event is a logical pointer (i.e. equals deviceid), the crossing event
was triggered logically, and not through user input.

Perform this simpler check, and drop the existing mechanism to
ignore logically induced crossing events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3267>
2023-09-28 15:39:44 +00:00
Carlos Garnacho
39f599018c core: Do not repick pointer while syncing wayland foci
This is a remnant of unreliable pointer state after some of the
event grabbing conditions (originally introduced for window dragging
at commit 1b29113150). Since the introduction of ClutterGrab
and implicit grabs generating crossing events when the conditions
change, this is not necessary.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2977
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3287>
2023-09-21 12:28:06 +00:00
Sebastian Keller
8a5067c917 events: Don't un-bypass Clutter event handling in presence of grabs
After an event has been handled such that it bypasses both Clutter and
Wayland, e.g. when handling a keybinding, bypass_clutter would get
unset in the presence of a wayland grab. This means that the event is
handled both as a keybinding and by Clutter.

In the case of switcher popups in gnome-shell in the presence of a gtk4
autohide popover this meant that instead of selecting the next element,
it would select the one after that. If there are only two elements, as
is common with input sources, this would mean going back to the current
one, preventing switching them with a single press of the keybinding.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6738
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3054>
2023-09-21 10:00:52 +00:00
Jonas Ådahl
b6c7303ee9 window: Mark the suspend-state property with (skip)
The enum used is private, and lets for now declare it private API.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3018
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3263>
2023-09-12 10:46:58 +00:00
Florian Müllner
bc74d166dd window: Really fix portrait orientation check for tiling
Commit 3bfcb6d1 fixed the check for tiling via keybindings, but
ignored a subtle edge case when tiling with the pointer: The
monitor used for tiling is the monitor with the pointer, which
is not necessarily the one that contains the largest part of the
window.

That is, the correct monitor to check against depends on the
context where the function is called. We can either figure
it out automatically via the current window drag, or make it
a parameter.

The latter is clearer, because the callers already decide which
monitor to use for tiling anyway.

Fixes: 3bfcb6d1b9 ("window: Fix portrait orientation check for tiling")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3248>
2023-09-06 12:36:57 +00:00
Uzair Ahmad
3bfcb6d1b9 window: Fix portrait orientation check for tiling
Use work area from the monitor that the window is currently on to
determine if tiling should be allowed.

Window tiling is disabled for monitors with portrait orientation, but
the work area we use to detect portrait orientation is taken from the
monitor that currently has the mouse pointer.

This works fine for edge tiling using the mouse, but this is broken when
using keybindings for window tiling because your mouse pointer could be
on a different monitor that has horizontal orientation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3199>
2023-09-05 20:13:48 +00:00
Barnabás Pőcze
9c3b130f67 display: Fix destruction order
MetaCompositorX11 might need the MetaDisplay's x11_display
during shutdown (meta_sync_ring_destroy -> meta_sync_free),
and `meta_display_shutdown_x11()` needs the MetaStack as
it calls `meta_stack_{freeze,thaw}()`. So fix the order
of destruction so that dependencies are destroyed
after dependants.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2852
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3202>
2023-09-03 23:31:37 +02:00
Barnabás Pőcze
d6b3679bd3 core: Subscribe to stack changes in the stack-tracker
This removes the implicit dependency on `display->stack_tracker`
existing and being valid in `on_stack_changed()` because
now it is the stack-tracker's responsibility to subscribe
to the "changed" signal of the stack and handle the changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3202>
2023-09-03 23:31:37 +02:00
Carlos Garnacho
7224bb8a8d backends: Drop X11 ClutterBackend error traps
Replace these with Mtk error traps altogether, and avoid stacking
one API over the other here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3230>
2023-09-02 09:52:54 +00:00
Carlos Garnacho
630f13db78 x11: Handle ConfigureRequest events in frames
Under strange timings, the GTK frames client may implicitly queue
relayouts that end up disagreeing with the latest frame size as
given by Mutter, this results in GTK calling XResizeWindow, and
Mutter plain out ignoring the resulting XConfigureRequestEvent
received.

This however makes GTK think there's pending resize operations,
so at the next resize it will freeze the window, until enough
resizes happened to thaw it again. This is seen as temporary
loss of frame-sync ness (e.g. frozen frame, and other weird
behavior).

In order to make GTK happy and balanced, reply to this
XConfigureRequest, even if just to ignore it in a more polite
way (we simply re-apply the size Mutter thinks the frame should
have, not GTK), this results in the right amount of
ConfigureNotify received on the frames client side, and the
surface to be thawed more timely, while enforcing the size as
managed by Mutter.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2837
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3189>
2023-08-31 20:53:04 +00:00
Bilal Elmoussaoui
1abef24154 mtk: Move Rectangle.from_graphene_rect from Meta
And drop the clutter helper

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
a93471eb90 mtk: Move Rectangle.to_graphene_rect from Meta
Also drops the clutter equivalent

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
3d693e8309 mutter: Completely replace MetaRectangle with MtkRectangle
There are still various helpers that might be worth to move to mtk as
well

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
aec8e50df8 mtk: Move Rectangle.[contains|could_fit]_rect from Meta
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
eafe07de31 mtk: Move Rectangle.overlap_* from Meta
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
db77759938 mtk: Move Rectangle.area from Meta
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
af7c7befd8 mtk: Move Rectangle constructors from Meta
Also rename the rect constructor from mtk_rect to mtk_rectangle_new so
it is detected as a proper constructor instead of a random function by
g-ir-scanner

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
565acaed9c mtk: Move Rectangle.intersect from Meta
Also replaces it usage everywhere & remove the Clutter helper. Note the
tests were not moved yet to mtk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
6f66dd9944 mtk: Move Rectangle.union from Meta
Similar to Rectangle.equal. The clutter helper was not used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:13 +02:00
Bilal Elmoussaoui
9b2cba4e86 mtk: Move Rectangle.equal from Meta
Moves equal the equal function and removes the clutter equivalent. The
tests were not moved until all the remaining helper functions are moved.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:13 +02:00
Bilal Elmoussaoui
918ae0f4d4 mutter: Replace cairo_rectangle_int_t with MtkRectangle
Note: the various helpers in boxes.c were not ported yet, see the next
commit. This was intentionally done to simplify the porting process

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:13 +02:00
Sandro Bonazzola
ff4d87727b Update license access method
Dropped obsolete Free Software Foundation address pointing
to the FSF website instead as suggested by
https://www.gnu.org/licenses/gpl-howto.html
keeping intact the important part of the historical notice
as requested by the license.

Resolving rpmlint reported issue E: incorrect-fsf-address.

Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3155>
2023-08-30 08:48:23 +02:00
Bilal Elmoussaoui
b004d1c577 cleanup: Drop empty vfuncs overrides
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3209>
2023-08-29 23:38:32 +00:00
Jonas Ådahl
1e25cb746a window: Don't update suspend state after unmanaging
The actor will try to update the suspend state when it goes away, which
can in the case of unmap animations be after the window was unmanaged.
In this case, don't try to update any suspend state.

Fixes: 9a2c8b2592 ("window: Add suspend state")
Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2984
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3213>
2023-08-25 15:48:19 +02:00
Jonas Ådahl
b743cc3528 tests/test-runner: Add 'sleep suspend_timeout' command
It's a tweak to the 'sleep' command to allow well known sleep lengths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3213>
2023-08-25 15:47:05 +02:00
Jonas Ådahl
9a2c8b2592 window: Add suspend state
The 'suspend state' is meant to track whether a window is likely to be
visible any time soon. The hueristics for this are as follows:

 * If a window is hidden, it will enter the 'hidden' state.
 * If a window is visible, and unobscured, it will enter the 'active'
   state.
 * If a window is visible, but obscured by another window, it will enter
   the 'hidden' state.
 * If there is a mapped clone of a window, it will enter the 'active'
   state.
 * If the window has been in the 'hidden' state for 3 seconds, it will
   enter the 'suspended' state.

This will eventually be communicated to Wayland clients so that they can
change their behaviour to e.g. save power.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3019>
2023-08-24 19:57:58 +00:00
Sebastian Keller
133931e3a3 core: Don't unmap XWayland windows without buffers on visibility update
18be74ed was changing meta_window_should_be_showing_on_workspace() to
only show XWayland windows when they have buffers to prevent starting
transitions with a seemingly black window.

This however did not just delay the transition, but when called in
meta_window_update_visibility() could result in the X11 window getting
unmapped again if the call happens before there is a buffer. Then,
depending on the client, the window would either remain hidden or if the
client tries to map the window again, this would repeat the process,
triggering the closing transition every time.

This commit instead just hides the XWayland window from the compositor
but keeps the corresponding X11 window mapped while it does not have a
buffer yet.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2611
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2965
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2820
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2867
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3194>
2023-08-21 18:32:41 +00:00
Sebastian Keller
73bc074917 core: Destroy the correct opaque region when destroying a frame
Freeing the window opaque region rather than the frame one when was
leaking the frame opaque region and wrongly setting the window opaque
region to NULL.

Fixes: 82b2b7688 ("core: Add infrastructure to keep window frames' opaque regions")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3188>
2023-08-17 00:00:55 +02:00
Sebastian Keller
03ba3a825e context: Fix a small leak in meta_context_main_get_x11_display_policy()
The caller of sd_pid_get_user_unit() is supposed to free the unit name
string.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3188>
2023-08-16 21:24:28 +02:00
Carlos Garnacho
90a00dae99 compositor: Handle grab state through ClutterStage::is-grabbed handler
This is something the compositor could now track by itself, instead of
being pushed through events. It also makes more sense to do this directly
when the grabbing conditions change, as opposed to the next event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3185>
2023-08-16 15:34:46 +00:00
Jonas Ådahl
05eeb684d1 window: Postpone focusing until grab ended if uninteractable
When GNOME Shell is in the overview, we don't want windows to steal
focus left and right, but once we leave the overview, we do want
whatever was mapped with "take_focus" to get focus. Do that, but after
the last grab was dismissed.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2690
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3185>
2023-08-16 15:34:46 +00:00
Jonas Ådahl
92051d59a6 constraint: Use WxH format for size in debug logs
Whether W,H or +W,H means "size" or "position" is rather unclear; fix
that by formating size as WxH instead of +W,H.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3124>
2023-08-12 21:11:15 +00:00
Bilal Elmoussaoui
cd27cb5c85 cleanup: Fix various typos
Using the typos cli app

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3169>
2023-08-12 20:13:37 +00:00
Michel Dänzer
16e8bb34de Remove unused meta_stack_get_bottom
Unused since 1b3a58c951 ("...").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3154>
2023-08-12 19:53:46 +00:00
Michel Dänzer
65add94bfd Remove unused meta_rectangle_edge_to_string
Unused since 52bc675fcb ("introspection: remove --allow-unprefixed")
(if ever used at all).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3154>
2023-08-12 19:53:46 +00:00
Michel Dänzer
bdad097af1 Remove unused *_menu_for_rect functions
Unused since 84785951fd ("x11: Remove MetaX11WindowControl").

v2:
* Leave struct _MetaPluginClass::show_window_menu_for_rect, still used
  by gnome-shell.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3154>
2023-08-12 19:53:46 +00:00
Michel Dänzer
63a7313a1b compositor: Fold meta_compositor_do_manage into meta_compositor_manage
meta_compositor_manage hasn't been public API since 4b3cab2cca
("compositor: Don't make internal API public").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3154>
2023-08-12 19:53:46 +00:00
Michel Dänzer
b0c6864b28 Remove unused meta_stack_get/set_positions
Unused since 9e51d98f4a ("Remove tabpopup and friends").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3154>
2023-08-12 19:53:46 +00:00
Carlos Garnacho
17191d5a6c core: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:11:11 +02:00
Carlos Garnacho
85b13ebd18 core: Pass ClutterStage explicitly to MetaGestureTracker
Pass a ClutterStage argument explicitly, instead of fetching it
from the event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
a08eea7f10 backends: Do not use clutter_event_[set|is]_pointer_emulated()
Add a new ClutterEventFlag to propagate this information, affecting
a few selected events on each backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 03:58:42 +02:00
Bilal Elmoussaoui
ead9a3024c cleanup: Switch to pragma once
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3157>
2023-08-07 22:24:36 +00:00
Carlos Garnacho
cd39ba8baf core: Get per-direction pad feature labels for rings/strips
Let the caller specify the directions, so that the pad OSD UI may
assign distinct labels to each direction, instead of showing an
unified one on both directions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3005>
2023-08-07 18:25:01 +00:00
Carlos Garnacho
3e3660ae5f core: Drop META_PAD_DIRECTION_NONE
Avoid this strange value, and stick with the ones suitable
for rings/strips.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3005>
2023-08-07 18:25:01 +00:00
Carlos Garnacho
3e6f7a9463 core: Drop META_PAD_FEATURE_BUTTON value
This is now handled externally through separate API calls.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3005>
2023-08-07 18:25:01 +00:00
Carlos Garnacho
2da9b67673 core: Separate pad button labels in high-level MetaDisplay API
These "features" are somewhat less featured, it's becoming too ugly
to handle all of them with a single API call. The clear outlier are
buttons, so move them to a separate function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3005>
2023-08-07 18:25:01 +00:00
Carlos Garnacho
b6a6e9f187 core: Separate MetaPadActionMapper pad button labeling
This will be handled separately in future commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3005>
2023-08-07 18:25:00 +00:00
Carlos Garnacho
85ac3a2d1a wayland: Separate pad button labeling from other pad features
This will be fully split in future commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3005>
2023-08-07 18:25:00 +00:00
Carlos Garnacho
233e612ef8 core: Rename MetaPadActionType to MetaPadFeatureType
We want to separate pad buttons from strips and rings for
purposes of labeling. Start by renaming the enum "features"
to use a less englobing word.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3005>
2023-08-07 18:25:00 +00:00
Sebastian Keller
7faf4a308e constraints: Delay initial maximization until after reparenting is done
For SSD windows the decoration window from the frames client might have
a different maximization state than the client window and would end up
restoring it once shown. Avoid this issue by waiting until all
reparenting is done before applying the initial maximization (and
minimization).

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2579
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3035>
2023-07-21 11:38:17 +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
Jonas Ådahl
a7954f4a75 onscreen/native: Move out timeval to timestamp helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 21:19:34 +02:00
Peter Hutterer
a6d406d7bf backends/eis: Hook eis into the debug system
To be enabled with MUTTER_DEBUG=eis

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
2fb3bdf774 input-capture: Hook up capturing of events to active session
This adds the actual input capturing rerouting that takes events and
first hands them to the input capture session, would it be active.
Events are right now not actually processed in any way, but will
eventually be passed to a libei client using libeis.

A key binding for allowing cancelling the capture session is added
(defaults to <Super><Shift>Escape) to avoid getting stuck in case the client
doesn't even terminate the session.

The added test case makes sure that the pointer moves again after
pressing the keybinding.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
f9b18d90c6 keybindings: Make event handlers take a const ClutterEvent
This avoids discarding the const qualifier.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Brendan William
23b98db004 core: Never automatically switch focus in strict focus mode
With window_is_terminal gone, "strict" and "smart" focus mode have no
behavioural difference. Let's broaden the scope of strict focus mode,
such that windows never automatically focus unless they are an ancestor
to the transient.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3063>
2023-06-30 22:40:20 -07:00
Brendan William
3bd36d506b core: Remove window_is_terminal and friends
As noted in the comments of window_is_terminal, this is a hack. This
code has not been touched for the better part of a decade. App res_class
tends to differ between Wayland and X11, so it is likely that none of
these apps have been recognised as terminals under Wayland ever. Also,
there are reports that strict focus mode also does not work under X11,
likely due to changes in these terminal apps over the years resulting
in different res_class than those manually specified in here. Let's remove
this hack and change strict focus mode accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3063>
2023-06-30 22:40:16 -07:00
Corentin Noël
6b9efc3b0c wayland: Make the MetaWaylandCompositor type public
Allows mutter implementation to have access to the underlying wl_display.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3092>
2023-06-27 16:17:16 +00:00
Jonas Ådahl
ee6f1f9246 seat/impl: Add 'input-events' debug topic
This will log all input events we forward from libinput.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3052>
2023-06-26 12:36:04 +00:00
Shmuel Melamud
993c42e11f compositor: Mirror window placement in RTL environment
If RTL environment (such as Hebrew or Arabic) is detected, the usual new
window placement algorithm is mirrored. New windows appear near the
right side of the screen and cascading is built from the top-right
corner of the screen.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1873
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3009>
2023-06-22 13:59:24 +00:00
Florian Müllner
a95a3a0d30 prefs: Remove titlebar-font preference
It has been unused since decorations moved into the frames client.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3075>
2023-06-15 16:51:20 +00:00
Sebastian Wick
87bd574598 core/window: Change MRU behavior for windows on secondary output
Current behavior pushes a window which receives focus to the start of
the MRU list on every workspace it is on. By focusing a sticky window
the default focus on all other workspaces changes as well. This is fine
for sticky windows explicitly marked as sticky by the user but if a
window is on a secondary output and workspaces are only on the primary
output the behavior is unexpected. Instead we want the window to be the
default focus only on the current workspace but also keep those windows
in a relative MRU order to each other on all workspaces.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2681
Fixes: 058981dc1 ("workspace: Focus the default window only if no window is focused")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2909>
2023-06-15 12:39:58 +02:00
Sebastian Wick
3bbff537d9 Revert "workspace: Focus the default window only if no window is focused"
This reverts commit 058981dc12.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2909>
2023-06-15 12:09:31 +02:00
Dor Askayo
a738132486 profiler: Actually free ThreadInfo when a thread unregisters
The previous commit only freed the list node.

Fixes: a731017ec ("profiler: Free ThreadInfo when a thread unregisters")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3078>
2023-06-14 23:54:41 +03:00
Dor Askayo
edc5d2a933 profiler: Free ThreadInfo when a thread unregisters
This avoids leaking the the ThreadInfo object when a thread unregisters.

Fixes: e16d68372 ("profiler: Add API to register profiler threads")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3076>
2023-06-14 19:48:12 +03:00
Dor Askayo
f49b2a3c7d profiler: Free ThreadInfo list on MetaProfiler finalize
This avoids use-after-free when handle_start() is called following
handle_stop() during the lifetime of the MetaProfiler. This happens
on repeated profiling sessions using Sysprof.

Fixes: e16d68372 ("profiler: Add API to register profiler threads")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3076>
2023-06-14 19:44:48 +03:00
Carlos Garnacho
bc04fcb89d core: Change MetaWaylandTextInput event forwarding to IMs
We need to juggle with some things here to keep key event ordering
and accounting consistent.

The keyboard internal state changes (and maybe modifier event emission)
happening through meta_wayland_seat_update() should ideally happen
from the same key events that reach the client through wl_keyboard.key,
so that wl_keyboard.modifier events are emitted in the right relative
order to other key events.

In order to fix this, we need to decide at an earlier point whether
the event will get processed through IM (and maybe be reinjected),
thus ignored in wait of IM-postprocessed events.

This means we pay less attention to whether events are first-hand
hardware events for some things and go with the event that does
eventually reach to us (hardware or IM).

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5890
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
2023-06-13 14:21:41 +00:00
Jonas Ådahl
bea2fdc12b profiler: Add missing call to stop profiling
Otherwise the profiling backend (cogl-trace.c) doesn't actually stop,
and will complain if we try to start it up again.

Fixes: ab39eaf131 ("cogl/trace: Make global start/stop more explicit")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3068>
2023-06-12 12:20:38 +00:00
Sebastian Keller
6274bb3518 x11: Use input region from frame window for decorated windows
Previously the input region was ignored for decorated windows, which
since the introduction of the frames client meant that the entire shadow
region of the frame window was considered interactive.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2706
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3031>
2023-06-02 20:21:56 +00:00
Jonas Ådahl
b413f45bee profiler: Enable tracing on threads added while running
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
ab39eaf131 cogl/trace: Make global start/stop more explicit
Don't try to handle things by threads enabling/disabling the main trace
context on-demand, just have a clear start/stop API. For the D-Bus API,
it becomes more straight forward, and for the persistent variant too, as
it avoids having to pass garbage input when it's known that arguments
will be discarded.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
1ca76e9b9c context: Start persistent profiling via command line argument
Persistent profiling was started via an env var, but that's rather hard
to discover and remember without grepping; change to use a command line
argument.

The profiler is started early, even during (though late in)
configuration, but configuration should ideally be instant and pointless
to configure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
e16d683721 profiler: Add API to register profiler threads
The registered threads will get tracing turned on when MetaProfiler is
started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Jonas Ådahl
604aeba9b3 events: Trace handling of event
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2998>
2023-05-31 08:37:52 +00:00
Robert Mader
4a5a31edc6 mutter: Remove stray spaces
To silence code-style-check complains.

Fixes d44f02ba64

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3018>
2023-05-24 14:16:41 +02:00
Carlos Garnacho
3bea86298d core: Avoid placing hidden windows too early on Wayland
This check only waited for windows without a buffer for wayland
clients. This should happen for all windows on a Wayland backend
here, unlike the other places calling client_window_should_be_mapped()
that expect to get ahead of the window state.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2786
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2999>
2023-05-22 16:12:36 +00:00
Bilal Elmoussaoui
d44f02ba64 mutter: Cleanup gi-docgen annotations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2939>
2023-05-22 15:47:37 +00:00
Carlos Garnacho
4fcfd0350e core: Sync actor frozen state after destroying frame
A window may become undecorated while the frame window is
frozen due to updates. In that case we would both miss a
reply for the frame window, and any other means to trigger
the window actor being thawed.

Check the frozen state after destroying the frame, so that
meta_window_x11_are_updates_frozen() may end up changing
opinion if the frame window was caught in this situation.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2639
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2996>
2023-05-22 15:13:30 +00:00
msizanoen1
e4d7667c43 core/window: Track monitor with the highest scale value
This is used for Wayland fractional scale pixel alignment.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
2023-05-22 14:44:33 +00:00
Bilal Elmoussaoui
b9a6891910 display: Drop the indirection when initializating Xwayland
The init function didn't do much other then calling into the xwayland
one

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
2023-05-15 20:47:06 +02:00
Bilal Elmoussaoui
a27b9d9707 wayland: Guard XWayland types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
2023-05-15 20:41:54 +02:00
Bilal Elmoussaoui
0f88f0931c core/events: Guard X11 types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2445>
2023-05-15 20:36:23 +02:00
Bilal Elmoussaoui
761a254e6f core/display: Guard X11 types
This also moves a couple of function calls to
MetaDisplay::x11-display-opened a signal handler

Related https://gitlab.gnome.org/GNOME/mutter/-/issues/2272

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)
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
Carlos Garnacho
18be74edeb core: Fix map transitions for X11 windows on Wayland
We are attempting to show windows that do not yet have a
surface/buffer, this makes GNOME Shell avoid transitions
for these windows.

Since on Wayland X11 windows are also Wayland surfaces,
this check is also valid for these, and is thus made more
generic to also cater for these windows.

Eventually, meta_window_update_visibility() is called
when the surface gets its buffer, so the window can be
neatly animated.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2611
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2975>
2023-04-25 17:34:24 +02:00
Sebastian Keller
04fa926eea core: Remove meta_frame_get_flags()
It is private and the last caller was removed in 92feea30.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2971>
2023-04-20 15:49:55 +02:00
Jonas Ådahl
86b5d9d809 Replace using sscanf() to parse mode strings with new helper
This fixes issues when the locale uses characters other than `.` in
floating point numbers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2902>
2023-04-18 18:38:03 +00:00
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