1
0
Fork 0
Commit graph

7258 commits

Author SHA1 Message Date
Jonas Ådahl
2c5404532b screen-cast-stream: Don't broadcast PipeWireStreamAdded signal
The helper function from gdbus-codegen broadcasts the signal emission,
but we really only care about sending it to the specific peer that
created the session. Thus, only emit the signal to the particular peer
that owns the session.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2019-01-30 17:14:47 +00:00
Pekka Paalanen
6932b3cbb3 renderer/native: fix missing GPU copy egl ext error
If the extension is missing, the GPU copy path would not work. The code sets
the error, but forgets to return a failure. Fix this.

While adding the necessary return FALSE, also destroy the EGL context we just
created. Code refactoring shares the destroying code.

Found by reading code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/416
2019-01-30 15:57:30 +02:00
Emilio Pozuelo Monfort
b76bf20092 backends/native: Don't use software renderer for GPU copy
If the GPU copy path would use a software renderer, fall back to the CPU
copy path. The CPU copy path is possibly faster and avoids screen
corruption issues that were observed on an Intel Haswell desktop. The
corruption was likely due to texturing from an unfinished rendering or
memory caching issues.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/325
2019-01-30 15:12:57 +02:00
Pekka Paalanen
a62dbc6680 renderer/native: Debug print chosen secondary FB format
Print the pixel format chosen for an output on a secondary GPU for
debugging. Knowing the format can aid in debugging e.g. red/blue channel
swaps and CPU copy performance issues.

This adds a DRM format printing helper in meta-crtc-kms.h. This header
is included in most native backend files making it widely available,
while DRM formats are specific to the native backend. It could be shared
with Wayland bits, DRM format codes are used there too.

The helper makes the pixel format much more readable than a "%x".

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
Pekka Paalanen
442dcc7855 renderer/native: Valid formats for secondary dumb buffers
When setting up an output on a secondary GPU with the CPU copy mode,
allocate the dumb buffers with a DRM format that is advertised supported
instead of hardcoding a format.

Particularly, DisplayLink devices do not quite yet support the hardcoded
DRM_FORMAT_XBGR8888. The proprietary driver stack actually ignores the
format assuming it is DRM_FORMAT_XRGB8888 which results the display
having red and blue channels swapped. This patch fixes the color swap
right now, while taking advantage if the driver adds support for XBGR
later.

The preferred_formats ordering is somewhat arbitrary. Here it is written
from glReadPixels point of view, based on my benchmarks on Intel Haswell
Desktop machine. This ordering prefers the format that was hardcoded
before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
Pekka Paalanen
23e7a0a099 crtc/kms: Add primary plane format list accessors
These functions allow inspecting which pixel formats a CRTC's primary
plane supports. Future patches will inspect the supported formats and
pick a framebuffer format accordingly instead of hardcoding a format.

The copy list function will be used to initialize a formats list, and
the supports format function will be used to intersect that list against
another CRTC's supported formats.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
Pekka Paalanen
7f2dbb6c44 crtc/kms: Document meta_crtc_kms_get_modifiers
It has some details that may not be obvious from the function signature.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
Pekka Paalanen
8a0d0ce987 crtc/kms: Add fallback primary plane formats
This avoids having to hardcode the same fallbacks elsewhere multiple
times when determining what formats might be suitable for a set of
CRTCs. The formats_modifiers hash table is now guaranteed to be
populated with at least something, so future code will not need to
handle it being empty.

The hardcoded fallback formats are a minimal set probably supported by
most hardware. XRGB8888 is the format that, according to ancient lore,
all DRM devices should support, especially if they don't have the
capability to advertise otherwise. Mutter also hardcodes XRGB8888 as the
GBM surface format, so it is already required on primary GPUs.

XBGR8888 matches the most common OpenGL format, sans alpha channel since
scanout hardware has not traditionally supported alpha. XBGR8888 is here
also because Mutter hardcodes that format for secondary GPU outputs when
using the CPU copy path.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
Pekka Paalanen
0789c3fb9f crtc/kms: Use plane formats if no IN_FORMATS
If the IN_FORMATS property is not found, copy the formats from the DRM
plane instead. This is the fallback for getting a list of formats the
primary plane supports when DRM universal planes capability is enabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
Pekka Paalanen
31d99c51cb crtc/kms: Remove unused field formats_prop_id
It was set but never used.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
Pekka Paalanen
30550ef688 crtc/kms: Parse and store IN_FORMATS in full
Rather than picking just one format, parse and store all the formats and
their modifiers.

This gives us a list of supported formats (and modifiers) on a CRTC
primary plane. Later I will be using this list to choose a framebuffer
format instead of hardcoding it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
Carlos Garnacho
177b4df217 wayland: Implement window activation and focus stealing prevention
This is done through gtk-shell ATM. If a window requests focus with
an invalid startup ID, just the demands-attention flag will be set.
The "did user interaction happen in between" checks are left to
meta_window_activate_full/meta_window_focus, by passing the timestamp
of the original launch request.
2019-01-26 18:07:03 +01:00
Carlos Garnacho
a08d7cf48a wayland: Update gtk-shell protocol to v3
This version has 2 new requests:
- gtk_shell1.notify_launch notifies the compositor that the requesting
  client shall launch another application. The given ID is expected to
  be unique.
- gtk_surface1.request_focus notifies the compositor that a surface
  requests focus due to it being activated. The given ID is passed to
  this process through undetermined means, if it corresponds with a
  current startup ID and there was no user interaction in between the
  surface will be focused, otherwise it will demand attention.
2019-01-26 18:07:03 +01:00
Jonas Ådahl
3fa6a92cc5 screen-cast: Fix monitor recording on HiDPI
It scaled the logical monitor rect with scale to get the stream
dimensions, but that is only valid when having
'scale-monitor-framebuffers' enabled. Even when it was, it didn't work
properly, as clutter_stage_capture_into() doesn't work properly with
scaled monitor framebuffers yet.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/415
2019-01-26 16:18:45 +00:00
Florian Müllner
d5a7bbd094 Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 09:43:06 +01:00
Iain Lane
2e53ce8e75
meta, startup-notification: Make type declarations public
Shell is using these, which was revealed by
1bbb5c8107 breaking its build when
generating its introspection due to meta_startup_notification_get_type()
not being found.

We keep the class structs private, so in practice MetaStartupSequence
and MetaBackend can't be derived from (the are semi-private).
2019-01-24 16:38:09 +00:00
Marco Trevisan (Treviño)
e02fef8e2f meta: Hide libmutter symbols by default and selectively export them
Make meson link libmutter using -fvisibility=hidden, and introduce META_EXPORT
and META_EXPORT_TEST defines to mark a symbols as visible.
The TEST version is meant to be used to flag symbols that are only used
internally by mutter tests, but that should not be considered public API.

This allows us to be more precise in selecting what is exported and what is
not, without the need of a version-script file that would be more complicated
to maintain.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/395
2019-01-23 14:18:13 +01:00
Marco Trevisan (Treviño)
e352011830 MonitorManager: Use composition instead of inheriting from dbus skeleton
MonitorManager was inheriting from MetaDBusDisplayConfigSkeleton, this was
causing introspection to see this like a GDBus skeleton object exposing to
clients methods that were not required.

Also, this required us to export meta_dbus_* symbols to the library, while
these should be actually private.

So, make MetaMonitorManager to be just a simple GObject holding a skeleton
instance, and connect to its signals reusing most of the code with just few
minor changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/395
2019-01-23 14:12:07 +01:00
Marco Trevisan (Treviño)
7f551ba776 meson: Don't list libraries private dependencies in pc files
pkg-config files for mutter are generated using *_pkg_deps as requires, but
programs linked with libmutter doesn't need most of these private dependencies
which are only needed for building and linking mutter and its subprojects.

So list packages needed only by mutter itself inside *_pkg_private_deps and
don't expose such packages to pkg-config, but only use them at build time.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
Marco Trevisan (Treviño)
08130912f0 meson: Set proper soversion and version to libraries
Soname of the libraries should be the major version number, while the version
triplet is currently used:
  objdump -p libmutter-4.so.0.0.0 | grep SONAME
    SONAME               libmutter-4.so.0.0.0

While is expected to be only libmutter-4.so.0

Fix all shared libraries by setting valid version and soversion.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
Olivier Fourdan
562cf14258 core: Fix compiler warning
Fix compiler warning: ‘startup_id’ may be used uninitialized in
`meta_launch_context_get_startup_notify_id()`.

Also change `gchar` to plain `char` while at it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/406
2019-01-23 10:06:30 +01:00
Jonas Ådahl
8d91135926 wayland/xdg-shell: Fix buffer attach coordinate comparison
Only x was checked, but twice. Should check both x and y.
2019-01-22 18:32:28 +01:00
Jonas Ådahl
1bbb5c8107 meta: Only declare types when generating gir files
Some types were declared in the public headers so that g-ir-scanner
could resolve the types. This caused warnings when using
-Wredundant-decls, so only redeclare them for the gir scanner.
2019-01-22 18:32:28 +01:00
Jonas Ådahl
12a42a9295 wayland: Move DND surface role into its own file
This avoids a -Wredundand-decls warning about the get_type() function.
2019-01-22 18:32:28 +01:00
Jonas Ådahl
01cea0d9ef Fix const qualifier usage
As with the commits earlier, this also adds const qualifiers where
expected. However, the const variables are casted to non-const variants
so they can be passed to glib functions that take non-const variants but
expect const-like input.
2019-01-22 18:31:53 +01:00
Jonas Ådahl
f615eea7ee backend: Remove redundant function declarations 2019-01-22 18:31:52 +01:00
Olivier Fourdan
3738579dd3 window-actor: Use actual image size for capture
Previously, the clipping rectangle passed to
`meta_surface_actor_get_image()` was updated with the actual texture
size, but recent changes in `meta_shaped_texture_get_image()` now keep
the caller's clipping rectangle unchanged.

The implementation of `meta_window_actor_capture_into()` was relying on
the old behavior of updating the passed clipping rectangle, but now that
it's kept unchanged, the actual clipping rectangle used to copy the data
is wrong, which causes either a distorded image or worse, a crash of
mutter.

Use the resulting cairo image size to copy the data instead of the
clipping rectangle to avoid the issue and get the expected size.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/442
2019-01-22 10:30:04 +01:00
Antoine Jacoutot
1ca60f424a input-settings/x11: Only warn once about missing udev support
Otherwise we end up logging the same message everytime we enter this function,
flooding the logs and making it annoying to spot other entries.
2019-01-22 02:21:13 +01:00
Jonas Ådahl
ff507273d2 startup-notification: Silence warning
Warning in question:

../src/core/startup-notification.c:646:16: error: unused variable ‘display’ [-Werror=unused-variable]
2019-01-18 18:18:57 +01:00
Carlos Garnacho
f033d0e846 core: Add MetaLaunchContext
This is a GAppLaunchContext subclass meant to replace usage of
GdkAppLaunchContext in gnome-shell.

Launch contexts get created from the MetaStartupNotification as
they are closely related. The messaging underneath depends on
the availability of a X11 display, if there is one we go through
it (and libsn). If there is none, we still create startup sequences
manually for wayland clients.
2019-01-18 17:03:57 +00:00
Carlos Garnacho
ca67d52cac x11: Add method to launch applications, using SnLauncher
The method spawns a launch request that will get caught by the
SnMonitor we have in place to handle X11 startup notification
messages.
2019-01-18 17:03:57 +00:00
Carlos Garnacho
60d22b7cd0 wayland: Accept NULL primary data source
A NULL argument is expected here in order to unset the selection,
meta_wayland_data_device_set_primary() accepts a NULL source, but
gtk_primary_selection_device.set_selection was not handling a
NULL wl_resource.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/335
2019-01-18 13:52:05 +00:00
Jonas Ådahl
e9778eba18 build: Pass --quiet to glib-genmarshal
We don't need to know it read the input file really.
2019-01-17 20:42:10 +00:00
Jonas Ådahl
56d260cfb3 screen-cast-monitor-stream-src: Only send cursor bitmap when it changes
To avoid unnecessary pixel copying, only send the cursor bitmap when it
changes. This also allows the receiver to know when the cursor bitmap
actually changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
c45d5f53ff cursor-tracker: Emit cursor-changed after renderer was updated
Otherwise the cursor retrieved via meta_cursor_renderer_get_cursor() is
out of date.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
4e402b3972 screen-cast: Add 'cursor-mode' to allow decoupled cursor updates
The 'cursor-mode', which currently is limited to RecordMonitor(), allows
the user to either do screen casts where the cursor is hidden, embedded
in the framebuffer, or sent as PipeWire stream metadata.

The latter allows the user to get cursor updates sent, including the
cursor sprite, without requiring a stage paint each frame. Currently
this is done by using the cursor sprite texture, and either reading
directly from, or drawing to an offscreen framebuffer which is read from
instead, in case the texture is scaled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
79d99cbe3f cursor-renderer: Add API to allow inhibiting HW cursor
There may be reasons to temporarly inhibit the HW cursor under certain
circumstances. Allow adding such inhibitations by adding API to the
cursor renderer to allow API users to add generic inhibitors with
whatever logic is deemed necessary.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
328eff7352 screen-cast/monitor-stream-src: Copy content before cursor is drawn
To get a consistent behaviour no matter whether HW cursors are in use or
not, make sure to copy the framebuffer content before the stage overlays
(cursor sprite textures) are painted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
ed5c1f433b backends/stage: Emit signal between painting actors and overlays
Will be used by screen casting for embedding the cursor separately, or
not including at all.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
7ac2083134 backends/stage: Fix minor style issue
https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
bd97b11414 renderer: Add API to get view from logical monitor
Will be used to get the view scale for a logical monitor, which is
necessary for passing cursor sprites via PipeWire.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
0da0207eed screen-cast: Add getters to fetch object owners
MetaBackend owns MetaScreenCast which owns MetaScreenCastSession which
owns MetaScreenCastStream. Make it possible to fetch objects in the
oppositev direction too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
08229a6f5d screen-cast-monitor-stream: Don't pass monitor manager when creating
It can be fetched indirectly from the monitor already.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Jonas Ådahl
2b2d77dc3e cursor-tracker: Add 'cursor-moved' signal
https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Florian Müllner
a0909c3440 constraints: Fix titlebars going off the bottom
The "current" rect includes the frame, so in order to keep the
titlebar on screen, window movement must be restricted to at
most (height - titlebar_height) past the work area bottom.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/391
2019-01-16 01:19:32 +01:00
Pekka Paalanen
22f865122c renderer/native: Prefer hardware rendering for primary GPU
Mutter prefers platform devices over anything else as the primary GPU.
This will not work too well, when a platform device does not actually
have a rendering GPU but is a display-only device. An example of this
are DisplayLink devices with the proprietary driver stack, which exposes
a DRM KMS platform device but without any rendering driver.

Mutter cannot rely on EGL init failing on such devices either, because
nowadays Mesa supports software renderers on GBM, so the initialization
may well succeed.

The hardware rendering capability is recognized by matching the GL
renderer string to the known Mesa software renderers. At this time,
there is no better alternative to detecting this.

The secondary GPU data is abused for the GL renderer, as the Cogl
context may not have been created yet.  Also, the Cogl context would
only be created on the primary GPU, but at this point the primary GPU
has not been chosen yet. Hence, GPU copy path GL context is used as a
proxy and predictor of what the Cogl context might be if it was created.
Mind, that even the GL flavour are not the same between Cogl and
secondary contexts, so this is stretch but it should be just enough.

The logic to choose the primary GPU is changed to always prefer hardware
rendering devices while also maintaining the old order of preferring
platform over boot_vga devices.

Co-authored by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>

https://gitlab.gnome.org/GNOME/mutter/merge_requests/271
2019-01-13 10:30:44 +00:00
Emilio Pozuelo Monfort
60ac2838b5 renderer/native: Move primary GPU choosing later
Moves the primary GPU choosing to after all secondary gpu data has been
created.

This makes it possible for a future patch to start looking at secondary
gpu data in choose_primary_gpu () to determine if it is using a hardware
driver or a software renderer.

Co-authored by: Pekka Paalanen <pekka.paalanen@collabora.com>

https://gitlab.gnome.org/GNOME/mutter/merge_requests/271
2019-01-13 10:30:44 +00:00
Emilio Pozuelo Monfort
dfde2f59da renderer/native: Secondary gpu data for all
Initialize the secondary GPU data for all GPUs, even the primary one. By
not looking at the primary_gpu_kms member, a future patch is allowed to
postpone choosing the primary GPU.

A future patch will use the secondary GPU data to decide which GPU will
become the primary GPU.

Co-authored by: Pekka Paalanen <pekka.paalanen@collabora.com>

https://gitlab.gnome.org/GNOME/mutter/merge_requests/271
2019-01-13 10:30:44 +00:00
Pekka Paalanen
3d2ca9a67f renderer/native: Count devices on EGLDevice check
create_renderer_gpu_data_egl_device () relied on the primary GPU being
already chosen for the "EGLDevice currently only works with single GPU
systems" error message. A future patch will choose the primary GPU after
this, not before, so this check needs to be rewritten before the
initialization order is changed.

The new check is implemented exactly as the error message says: there
must be exactly one GPU, otherwise fail.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/271
2019-01-13 10:30:44 +00:00
Pekka Paalanen
9182c8b801 backends/native: Move primary_gpu into MetaRendererNative
Make the choosing and identity of the primary GPU an internal detail to
the native renderer. MonitorManagerKms did not need it for anything.

The primary GPU logic remains unchanged.

This allows follow-up patches to change how the renderer chooses the
primary GPU. It will be easier for the renderer to use private
information for choosing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/271
2019-01-13 10:30:44 +00:00
Emilio Pozuelo Monfort
1def099047 backends/native: Re-order primary GPU choosing logic
This is a step towards moving the primary GPU logic into the native
renderer exclusively. In the future the renderer will have one more
criterion on choosing the primary GPU than MetaMonitorManagerKms should
know about: does a GPU offer hardware rendering.

The choosing of primary GPU is separated from the discovery of GPUs.
When GPUs are discovered and added to the list, the MetaGpuKmsFlag is
now populated correctly and used in choosing.

Choosing the primary GPU is done after all GPUs have been found and is
slightly different from before:

- Skipping devices that do not belong to our seat now works instead of
becoming the primary GPU.

- Fall back to any non-platform, non-boot_vga device if neither kind is
found.

The old preference of platform over boot_vga device is kept.

The hotplug path will continue creating a gpu_kms without flags, because
at that point the primary GPU has already been chosen and the flags are
irrelevant.

Co-authored by: Pekka Paalanen <pekka.paalanen@collabora.com>

https://gitlab.gnome.org/GNOME/mutter/merge_requests/271
2019-01-13 10:30:44 +00:00
Pekka Paalanen
ddb0ef1e8d backends/native: Add flags to MetaGpuKms
Add a flags field to MetaGpuKms. In following commits, the flags defined
here will be set and used for choosing the primary GPU.

Co-authored by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>

https://gitlab.gnome.org/GNOME/mutter/merge_requests/271
2019-01-13 10:30:44 +00:00
Georges Basile Stavracas Neto
fb38738fe9
Remove obsolete .cvsignore files
We moved to git 11 years ago, it's about time.
2019-01-10 11:50:54 -02:00
Georges Basile Stavracas Neto
763ae36cee
Drop Autotools
I saw Meson fade from the sky
On the wind I heard a sigh
As snowflakes cover fallen Makefiles
I will say this last goodbye

Meson is now coming
So ends Autotools days
Future is now coming
And we must away
Over Python and without Bashisms
Through lands where never Meson touched
By silver streams that run down to the Sea

Under parsers, beneath old legacy
Over snow one winter’s morn
I turned at last to paths that lead home
And though where the road then takes me
I cannot tell
We came all this way
But now comes the day
To bid you farewell

Many places I have been
Many sorrows I have seen
But I don’t regret
Nor will I forget
All Makefiles that took that road with me

I bid you all a very fond farewell.
2019-01-10 11:50:54 -02:00
Olivier Fourdan
582b67a2f1 window: Handle maximize when headless
When for some reason a window is maximized while the compositor is
headless, `window->monitor` will be NULL, so check for a NULL monitor
to avoid a NULL-pointer dereference.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/58

https://gitlab.gnome.org/GNOME/mutter/merge_requests/383
2019-01-09 15:19:20 +01:00
Robert Mader
f740e8ed79 core: Fix compiler warning in MetaSoundPlayer 2019-01-09 03:42:43 +00:00
Florian Müllner
d360b25b81 build: Install .pc files in correct location
If a library is provided in the positional arguments, then meson
defaults to installing the .pc file in a 'pkgconfig' subdirectory
in the library's install location. We want the files in the regular
$libdir/pkgconfig rather than $libdir/mutter-$api/pkgconfig, so
specify the location explicitly in the parameters.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/382
2019-01-08 22:36:20 +01:00
Carlos Garnacho
3693f6f630 build: Use plain libcanberra instead of libcanberra-gtk3
We no longer use the gtk-aware ca_context, the dependency can be lowered
now.
2019-01-08 16:14:17 +01:00
Carlos Garnacho
ebfc6184b2 workspace: Port to MetaSoundPlayer
Use MetaSoundPlayer to play workspace switch sounds, instead of using
libcanberra directly.
2019-01-08 16:14:17 +01:00
Carlos Garnacho
8715f7481b core: Make MetaBell use MetaSoundPlayer to play the bell sound
Instead of using libcanberra/gtk+.
2019-01-08 16:14:17 +01:00
Carlos Garnacho
12f8325cbc core: Add MetaSoundPlayer abstraction
This is a simple libcanberra abstraction object, so we are able
to play file/theme sounds without poking into GTK+/X11. Play
requests are delegated to a separate thread, so we don't block
UI on cards that are slow to wake up from power saving.
2019-01-08 16:14:17 +01:00
Carlos Garnacho
956ab4bd58 build: Make libcanberra no longer optional
This is not the case anymore with MetaSoundPlayer in place, and also
important to get keyboard bell right.
2019-01-08 15:58:11 +01:00
Jonas Ådahl
b448ced8e4 backends: Silence a couple of gtk-doc warnings
A lot of fancy gtk-doc documentation was added, but they had a couple of
issues: invalid return value annotations and wrong documented function
name.
2019-01-08 09:06:11 +01:00
Jonas Ådahl
73ddd7cd48 build: Pass library as first argument to pkg.generate()
Dependencies are added automatically, and we no longer get warnings
like:

clutter/clutter/meson.build:628: DEPRECATION: Library mutter-clutter-4
was passed to the "libraries" keyword argument of a previous call to
generate() method instead of first positional argument. Adding
mutter-clutter-4 to "Requires" field, but this is a deprecated behaviour
that will change in a future version of Meson. Please report the issue
if this warning cannot be avoided in your case.
2019-01-08 09:05:08 +01:00
Robert Mader
e7fb45364a compositor: Fix maybe-uninitialized warning
Introduced in 54febd1419

https://gitlab.gnome.org/GNOME/mutter/merge_requests/374
2019-01-07 16:13:32 +00:00
Niels De Graef
0478c225b7 Add some gtk-doc comments. 2019-01-06 21:57:16 +01:00
Robert Mader
51e4fe7fef shaped-texture: Indentation fix in update_area()
https://gitlab.gnome.org/GNOME/mutter/merge_requests/366
2019-01-05 14:18:31 +01:00
Robert Mader
d52081bed4 shaped-texture: Invert transform of damage in update_area()
Transformed textures need to transform back the damage area, which
is given in buffer coordinates, with the inverted transform.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/366
2019-01-05 14:18:28 +01:00
Robert Mader
686b7f8baa boxes: Add API to transform a MetaRectangle
To be used if not a whole region needs to get transformed.
It also has an argument for reverse-transforms.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/366
2019-01-05 14:18:25 +01:00
Robert Mader
b7a9c7e7d3 monitor-transform: Add helper function transform_invert()
It returns the inverted transform, which is always the same as the
input, besides for TRANSFORM_90 and TRANSFORM_270.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/366
2019-01-05 14:18:02 +01:00
Robert Mader
676a8da005 monitor-transform: Move helper functions into their own file
The existing ones are statically inlined, so there is no .c file
right now.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/366
2019-01-05 14:15:23 +01:00
Jonas Ådahl
490f27efcb shaped-texture: Use actual texture if tower returned NULL
The texture tower can return no texture e.g. if the calculated level is
negative. This was handled before, but regressed with
e1370ee209. This fixes a potential crash
observed occasionally when starting Firefox nightly using the Wayland
backend in overview mode.
2019-01-05 09:36:46 +00:00
Jonas Ådahl
173867c12b renderer/native: Use shadow fb on software GL if preferred
If a KMS device has the DRM_CAP_DUMB_PREFER_SHADOW and a software based
GL driver is used, always use a shadow fb. This will speed up read backs
in the llvmpipe OpenGL implementation, making blend operations faster.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/106
2019-01-04 20:59:00 +00:00
Georges Basile Stavracas Neto
df1384a856
window-actor: Turn into an abstract class
Now that everything is settled, from the initialization
process to the subclasses to moving code to the compositor,
MetaWindowActor can be a proper abstract class that cannot
be instantiated.

Thus, make MetaWindowActor an abstract class.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 11:58:03 -02:00
Georges Basile Stavracas Neto
5fbeecaac6
window-actor: Remove post_init() vfunc
This vfunc was added as a was to work around the convoluted
initialization process. Now that we figured it out and moved
the MetaWindowActor-specific initialization to constructed(),
we can override that.

Remove post_init() and use GObject.constructed() entirely.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 11:58:02 -02:00
Georges Basile Stavracas Neto
54febd1419
window-actor: Move window actor creation to MetaCompositor
MetaWindowActor breaks layering isolation by accessing
and injecting itself into compositor->windows. This is
a bad practice, and effecticely makes returning the
new actor useless, since we doesn't even use the return
value.

Move window actor creation to under MetaCompositor and
stop violating (too badly) the resposabilities of each
component. This moves meta_window_actor_new() into
meta_compositor_add_window().

Also, move the remaining initialization code to the
GObject.constructed vfunc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 11:58:02 -02:00
Georges Basile Stavracas Neto
7952808469
Document window and surface actors
Document the roles of MetaSurfaceActor and MetaWindowActor,
and when their subclasses are used.

(And this is actually the first real documentation under
src/compositor/README!)

https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 09:32:58 -02:00
Georges Basile Stavracas Neto
0442fc8ddc
window-actor: Cleanup includes
https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 09:32:58 -02:00
Georges Basile Stavracas Neto
80e3c1de57
window-actor: Move X11-specific code to MetaWindowActorX11
MetaWindowActor handles sending _NET_WM_FRAME_* X atoms to
clients - even pure Wayland clients.

Now that we have Wayland- and X11-specific implementations of
MetaWindowActor, we can delegate this to MetaWindowActorX11,
and allow pure Wayland apps to not even connect to
MetaSurfaceActor:repaint-scheduled.

Do that by moving all the X11-specific code to the X11-specific
MetaWindowActorX11 class. Add vfuncs to MetaWindowActorClass
that are necessary for the move, namely:

 * pre_paint() and post_paint()
 * post_init()
 * frame_complete()
 * set_surface_actor()
 * queue_frame_drawn()

https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 09:32:58 -02:00
Georges Basile Stavracas Neto
ac2f8cad0c
window-actor: Select X11 or Wayland actor based on client type
X11 clients now have a MetaWindowActorX11 on the surface. Next
commits will move the X11-specific code to MetaWindowActorX11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 09:32:51 -02:00
Georges Basile Stavracas Neto
7e8fc13504
Add MetaWindowActorX11 and MetaWindowActorWayland
Those are stub specialized classes for MetaWindowActor. This will
help ensuring that we do not execute X11-specific code paths on
pure Wayland clients.

The relationship between the window actor and the surface is the
following:

 * Wayland: MetaWindowActorWayland + MetaSurfaceActorWayland
 * X11: MetaWindowActorX11 + MetaSurfaceActorX11
 * Xwayland: MetaWindowActorX11 + MetaSurfaceActorWayland

It is not possible to have MetaWindowActorWayland backed by a
MetaSurfaceActorX11 surface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 09:32:51 -02:00
Georges Basile Stavracas Neto
60f7ff3a69
window-actor: Turn into a derivable class
We will introduce specialized MetaWindowActors for X11
and Wayland in the future, so it needs to be derivable.

Make it a derivable class, and introduce a private field.
The MetaWindowActorClass definition is in the private
header in order to prevent external consumers of Mutter
to create MetaWindowActor implementations of their own.
That is, MetaWindowActor is only internally derivable.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/368
2019-01-04 09:32:51 -02:00
Jonas Ådahl
2fe05d7c35 x11-display: Add back _GTK_EDGE_CONSTRAINTS as supported hints
It was dropped by accident in 1530f27513,
so lets add it back.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/423
2019-01-03 17:57:06 +01:00
Jonas Ådahl
012691bebf shaped-texture: Draw external textures via offscreen
EGLStream textures are imported as GL_TEXTURE_EXTERNAL_OES and reading
pixels directly from them is not supported. To make it possible to get
pixels, create an offscreen framebuffer and paint the actor to it, then
read pixels from the framebuffer instead of the texture directly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-01-03 10:26:13 +00:00
Jonas Ådahl
c84d7ebc6d shaped-texture: Get transformed textures pixels via offscreen
When a texture is transformed in any way (e.g. Wayland buffer
transforms), we cannot just fetch the pixels from the texture directly
and be done with it, as that will result in getting the untransformed
pixels.

To properly get the pixels in their right form, first draw to an
offscreen framebuffer, using the same method as when painting on the
stage, then read from the framebuffer into a cairo image surface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/408
2019-01-03 10:26:13 +00:00
Jonas Ådahl
f9118fb99b shaped-texture: Don't change the callers clip rect
We intersected the callers clip rect. That is probably not a good idea,
and easily avoided, so lets avoid it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-01-03 10:26:13 +00:00
Jonas Ådahl
d3301d6b53 shaped-texture: Stop using gdk rect helper
We have our own version, just use that.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-01-03 10:26:13 +00:00
Jonas Ådahl
1755a8b8de shaped-texture: Fix include order
https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-01-03 10:26:13 +00:00
Jonas Ådahl
36b46af92f boxes: Add helper to scale rectangles by a double
And change the similar region scaling helper to use this one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-01-03 10:26:13 +00:00
Jonas Ådahl
e1370ee209 shaped-texture: Put actual texture painting in helper
This is so that it can be reused later by meta_shaped_texture_get_image() for
drawing via an offscreen framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-01-03 10:26:13 +00:00
Jonas Ådahl
37e36e8208 compositor: Make meta_actor_painting_untransformed take a framebuffer
Stop using the cogl draw framebuffer implicitly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-01-03 10:26:13 +00:00
Daniel Stone
177d0c2d63 gpu/kms: Use correct DRM event context version
DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
whatever version of libdrm is present. Mutter was blindly asserting it
supported whatever version that may be, even if it actually didn't.

With libdrm 2.4.78, setting a higher context version than 2 will attempt
to call the page_flip_handler2 vfunc if it was non-NULL, which being a
random chunk of stack memory, it might well have been.

Set the version as 2, which should be bumped only with the appropriate
version checks.

https://bugzilla.gnome.org/show_bug.cgi?id=781034
2019-01-02 15:44:52 +01:00
Jonas Ådahl
f7d4a727a8 build: Always pass --quiet to g-ir-scanner
This makes the build less verbose, as all .gir generation except for
clutters didn't pass --quiet to g-ir-scanner, making it output long
linking commands. Do this by adding a common introspection_args
variable.

While at it, put -U_GNU_SOURCE in there too, as it was always passed
everywhere as without it the scanner would log warnings.
2018-12-22 11:31:10 +01:00
Niels De Graef
d539fe28d5 Use G_DECLARE_DERIVABLE/FINAL_TYPE on some types
This is only for types in the `Meta` namespace.

* Clears up a lot of boilerplate
* We get `g_autoptr` support for free
2018-12-21 19:48:50 +00:00
Georges Basile Stavracas Neto
9bd427a74c
meta/tests: Remove commented lines
Leftovers from the initial landing of Meson files.
2018-12-20 13:52:35 -02:00
Georges Basile Stavracas Neto
ebb6c56f67
Add Meson support for installed tests
This is the last remaining feature necessary to achieve
parity with the Autotools build.

A few changes were made to the install locations of the
tests, in order to better acomodate them in Meson:

 * Tests are now installed under a versioned folder (e.g.
   /usr/share/installed-tests/mutter-4)

 * The mutter-cogl.test file is now generated from an .in
   file, instead of a series of $(echo)s from within Makefile.

Notice that those tests need very controlled environments
to run correctly. Mutter installed tests, for example, will
failed when running under a regular session due to D-Bus
failing to acquire the ScreenCast and/or RemoteScreen names.
2018-12-20 13:52:35 -02:00
Georges Basile Stavracas Neto
dcb525397c
build: Move libmutter_name to toplevel Meson file
The libmutter name will be reused by other Meson files,
so it makes sense to share it instead of rebuilding this
string every time.
2018-12-20 12:44:15 -02:00
Carlos Garnacho
3c6a518d40 compositor: Avoid changing pipeline/source if shadow is not being painted
Avoids some context invalidations in cogl.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2018-12-18 12:51:28 +01:00
Peter Hutterer
9f3d321bf2 input-settings: treat a serial of 1 as serial of 0
The Wacom Xorg driver assigns a serial number of 1 for any pad that doesn't
have a serial. libinput assigns 0. Just treat 1 as 0 here, there are no pens
with a real serial 1 anyway.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/414
2018-12-17 16:12:50 +10:00
Jonas Ådahl
781ec74fd2 window: Fix introspection warnings
(transfer none) was added for fundamental types, which can't be
transfered.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/356
2018-12-14 15:57:36 +01:00