Commit graph

418 commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
de758cc962 display: Show monitor settings in main page when single
When there's only one display, there's no need to redirect
users to another page. In this case, simply move the settings
widget to the main page.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
67e8c7f5c6 display: Add monitor rows to display settings group
They allow selecting a monitor to config, and navigating to
the monitor settings page.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
9ca9877520 fixup! display: Move display settings to a separate page 2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
7091ddee49 display: Remove display section from main page
We'll soon replace this by rows, so let's remove these widgets
now. They accounted for a lot of the complexity of the panel!
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
da599ec252 display: Move display settings to a separate page
Right now there's no way to reach this page, but we'll add
ways in the next commits.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
8c8e123690 display: Add row to switch to Night Light page
This adds a new listbox with a single row, as per
mockups, to switch to the Night Light page; and
also adds a back button to switch back to the main
page.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
c5f984c247 display: Adjust styling of arrangement widget
Use the "card" style class to make it visually similar to
other elements of the panel.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
f05fe78a98 display: Move display arrangement to the top
As per mockups. No functional changes.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
07c4e0f6d3 display: Rename variable
The config_type_switcher_group preferences group now handles
more than config_type_switcher_row, so adjust the naming to
match that.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
2a838f8684 display: Move primary display row to display type group
As per mockup. Over the next commits, more parts of the
display panel will be moved to this group.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
dd1817f5b8 display: Move config type toggles into a row
Fortunately for us, AdwPreferencesGroup makes that trivial.
Move the linked box into an AdwActionRow, and remove the icon
and the margins from the toggle buttons.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
8a353c0cdd display: Remove arrangement group description
As per mockups.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
983ac203e0 display: Remove "Display Mode" title
As per mockups. In preparation for future changes.
2022-01-18 17:03:14 +00:00
Jan Beich
37b29c32cb meson: drop unused argument for i18n.merge_file()
Ignored in Meson < 0.60.0, deprecated since 0.60.1 and fatal since 0.61.0.

panels/applications/meson.build:10:5: ERROR: Function does not take positional arguments.
panels/background/meson.build:10:5: ERROR: Function does not take positional arguments.
panels/camera/meson.build:10:5: ERROR: Function does not take positional arguments.
[...]
2022-01-07 17:22:43 +00:00
Robert Mader
6a4652bd35 display-config: Do not invert order when constructing modes
Mutter sends modes in descending order of preference. By reverting
the order via `g_list_prepend`, we get unintended side effects
such as choosing the least preferred refresh rate by default (if
the selected mode is not marked as preferred).

Instead of adding complex logic in several places, make sure that
the assumption of descending preference is kept by simply not
inverting the order.

Closes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1562
2022-01-05 22:12:13 +00:00
Christopher Davis
981a8cea7b panels: Use .boxed-list instead of .content
The `.content` style class is deprecated in favor
of the `.boxed-list` style class, which is named
after the design pattern it's used for.
2021-12-16 12:52:44 -08:00
Georges Basile Stavracas Neto
f598fb3ed6 display: Port to GTK4 2021-12-14 22:34:21 -03:00
Guido Günther
8868510e33 display: Use ComboBox when folded
On small window sizes the ButtonBox can overflow the panel. This is
especially true in single display mode when no other elemnts prevent
shrinking to e.g. 360px width on phones. Use the ComboBox introduced in
632cb3c907 in these cases.

For that we introduce cc_display_settings_refresh_layout() to refresh
the layout when the folded state changes. This can later on be used for
more tweaks to shrink to smaller sizes.
2021-09-25 19:05:28 +00:00
Nishal Kulkarni
7054d8b050 display: deprecation fix
Change g_memdup to g_memdup2 in display.

https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538
2021-08-15 11:29:19 +00:00
Benjamin Berg
9d14644caf display: Prevent snapping unmodified display
Rebuilding the UI would trigger the scale to be re-applied. This in turn
would cause the monitor to be snapped and possibly changing a correct
configuration.

Note that this really is a bug in the snapping code. But that code is a
mess and not fireing the signal is a good thing either way.

Closes: #1412
2021-07-29 16:59:13 +02:00
Marco Trevisan (Treviño)
632cb3c907 display-settings: Show scaling values using a combo-box when more than buttons limit
In case fractional scaling is enabled, depending on the resolution,
mutter may advertise many fractional scaling values which are way more
than MAX_SCALE_BUTTONS, making impossible to use higher fractional
scaling values in high dpi setups.

So, in case scaling is possible, show them as buttons if they fit the
buttons limit, otherwise fallback to a combo box that is consistent with
the rest of the UI and will allow to use any valid scaling value.
2021-06-15 17:30:36 +00:00
Marco Trevisan (Treviño)
266622e99e display-config: Filter invalid modes and scales when setting minimum size
In the front-end we define a minimum size and then we check every time
we iterate through resolutions or scales if such mode is valid.

Since the configuration won't change, we can just filter the invalid
values once when the minimum allowed size is set, so that we can be sure
that the returned scales list is always matching the ones appliable for
the current mode.

The only edge case is when using a cloned configuration, as in this case
the values need to be applied to all the monitors.
However, since we already return a reffed GArray we can just create a
temporary one in this case where unappliable scales are skipped.

As per this we can just use around the scales array length as the number
of visible buttons.
2021-06-15 17:30:36 +00:00
Marco Trevisan (Treviño)
a3392176a9 display-config: Expose the supported scales as a reffed GArray
It's just a nicer api and allows us to avoid having to count all the
elements around or to expose the size via an out value.

Given this is a private API anyway there's no risk for modifying the
array, so it's something safe to use anyways.
2021-06-15 17:30:36 +00:00
Marco Trevisan (Treviño)
89cb1d99cb display-config: Use G_APPROX_VALUE to compare scale doubles
It's not safe to compare double values directly, use G_APPROX_VALUE with
DBL_EPSILON instead.
2021-06-15 17:30:36 +00:00
Marco Trevisan (Treviño)
ca884dc666 display-panel: Clear the variant builder if not showing an OSD
When we've only one monitor active we are not showing the OSD but we're
leaking the variant used to request the shell to show the OSDs.
2021-06-15 17:30:36 +00:00
Guido Günther
5d4c7c5ee0 display-panel: Allow for smaller display sizes
This makes scaling work e.g. on the Librem 5's built-in display which
has a 720x1440 resolution. It's scaled to 200% by default so currently
hitting the 100% button makes it scale to 100% but then the 200% button
vanishes due to assumed too small resultion. Fix that by allowing for
360x720 as well.
2021-02-11 02:44:19 +00:00
Benjamin Berg
feb762dde9 display: Sort resolutions by width first
We used to sort by area, but really, that is more confusing than
helpful. Instead, sort by width then height.

Fixes: #1237
2021-01-21 17:51:17 +01:00
vitorramos
e5b68871f8 display:Fix null pointer dereference 2020-12-13 22:51:09 +00:00
Benjamin Berg
43b444fba3 display: Try harder to select a good and working scale
When swicthing configurations, we should ensure that the selected scale
is valid. This is complicated by the fact that it depends on other
factors whether we need a single global scale or not.

Try to retain the scale that monitors have if possible. If that does not
work, try to use the old scale of the primary monitor everywhere. This
should result in a good behaviour in most situations.

Co-authored-by: Stéphane Travostino <steph@combo.cc>

Fixes: #1038
2020-10-29 20:27:29 +00:00
Benjamin Berg
66c81d8128 display: Fix possible recursion when configuration type changes
The UI rebuilding code may change the configuration type, which in turn
can trigger a UI rebuild. This should not be done if we are already
updating the UI (but must be done otherwise, as that means the user has
chosen to change the configuration).

Fixes: #1141
2020-10-12 03:22:15 +00:00
Carlos Garnacho
6782bc07db display: Hook to PanelOrientationManaged for accelerometer checks
This property gives means for Mutter to determine who is in charge of
display rotation for the built-in panel (us or Mutter). The UI must
reflect this change.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1018
2020-09-05 08:03:44 +00:00
Carlos Garnacho
c89f5ca526 display: Add panel-orientation-managed signal to CcDisplayConfig
So we can track changes on this property.
2020-09-05 08:03:44 +00:00
Carlos Garnacho
b91a83c402 display: Add API to get the PanelOrientationManaged DisplayConfig property
This property indicates whether the builtin panel orientation is managed by
an accelerometer, thus shouldn't be managed by the display panel.
2020-09-05 08:03:44 +00:00
Carlos Garnacho
1ae3ebcfb2 display: Use a proxy for org.gnome.Mutter.DisplayConfig
It will be more convenient than a direct DBus call in future commits.
2020-09-05 08:03:44 +00:00
Adrien Plazas
fd60c313df Stop using HANDY_USE_UNSTABLE_API
It isn't needed anymore since libhandy 0.90.0.
2020-08-18 02:51:04 +00:00
Adrien Plazas
0c71793e7c Stop using the action HdyActionRow child type
It has been dropped and is now the default child type.
2020-07-20 08:04:28 +02:00
Adrien Plazas
f06379e30c Replace HdyColumn by HdyClamp
In libhandy 1, HdyClamp replaces HdyColumn. This stops setting values
when they match HdyClamp's defaults.
2020-07-20 08:04:28 +02:00
Robert Ancell
d82f241a9f display: Add missing parameter checks on CcDisplayConfig methods
Closes #945
2020-04-14 11:25:33 +12:00
Robert Ancell
c0cfbeccff display: Connect signals with g_signal_connect_object in swapped form 2020-03-30 16:18:50 +13:00
Robert Ancell
f00a5e20cb display: Fix wrong widget type used 2020-03-30 01:45:57 +00:00
Robert Ancell
73469d3ba2 display: Replace GtkStack child names with widget references
The child names are easier to break if widgets are changed - this can't be
detected by the compiler.
2020-03-30 01:45:57 +00:00
Jian-Hong Pan
00081c434c display: Fix the resolution going to be tested
Gnome-control-center checks the display modes by
cc_display_config_is_scaled_mode_valid()
  ...
  cc_display_config_dbus_is_scaled_mode_valid()
to exclude unusable low resolutions.

However, it is the current using resolution that going to be tested by
is_scaled_mode_allowed() in is_scale_allowed_by_active_monitors(), if it
is global scaled required or configured as cloning mode originally.
Therefor, it will check current using resolution again and again,
instead of the enumerated one. This leads gnome-control-center building
wrong resolution list on the panel.

This patch replaces the current mode with the enumerated mode to have
the correct resolution to be tested by is_scaled_mode_allowed().

Fixes #903
2020-03-10 17:49:22 +08:00
Robert Ancell
93b14a4339 panel: Move shared GCancellable code into panel class
Make the panel class provide a cancellable that will be cancelled when the panel
is destroyed. Panel implementations can use this and not have to mangage the
cancellable themselves. Consolidate cases where panels had multiple cancellables
that were all being used for this behaviour.
2020-02-03 09:36:24 +13:00
Robert Ancell
19ccad96ae Whitespace fixes for g_autoptr coding style 2019-11-08 09:42:10 +13:00
Mohammed Sadiq
af76f51976 display: Reduce some margins in night light page
So that the display panel can reach smaller widths
2019-11-06 17:12:27 +00:00
Benjamin Berg
0fa4d11477 display: Use correct mode for supported scale checking
Monitors may not always have a mode. This means we cannot look up the
mode on the fly, but instead need to have a heuristic to select a mode
if there is none.

Everything was in place already for this, except that one location was
still doing a fresh lookup, possibly causing a crash.

Fixes: #675
2019-10-21 16:22:25 +13:00
Will Thompson
fd93886f6f display: mark 3 missed translatable strings
"Primary Display" and "Contains top bar and Activities" are visible when
you have >1 display connected and the "Join Displays" option is
selected. I can't work out how to see the "Active Display" string but it
sure looks translatable to me.
2019-10-03 17:18:00 +01:00
Robert Ancell
9a2e821fe5 Initialize autoptr values to NULL.
These cases were safe, but if the code changed this risked freeing uninitialized
memory.
2019-10-03 10:58:38 +13:00
Georges Basile Stavracas Neto
f43238473a display: Replace CC_DISPLAY_*_GET_PRIVATE
Replace the custom and deprecated CC_DISPLAY_*_GET_PRIVATE by
the automatically generated cc_display_*_get_instance_private
functions.
2019-09-10 11:40:39 +00:00
Robert Ancell
97985a664e Remove unused GNOMELOCALEDIR defines 2019-09-09 21:45:53 +00:00