1
0
Fork 0
Commit graph

6441 commits

Author SHA1 Message Date
Jonas Ådahl
2df4ccd1cd window: Handle being headless better
This avoids updating state (such as position, size etc) when going
headless. Eventually, when non-headless, things will be updated again,
and not until then will we be able to update to a valid state.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:44:05 +08:00
Jonas Ådahl
dcd15e6145 wayland: Don't free the Wayland display name string too early
We accidentally freed the Wayland display name string, meaning
retrieving it later retrieved freed memory.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:42:45 +08:00
Jonas Ådahl
2a318eb3f2 wayland/output: Flush clients after creating wl_output global
In order to give the clients the best chance to bind the wl_output
before we later remove it (for example on fast hot plugs or in the test
suite), flush the client sockets after creating the global.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:42:45 +08:00
Jonas Ådahl
522eec00cd monitor: Add foreach output helper and fix foreach crtc helper
The foreach CRTC monitor mode helper incorrectly iterated over outputs
without CRTC when non-tiled modes were set on tiled monitors. This was
not expected by callers, so fix the helper to only iterate over active
outputs (that has or should have a CRTC).

The test cases uses the incorrect behaviour of the foreach CRTC helper
to check that the disabled outputs mode are set to NULL, so add a
foreach output helper and change the tests to use that instead.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
be11c32815 tests: Move out test client helper from test-runner.c
It could be useful for running other types of test clients in other
tests.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
24c91d95de core/screen: Make logical monitor getters handle being headless
Don't crash or return invalid indices when we are headless.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
7562eb6006 core/window: Don't set a preferred output when there is none
If there are no active logical monitors, don't try to dereference a
NULL one to get a preferred output winsys id. Instead just set an
invalid one.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
0aa7405a2a monitor-manager: Fall back to minimum screen size of 640 x 480
When headless, we don't have any logical monitors to derive a screen
size from, but we can't set it to empty as that will cause issues with
the clutter stage, UI widget layout and other things. To avoid such
issues, just fall back to a 640 x 480 screen size when headless.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
a119e58773 backend: Only try to center pointer when there not headless
Don't attempt to center the pointer when there is nothing to center on.

https://bugzilla.gnome.org/show_bug.cgi?id=730551
2017-08-30 13:09:38 +08:00
Jonas Ådahl
8a32b42172 renderer/native: Round calculated framebuffer size before casting to int
Due to rounding issues, we can't assume a floating point calculation
will end up on an integer, even if we got the factor from the reverse
calculation. Thus, to avoid casting away values like N.999... to N,
when they should really be N+1, round the resulting floating point
calculation before casting it to int.

This fixes an issue where using the scale ~1.739 on a 1920x1080 mode
resulted in error when setting the mode, as the calculated size of the
framebuffer was only 1919x1080.

https://bugzilla.gnome.org/show_bug.cgi?id=786918
2017-08-30 13:07:11 +08:00
Jonas Ådahl
6e46ad9f3a remote-desktop, screen-cast: Fail session method calls from other peers
Only accept method calls on the session objects from the same peer that
created the session.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
921b18f713 screen-cast-session: Allow stand alone screen cast sessions
When a screen cast session is stand-alone, i.e. not created given a
remote desktop session managing it, allow calling the Start/Stop
methods to start and stop it.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
53175e8788 ScreenCast: Pass PipeWire stream node ID directly
As of commit 5f5ef3de2cdc816dab82cb7eb5d7171bee0ad2c5 in pipewire the
stream creator can find out the node ID of the stream it created.

So instead of using a special purpose entry to the info property box to
let the application discover stream by monitoring added nodes searching
for the given special purpose entry, just pass the node directly.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
920541fa26 screen-cast-stream-src: Only try to record frames when streaming
Only when the PipeWire stream state is 'PW_STREAM_STATE STREAMING'
should the signal be connected causing the src to maybe record a frame.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
9d8922764c screen-cast: Handle PipeWire errors
When the PipeWire context or stream ends up in an error state, signal
that the source has closed. This then triggers the stream and finally
the session to be closed too.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
97f2c7c161 Add remote desktop and screen cast functionality
This commit adds basic screen casting and remote desktoping
functionalty. This works by exposing two D-Bus API services:
org.gnome.Mutter.ScreenCast and org.gnome.Mutter.RemoteDesktop.

The remote desktop API is used to create remote desktop sessions. For
each session, a D-Bus object is created, and an application can manage
the session by sending messages to the session object. A remote desktop
session the user to emit input events using the D-Bus methods on the
session object. To get framebuffer content, the application should
create an associated screen cast session.

The screen cast API is used to create screen cast sessions. One can so
far either create stand-alone screen cast sessions, or a screen cast
session associated with a remote desktop session. A remote desktop
associated screen cast session is managed by the remote desktop session.

So far only remote desktop managed screen cast sessions are implemented.

Each screen cast session may have one or more streams. A screen cast
stream is a stream of buffers of some part of the compositor content.
So far API exists for creating streams of monitors and windows, but
only monitor streams are implemented.

When a screen cast session is started, the one PipeWire stream is
created for each screen cast stream created for the session. When this
has happened, a PipeWireStreamAdded signal is emitted on the stream
object, passing a unique identifier. The application may use this
identifier to find the associated stream being advertised by the
PipeWire daemon.

The remote desktop and screen cast functionality must be explicitly be
enabled at ./configure time by passing --enable-remote-desktop to
./configure. Doing this will build both screen cast and remote desktop
support.

To actually enable the screen casting and remote desktop, the user must
enable the experimental feature. See
org.gnome.mutter.experimental-features.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
38235bc145 Add MetaFraction for dealing with fractions
Add MetaFraction, which consists of two integers, the numerator an the
denominator. The utility function to convert a double to a MetaFraction
comes from gstreamer.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:39:04 +08:00
Jonas Ådahl
3ce3a5a952 monitor: Add API to compare with old instance
When monitors changed, previous monitor instances are defunct, and any
reference holder should drop its reference. Sometimes they will want to
continue having a reference to the same monitor, so add this function
to make it possible to find it.

Currently the output and crtc references are invalid, as they are not
yet reference counted, so this can only look at cached fields.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 14:38:20 +08:00
Jonas Ådahl
3005a400ca monitor-manager: Add helper for getting monitor from connector
This will be used later.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 11:49:01 +08:00
Jonas Ådahl
34e7134db2 wayland/xdg-foreign: Move out ID generation helper to util.c
It'll be used to generate ID in the same way in other places later.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 11:49:01 +08:00
Daniel Stone
06d0989014 wayland-dma-buf: Fix 32bpp channel order inversion
Apparently my understanding of Cogl pixel formats, or at least their
use, was somewhat shaky.

Un-invert the inversion of the DRM FourCC -> Cogl pixel format mapping
when creating dmabufs from clients, fixing inverted channel ordering
seen from GL clients, e.g. gold highlights in gtk4-demo when using the
GSK GL backend when they should be blue.

https://bugzilla.gnome.org/show_bug.cgi?id=786677
2017-08-24 15:11:37 +02:00
Mario Sanchez Prada
e075242801 egl: Don't require eglGetPlatformDisplayEXT
Trying to unilaterally require eglGetPlatformDisplayEXT causes problems in
scenarios where this method is not available. Besides, this should only be
required on Wayland, so we can stop requiring it always and simply let the
eglGetPlatformDisplay() function error accordingly when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=786619
2017-08-22 18:33:13 +02:00
Alessandro Bono
168479862d meta-background-actor: Unset flags when they are not valid anymore
Currently, the flags that describe what is changed are never unsetted.
Unset each flag just after using them.

https://bugzilla.gnome.org/show_bug.cgi?id=783512
2017-08-21 22:18:28 +02:00
Jonas Ådahl
14fe6e9c95 cursor-renderer-native: Don't use HW cursor on transformed logical monitor
The HW cursor plane can't do any transformations, and as we still don't
pre-transform any buffer before uploading to the cursor plane, we must
disable the HW cursor when a logical monitor is transformed.

This worked previously because the transform of a MetaCrtc did not
correspond to the transform of a CRTC, but the transform of the logical
monitor the CRTC was assigned to.

https://bugzilla.gnome.org/show_bug.cgi?id=786023
2017-08-21 21:20:19 +08:00
Jonas Ådahl
6584d06bb5 monitor-manager: Don't cancel confirm dialog on verifying
When another D-Bus call that just tries to verify a configuration is
made, don't cancel any active monitor configuration dialog, as doing so
would effectively confirm queried configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=786023
2017-08-21 21:20:19 +08:00
Jonas Ådahl
92a53f08f4 keybindings: Only resolve keysyms for the current layout group
When resolving what keycodes a key binding resolves to, only look up
key codes from the current layout group. Without this, unwanted
overlaps may occur. For example when a keymap has both a dvorak and a
qwerty layout on different layout groups, one keybinding may be bound
on multiple keys, arbitrarily "shadowing" another.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
a81d4aed7a backend/x11: Notify whenever the layout group changes
Will be used to trigger keyboard binding rebuild.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
517488ef67 backends/native: Only emit layout group changed event when changed
Check that the layout group changed before emitting a changed event.
2017-08-21 21:19:18 +08:00
Jonas Ådahl
33f1706634 backend: Add API to get layout group
Add API to get the layout group (layout index) currently active. In the
native backend this is done by fetching the state directly from the
evdev backend; on X11 this works by listening for XkbStateNotify
events, caching the layout group value.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
a6d67b164a x11: Open backend X11 connection ourself
Don't wait for clutter to initialize for connecting to X11; do it when
constructing the backend instance. This way we can later depend on
having an X11 connection earlier during initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
f950380202 monitor-manager-xrandr: Use G_DECLARE_FINAL_TYPE macro
Declare the MetaMonitorManagerXrandr type using the helper macro,
instead of manually.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
35c9280fb6 monitor-manager: Try to restore previous config before regenerating
When opening a laptop lid, one will likely want to restore the
configuration one had prior to closing it, so when ensuring monitor
configuration, first try to see if the previously set configuration is
both complete (all connected monitors are configured) and applicable
(it is a valid configuration) and only try to generate a new from
scratch if that failed.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
8b92ad1d4b tests/monitor-unit-tests: Clear config history before each test
To not let different tests interfere with each other, clear the config
history before each run.
2017-08-21 12:23:51 +08:00
Jonas Ådahl
0d6e3fd675 tests/monitor-unit-tests: Use special purpose add test helper
Will later be used to set a setup function.
2017-08-21 12:23:51 +08:00
Jonas Ådahl
b140e7fbeb monitor-config-manager: Keep short history of configurations
In order to go back in monitor configurations, save them to a history.
The history is implemented as a max 3 element long queue, where newly
set configurations are pushed to the head, and old are popped from the
tail.

The difference between using a single previous config reference and a
queue is that we can now remember the configuration used prior to a
D-Bus triggered configuration when the user discarded the configuration.

This will later be used to restore a previous configuration when a
laptop lid is opened.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
6c0f107db0 tests: Add rotated multi head monitor config migration test
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
61950755ec tests: Add monitor config migration tests
So far some basic testing, including:

 * Test that the migrated configuration is applicable
 * Test that a monitors.xml with multiple configurations are translated
 * Test rotation
 * Test tiled monitor discovery (well, test a made up tiled monitor
   configuration since I don't have a real one)

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
bc3162460f Migrate old monitor configuration files to new system
This commit changes the new configuration system to use monitors.xml
instead of monitors-experimental.xml. When starting up and the
monitors.xml file is loaded, if a legacy monitors.xml file is
discovered (it has the version number 1), an attempt is made to migrate
the stored configuration onto the new system.

This is done in two steps:

1) Parsing and translation of the old configuration. This works by
parsing file using the mostly the old parser, but then translating the
resulting configuration structs into the new configuration system. As
the legacy configuration system doesn't carry over some state (such as
tiling and scale used), some things are not available. For tiling, the
migration paths makes an attempt to discover tiled monitors by
comparing EDID data, and guessing what the main tile is. Determination
of the scale of a migrated configuration is postponed until the
configuration is actually applied. This works by flagging the
configuration as 'migrated'.

2) Finishing the migration when applying. When a configuration with the
'migrated' flag is retrieved from the configuration store, the final
step of the migration is taken place. This involves calculating the
preferred scale given the mode configured, while making sure this
doesn't result in any overlapping logical monitor regions etc.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
27a4f9f862 monitor-manager/kms: Use connector id to find old output
The zero-initialized winsys id was incorrectly used as the key to find
the old output to base active/primary state from, which would never
succeed unless the winsys id happened to be 0. Fix this by using the
winsys id that will be used, i.e. the connector id.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
88f2441330 monitor-manager: Fix output variable naming
Fix the last case of using the variable name "meta_output" for a
MetaOutput.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
ab04286c6b monitor-manager/x11: Don't complain about 'normal' transform
The 'normal' transform has the value 0, so the g_warn_if_fail()
expression failed. Correct it so that it doesn't complain when no
transform is checked.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:23:51 +08:00
Jonas Ådahl
e8a62861c9 Remove old monitor configuration system
Remove the old MetaMonitorConfig system and mark the new one as
non-experimental. This also removes the D-Bus property.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:20:53 +08:00
Jonas Ådahl
9ac87b36c1 monitor-manager/xrandr: Fix name inconsistencies
MetaOutputs should be "output" and external types should be named as
such, i.e. XRandr outputs are renamed to "xrandr_output".

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:20:30 +08:00
freeroot
12792f99a0 Add tag-and-drag setting from libinput into mutter
The problem is that libinput offers the possibility to not enabled
dragging when tap-to-click is enabled but mutter doesn't. For people who
have a sensitive touchpad and who like tap-to-click option, dragging is
launched even when you don't want it : for example, when you select a
folder, most of the time the folder is dragging whereas just selected or
when you want to select some lines of a text file, several lines are
moved as a cut-paste which is not expected and erase datas.

To fix it, you need to have the possibility to desactivate the drag
option when you use tap-to-click in mutter. Because it's already a
specification of libinput, it remains to add it to mutter.
Implementation with X11 is added too.

https://bugzilla.gnome.org/show_bug.cgi?id=775755
2017-08-20 09:27:28 +08:00
Jonas Ådahl
66996dee4b wayland/inhibit-shortcuts-dialog: Destroy the dialog after response
We'll never actually show it again, but just use the last response, so
we can just destroy it now already.

https://bugzilla.gnome.org/show_bug.cgi?id=786385
2017-08-19 17:24:06 +08:00
Jonas Ådahl
2f45e88f06 wayland/inhibit-shortcuts-dialog: Just hide the dialog when hiding
The meta_wayland_surface_hide_inhibit_shortcuts_dialog() function
disconnected the "destroy" handler, but we'd still be listening on
response events. Change this to just hide the dialog, leaving the data
intact with the proper life time signal in place.

https://bugzilla.gnome.org/show_bug.cgi?id=786385
2017-08-19 17:24:06 +08:00
Jonas Ådahl
c1439e141e wayland/inhibit-shortcuts-dialog: Make the dialog ownership clearer
Make it clear that the data object is the owner of the dialog; it
creates it, and eventually destroys it.

https://bugzilla.gnome.org/show_bug.cgi?id=786385
2017-08-19 17:24:02 +08:00
Jonas Ådahl
dceb0f1f1f wayland/inhibit-shortcuts-dialog: Make data life cycle a bit clearer
The 'data' object is attached to the MetaWaylandSurface as a GObject
qdata. It is created once, and stays allocated until the surface is
destroyed. To make things clearer, connect to the "destroy" signal just
after creating, and from a on_surface_destroyed() callback call the
.._free() function.

https://bugzilla.gnome.org/show_bug.cgi?id=786385
2017-08-19 17:23:07 +08:00
Jonas Ådahl
a7915ff8ae wayland/inhibit-shortcuts-dialog: Only reuse last reply if there was one
We might have hidden the dialog, without a response. To avoid using the
not answered response, make sure we have actually got one before
reusing.

https://bugzilla.gnome.org/show_bug.cgi?id=786385
2017-08-19 17:11:21 +08:00
Rui Matos
420a712ad5 meta-monitor: Make supported scales determination saner
Scales below 1 and scales that result in a too small logical monitor
size don't make sense. We also don't need so many intermediate scales.

https://bugzilla.gnome.org/show_bug.cgi?id=786474
2017-08-18 18:41:01 +02:00