1
0
Fork 0
Commit graph

622 commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
e005d035c0 boxes: Define cleanup function for MetaStrut and use auto-pointers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3701>
2024-05-17 15:33:52 +00:00
Sebastian Keller
1f1538be76 x11/window: Compare input shape to client rect when undecorating
When a window with an input shape on its decoration window becomes
undecorated and meta_window_x11_update_input_region() gets called via
notify::decorated, the buffer_rect of the window has not been updated
yet while the decorated property has. This would lead to us comparing
the input shape of the client window to the buffer_rect which still
includes the decoration window. This would fail to detect the common
case when the client window has no input shape set, leading to the input
region being set to the size of the client window rather than NULL. If
the window is then resized later, the input shape would remain at the
previous size.

This was not a problem before 6bd920b35, because then we were (wrongly)
always comparing to the client_rect.

Fix this by choosing the correct rect for comparison depending on
whether the window is decorated.

Fixes: 6bd920b35 ("x11/window: Use correct bounding rect to determine NULL input region")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3451
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3720>
2024-05-15 14:07:36 +00:00
Marco Trevisan (Treviño)
31165c2d86 x11/window: Add proper type guard to x11-specific public API calls
These functions are specific for X11 windows only so we should check
if the passed window is an X11 one, not just a MetaWindow since we're
casting to the actual type at later point.

Fixes changes part of commit e1e6534eb

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3727>
2024-05-03 12:38:01 +00:00
Marco Trevisan (Treviño)
b422393bbc x11/window: Add type-check guard to meta_window_x11_get_group()
Since this is still public API we want to ensure that we don't cast
it directly without having checked its type

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3727>
2024-05-03 12:38:01 +00:00
Marco Trevisan (Treviño)
2a88a3eb96 x11/window: Do not try to compare a wayland active window with X11
If a window sends a configure stacking request, we were comparing the
active window with the event window even though they were different
client types (e.g. wayland and x11).

This was leading to a critical error, so let's handle this by ensuring
that the active window is of the same kind of the event window before
doing x11-specific checks. Behaving as different applications in case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3727>
2024-05-03 12:38:01 +00:00
Sebastian Keller
e4763d00e8 x11/window: Update comment and variable name to reflect current behavior
d991961ae changed this code from client rect to buffer rect to account
for the fact that for SSD windows the decorations are now included in
the bounding region, but it kept the variable name as client_area and
the comment was also still referring to the client rect.

Fixes: d991961ae ("x11: Use input region from frame window for decorated windows")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3697>
2024-04-19 13:18:39 +00:00
Sebastian Keller
6bd920b355 x11/window: Use correct bounding rect to determine NULL input region
When updating the input region we check whether the input shape reported
by XShape matches the bounding region of a window to determine when it
was not set by the client. We would then use a NULL input region instead
which always matches the full size of the window. The code however was
using the client rect for this comparison, which does not include the
window frame. Since d991961a the frame is considered part of the input
region.

This meant that for SSD windows where the input region would match the
bounding region, we would not detect that and fail to set the input
region to NULL, but instead set it to the reported input shape.

Usually this would not be the case due to the GTK frame window having
shadows and a resize region, but in the presence of an issue that causes
GTK to wrongly detect _GTK_FRAME_EXTENTS as not supported, GTK would not
draw shadows or set an input shape. And due to GTK not updating its
input shape, there would be no further calls to
meta_window_x11_update_input_region() after the initial one.
The input region would therefore remain at the fixed size from the
initial call. This was causing windows to become click-through outside
of the region corresponding to their initial size after being resized.

Fixes: d991961ae ("x11: Use input region from frame window for decorated windows")
Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/6558
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3404
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3697>
2024-04-19 13:18:39 +00:00
Zander Brown
8002919f7b meta: Update annotations
MetaBackend is part of the public API but MetaGPU is not so gpu-added
can cause confusion, treat it as gpointer.
Also ensure XEvent is properly recognised

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1918>
2024-03-13 12:52:41 +00:00
Bilal Elmoussaoui
6d03666d2d window/x11: Try harder to find the associated group
Otherwise we would try to create a new group later on which would crash

Fixes #3329

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3656>
2024-03-12 14:30:40 +01:00
Sebastian Keller
a66b4c3da9 x11/display: Always use meta_display_set_input_focus() for focus change
X11 server side focus changes, such as when a focus change was requested
by mutter for a globally active window, did not go through
meta_display_set_input_focus(), which is responsible for emitting the
`focus-window` signal. Since this signal is what triggers the display
server specific code to handle focus changes, this was leading to a
problem on Wayland where the focus remained on the last active Wayland
window when the focus got changed to a globally active XWayland window.

This commit now changes handling X11 server side focus changes to also
go through the code path that emits the signal while making sure to not
trigger another focus change and keeping the same serials as the
previous code to not interfere with future focus changes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3328
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3651>
2024-03-11 10:47:43 +00:00
Carlos Garnacho
1b3759d51c x11: Pass NET_WM_MOVERESIZE coordinates as window drag hint
This will make windows stick to the pointer from the right point
where dragging started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:22 +01:00
Carlos Garnacho
4b1e24fcc4 core: Pass position hint to meta_window_begin_grab_op()
Add an argument to pass the position hint to this public API
call, so that callers can specify such hint. Everyone passes
NULL at the moment.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:22 +01:00
Leonhard
7bf8945da4 window: Handle layer of DOCK windows
Assigning the corresponding stack layer of DOCK windows is currently X11
specific, because there is no way for wayland clients to set the DOCK
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/3612>
2024-02-26 11:19:03 +00:00
Bilal Elmoussaoui
2834780cbe window: Move set_frame_xwindow to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3603>
2024-02-21 16:01:00 +01:00
Bilal Elmoussaoui
3cc44b1f04 cleanup: Guard x11 headers includes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3603>
2024-02-21 16:01:00 +01:00
Bilal Elmoussaoui
b5cf16fa74 cleanup: Remove not used X11 includes
Also add ones where they are actually used

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3603>
2024-02-21 15:25:44 +01:00
Bilal Elmoussaoui
899b4aad37 x11/display: Don't go through meta_create_x_cursor
As the cursor would always be default in this case and we would
want to move that function to the x11 cursor renderer.See next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3599>
2024-02-20 15:21:21 +00:00
Bilal Elmoussaoui
cf9f7f427e window: Add a copy of XSizeHints
The type ended being used even in wayland code paths
so add a copy of it for now.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3597>
2024-02-19 20:19:41 +01:00
Bilal Elmoussaoui
41cc85c857 window: Move shape_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
5e8e7df5bd window: Move input_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
606197de46 window: Move opaque_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
09fc3e966a window: Move wm_client_machine to WindowX11
Also removes the public getter as nothing uses it and it no longer
make sense to expose X11-ism as API

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
692414c078 window: Move sm_client_id to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
72326d8ca5 window: Move grab_on_frame to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
de2a24b313 window: Move keys_grabbed to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
e1e6534eb2 group: Move various functions to MetaWindowX11
Except meta_window_x11_get_group, which is still used by GNOME Shell
and we can't make it a private API for now.

Will need further investigation and could be done as a future
step

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
2024-02-08 16:55:06 +01:00
Bilal Elmoussaoui
f0c22cb3bc core: Guard MetaGroup usage
For now, we just guard part of the group header as it is
consumed by gnome-shell. Ideally, we would drop that use case and make
the whole header private.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
2024-02-08 16:54:50 +01:00
Bilal Elmoussaoui
43351b483f window: Move group to WindowX11
Which means meta_window_get_group now requires a x11 client type,
so ensure we don't call it on a wayland client

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
2024-02-08 16:24:58 +01:00
Carlos Garnacho
54e4d1df79 x11: Defer ClutterStage focus actor change until window is focused
If we happen to be changing focus to a window *while* taking focus
away from Clutter widgetry, we would unintendedly trigger reentrance
in a way that the old focused window remained in focus, by asking
to focus the default focus window in an untimely manner.

To handle this reentrancy, delay dropping the Clutter key focus
until the window focus changed, so that the focus change will look
up the default focused window in the workspace, and find the up to
date one.

Fixes: ae102ee301 ("x11: Refactor ClutterStage key focus management")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3467>
2024-01-10 20:56:24 +01:00
Bilal Elmoussaoui
94f9d88371 x11: Drop error trap helpers
They are no longer that useful as they end up calling
mtk functions nowadays

Followup of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3230

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3483>
2024-01-10 13:58:18 +00:00
Bilal Elmoussaoui
09b7cd9f4a x11/display: Don't try to retrieve xwindow of wayland windows
Trying to get the xwindow of a wayland only window would fail when
casting to a x11 window. Which happens as
meta_x11_display_set_input_focus is called whenever the focused
window changes, whether it is a wayland or x11 one

Fixes: bc9cd123e ("window: Move xwindow to WindowX11")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3506>
2024-01-09 23:51:37 +01:00
Bilal Elmoussaoui
5ad8a79823 display: Add a helper to retrieve associated xwindow
As we moved the xwindow property from Window to WindowX11 which is
not exposed as public API. So instead of exposing WindowX11,
the API is added to MetaX11Display which is already exposed.

This is only needed by gnome-shell for it tray icons support
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/81f18d7d/src/shell-tray-icon.c#L67

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
0236506cff window: Move has_pointer_x11 to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
19a36b8879 window: Stop storing xtransient_for field
Instead retrieve the associated Window from the xwindow property.
Avoids having a vfunc to handle the get_transient_for differences
between Wayland and x11

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
5e098eadce window: Move user_time_window to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
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
57b59f95a6 x11: 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
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
b64381d366 x11: Rename cairo_rects to mtk_rects
Avoids the result from showing up in a grep cairo

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3486>
2024-01-04 14:00:26 +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
ae102ee301 x11: Refactor ClutterStage key focus management
Integrate it into the code, instead of depending on MetaDisplay
notify::focus-window for it. Now, instead of focusing explicitly the
stage window, we focus a NULL window, and let the MetaX11Display
determine whether focus should go to the stage window if there's
a focused actor, or the no_focus_window if nothing has focus.

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
Carlos Garnacho
4179679239 x11: Adopt code to focus stage window on Clutter key focus
We currently offer the mechanism for GNOME Shell to implement, and
while this is not exercised often (our entries are typically surrounded
by a ClutterGrab ensuring key events, so this is reserved to grab-less
entries, probably there are some in extensions), this is arguably
something Mutter should cover by itself without GNOME Shell guidance.

This is only necessary on the X11 backend, although it is conceptually
more tied to the MetaX11Display connection, so perform the focus
tracking there only if not running as a Wayland compositor (i.e. --x11).

This avoids the only case where the low-level
meta_x11_display_set_input_focus_xwindow() function is used, or rather
makes it completely a MetaX11Display implementation detail, leaving
only the MetaDisplay API as the high-level entry points to handle
window key focus.

The public API that allowed GNOME Shell to implement these mechanisms
is also gone in this commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Florian Müllner
d16ddc42ce x11: Remove icon cache
We stopped reading window icons, so there's nothing to cache
anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3452>
2023-12-15 14:14:33 +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
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