1
0
Fork 0
Commit graph

8624 commits

Author SHA1 Message Date
Jonas Ådahl
1de436684c clutter: Include clutter-frame-clock.h from clutter.h
So that it can be used by libmutter and gnome-shell.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
847e89d31f clutter/frame-clock: Handle reschedule then dispatch results in idle
A frame clock dispatch doesn't necessarily result in a frame drawn,
meaning we'll end up in the idle state. However, it may be the case that
something still requires another frame, and will in that case have
requested one to be scheduled. In order to not dead lock, try to
reschedule directly if requested after dispatching, if we ended up in
the idle state.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:51 +02:00
Jonas Ådahl
c00a8e98a3 clutter/cogl: Take over global frame count responsibility
The native backend had a plain counter, and the X11 backend used the
CoglOnscreen of the screen; change it into a plain counter in
ClutterStageCogl. This also moves the global frame count setting to the
frame info constuctor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
2a6e8bda8d cogl/onscreen: Let swap buffer caller create frame info
We currently have mutter set a global frame counter on the frame info in
the native backend, but in order to do this from clutter, change the
frame info construction from being implicitly done so when swapping
buffers to having the caller create the frame info and passing that to
the swap buffers call.

While this commit doesn't introduce any other changes than the API, the
intention is later to have the caller be able to pass it's own state
(e.g. the global frame count) along with the frame info.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
ff65c95aee frame-clock: Pass frame info when notifying presented
Instead of just the timestamp, pass the frame info struct we already,
that also include refresh rate.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
f086eafe57 Gather all time unit conversion helpers in one place
We had time unit conversion helpers (e.g. us2ms(), ns2us(), etc) in
multiple places. Clean that up by moving them all to a common file. That
file is clutter-private.h, as it's accessible by both from clutter/ and
src/.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
bb73038a27 clutter/stage-view: Give a stage view a refresh rate
Currently unused, but it's intention is to use as a initial refresh rate
for a with the stage view associated frame clock. It defaults to 60 Hz
if nothing sets it, but the native backend sets it to the associated
CRTCs current mode's refresh rate.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
2b95ec40c6 clutter/timeline: Deprecate timelines without an actor or frame clock
Without an associated actor, or explicit frame clock set, in the future
a timeline will not know how to progress, as there will be no singe
frame clock to assume is the main one. Thus, deprecate the construction
of timelines without either an actor or frame clock set.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
fc0b8f9d9c laters: Use clutter_stage_schedule_update() instead of timeline
The MetaLater functionality needs to make sure an update is scheduled so
that it can run its callbacks etc. This used a ClutterTimeline (which is
an object more or less meant to drive animations markers, frames etc)
just to keep the master frame clock running. We're moving away from a
single master clock, so just schedule updates directly instead, with the
newly exposed API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
b9a52ecfdf screen-cast: Only check queued-redraw on the relevant views
We'd check if there was any queued redraw on the stage, but this is
inappropriate for two reasons:

1) A monitor and area screen cast source only cares about damage on a
   subset of the stage.
2) The global pending-redraw is going away when paint scheduling will be
   more view centric.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
feb444402e renderer: Add API to get a view list for a monitor
Where renderer views correspond to CRTCs, this will result in a list of
those views; otherwise (i.e. X11 CM), it'll result in a list containing
the global view.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
9ed463b488 renderer-view: Keep track of what CRTC it is associated with
For the nested and native backend, it'll point to the CRTC it was
created for. On the X11 CM backend, it'll be NULL, as there is only a
single global stage view.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
59eebd6f6d clutter/stage-view: Pass a pointer to the stage during constuction
This is so that stage views can interact with the stage they are views
of.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
ca82cde6dd tests/frame-clock: Add test that switches frame clock mid timeline
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
a0d87662f7 tests/clutter: Add frame clock timeline test case
Tests basic functionality such as that timelines are advanced after
having added themself to frame clock.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
3c4efd13c1 frame-clock: Pass timestamp to frame callback
The timestamp comes from the GSource, meaning it's a more accurate
representation of when the frame started to be dispatched compared to
getting the current time in any callback.

Currently unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
a132c8dc8e frame-clock: Add API to inhibit/uninhibit updates
Equivalent to pause/resume, but ref counted.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
cae5b99537 frame-clock: Add callback before the actual frame callback
Aimed to have the frame listener do things like processing events before
the actual frame. In between the before-frame and actual frame,
timelines will be advanced.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
b18d4fc346 tests/frame-clock: Add schedule-update-now test
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
8f96885af8 tests/frame-clock: Check that no damage doesn't ever dispatch
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
51ee41ee43 tests/frame-clock: Test delayed schedule update
Check that the frame clock doesn't dispatch any updates early until
there is any scheduling.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
e743b36cfc clutter/frame-clock: Handle immediate present feedback
In certain scenarios, the frame clock needs to handle present feedback
long before the assumed presentation time happens. To avoid scheduling
the next frame to soon, avoid scheduling one if we were presented half a
frame interval within the last expected presentation time.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
96a108ed4e clutter: Add a simple frame clock base
This adds a current unused, apart from tests, frame clock. It just
reschedules given a refresh rate, based on presentation time feedback.

The aiming for it is to be used with a single frame listener (stage
views) that will notify when a frame is presented. It does not aim to
handle multiple frame listeners, instead, it's assumed that different
frame listeners will use their own frame clocks.

Also add a test that verifies that the basic functionality works.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
2020-07-02 19:36:50 +02:00
Jonas Ådahl
da633dcc52 clutter/actor: Allocate with the same box if deferred due to transition
When a transition is created for the allocation change, it will delay
the new allocation box getting set depending on transition details.
This, however, means that e.g. the 'needs_allocation' flag never gets
cleared if a transition is created, causing other parts of the code to
get confused thinking it didn't pass through a layout step before paint.

Fix this by calling clutter_actor_allocate_internal() with the current
allocation box if a transition was created, so that we'll properly clear
'needs_allocation' flag.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1345
2020-07-02 17:35:41 +02:00
Robert Mader
86646679f1 surface-actor: Add culling offset for geometry scale - take 2
41130b08eb added a fix for culling subsurfaces with geometry scale.
Unfortunately it only did so for the opaque regions, not for clip and
unobscured regions, as the effect was hidden by bug that was only
fixed by 3187fe8ebc.

Apply the same fix to clip and unobscured regions and use the chance
to move most of the slightly hackish geometry scale related code
into a single place.

We need to scale slightly differently in the two cases, indicated by
the new `ScalePerspectiveType` enum, as the scale is dependent on the
perspective - once from outside, once from inside of the scaled actor.

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1312
2020-06-30 20:57:57 +02:00
Jonas Dreßler
98df2dbd05 clutter/actor: Always return a resource scale in get_resource_scale()
Since we now always return a resource scale, we can remove the boolean
return value from clutter_actor_get_resource_scale() and
_clutter_actor_get_real_resource_scale(), and instead simply return the
scale.

While at it, also remove the underscore from the
_clutter_actor_get_real_resource_scale() private API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1276
2020-06-30 13:15:53 +00:00
Jonas Dreßler
802b24a640 clutter/backend: Introduce a fallback scale set to primary monitor scale
Add private API to ClutterBackend to set a fallback resource scale
available to Clutter. This API will be used for "guessing" the
resource-scale of ClutterActors in case the actor is not attached to a
stage or not properly positioned yet.

We set this value from inside mutters MetaRenderer while creating new
stage-views for each logical monitor. This makes it possible to set the
fallback scale to the scale of the primary monitor, which is the monitor
where most ClutterActors are going to be positioned.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1276
2020-06-30 13:15:53 +00:00
Daniel van Vugt
9823a0f6c9 background-content: Fix an x/y mixup
Fortunately the coordinate is local and always (0,0) so it didn't
break anything.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1341
2020-06-30 18:37:35 +08:00
Olivier Fourdan
b8524504f4 remote-desktop: Check for screencast only when required
The portal API requires a screencast session only for absolution motion
with remote desktop, other methods including relative motion do not
require a screencast session.

There is no reason to be more strict than the API actually is, check for
a screencast session only when required, like for absolute motion events
and touch events.

Tested with https://gitlab.gnome.org/snippets/1122

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1307
2020-06-29 16:41:51 +00:00
Florian Müllner
c1933cfd09 workspace: Add :active convenience property
There are a couple of places in gnome-shell where we aren't interested
in which workspace is active, but whether a given workspace is active.

Of course it's easy to use the former to determine the latter, but we
can offer a convenience property on the workspace itself almost for
free, so let's do that.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1336
2020-06-29 14:07:20 +00:00
Robert Mader
1142f06af5 shaped-texture: Clean up set_opaque_region()
Make the code more consistent with similar functions elsewhere
and save a few cycles by removing the type check.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1334
2020-06-29 12:58:10 +02:00
Robert Mader
bb4e87bf35 shaped-texture: Make set_opaque_region() private
The shell doesn't use it and I couldn't find any extensions that does
and it probably doesn't make much sense any more these days anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1334
2020-06-29 12:57:55 +02:00
Georges Basile Stavracas Neto
88141f1483 tests: Rename actor-anchors to actor-pivot-point
The test only covers the pivot point now, rename to reflect this.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
7146a6dddb clutter/actor: Remove anchor points and gravity
Drop the bomb.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
031098a43d tests: Drop anchor-related parts of the actor-anchors test
The pivot-point parts of the test are still useful, so don't completely
remove the test, only the deprecated parts of it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
dc4cb562b7 clutter/actor: Remove rotation center
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
2e086c74e7 Drop ClutterRectangle
And the correcponding CallyRectangle class.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
e884ba7f39 tests: Replace ClutterRectangle with ClutterActor
These tests were written (and copy-pasted) before ClutterActor
had an actual background-color property. As a preparation to
the removal of ClutterRectangle, replace all these rectangles
with plain actors and background colors.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
2802d359e5 Drop ClutterBox
Nobody was subclassing or using it, except for the tests. Replace
it by ClutterActor in the tests.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
d4993c4b22 clutter/stage: Remove all deprecated functions
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
ae49f89cf3 clutter/stage: Remove color property
The property is deprecated and the current implementation simply
redirects it to ClutterActor::background-color, so remove it.

Also update the tests to set the background color directly.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
ce3e293a18 clutter: Drop ClutterGroup
It is now unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:46 +00:00
Georges Basile Stavracas Neto
d4953c77c3 clutter/actor: Remove clutter_actor_show_all
Actors are visible by default these days, and this function
is deprecated for a long time.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:45 +00:00
Georges Basile Stavracas Neto
237f277641 clutter/actor: Remove clutter_actor_unparent
Pretty much the same set of changes of the previous commit, but
for clutter_actor_unparent().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:45 +00:00
Georges Basile Stavracas Neto
59e454f01e clutter/actor: Remove clutter_actor_set_parent
Replace it by clutter_actor_add_child(), and update ClutterGroup
to not emit the 'actor-added' anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:45 +00:00
Georges Basile Stavracas Neto
387a13f0ab clutter/actor: Drop depth property and functions
It is deprecated in favor of the 'z-position' property, and
the implementation itself redirects to the z-position, so
just drop it and replace all get|set_depth calls to their
z-position counterparts.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
2020-06-27 13:35:45 +00:00
Daniel van Vugt
e5542c3210 shaped-texture: Use the REPLACE combine function on opaque areas
We were setting the pipeline colour to all white (1.0, 1.0, 1.0, 1.0)
and so the default layer combine function multiplied each pixel
(R, G, B, A) by all ones. Obviously multiplying by one four times per
pixel is a waste of effort so we remove the colour setting *and* set
the layer combine function to a trivial shader that will ignore whatever
the current pipeline colour is set to. So now we do **zero** multiplies
per pixel.

On an i7-7700 at UHD 3840x2160 this results in 5% faster render times
and 10% lower power usage (says intel_gpu_top). The benefit is probably
much higher for virtual machines though, as they're no longer being
asked to do CPU-based math on every pixel of a window.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1331
2020-06-27 10:20:11 +00:00
Sebastian Keller
d85c3c1e94 tests/stacking: Add test for when no default focus window can be found
The previous commit removed checks for intermediate focus states which
would make tests randomly fail, because of their time dependence. What
can be tested however is that if there is no other window available that
would accept the focus, that the focus remains at 'none', after the
focused window has been closed. This newly introduced test checks the
focus directly after closing the window (and syncing) and after the time
it would have taken for the queue to finish. The first check has a
similar timing issue as the removed focus checks in the other tests, but
the test will never accidentally fail, because regardless of whether the
queue has finished or not, the focus is always expected to be 'none'.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1329
2020-06-26 21:00:12 +00:00
Sebastian Keller
d830d985c1 tests/stacking: Don't test for time-dependent intermediate focus state
While c3d13203 ensured that the test-client has actually closed the
window before testing for the focus change, it also made another timing
related issue with the tests more likely to happen. Serveral tests
assert that the focus is set to 'none' after the focussed window has
been closed when the window below does not accept focus. This however
can never be reliably tested, because closing the window triggers
timeout based iteration of a queue of default focus candidate windows.
This starts after the window has been closed and might finish before the
clients have finished synchronizing. This issue is more likely to
trigger the shorter the queue is and the more test clients there are
that could delay the synchronization.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1329
2020-06-26 21:00:12 +00:00
Jonas Ådahl
4c0aa2afca wayland/xdg-shell: Don't use xdg_surface private to get window geometry
We already used the actual API in the same function, move that call a
bit higher up to and use the variable in more places.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1295
2020-06-26 07:47:41 +00:00
Jonas Ådahl
d6af59612c wayland/shell: Apply geometry after subsurface state application
The subsurface state may affect the geometry end result, e.g. when
window decoration enlarging the toplevel window are applied. If we don't
wait with calculating the window geometry, intersecting the set region
with the subsurface tree extents will not include the subsurfaces.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1295
2020-06-26 07:47:40 +00:00
Jonas Ådahl
be59b514ca wayland: Remove a couple of stray newlines
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1295
2020-06-26 07:47:40 +00:00
Michel Dänzer
2e5b767c01 gpu/kms: Turn off CRTCs as well for DPMS
This avoids some issues which could happen on some setups[0] due to
meta-native-renderer.c:dummy_power_save_page_flip →
meta_onscreen_native_swap_drm_fb implicitly turning of the primary
plane (by destroying the KMS framebuffer assigned to it):

* drmModeObjectSetProperty could return an "Invalid argument" error
  between setting a non-empty cursor with drmModeSetCursor(2) and
  enabling the primary plane again:

  Failed to DPMS: Failed to set connector 69 property 2: Invalid argument

  (This was harmless other than the error message, as we always re-set
  a mode on the CRTC after setting the DPMS property to on, which
  enables the primary plane and implicitly sets the DRM property to on)

* drmModeSetCursor(2) could return an "Invalid argument" error between
  setting the DPMS property to on and enabling the primary plane again:

  Failed to set hardware cursor (drmModeSetCursor failed: Invalid argument), using OpenGL from now on

[0] E.g. with the amdgpu DC display code.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1240
2020-06-23 12:04:14 +02:00
Robert Mader
3187fe8ebc shaped-texture: Reintroduce clip_region
In commit 4c1fde9d MetaCullable related code was moved out of
MetaShapedTexture into MetaSurfaceActor. While generally desirable,
this removed drawing optimizations in MetaShapedTexture for partial
redraws. The common case for fully obscured actors was still supposed
to work, but it was now discovered that it actually did not.

This commit revert parts of 4c1fde9d: it reintroduces clipping
to MetaShapedTexture but leaves all culling and actor related logic
in MetaSurfaceActor.

Thanks to Daniel van Vugt for uncovering the issue.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/850
Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1295

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1326
2020-06-22 17:56:01 +02:00
Sebastian Keller
f5c8e0d96d window/x11: Don't stop early when trying to find default focus window
When trying to find a default focus window, the code iterates through a
queue of candidates with a timeout between each candidate. If the window
the current timeout is waiting for gets destroyed, this process just
stops instead of trying the next window in the queue.

This issue was made more likely to be triggered with the previous change
to the closed-transient-no-input-parents-queued-default-focus-destroyed
test due to the introduction of a wait, which can introduce a
delay between the two destroy commands.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1325
2020-06-22 17:12:49 +02:00
Sebastian Keller
c3d1320343 tests/stacking: Avoid random failures in focus tests
Some tests were not waiting for the test client to actually issue
destroy commands before checking their effect on the window focus.

Similarly when mutter is supposed to change the focus based on a delay
by sending a WM_TAKE_FOCUS to the client, this also could fail without
synchronization with the client before checking the result.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1325
2020-06-21 05:00:03 +02:00
Adam Jackson
d133f94f8f cogl: Introduce and use cogl_context_is_hardware_accelerated
We delegate the answer through CoglDriverVtable::is_hardware_accelerated
since this is properly a property of the renderer, and not something the
cogl core should know about. The answer given for the nop driver is
admittedly arbitrary, yes it's infinitely fast but no there's not any
"hardware" making it so.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
2020-06-18 13:55:14 -04:00
Carlos Garnacho
79050004b0 wayland: Avoid popup grab focus changes if there's an implicit grab
Event delivery with grabbing popups stay essentially the same within
the grabbing client, we still must honor the implicit grab as long as
there is one.

This is however not the case, the popup_grab_focus() function ignores
the button state. The popup_grab_button() function will already indirectly
re-sync the focus surface after the last button is released, so checking
for button state in popup_grab_focus() is sufficient to make the implicit
grab honored with popup grabs involved.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1275

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1270
2020-06-17 13:47:38 +00:00
Jonas Ådahl
e5ea8f5483 stage/x11: Check that message is WM_PROTOCOLS before assuming so
When a touch sequence was rejected, we'd update the event timestamps of
incoming touch events to help with implementing grabs. This was done by
sending a ClientMessage with a counter, and comparing the counter to
decide whether we're seing a replayed event or not.

This had the unforseen consequence that we would potentially end up
destroying all actors including the stage, since, when mutter receives a
ClientMessage event, it would assume that it's a WM_PROTOCOLS event, and
handle it as such. The problem with this approach is that it would
ignore fact that there might be other ClientMessage types sent to it,
for example the touch synchronization one. What could happen is that the
touch count value would match up with the value of the WM_DELETE_WINDOW
atom, clutter would treat this as WM_PROTOCOLS:WM_DELETE_WINDOW, which
it'd translate to clutter_actor_destroy(stage).

Destroying the stage in such a way is not expected, and caused wierd
crashes in different places depending on what was going on.

This commit make sure we only treat WM_PROTOCOLS client messages as
WM_PROTOCOLS client messages effectively avoiding the issue.

This fixes crashes such as:

 #0  meta_window_get_buffer_rect (window=0x0, rect=rect@entry=0x7ffd7fc62e40) at core/window.c:4396
 #1  0x00007f1e2634837f in get_top_visible_window_actor (compositor=0x297d700, compositor=0x297d700) at compositor/compositor.c:1059
 #2  meta_compositor_sync_stack (compositor=0x297d700, stack=<optimized out>, stack@entry=0x26e3140) at compositor/compositor.c:1176
 #3  0x00007f1e263757ac in meta_stack_tracker_sync_stack (tracker=0x297dbc0) at core/stack-tracker.c:871
 #4  0x00007f1e26375899 in stack_tracker_sync_stack_later (data=<optimized out>) at core/stack-tracker.c:881
 #5  0x00007f1e26376914 in run_repaint_laters (laters_list=0x7f1e2663b7d8 <laters+24>) at core/util.c:809
 #6  run_all_repaint_laters (data=<optimized out>) at core/util.c:826
 #7  0x00007f1e26b18325 in _clutter_run_repaint_functions (flags=flags@entry=CLUTTER_REPAINT_FLAGS_PRE_PAINT) at clutter-main.c:3448
 #8  0x00007f1e26b18fc5 in master_clock_update_stages (master_clock=0x32d6a80, stages=0x4e5a740) at clutter-master-clock-default.c:437
 #9  clutter_clock_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at clutter-master-clock-default.c:567
 #10 0x00007f1e27e48049 in g_main_dispatch (context=0x225b8d0) at gmain.c:3175
 #11 g_main_context_dispatch (context=context@entry=0x225b8d0) at gmain.c:3828
 #12 0x00007f1e27e483a8 in g_main_context_iterate (context=0x225b8d0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3901
 #13 0x00007f1e27e4867a in g_main_loop_run (loop=0x24e29f0) at gmain.c:4097
 #14 0x00007f1e2636a3dc in meta_run () at core/main.c:666
 #15 0x000000000040219c in main (argc=1, argv=0x7ffd7fc63238) at ../src/main.c:534

and

 #0  0x00007f93943c1f25 in raise () at /usr/lib/libc.so.6
 #1  0x00007f93943ab897 in abort () at /usr/lib/libc.so.6
 #2  0x00007f9393e1e062 in g_assertion_message (domain=<optimized out>, file=<optimized out>, line=<optimized out>, func=0x7f93933e6860 <__func__.116322> "meta_x11_get_stage_window",
 #3  0x00007f9393e4ab1d in g_assertion_message_expr ()
 #4  0x00007f939338ecd7 in meta_x11_get_stage_window (stage=<optimized out>) at ../mutter/src/backends/x11/meta-stage-x11.c:923
 #5  0x00007f939339e599 in meta_backend_x11_cm_translate_device_event (x11=<optimized out>, device_event=0x55bc8bcfd6b0) at ../mutter/src/backends/x11/cm/meta-backend-x11-cm.c:381
 #6  0x00007f939339f2e2 in meta_backend_x11_translate_device_event (device_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:179
 #7  0x00007f939339f2e2 in translate_device_event (device_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:208
 #8  0x00007f939339f2e2 in maybe_spoof_event_as_stage_event (input_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:284
 #9  0x00007f939339f2e2 in handle_input_event (event=0x7fff62d60490, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:309
 #10 0x00007f939339f2e2 in handle_host_xevent (event=0x7fff62d60490, backend=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:413
 #11 0x00007f939339f2e2 in x_event_source_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at ../mutter/src/backends/x11/meta-backend-x11.c:467
 #12 0x00007f9393e6c39e in g_main_dispatch (context=0x55bc89dd03e0) at ../glib/glib/gmain.c:3179
 #13 0x00007f9393e6c39e in g_main_context_dispatch (context=context@entry=0x55bc89dd03e0) at ../glib/glib/gmain.c:3844
 #14 0x00007f9393e6e1b1 in g_main_context_iterate (context=0x55bc89dd03e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:3917
 #15 0x00007f9393e6f0c3 in g_main_loop_run (loop=0x55bc8a042640) at ../glib/glib/gmain.c:4111
 #16 0x00007f9393369a0c in meta_run () at ../mutter/src/core/main.c:676
 #17 0x000055bc880f2426 in main (argc=<optimized out>, argv=<optimized out>) at ../gnome-shell/src/main.c:552

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/338
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/951

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1317
2020-06-16 13:59:15 +00:00
Jonas Dreßler
7539de2320 clutter/input-device: Make clutter_input_device_get_actor() public
Make the clutter_input_device_get_actor() API public and remove
clutter_input_device_get_pointer_actor() in favour of the new function.

This allows also getting the "pointer" actor for a given touch sequence,
not only for real pointer input devices like mice.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1275
2020-06-16 10:09:26 +00:00
Jonas Dreßler
45c14f74b4 clutter/seat: Add private method to peek list of input devices
Add a method to ClutterSeat that allows peeking the list of input
devices and allow looping through devices a bit faster. The API left is
private so we can make use of peeking the GList internally, but don't
have to expose any details to the outside, which means we'd have to
eventually stick with a GList forever to avoid breaking API.

Since we now have the peek_devices() API internally, we can implement
ClutterSeats public list_devices() API using g_list_copy() on the list
returned by peek_devices().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1275
2020-06-16 10:09:26 +00:00
Corentin Noël
e09ac67698 window-actor-x11: switch the signal callback argument and data on shadow factory change
invalidate_shadow takes the MetaWindowActorX11 as argument and not the MetaShadowFactory.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1314
2020-06-15 13:22:08 +00:00
Jonas Dreßler
e6a93326bf window-actor: Don't freeze actor updates during the size-change effect
As explained in the last commits, we'll let gnome-shell take care of
this since freezing and thawing needs to be decoupled from the effect
starting and ending.

So stop freezing the MetaWindowActor when starting the effect and
thawing the actor when ending the effect.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1250
2020-06-15 13:10:16 +00:00
Jonas Dreßler
fb474fb612 window-actor: Make freezing and thawing of actor updates public API
As explained in the last commit, gnome-shell needs to be able to thaw
window actor updates during its size-change effect is active.

So make meta_window_actor_freeze() and meta_window_actor_thaw() public
API, which will allow the shell to freeze and thaw actor updates itself.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1250
2020-06-15 13:10:16 +00:00
Jonas Dreßler
d12dc993d1 window-actor: Allow syncing actor geometry while effect is running
The size-change animation in gnome-shell needs to sync the window actors
geometry during the animation, it currently does this by notifying the
compositor that the animation was finished before it actually is.

This causes a few bugs in Mutter though, since it will now emit the
"effects-completed" signal on the window actor even though they aren't
completed.

To fix that, we need to decouple freezing and thawing of actor updates
from window effects and allow gnome-shell to thaw actor updates before
it notifies Mutter that the effect is completed.

The first step for this is allowing to sync the actor geometry while an
effect is active, this should be redundant since effects which actually
need to inhibit those updates will freeze the actor anyway. Also a
geometry change happening while another effect is active will kill the
old effect anyway because MetaPluginManager kills all the active window
effects before starting a new one; so the new size-change effect for any
geometry change is going to kill the current effect.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1250
2020-06-15 13:10:16 +00:00
Jonas Ådahl
19b467aa01 crtc-kms: Include MetaCrtc in MetaCrtcKms struct
Otherwise it can't be a GObject inheriting MetaCrtc. This fixes warning
logged as

"invalid uninstantiatable type '(null)' in cast to 'MetaCrtcKms'"

Fixes: 1ce9e379d9

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1308
2020-06-11 11:52:53 +02:00
Jonas Ådahl
e089e53b24 crtc-kms: Make KMS CRTC mode a type inheriting MetaCrtcMode
It carries the drmModeModeInfo copy in it's instance struct, instead of
the `driver_private` it was using before.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287

This version of the commit includes fixes from:

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1305
2020-06-11 09:20:16 +00:00
Daniel van Vugt
bad1a7fd0c backends-x11: Remove g_new0 overwriting g_object_new
The object starts out right, and then gets overwritten with zeroes:

```
  crtc_xrandr = g_object_new (META_TYPE_CRTC_XRANDR,
                              "id", crtc_id,
                              "gpu", gpu,
                              "all-transforms", all_transforms,
                              NULL);

  crtc_xrandr = g_new0 (MetaCrtcXrandr, 1);
```

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1306
2020-06-11 07:53:02 +00:00
Sebastian Keller
51a8193c16 wayland/keyboard: Fix anonymous file leak on repeated keymap changes
keymap_rofile was being overwritten without the old one being free'd on
repeated calls of meta_wayland_keyboard_take_keymap().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1304
2020-06-11 07:23:18 +00:00
Sebastian Keller
94fb82137f backends/native: Fix input device touch hash table leak
It was emptied but never unref'ed in finalize.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1304
2020-06-11 07:23:18 +00:00
Georges Basile Stavracas Neto
49408e8f9f Revert "crtc-kms: Make KMS CRTC mode a type inheriting MetaCrtcMode"
This reverts commit 09078762a, which breaks Mutter.
2020-06-10 23:11:21 -03:00
Jonas Ådahl
09078762ac crtc-kms: Make KMS CRTC mode a type inheriting MetaCrtcMode
It carries the drmModeModeInfo copy in it's instance struct, instead of
the `driver_private` it was using before.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
352c2ec7b8 output-kms: Remove old FIXME
Trying to figure out what this comment was actually about, it turns out
that MSC means Media Stream Counter, and as mentioned in an article[0]
is related to DRI3 and the X11 Present extension. Anyway, the comment
has been there raising questions for some years now, I think we can
remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
4b37c2e446 crtc-mode: Move away fields from public MetaCrtcMode struct
The ID and name are just moved into the instance private, while the rest
is moved to a `MetaCrtcModeInfo` struct which is used during
construction and retrieved via a getter. Opens up the possibility to
add actual sub types.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
980ece9a4b crtc: Move out MetaCrtcMode into its own file
It's somewhat annoying to have two very closely named types in the same
file. It's also about to grow some, so better move it to its own file.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
1ce9e379d9 crtc: Make implementations inherit MetaCrtc
Just as with MetaOutput, instead of the home baked "inheritance" system,
using a gpointer and a GDestroyNotify function to keep the what
effectively is sub type details, make MetaCrtc an abstract derivable
type, and make the implementations inherit it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
4a4f2d8264 output: Make implementations inherit MetaOutput
Instead of the home baked "inheritance" system, using a gpointer and a
GDestroyNotify function to keep the what effectively is sub type
details, make MetaOutput an abstract derivable type, and make the
implementations inherit it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
4920b5064d tests/monitor-unit-tests: Only set suggested_x/y when relevant
It's used for two things: avoid reading configs, and actual hotplug
update mode. The former requires the suggested position to be (-1, -1)
to trick the monitor configuration generator to skip using the suggested
position even if hotplug update mode is set to TRUE. The latter should
use the actual hotplug mode coordinates.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:51 +00:00
Jonas Ådahl
26ddb07066 monitor-manager-dummy: Remove redundant suggested_x/y setting
The `hotplug_update_mode` is set to FALSE, so they should never be
queried.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
574b49ed95 monitor: Check hotplug update mode before getting suggested x/y
Without it being TRUE, the suggested x/y has no meaning.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
6697b0d069 output/xrandr: Fix include guards
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
092c5304a9 crtc: Move MetaCrtcConfig field to instance private
Last piece before MetCrtc can be made a derivable type.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
c3fc6025b1 crtc: Move all_transforms field into instance private
Now set as a property during construction. Only actually set by the
Xrandr backend, as it's the only one currently not supporting all
transforms, which is the default.

While at it, move the 'ALL_TRANFORMS' macro to meta-monitor-tranforms.h.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
1406348be4 output: Move output info to MetaOutputInfo struct
The output info is established during construction and will stay the
same for the lifetime of the MetaOutput object. Moving it out of the
main struct enables us to eventually clean up the MetaOutput type
inheritence to use proper GObject types.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
46e3d20057 tests/monitor-unit-tests: Make hotplug mode part of test setup
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
9bcf1d0238 monitor-manager: Remove useless comment
An old forgotten FIXME. If we actually need better hueristics, we should
probably know why we need that, and open a bug about it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
b69111d8e6 monitor-manager: Rename *Info structs to *Assignment
MetaCrtcInfo and MetaOutputInfo did not represent information about
MetaCrtc and MetaOutput, but the result of the monitor configuration
assignment algorithm, thus rename it to MetaCrtcAssignment and
MetaOutputAssignment.

The purpose for this is to be able to introduce a struct that actually
carries information about the CRTCs and outputs, as retrieved from the
backend implementations.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
f71316c850 output: Move configureable state to instance private
That is is_presentation, is_primary, is_underscanning and backlight.

The first three are set during CRTC assignment as they are only valid
when active. The other is set separately, as it is untied to
monitor configuration.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
9186b6d6b0 monitor-manager: Remove is_dirty from MetaCrtc and MetaOutput
It was used during configuration to ensure that we always dealt with
every output and CRTC. Do this without polluting the MetaOutput and
MetaCrtc structs with intermediate variables not used by the
corresponding types themself.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
55719afcbf output: De-glib:ify some struct field types
Just use int instead of gint.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
e063947a16 output: Move winsys_id into instance private and rename to id
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
a42eed0231 crtc: Move CRTC id field into instance private
Set during construction, retrieved using helper.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
f4fd92d8e8 output: Move MetaGpu field to instance private
Set during construction only, retrieved using helper.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
2ebd43cba9 crtc: Move MetaGpu field to instance-private
Users either set during construction, or get via the helper.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
2724f36527 tests/monitor-unit-tests: Set initial state during backend construction
This way we can construct CRTCs and Outputs and associated them with the
fake GPUs at construction.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:50 +00:00
Jonas Ådahl
569a183828 crtc: Move renderer private to MetaKmsCrtc
It's used only by the native cursor renderer.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
2020-06-10 18:54:49 +00:00
Jonas Ådahl
932340a989 background-content: Shut up warning
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1303
2020-06-10 10:42:18 +02:00
Georges Basile Stavracas Neto
ca0156e9a7 background-content: Render background slices relative to actor box
The current code assumes that the actor will always have the same
size and position of the background texture, but part of the implicit
contract of being a ClutterContent is being able to render itself
at any given actor, at any given size.

For example, if the current code is given an actor with 0x0+100+100
as geometry, and no clipped region, it'll render not the whole
background, but the 0x0+100+100 rectangle of the background. In
practice, the actor geometry acts like a "clip mask" over the
background texture, due to the assumption that the actor will
always have the same size of the monitor.

Make the calculation of the texture slices relative to the actor
box.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1302
2020-06-09 17:07:02 -03:00
Georges Basile Stavracas Neto
6d75b4fc53 background-content: Simplify method call
It's always passing the same pipeline and texture rect, simplify
by passing the MetaBackgroundContent instance itself.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1302
2020-06-09 17:07:02 -03:00
Georges Basile Stavracas Neto
6bd382ad23 background-actor: Use MetaBackgroundContent
MetaBackgroundActor is still necessary for culling purposes,
but now the actual rendering of the background is delegated
to MetaBackgroundContent, as well as the sizing information.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1302
2020-06-09 17:07:02 -03:00
Georges Basile Stavracas Neto
a1b3d1a2a7 Introduce MetaBackgroundContent
MetaBackgroundContent is a ClutterContent implementation
that can render a background to any attached actor. Right
now, it preserves all the properties and the rendering
model of MetaBackgroundActor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1302
2020-06-09 17:07:02 -03:00
Jonas Ådahl
53f61f3778 stack-tracker: Don't log warnings on race conditions
X11 window stacking operations are by nature prone to race conditions.
For example, we might queue a "raise above" operation, but before it
actually takes place, the sibling the window was to be rased above, is
withdrawn.

In these cases we'd log warnings even though they are expected to
happen. Downgrade these warnings to debug messages, only printed when
MUTTER_VERBOSE is set.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1300
2020-06-09 18:46:38 +00:00
Jonas Ådahl
74c0d9140c stack-tracker: Fix coding style of meta_stack_op_apply()
Change tabs to spaces, clean up variable declarations.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1300
2020-06-09 18:46:38 +00:00
Jonas Dreßler
49e983b06e tests: Add a test for ClutterActors stage_views() API
Test that the stage-views list of ClutterActor is correct when moving an
actor, reparenting it, or hiding an actor up the hierarchy. Also test
that the "stage-views-changed" signal works as expected.

Don't test actor transforms for now because those aren't supported yet.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1196
2020-06-09 16:07:46 +00:00
Jonas Dreßler
8127494e52 clutter/stage: Rename update_resource_scales to clear_stage_views
When the stage views the stage is shown on are changed, ClutterStage
currently provides a clutter_stage_update_resource_scales() method
that allows invalidating the resource scales of all actors. With the new
stage-views API that's going to be added to ClutterActor, we also need a
method to invalidate the stage-views lists of actors in case the stage
views are rebuilt and fortunately we can re-use the infrastructure for
invalidating resource scales for that.

So since resource scales depend on the stage views an actor is on,
rename clutter_stage_update_resource_scales() and related methods to
clutter_stage_clear_stage_views(), which also covers resource scales.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1196
2020-06-09 16:07:46 +00:00
Sebastian Keller
99c9f4c1fa wayland/data-device: Don't create and leak unused memory on dnd
"offer" is overwritten with the result of meta_wayland_data_offer_new a
few lines later.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1293
2020-06-08 12:11:11 +00:00
Sebastian Keller
dd32ff018a wayland: Free selection streams streams after transfer
They were only being closed but never freed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1293
2020-06-08 12:11:11 +00:00
Sebastian Keller
019643bad0 core: Free clipboard selection source on shutdown
The clipboard manager is the only code to ever set the display selection
source, so it should also be responsible for unsetting it when the
clipboard manager gets shut down.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1293
2020-06-08 12:11:11 +00:00
Sebastian Keller
a031ac067e core: Fix memory selection source leak after clipboard owner disappears
When an app disappears after some data from it has been copied to the
clipboard, the owner of the clipboard selection becomes a new memory
selection source. The initial reference this new selection source is
never unref'ed, which leads to this being leaked on the next clipboard
selection owner change.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1293
2020-06-08 12:11:11 +00:00
Peter Hutterer
f712387325 compositor: use XDG_CONFIG_HOME as initial lookup path for xkb
Using XDG_CONFIG_HOME allows users to place their keyboard configuration into
their home directory and have them loaded automatically.
libxkbcommon now defaults to XDG_CONFIG_HOME/xkb/ first, see
https://github.com/xkbcommon/libxkbcommon/pull/117

However - libxkbcommon uses secure_getenv() to obtain XDG_CONFIG_HOME and thus
fails to load this for the mutter context which has cap_sys_nice.
We need to manually add that search path as lookup path.

As we can only append paths to libxkbcommon's context, we need to start with
an empty search path set, add our custom path, then append the default search
paths.

The net effect is nil where a user doesn't have XDG_CONFIG_HOME/xkb/.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/936
2020-06-08 11:29:30 +00:00
Jonas Ådahl
1eaf9e5f63 tests/clutter/timeline-interpolate: Maximize error tolerance
Simply to make it less flaky.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1291
2020-06-06 00:27:40 +02:00
Jonas Ådahl
7222bdde57 tests/clutter/timeline: Lower FPS even further
It's still flaky running in CI, lets run it even slower.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1291
2020-06-06 00:27:40 +02:00
Jonas Ådahl
007d27fa40 tests/conform: Use the clutter stage from mutter
The tests created their own stage, which caused various issues. Lets use
the one from mutter instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:27 +00:00
Jonas Ådahl
55302dbb38 cursor-renderer: Pass backend to constructor
Then use the backend passed instead of the global singleton.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:27 +00:00
Jonas Ådahl
7876018755 backends/native: Get clutter backend from backend
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:27 +00:00
Jonas Ådahl
e3c332fa10 backend: Remove unused freeze/thaw functions
They are no longer used, so remove them.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:27 +00:00
Jonas Ådahl
faa831f2f6 backend: Remove cursor renderer construction fallback
All backends have their own cursor renderer constuctors, so remove the
unused fallback.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:27 +00:00
Jonas Ådahl
25f9406e69 compositor: Get the stage via the backend
We would get the MetaDisplay from the backend singleton before creating
the MetaCompositor, then in MetaCompositor, get the backend singleton
again to get the stage. To get rid of the extra singleton fetching, just
pass the backend the MetaCompositor constructors, and fetch the stage
directly from the backend everytime it's needed.

This also makes it available earlier than before, as we didn't set our
instance private stage pointer until the manage() call.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:27 +00:00
Jonas Ådahl
a05dd813da clutter/timeline: Remove clutter_timeline_clone()
It was deprecated long ago, and users should switch to using te regular
constructors.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:26 +00:00
Jonas Ådahl
08b30d6fe2 clutter/timeline: Remove deprecated 'loop' property
It was since long ago replaced by a 'repeat-count' property.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:26 +00:00
Jonas Ådahl
d742f9331c tests/clutter: Port timeline-rewind to current test suite
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:26 +00:00
Jonas Ådahl
420ca31f0b tests/clutter: Port timeline-progress to current test suite
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:26 +00:00
Jonas Ådahl
73da901cd3 tests/clutter: Port timeline-interpolate to current test suite
The error tolerance is increased dramatically to make the test less
flaky when running in CI.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:26 +00:00
Jonas Ådahl
dd16fac0c7 tests/clutter: Port timeline tests to current test suite
Also fix a test that dependends on a specific element order in a list
that wasn't defined to have any particular order.

The frames per second is decreased from 30 to 10, to make the test less
flaky when running in CI.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:26 +00:00
Jonas Ådahl
1b2af2891f tests/clutter/conform: Default to print test logs
To change to the old behavior, pass --quiet. The aim is to be make it
easier to debug issues only reproducing in the CI.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:26 +00:00
Jonas Ådahl
050c21c24f tests/clutter/conform: Don't run tests in parallel
Might end up failing to acquire D-Bus names, resulting in warnings.
Avoid that by not running the tests in parallel.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1289
2020-06-05 21:39:26 +00:00
Jonas Ådahl
7b45de941b tests/test-client: Disable shadow for Wayland client too
The shadow was disabled for the X11 client as it was far to unreliable
when comparing sizes.

It seems that the Wayland backend has been somewhat unreliable as well,
where some race condition causing incorrect sizes thus a flaky test.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1288
2020-06-05 00:15:52 +02:00
Jonas Ådahl
8d84449941 test-runner: Wait before finding MetaWindow when showing
A "show" command calls gtk_window_show() and gdk_display_sync(), then
returns. This means that the X11 window objects are guaranteed to have
been created in the X11 server.

After that, the test runner will look up the window's associated
MetaWindow and wait for it to be shown.

What this doesn't account for is if mutter didn't get enough CPU time to
see the new window. When this happens, the 'default-size' stacking test
sometimes failed after hiding and showing the X11 window.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1288
2020-06-05 00:15:52 +02:00
Jonas Ådahl
c823b5ddba renderer-native: Don't leak DMA buffer CoglFramebuffer
When we created the DMA buffer backed CoglFramebuffer, we handed it over
to CoglDmaBufHandle which took its own reference. What we failed to do
was to release our own reference to it, effectively leaking it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283
2020-06-02 18:39:27 +02:00
Jonas Ådahl
97175f8fa1 screen-cast-src: Destroy hash dmabuf table after stream
The stream will clean up the buffers, so let it do that before we
destroy them under its feet. Note that it'll only do this after the
following PipeWire commit:

    commit fbaa4ddedd84afdffca16f090dcc4b0db8ccfc29
    Author: Wim Taymans <wtaymans@redhat.com>
    Date:   Mon Jun 1 15:36:09 2020 +0200

        stream: allow NULL param and 0 buffers in disconnect

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1283
2020-06-02 18:39:23 +02:00
Jonas Ådahl
c5b1bdc0fe tests/stacking/restore-position: Always use wait_reconfigure
wait_reconfigure ensures that the whole configure back and forth
completes before continuing. Doing this after every state change ensures
that we always end up with the expected state, thus fixes flakyness of
the restore-position stacking test.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1279
2020-05-29 14:47:10 +00:00
Carlos Garnacho
f8e2234ce5 backends/native: Drop external keyboard detection for ::touch-mode
This cannot be made to work reliably. Some factoids:

- Internal devices may be connected via USB.
- The ACPI spec provides the _PLD (Physical location of device) hook to
  determine how is an USB device connected, with an anecdotal success
  rate. Internal devices may be seen as external and vice-versa, there is
  also an "unknown" value that is widely used.
- There may be non-USB keyboards, the old "AT Translated Set 2 Keyboard"
  interface does not change on hotplugging.
- Libinput has an internal series of quirks to classify keyboards as
  internal of external, also with an "unknown" value.

These heuristics are kinda hopeless to get right by our own hand. Drop
this external keyboard detection in the hope that there will be something
more deterministic to rely on in the future (e.g. the libinput quirks
made available to us directly or indirectly).

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2378
Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2353

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1277
2020-05-29 14:37:21 +00:00
Carlos Garnacho
38bbd9593b backends/x11: Implement ClutterSeat::touch-mode for the X11 backend
This only checks touchscreen availability as we have no access to
tablet-mode switch events as we do on the native backend.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1242

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1278
2020-05-29 12:39:59 +00:00
Jonas Ådahl
066bc5986d wayland: Drive frame callbacks from stage updates
Don't tie frame callbacks to actor painting, as it may end up in
situations where we miss sending frame callbacks when we should have. An
example of this is when a surface is partially off screen, and then
reports damage that is fully off screen. When this happen, we are likely
not to repaint anything, thus we won't send any frame callbacks even
though it's "suitable" for rendering again, as the surface is not on a
separate workspace or fully obscured.

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

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1218
2020-05-26 16:46:57 +02:00
Jonas Ådahl
e8b09df8d2 wayland/compositor: Pass backend when constructing
This is so that it can be retrieved later without going via the global
singleton.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1218
2020-05-26 16:35:01 +02:00
Jonas Ådahl
1571f8078a Reshuffle Wayland initailization
Move Wayland support (i.e. the MetaWaylandCompositor object) made to be
part of the backend. This is due to the fact that it is needed by the
backend initialization, e.g. the Wayland EGLDisplay server support.

The backend is changed to be more involved in Wayland and clutter
initialization, so that the parts needed for clutter initialization
happens before clutter itself initialization happens, and the rest
happens after. This simplifies the setup a bit, as clutter and Wayland
init now happens as part of the backend initialization.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1218
2020-05-26 16:35:00 +02:00
Jonas Ådahl
510cbef15a surface-actor: Move out some X11-ism to X11 subclass
On X11 we don't update the texture in certain circumstances, such as if
the surface is a fullscreen unredirect, or doesn't have a Pixmap. On
Wayland we only want to avoid updating the texture if there is no
texture, but as this is handled implicitly by MetashapedTexture, we
don't need to try to emulate the X11-y conditions in the generic layer
and instead just have the implementations handle update processing
themself.

This doesn't have any functional changes, but removes a vfunc from
MetaSurfaceActorClass.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1218
2020-05-26 16:35:00 +02:00
Jonas Ådahl
9d3e4fd402 clutter/stage-cogl: Use buffer age when view monitor is rotated
We failed to use the buffer age when monitors were rotated, as when they
are, we first composite to an offscreen framebuffer, then later again to
the onscreen. The buffer age checking happened on the offscreen, and an
offscreen being single buffered, they can't possible support buffer
ages.

Instead, move the buffer age check to check the actual onscreen
framebuffer. The offscreen to onscreen painting is still always full
frame, but that will be fixed in a later commit.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
2020-05-26 13:54:28 +00:00
Jonas Ådahl
03c65b93e6 region-utils: Make transform util const correct
The input should be const, as it will not be altered.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
2020-05-26 13:54:28 +00:00
Jonas Ådahl
346cadeddb renderer/native: Only enable shadowfbs if we can blit
There is no point in enabling shadow buffers if we can't as that'd be
even slower than not having them at all.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
2020-05-26 13:54:28 +00:00
Jonas Ådahl
f4d9953b9c renderer-native: Move shadow fb construction to the stage view
The stage view will need a more involved approach to shadow buffers, in
order to implement things such double buffered shadow buffers and damage
detection.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
2020-05-26 13:54:27 +00:00
Jonas Ådahl
6db94a0b77 clutter/stage-view: Add name property
Will be used for logging to identify what view a log entry concerns. For
the native and nested backend this is the name of the output the CRTC is
assigned to drive; for X11 it's just "X11 screen", and for the legacy
"X11 screen" emulation mode of the nested backend it's called "legacy
nested".

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
2020-05-26 13:54:27 +00:00
Jonas Ådahl
9bf6faf639 output: Add name getter
This will return the name of the connector, e.g. DP-2.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
2020-05-26 13:54:27 +00:00
Jonas Ådahl
4434a17d08 cogl/dma-buf-handle: Pass more metadata to handle constructor
Could be useful would one want to mmap the dmabuf and deal with its
content manually in CPU space.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
2020-05-26 13:54:27 +00:00
Jonas Dreßler
c65f63b647 wayland/actor-surface: Don't notify geometry-changed on mapped changes
There's no reason to notify the surface that its geometry changed when
the visibility of the actor changes. This is only needed to update the
outputs of the surface, so do that directly instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1235
2020-05-26 14:54:57 +02:00
Jonas Dreßler
79d981aac9 wayland/actor-surface: Factor in mapped clones in mapped check
We started listening to notify::mapped with commit
5eb5f72434 in order to emit
wl_surface.leave events consistently when a surface gets hidden. This
caused a problem with the ClutterClones used in the overview, since
those temporarily map and unmap the windows for painting, spamming
wl_surface.leave and enter events to all surfaces.

We can easily fix that by also treating mapped clones as mapped, which
means the surface should also be on a wl_output when the overview is
shown.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1141

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1235
2020-05-26 14:54:57 +02:00
Jonas Dreßler
2791f5b466 clutter/actor: Make has_mapped_clones() factor in parent actors
All existing users of clutter_actor_has_mapped_clones() actually want to
know whether the actor is being cloned by a visible clone, it doesn't
matter to them if that clone is attached to an actor somewhere else in
the tree or to the actor itself.

So make clutter_actor_has_mapped_clones() a bit more convenient to use
and also check the clones of the parent-actors in that function.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1235
2020-05-26 14:54:57 +02:00
Jonas Dreßler
e68bb27df2 wayland/actor-surface: Don't listen to notify::position signal
We started listening to "notify::position" on surface actors with commit
08e4cb54. This commit was done to fix a regression from commit cf1edff9,
which forgot to handle some cases like the actual WindowActor and not
the SurfaceActor (which is a child of the WindowActor) moving (that was
fixed by listening to MetaWindows "position-changed" signal). Also that
commit introduced meta_wayland_surface_update_outputs_recursively(),
which updates the outputs of all (sub-)surfaces in case any position
changed and made sure subsurfaces also get their outputs updated in case
the parent actor moved.

Connecting to the "notify::position" signal, which the above commit also
did is now superflous though because position changes will queue a
relayout and the actors allocation will change during the next
allocation cycle, notifying the "allocation" property which we also
listen to.

So save some resources and stop listening to that signal.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1235
2020-05-26 14:52:15 +02:00
Jonas Ådahl
0fbda366e8 native: Return an error if no drm devices are found
Without this, we'll end up segfaulting when trying to log the
non-existing error.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1217
2020-05-22 20:25:06 +00:00
Florian Müllner
106d332c71 backend/xcursor: Support a "blank" cursor type
We don't have enough Xlib code in mutter ...

Joking aside, it can be useful to make the cursor invisible
without hiding it, for example for replacing the actual cursor
with an actor in gnome-shell; the real cursor should still
update the focus surface in that case, and not sneak into
screenshots or -casts.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1244
2020-05-22 14:10:50 +00:00