1
0
Fork 0
Commit graph

141 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Cosimo Cecchi
1455c402b9 monitor-manager: add API to get the display configuration timeout
Instead of hardcoding this into two different places, add an API so that
gnome-shell can fetch it.

https://bugzilla.gnome.org/show_bug.cgi?id=767805
2017-07-31 15:41:15 +01:00
Rui Matos
3f9c5823cb backends: Add API to switch to predetermined monitor configurations
This will allows us to support the XF86Display key present on some
laptops, directly in mutter. This is also known, in evdev, as
KEY_SWITCHVIDEOMODE.

The common usage for this key is to alternate between a few well known
multi-monitor configurations though these aren't officially
standardized. As an example, Lenovo documents it as:

"Switches the display output location between the computer display
and an external monitor."

On this patch, we're just introducing the configurations that have been
implemented in g-s-d until now, which go a bit beyond the above
description.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-19 11:18:53 +02:00
Jonas Ådahl
32fd1e8c08 monitor-manager: Let the MetaMonitor derive the whole layout
Instead of letting MetaMonitor derive the logical monitor size, then
using the main monitor for the position, just let MetaMonitor derive
the whole layout including the position. This means it can deal with
tiled monitors better, for example when the main output (the output
always active when the monitor is active) is not the origin output (the
output with tile position (0, 0)).

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-07-19 17:06:17 +08:00
Florian Müllner
8b5d34b24a monitor-manager: Shut up a compiler warning
Add a default switch statement to make it clear that 'transform'
won't be used uninitialized.
2017-07-14 16:56:43 +02:00
Rui Matos
7360f51ee8 meta-monitor-manager: Add API to rotate the current configuration
This will allows us to support the XF86RotateWindows key present on
some laptops directly in mutter.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-14 15:31:20 +02:00
Rui Matos
6ae42f3845 monitor-manager: Hook MetaOrientationManager to change the config
On orientation changes we'll apply the appropriate monitor transform
to the current configuration if possible.

https://bugzilla.gnome.org/show_bug.cgi?id=781906
2017-07-14 15:31:20 +02:00
Jonas Ådahl
777963eeb6 monitor-manager: Don't set current config if only verifying
When verifying if a configuration is applicable, don't set it as
current when applying succeeded, or else reverting to a previous
configuration doesn't work after having verified.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
49c5228655 DisplayConfig: Add support for interlaced modes
Differentiate between non-interlaced and interlaced modes. This is done
by appending an "i" after the resolution part of the mode ID, and
adding a 'is-interlaced' (b) property to the mode properties.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
0a8e108f10 DisplayConfig: Replace mode 'u' flags with 'a{sv}' property bag
To be more flexible without having to change any D-Bus type signatures
in the future, replace the 'uint' flags value (currently determining
whether a mode is current and/or preferred) with a variant lookup table.

The keys 'is-current' (b) and 'is-preferred' (b) replace the existing
flags.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
859b01fc39 DisplayConfig: Specify mode ID string instead of mode spec
To be able to add more modes types that happen to have the same
resolution and refresh rate, change the API to specify modes using an
ID string. The ID string is temporary, and only works for associating a
mode for the monitor instance that it was part of.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
41eea5a942 monitor-config: Handle fractional scale precision loss
When calculating sizes given some size and a fractional logical monitor
scale with precision loss, round the result of the floating point
calculation to the closest integer, as otherwise we might end up with
result smaller by 1 if there was a loss of precision when calculating
the scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
67eb289a6a monitor-manager: Find the supported scales from one passed
When passing scales over D-Bus, we'll loose some precision. To set the
correct scale, use the configured scale and look up the one actually
supported by the monitor mode, and use that. To match the supported one
with the configured one, the difference must be within rounding error
range.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
b2a530b326 DisplayConfig: Make supported scales per mode
This changes the API to pass supported scales per mode instead of
providing a global list. This allows for more flexible scaling
scenarious, where a scale compatible with one mode can still be made
available even though another mode is incompatible.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
10b0351a59 Add support for rudimentary fractional scaling
When the logical layout mode is used, allow configuring the scaling to
be non-integer. Supported scales are so far hard coded to include at
most 1, 1.5 and 2, and scales that doesn't result in non-fractional
logical monitor sizes are discarded.

Wayland outputs are set to have scale ceil(actual_scale) meaning well
behaving Wayland clients will provide buffers with buffer scale 2, thus
being scaled down to the fractional scale.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
b64c69e4bc logical-monitor: Make scale a float
To support fractional scaling, the logical monitor scale must be stored
as a float. No other functional changes is part of this commit.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Bastien Nocera
f5f0ff0a2f monitor-manager: Fix crash when UPower is not available
Don't access the upower client if it doesn't exist

https://bugzilla.gnome.org/show_bug.cgi?id=780407
2017-05-31 16:11:24 +02:00
Jonas Ådahl
82325cbcfd monitor: Don't get the monitor manager from the backend
We will both create and destroy monitors during initialization (when
using the X11 backend), so don't try to access the monitor manager from
the backend, but store a pointer to it instead.

It's stored in MetaMonitor even though only MetaMonitorTiled uses it,
mostly because it makes more sense to store such a pointer there.

https://bugzilla.gnome.org/show_bug.cgi?id=781723
2017-05-26 14:32:43 +08:00
Jonas Ådahl
1bb0e18042 monitor-manager/xrandr: Allow configuring scales on X11 too
This commit makes it possible to configure logical monitor scale also
when running on top of an X11 server using Xrandr. An extra property
'requires-globla-scale' is added to the D-Bus API is added to instruct
a configuration application to only allow setting a global logical
monitor scale.

This is needed to let gsd-xsettings use the configured state to set a
XSettings state that respects the explicit monitor configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Jonas Ådahl
2718699ccc backend: Move settings into a new MetaSettings object
Introduce MetaSettings and add the settings managed by MetaBackend into
the new object. These settings include: experimental-features and UI
scaling factor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-05-26 14:31:48 +08:00
Marco Trevisan (Treviño)
183f4b0c13 MetaMonitorManager: ignore hotplug_mode_update at startup
hotplug_mode_update is used (mostly by VMs nowadays, and
VMware has implemented it) to inform that modes list (including
the preferred one) might change after an uevent.

However, when using MetaMonitorConfigManager we should
ignore this value at initialization level, or mutter
won't restore the configured values at startup.

https://bugzilla.gnome.org/show_bug.cgi?id=783073
2017-05-25 16:50:29 +08:00
Rui Matos
612432ac3e monitor-manager: Fix format-security gcc warnings 2017-04-12 16:53:30 +02:00
Jonas Ådahl
c214eb15bf monitor-manager: Check active monitors when looking for logical monitor
An inactive monitor will not be assigned to a logical monitor, so don't
try to match against those. This avoids a dereferencing a NULL when the
main output of an inactive monitor doesn't have an assigned CRTC.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 23:53:51 +08:00
Jonas Ådahl
de61da16ae monitor-manager: Reconfigure when 'scale-monitor-framebuffer' is toggled
When the experimental feature 'scale-monitor-framebuffer' is enabled or
disabled, reconfigure the monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
bdcb395b33 DisplayConfig: Add 'supports-changing-layout-mode' property
This property may be used by a client to determine whether it is
allowed to change the layout mode.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
1caa7f7627 monitor-manager: Add public API to get logical monitor from connector
This adds a function to be used by gnome-shell to get the logical
monitor given a connector name. For now, use the same index integer
method to reference a logical monitor, but this should be revisited by
providing a better API later.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
15dd23a323 monitor-manager: Fix gtk-doc of .._get_monitor_for_output
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:51 +08:00
Jonas Ådahl
04d7fcf60d DisplayConfig: Add display-name monitor property
This is the same property as the one associated with an output in
GetResources.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
9755cd469c DisplayConfig: Make naming convention consistent
Always use hyphens as delimit words in property keys. Underscore to
delimit words in method arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
1bdadfa3e1 backend: Add API to get UI scaling
The UI scaling depends on whether the framebuffers are scaled. Enable
the caller to determine the what scale its UI should be drawn in, in
relation to the stage coordinate space by calling this function. A new
singal "ui-scaling-factor-changed" is added in order to liston for for
changes.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
6c8b103a7b DisplayConfig: Add "is_builtin" monitor property
Add a per-monitor property allowing the application to determine
whether the monitor is builtin or not, e.g. a laptop panel.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
95d0117784 monitor-manager: Hook up config manager to display config confirmation
Make it possible to confirm or cancel the new configuration also when
the new API is used.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
af4017de49 monitor-manager: Derive logical monitor position from top left CRTC
Derive the logical monitor position not by looking at the main output
(the (0, 0) tile), but the one that is placed on the top-left corner.
This might be the non-main output on certain transformations.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
0ac2eba4d3 DisplayConfig: Add logical monitor transforms
Add the transform as a logical monitor parameter, both when getting the
current state and applying a new configuration. The transform is defined
to be identical to MetaMonitorTransform.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
472a434212 monitor-config-manager: Support logical monitor transforms
Add support for rotated monitors. This is done per logical monitor, as
every monitor assigned to a logical monitor must be transformed in the
same way. This includes being transformed on the same level; e.g. if
the backend does not support transforming any monitor of a logical
monitor natively, then all monitors will be transformed using the
offscreen intermediate framebuffer.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
d38c4c1f2d logical-monitor: Track whether the logical monitor is transformed
Keep track of the logical monitor transform. When a logical monitor is
transformed, all of its monitors are also transformed in the same way.
A logical monitor can either be transformed on the CRTC level, or using
an offscreen intermediate buffer. In both cases will the logical
monitor be transformed, but only in the latter will the view be
transformed.

MetaCrtcs::transform currently does not represent whether the CRTC is
configured to be transformed or not; only when the backend can handle
it does it correctly correspond to the actual CRTC configuration. This
is intended to change with MetaMonitorConfigManager.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:49 +08:00
Jonas Ådahl
0c64c35a8a monitor-manager: Make the config manager an 'experimental feature'
Instead of using a environment variable, add a new 'experimental
feature' gsetting keyword "monitor-config-manager" that enables the use
of the new MetaMonitorConfigManager. This commit also makes it possible
to switch between the two systems without restarting mutter.

The D-Bus API is disabled when the experimental feature is not enabled,
and clients trying to access it will get a access-denied error in
response. A new property 'IsExperimentalApiEnabled' is added to let the
D-Bus client know whether it is possible to use the experimental API or
not.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
57acbc53fb legacy-monitor-config: Let the manager listen on lid closed changes
This is in preparation for making config-manager work alongside the
legacy configuration system.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
8163ca6821 Add support for scaled logical monitor framebuffers
This commit adds support for rendering onto enlarged per logical
monitor framebuffers, using the scaled clutter stage views, for HiDPI
enabled logical monitors.

This works by scaling the mode of the monitors in a logical monitors by
the scale, no longer relying on scaling the window actors and window
geometry for making windows have the correct size on HiDPI monitors.

It is disabled by default, as in automatically created configurations
will still use the old mode. This is partly because Xwayland clients
will not yet work good enough to make it feasible.

To enable, add the 'scale-monitor-framebuffer' keyword to the
org.gnome.mutter.experimental-features gsettings array.

It is still possible to specify the mode via the new D-Bus API, which
has been adapted.

The adaptations to the D-Bus API means the caller need to be aware of
how to position logical monitors on the stage grid. This depends on the
'layout-mode' property that is used (see the DisplayConfig D-Bus
documentation).

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
0952409de4 monitor-manager: Always set current config when apply succeeds
No reason making any caller do it.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
f25f14351c monitor-manager: Make max screen size optional
Make the concept of maximum screen size optional, as it is not
necessarily a thing on all systems (e.g. when using the native backend
and stage views).

The meta_monitor_monitor_get_limits() function is replaced by a
meta_monitor_manager_get_max_screen_size() which fails when no screen
limit is available. Callers and other users of the previous max screen
size fields are updated to deal with the fact that the limit is
optional.

The new D-Bus API is changed to move it to the properties bag, where
its absence means there is no applicable limit.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
691e7951ea DisplayConfig: Add new API for configuring monitors
Add a new D-Bus API that uses the state from GetCurrentState to
configure high level monitors, instead of low level CRTCs and
connectors. So far persistent configuration is not implemented, as
writing to the configuration store is still not supported.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
9a5b94a340 monitor-manager: Use better error code when using the wrong API
It has nothing to do with permissions, so 'not-supported' is a bit
better.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
079b125430 DisplayConfig: Group logical monitor parameters a bit better
Move around the parameters, just to put the always-there fields before
the monitor array and property box.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00