1
0
Fork 0
Commit graph

9583 commits

Author SHA1 Message Date
Jonas Ådahl
2b59b85d85 wayland: Fetch wl_output logical monitor via helper
Will be useful when wl_output gets tied to a MetaMonitor, instead of a
MetaLogicalMonitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
2021-08-22 16:40:42 +00:00
Jonas Ådahl
99531f9d4b wayland/surface: Get wl_output resource list via helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
2021-08-22 16:40:42 +00:00
Ivan Molodetskikh
f6bf1ceb92 cursor-tracker: Add meta_cursor_tracker_get_scale ()
Used in the screenshot UI (and arguably should be used in the existing
gnome-shell screenshot drawing code).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1967>
2021-08-22 15:02:38 +00:00
Alexander Mikhaylenko
ed391eb06b window: Make default focus window on each workspace appear focused
Makes workspace transitions in gnome-shell look more seamless, since
both outgoing and incoming workspace have focused windows.

This is only done for click focus mode, since it's not known which
window would be focused for the other modes.

Track the state and recompute it when it changes, to avoid redrawing
the windows needlessly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/850>
2021-08-12 21:41:40 +05:00
Alexander Mikhaylenko
7afefbbb61 workspace: Add meta_workspace_get_default_focus_window()
Each workspace has a window that will be focused when switching to that
workspace. Add a function to retrieve that window.

This is only relevant for click-to-focus focus mode, since with the two
other modes no window will be focused upon switching, and will only gain
focus when hovered.

This will be used in the next commit to make this window appear focused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/850>
2021-08-12 21:39:05 +05:00
Alexander Mikhaylenko
448ffaefc5 stack: Check workspace in get_default_focus_window()
Check against the window argument, instead of active workspace.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/850>
2021-08-12 21:39:05 +05:00
Jonas Ådahl
26e06845e3 plugins/default: Switch to g_spawn_check_wait_status()
The old one is deprecated and equivalent.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1941>
2021-08-12 13:11:31 +00:00
Jonas Ådahl
23bebf3385 xwayland-grab-keyboard: Switch to g_pattern_spec_match_string()
The g_pattern_match_string() variant is deprecated, switch to the
properly namespaced one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1941>
2021-08-12 13:11:31 +00:00
Robert Mader
a96caf6def wayland-dma-buf: Fix 'kms-modifiers' experimental setting
The setting was ignored in favor of whatever the backend
returned.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1953>
2021-08-06 10:28:13 +00:00
Robert Mader
287c715df6 shaped-texture: Do not apply y-inverts to shape masks
This was introduced by accident in commit 1467b6b02a

y-inverted textures in combination with shape masks appear to
be only commonly used with EGLstreams. However, as we draw the
shape mask ourselves, we don't want to apply the y-invert to it
as testified by the left over `cogl_pipeline_set_layer_matrix()`.

Note that we still allow to apply viemports and buffer transforms,
as the Xwayland mode setting emulation may use it (in fact only
the former, but it probably does not hurt to leave the later as well).

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1792

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1937>
2021-08-04 15:08:12 +00:00
Florian Müllner
111055acdd wayland/gtk-shell: Add titlebar_gesture request
This allows client to delegate titlebar gestures to the compositor,
which allows for better consistency with server-side decorations,
and a wider range of actions (including lower-on-middle-click).

The protocol addition is based on a suggestion from Carlos Garnacho
and Jonas Ådahl.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1944>
2021-08-04 14:41:43 +00:00
Florian Müllner
eed1db4379 window: Add meta_window_lower_with_transients()
The only thing x11-specific about the existing code is that it is only
used to implement titlebar actions on server-side decorations.

We are about to bring that functionality to wayland, so move the code
into MetaWayland.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1944>
2021-08-04 14:41:43 +00:00
Marco Trevisan (Treviño)
3baf750e42 monitor-test-utils: Add debug friendly statements during tests
Monitor configuration check tests can be very complex and in case of
failures we can't easily catch where a failure happened without entering
in debug mode, something that isn't always an option in CI or external
builders.

So add more debug statements in configuration check functions and use
macros to ensure that we print the caller function and location on more
complex check functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
37e154c832 monitor-config-manager: Use match rule to check laptop panel visibility
Use the MONITOR_MATCH_VISIBLE match rule instead of doing the same check when
initializing the list of disabled monitor specs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
e59da5ad83 monitor-conifig-manager: Generate primary monitor config with others
Primary monitor is just the same of the other monitors, but it has a
primary monitor flag. Since the computation of the scaling isn't
dependent anymore on the computed configuration we can now generate the
primary monitor config together with the others.

However, we've to ensure that the primary monitor is the first of the
configs list in order to properly compute the positioning.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
e8b84441a4 monitor-config-manager: Computer monitor scale in caller
Compute the monitor scaling in a separated function using the primary
monitor (not its config) and pass it to the creation function instead.

This will allow removing the special logic for the primary monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
aeea2882e5 monitor-config-manager: Use monitor match filters to create config
Factorize the creation of a configuration inside one function that looks for
the primary monitor and the other monitors using the matching rules and
dispose them according to the chosen policy (checking if the result is valid
when using the suggested positioning).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
3dbec4d709 monitor-config-manager: Define cleanup functions for structs
Monitor configuration structures can be used inside containers such as GList
and in order to have smart cleanups we need to define the relative free function

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
4574f2d9af monitor-config-manager: Use single filter function to build configs
Add a find_monitors function that allows to search for monitors that match
the MonitorMatchRule filter and use this to look for the primary monitor and
the other monitors that need to match the requested filter in order to be
configured.

Having just one function doing this kind of checks reduces the possibility
of unexpected results.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
32d7c5fbfb monitor: Only assign suggested positions to valid pointers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
ab48b6b933 monitor-unit-tests: Check suggested configuration has adjacent outputs
Verify that the suggested monitor configuration contains only adjacent monitors,
and that if this is not the case we fallback to the linear configuration.

This can happen in case of multi-DPI setup, so add a test checking this too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
be9e6dcc4f monitor-config-manager: Reject a suggested config with gaps
It could happen that monitors suggest to use coordinates that don't take
in consideration the scaling applied to one monitor, and such the
generated configuration is not valid because not all the monitors are
adjacent.

So enforce this check before accepting a suggested configuration as it
is.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
58c2f423f7 boxes: Add function to check if rectangle is adjacent to region
We may need to check if rectangles region has adjacent neighbors and
so if there are no gaps in between monitors.

This can be done by checking if each monitor is adjacent to any other in
the same region.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Marco Trevisan (Treviño)
d3602e9fef monitor-unit-tests: Add test for overlapping monitor config
Verify that when we've monitors with overlapping preferred configuration, we
fallback to the default linear configuration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
2021-08-04 14:02:16 +00:00
Carlos Garnacho
36299494dd x11: Add COGL_HAS_TRACING checks around tracing code
This code sneaked unconditionally, even though we can disable
tracing code with -Dprofiler=false. Add some COGL_HAS_TRACING
checks so that this code is also optionally built.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1951>
2021-08-02 17:15:33 +02:00
Carlos Garnacho
a42c470efd compositor: Add COGL_HAS_TRACING checks around tracing code
This code sneaked unconditionally, even though we can disable
tracing code with -Dprofiler=false. Add some COGL_HAS_TRACING
checks so that this code is also optionally built.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1951>
2021-08-02 17:15:23 +02:00
Jonas Ådahl
ffb88bffc5 x11/window: Add tracing for X11 synchronization events
Add tracing and data gathering for processing related to
_NET_WM_FRAME_DRAWN and _NET_WM_FRAME_TIMINGS, used by some X11 clients
for synchronized rendering.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
2021-07-29 15:37:12 +02:00
Jonas Ådahl
d956f63d67 x11/events: Trace X11 event handling
Traces the type of event, and how much time was spent processing it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
2021-07-29 15:16:48 +02:00
Jonas Ådahl
6c7765439f x11/events: Fly-by coding style cleanup
A large else block didn't have {}, so added them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
2021-07-29 15:16:48 +02:00
Jonas Ådahl
72704f787c x11/events: Clean up event name getting
Preparation for adding a generic "get event name" getter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1700>
2021-07-29 15:16:48 +02:00
Pascal Nowack
537e2dfafe core/selection: Cancel selection transfer requests after a timeout
When a selection owner advertises a mime type, but does not provide the
content upon a request for the mime type content, the requesting side
might wait indefinitely on the content.
To avoid this situation, add a timeout source, which will cancel the
selection transfer request after a certain timeout (15 seconds) passed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1874>
2021-07-28 15:26:04 +00:00
Pascal Nowack
20db6af4e6 remote-desktop: Check pipe fd before assuming existing read() operation
Currently, if g-r-d closes the read end of the pipe for a
SelectionRead() operation, due to realizing that the application, that
should provide the mime type content, does not provide any content,
mutter won't notice that and still assumes that the read() operation
on the pipe in g-r-d is still happening, as mutter never writes to the
pipe in that situation and therefore cannot realize that the pipe is
already closed.
The effect of this is, that if g-r-d aborts a read() operation and
requests a new read() operation via SelectionRead(), mutter will deny
the request since it assumes that the previous read() operation is
still ongoing.

Fix this behaviour by also checking the pipe fd in mutter before
denying a SelectionRead() request.

https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/issues/60

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1874>
2021-07-28 15:26:04 +00:00
Daniel van Vugt
9e6a3f537b background-content: Shrink and optimize the rounded-clip shader
The main benefit being it now fits within the hardware limits for the
i915 Mesa driver, and runs on the GPU instead of software fallback.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4251,
       https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4425

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1860>
2021-07-26 16:17:46 +08:00
Marco Trevisan (Treviño)
3e1e2cb91f monitor: Do not overlap when checking for applicable scaling values
With some resolutions (such as 4096x2160) we may compute duplicated
scale factors because we used a too wide threshold to check for an
applicable value.

In fact, while when we're at the first and last values it's fine to
search applicable values up to SCALE_FACTORS_STEP, on intermediate ones
we should stop in the middle of it, or we're end up overlapping the
previous scaling value domain.

In the said example in fact we were returning 2.666667 both when
looking to a scaling value close to 2.75 and 3.00 as the upper bound of
2.75 (3.0) was overlapping with the lower bound of 3.0 (2.75).
With the current code, the lower and upper bounds will be instead 2.875.

Adapt test to this, and this allows to also ensure that we're always
returning a sorted and unique list of scales (which is useful as also
g-c-c can ensure that this is true).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
2021-07-22 16:19:15 +02:00
Marco Trevisan (Treviño)
c86a1e00c0 monitor-unit-tests: Check integer scaling values are matching expectations
A per previous commit we can now ensure that all the scaling values
when using non-fractional scaling have the value we expect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
2021-07-22 16:06:10 +02:00
Marco Trevisan (Treviño)
98f3f96978 monitor: Never return fractional scale values when NO_FRAC is used
We introduced META_MONITOR_SCALES_CONSTRAINT_NO_FRAC to get global scale
values however, this didn't work properly for some resolutions.

In fact it may happen that for some resolutions (such as 3200x1800) that
we did not compute some odd scaling levels (such as 3.0) but instead
its closest fractional value that allowed to get an integer resolution
(2.98507452 in this case).

Now this is something relevant when using fractional scaling because we
want to ensure that the returned value, when multiplied to the scaled
sizes, will produce an integer resolution, but it's not in global scale
mode where we don't use a scaled framebuffer.

So, take a short path when using no fractional mode and just return all
the applicable values without waste iterations on fractional values.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
2021-07-22 16:06:08 +02:00
Marco Trevisan (Treviño)
f6e2059a65 monitor: Replace some useless goto with clearer returns
There was no point to use goto in place of normal returns here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
2021-07-22 15:54:03 +02:00
Marco Trevisan (Treviño)
b088dbd90b monitor-unit-tests: Add tests to verify the computed scaling values
Scaling values computation code served us well in the past years but
it's quite delicate and it has some issues in edge cases, so add a test
that verifies that the computed scaling values for all the most common
resolutions (and some that may be common in future) are what we expect
to be.

This may also serve us in future when we'd define a better algorithm to
compute the preferred scale, but this not the day.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
2021-07-22 15:50:44 +02:00
Marco Trevisan (Treviño)
4ca5a97ea8 monitor-manager: Only derive global scales supported by all monitors
When deriving the global scale from current monitor, we were just checking the
supported value by the primary monitor, without considering weather the current
scale was supported by other monitors.

Resolve this by checking if the picked global scale is valid for all active
monitors, and if it's not the case, use a fallback strategy by just picking the
maximum scale level supported by every head.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/407

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/336>
2021-07-22 15:38:04 +02:00
Marco Trevisan (Treviño)
1ab79c79a5 monitor-manager: Derive configured global scale using common value
When deriving the global scale from config, we need to ensure that the value
is matching all the monitor configurations.

If not, we should fallback to the normal scale value.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/407

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/336>
2021-07-22 15:38:04 +02:00
Marco Trevisan (Treviño)
7c87c1c24f monitor-manager: Check if all monitor scales are matching in global mode
When global scaling is set we need to ensure that all the requested scale
configurations are matching, otherwise we'd end up in a mixed setup that
we don't support in this scenario.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/407

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/336>
2021-07-22 15:38:04 +02:00
Marco Trevisan (Treviño)
1ac63fcd77 monitor-manager-xrandr: Use monitor to calculate scaling
In Xrandr we were caching the available scaling modes that were computed just
for the current mode, for each monitor, while we can actually reuse the
default implementation, by just passing the proper scaling constraint.

In monitor we need then to properly filter these values, by only accepting
integer scaling factors that would allow to have a minimal logical monitor
size.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/407

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/336>
2021-07-22 15:38:02 +02:00
Marco Trevisan (Treviño)
67eb60c19a monitor-manager: Pass the Logical mode when computing the monitor scale
In order to compute proper default scaling value we need to know if the
fractional scaling is enabled or not and thus if we're using a logical
mode or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/336>
2021-07-22 13:14:01 +02:00
Florian Müllner
ff14ed5ad9 compositor: Update outdated URL
The file was moved a while ago. Update the link to the new location,
and specify a particular tag instead of master to make sure this
doesn't happen again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1930>
2021-07-18 23:14:16 +02:00
Carlos Garnacho
414302fa82 backends: Promote g_debug() MetaStageImpl message to meta_topic()
We now have a META_DEBUG_BACKEND topic that can suit this bag of
assorted debug messages. Assign it to these, instead of plain
G_MESSAGES_DEBUG=mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1862>
2021-07-16 19:12:01 +02:00
Carlos Garnacho
dc6d3cead2 backends: Shuffle ClutterBackendX11 code into MetaClutterBackendX11
We have a Clutter implementation of the X11, just to subclass it in
our backends. Move the implementation entirely to src/backends/x11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1862>
2021-07-16 19:08:06 +02:00
Carlos Garnacho
e77e88894b backends: Excise MetaStageView to its own file
It was implemented together with MetaStageImpl, move it to a separate
file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1862>
2021-07-16 19:08:06 +02:00
Carlos Garnacho
d5c3c80dfe backends: Rename ClutterStage[View]Cogl API and types
Rename to MetaStageImpl and MetaStageView, so they are in line with
the rest of the backend code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1862>
2021-07-16 19:08:06 +02:00
Carlos Garnacho
8f839b2f9c clutter: Move ClutterStageCogl[View] code to src/backends
This is now MetaStageImpl in backend code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1862>
2021-07-16 19:08:06 +02:00
Carlos Garnacho
0ac257212e core: Add private utility function to get Clutter debug flags
This will be used to fetch the debug flags from backend code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1862>
2021-07-16 19:08:06 +02:00