Commit graph

514 commits

Author SHA1 Message Date
Benjamin Berg
561ac849d7 display: Add failure returns into CcDisplayConfig
This guards against accidental use of NULL pointers so that the panel
will hopefully not crash if new bugs like this are introduced.
2019-07-20 02:23:53 +00:00
Benjamin Berg
3721f9ed4a display: Update ShowMonitorLabels DBus call
The function has been changed in gnome-shell to be called ShowMonitorLabels
again (rather than ShowMonitorLabels2). Update g-c-c accordingly.

See https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/491
2019-07-15 09:21:23 +00:00
Benjamin Berg
6ed523959d display: Show scale row unconditionally
The only functional change in this commit is the reval of the if that is
checking for cloning mode.
2019-07-15 03:14:24 +00:00
Benjamin Berg
5aac1e93f2 display: Check scale is valid for all monitors when mirroring 2019-07-15 03:14:24 +00:00
Benjamin Berg
9e4c6e89a0 display: Use the new API to determine whether a scale is valid 2019-07-15 03:14:23 +00:00
Marco Trevisan (Treviño)
9ef001b3b1 display-config: Add size constraints and (global) scaled mode checks
Make possible to set scaled size constraints per configuration, and add a method
to verify if the current mode at scale is allowed for such config.

This allows to perform such check also in case we have global scaling enabled,
as in such case we must verify that all the selected current modes are supported
by the given scale.

Fixes GNOME/mutter#407
2019-07-15 03:14:23 +00:00
Allan Day
3d9649577a display: improve time widget spacing
It's good to have some space between the to and from widgets, so
they aren't squashed, and so they blend better with the colour
temperature slider below.

Ideally we'd just increase the space between the to and from
sections, and not also between the widgets and their labels, but
the approach in this commit isn't too bad.
2019-06-17 11:44:06 +01:00
Allan Day
c8c6d51fd0 display: Improve Night Light settings labels
Make sure that the labels in the night settings are clear.

Fixes #583
2019-06-17 11:41:26 +01:00
Georges Basile Stavracas Neto
28b0acb24e display: Rework Night Light page
The new Night Light page, as described by the latest mockups [1],
uses a listbox to display the options. Also, there is a small
revamp on how the disabled state is handled; it now is a switch
in a row, instead of an extra radio button.

This commit changes the Night Light page to have a listbox, and
uses libhandy's rows to achieve the desired interface.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/533
2019-06-16 01:01:36 +00:00
Georges Basile Stavracas Neto
50be7b13c8 display: Make night light a panel page
This introduces a GtkStack to handle the pages; move the
current panel to be the "displays" page; and adds the
Night Light page as "night-light".

A stack switcher was added, as a header widget, to control
the stack.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/533
2019-06-16 01:01:36 +00:00
Georges Basile Stavracas Neto
b46aef0cb6 display: Make night light dialog a GtkBin
And create the dialog manually instead. The next commit
will move it to a different page in the panel itself,
so not much care was put into makin the dialog perfectly
matching.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/533
2019-06-16 01:01:36 +00:00
Benjamin Berg
f75c3a8471 display: Fix crash if a monitor has no preferred mode
When a monitor has no current mode set and also no preferred mode we ran
into a crash. Simply select the first mode we can find as a further
fallback.
2019-04-30 14:16:17 +00:00
Sebastien Bacher
8541ef9e46 Include glib/gi18n.h which is needed for gettext 2019-04-10 11:27:14 +02:00
Sebastien Bacher
1268137e63 night-light: set screen temperature strings as translatable
Fixes #437
2019-04-09 21:07:12 +02:00
Veerasamy Sevagen
bf3d97e50d panels/display/cc-display-settings.ui: Adding context to "Scale"
The title property for "Scale" did not have any context.
2019-03-29 18:50:04 +00:00
Benjamin Berg
b26a8bdeed display: Ensure configuration has the expected type
In almost all cases, the configuration will be "valid" in the sense that
g-c-c can represent it in the UI. However, there are cases like
mirroring setups with three monitors that we do not allow.

In case that the user has such a configuration, ensure that the
configuration we represent is actually valid according to our
expectations. This should not affect normal use cases, but allows users
to recover again if the configuration is broken for some reason.

Fixes #383
2019-03-20 18:01:01 +01:00
Benjamin Berg
f45dcff81f display: Ensure at least one display is enabled
When the user has more than two monitors, then they can disable each
monitor separately. If the user creates an invalid configuration because
they disabled the last monitor, then enable a different one immediately.
2019-03-20 18:01:01 +01:00
Benjamin Berg
defbcebfab display: Simplify configuration type and UI selection logic
The new logic selects a single configuration type rather than detecting
which types can be considered valid. This simplifies the UI rebuilding
somewhat, but also changes some internal behaviour. We will now always
be in the correct mode internally, even if the UI may not represent this
change (i.e. with more than two monitors it always looks the same).
2019-03-20 18:01:01 +01:00
Benjamin Berg
b2f1d489ad display: Add unusable monitors to dropdown and disable switch for them
We should show unusable monitors in the monitor selection drop-down
list. So always add them to the combobox and add the code to make the
switch to enable them insensitive.
2019-03-20 18:01:01 +01:00
Benjamin Berg
e387b3bb86 display: Only enforce single mode when desired by UI
We should only enforce single mode, when we have exactly two monitors
and the two button UI is used to switch between them in single mode.
Move the code to ensure the single configuration into the relevant
callback handler, rather than trying to solve this globally.
2019-03-20 18:01:01 +01:00
Benjamin Berg
98d20659b7 display: Make rebuilding variable a counter
We need to also set rebuilding while updating some other UI elements.
Make it into a counter to allow for recursive setting.
Note that additional checks for rebuilding will be added in later
commits.
2019-03-20 17:58:29 +01:00
Benjamin Berg
21bb6416be display: Reset resolution when switching configuration types
It generally makes more sense to reset the resolution of a monitor after
we switch configuration types. The main case where this is relevant is
switching from a mirror configuration (CLONE) to either join or single.
In this case, higher resolutions for monitors may become available.

Note that this might be annoying to some users, because there may be
monitors reporting a lower "preferred" resolution than the highest
supported resolution. There is little we can do though, as always
selecting the highest resolution doesn't seem like a much better
approach.
2019-03-20 17:26:56 +01:00
Benjamin Berg
ae22f72cac display: Prevent error when serializing invalid configuration
If no monitors are enabled, then the variant would end up with an
invalid variant type, causing a crash later on. This case only happened
due to other bugs (i.e. in principle we should never send a
configuration without any monitors to the server).

Prevent the serialization error by specifying the correct type for the
builder, therefore potentially preventing a crash in such a corner case.
2019-03-20 17:26:56 +01:00
Benjamin Berg
0c4e84e417 display: Ensure we have a primary monitor after all were disabled
When enabling the first monitor, we need to select it as primary as we
otherwise end up without a primary monitor (rendering the configuration
invalid). "Unsetting" the NULL primary monitor effectively causes the
first and only available monitor to become the primary, while not doing
anything if we have a primary monitor.
2019-03-20 17:26:08 +01:00
Benjamin Berg
20d24992ee display: Enable all monitors when switching to join config
The new code had a bug in that it only ever enabled the first monitor
rather than all usable ones. Fix this by removing the erroronuous break.
Also clarify the comment a bit that the current solution is not really
ideal as it may result in invalid configurations (i.e. we enable more
outputs than are possible with the number of available CRTCs).

Fixes #418
2019-03-18 17:08:35 +00:00
Marco Trevisan (Treviño)
49957ef818 display: Don't always set the primary monitor to the first in list
As per the binding that we have between the list store and the combo-box, when
the first element is added to the list-store, the combo box set this value as
the selected-index, and this leads to a call to cc_display_monitor_set_primary
which set the first-listed monitor as primary and unset the real primary monitor.

To avoid this, just ignore the binding when rebuilding the UI, since in this
phase control-center should just reflect the actual state without changing
anything.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/419
2019-03-18 11:53:18 +00:00
Benjamin Berg
37c768ab0f display: Fix Apply button showing for changes to disabled monitor
Disabled monitors may or may not have a mode selected. This means, we
need to skip the mode comparison if the two compared monitors are
disabled (i.e. have no logical monitor).
Move the mode check to the end and skip it if both monitors are disabled.

This fixes cases where identical configurations are misdetected, because
we applied a mode to a monitor and disabled the monitor again. This
happens for example when switching the active monitor in "single" mode.
2019-03-11 18:32:21 +00:00
Benjamin Berg
1f29dad46f display: Keep current monitor enabled when forcing an update
In the case where the user plugged/unplugged a screen, we could run into
the case where we would first enable and then disable the same output.
This could potentially result in an invalid configuration.

Prevent this by not disabling the output if no switch happened.
2019-03-11 18:32:21 +00:00
Benjamin Berg
75bf1b8cd1 display: Update apply button when switching output in "single" mode
While the configuration was updated, the apply button was not synced.
This meant users could not switch the active monitor properly.

Fixes #405
2019-03-11 18:32:21 +00:00
Benjamin Berg
5aa17c6984 display: Correctly select "single" mode when opening display panel
The dialog tried to retain the current configuration mode. However,
doing so means that we end up in the wrong mode in some situation (e.g.
opening the dialog with two displays but only one enabled).

Fix this by always selecting a configuration mode. This potentially
switches the user from "join" to "single" if only one monitor is left.
However, the user has no way to do this manually, so no unexpected UI
change will happen.
2019-03-11 18:32:21 +00:00
Benjamin Berg
42006249af Remove internal copy of HdyValueObject
The relevant code is included in libhandy 0.8 and can be removed now
that we depend on a new enough version.
2019-03-04 16:59:25 +00:00
Benjamin Berg
e786b5a767 display: Mark "Scale" label as translatable
These strings were not marked as translatable when the panel was ported
to use templates.

Follow up for 9fba7cc2
2019-02-27 10:39:51 +00:00
Benjamin Berg
c4d60b9d1d display: Add context to display setting strings
Note that no context is added for "Refresh Rate" and "Adjust for TV" at
least for now.

Fixes #393
2019-02-26 19:40:07 +01:00
Bastien Nocera
9fba7cc2ad display: Mark strings as translatable
Those were translatable before the "templating" of this section of the
panel.

Fixes: 8503dab5
2019-02-26 18:54:14 +01:00
Benjamin Berg
638f2065a5 display: Do not expand display enabled switch
Fixes #367
2019-02-22 13:44:39 +00:00
Benjamin Berg
1accfac4ef display: Move arrangement instructions outside of view area
Having the instructions inside can be slightly confusing because
monitors cannot be moved around in the labels area. Simply moving the
instructions to be at the top again improves this.

With this change the dialogs UI matches the old layout more closely.
2019-02-11 18:59:32 +01:00
Benjamin Berg
b69fbc88c2 display: Resurrect the old scale buttons
This means we show the first 5 scales that are supported for the
display. That is the same behaviour as 3.30 had, therefore minimizing
the UI changes that users will see.

Note that there are plans to improve the scaling UI, however, it is not
yet clear how this will look like.
2019-02-11 18:54:54 +01:00
Adrien Plazas
ba6106dfca display: Use a HdyColumn
This allows the panel to better adapt to the available width.
2019-01-29 17:23:20 +01:00
Benjamin Berg
d9a7c84905 display: Rewrite as a template widget 2019-01-29 12:05:43 +01:00
Benjamin Berg
e5925f5eb6 display: Hookup new CcDisplaySettings 2019-01-29 12:05:43 +01:00
Benjamin Berg
8503dab530 display: Add settings widget for output configuration
This widget now uses libhandy for the rows.
2019-01-29 12:05:43 +01:00
Benjamin Berg
afe8661704 display: Allow config to be modified in arrangement widget 2019-01-29 12:05:43 +01:00
Benjamin Berg
9025f79b5f display: Add helper that returns the monitor name as new string 2019-01-29 12:05:43 +01:00
Benjamin Berg
4360288c74 display: Move setter for cloning mode into CcDisplayConfig
It will be used from multiple files in the future.
2019-01-29 12:05:43 +01:00
Benjamin Berg
be3fbd8bef display: Redraw arrangement widget after monitor selection change 2019-01-29 12:05:43 +01:00
Benjamin Berg
5b53f026c8 display: Chain up CcDisplayConfig finalize handler 2019-01-29 12:05:43 +01:00
Benjamin Berg
e520ab8952 display: Chain up CcDisplayArrangement finalize handler 2019-01-29 12:05:43 +01:00
Benjamin Berg
713e209783 display: Add missing finalize handler for CcDisplayMonitor
This caused the UI related strings to be leaked.
2019-01-29 12:05:43 +01:00
Benjamin Berg
41717253c8 display: Fix leak in night light dialog 2019-01-29 12:05:43 +01:00
Benjamin Berg
d9aab36609 display: Compare configurations without monitor offset
When comparing configurations, the monitor positions are compared
directly. This comparison will not work properly if one of the
configurations has an offset.

This results in the "Apply" button to show up incorrectly after moving
the top/left monitor position.
2019-01-29 12:05:43 +01:00