Commit graph

427 commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
82c87578cd window: Install action to navigate main leaflet
This allows implementing the back button of panel titlebars
trivially, which is also done in this commit.
2022-01-20 02:23:42 +00:00
Georges Basile Stavracas Neto
b756f1e07a display: Rework titlebar handling entirely
Move all titlebars to the panel itself. Add an overlay with
the apply titlebar, which shows the apply / cancel titlebar
above whatever current titlebar is visible.

Add titlebars to the Night Light, and display settings pages.
2022-01-20 02:23:42 +00:00
Georges Basile Stavracas Neto
4300a4a290 panels: Use new CcPanel helpers for title widgets
This should significantly simplify these panels, by not forcing
them to override GObject.constructed all the time. Most panels
were quite straightfoward.
2022-01-20 02:23:42 +00:00
Georges Basile Stavracas Neto
0ab20af9ba panels: Switch to CcPanel content
Start porting panels to the new panel format. This commit
temporarily makes panels have two titlebar, which will be
fixed soon.
2022-01-20 02:23:42 +00:00
Robert Mader
375bbc333c display: Always show refresh rate
Refresh rates are an important information for users, even if they
can't change them.
This is especially true for cases where knowledge of the refresh
rate may influence the decission about the resolution to use.
Consider the example where a display may support `3840x2160@60Hz`
and `2560x1440@144Hz`. When choosing `3840x2160` as resolution,
the refresh rate will likely get hidden, making the user unaware
of the fact that they will maybe not get what they want (potentially
144Hz).

So follow the example of e.g. the sound panel where input and output
devices are listed in dropdowns, even if they are the only options
selectable.

Note: while this is a design change, for a big group of users this
won't actually change the default experience as Mutter until recently
had a bug to duplicate 60Hz modes in many cases. So most laptop users
already saw the refresh rate panel in previous Gnome versions,
dispite it having little use.

See also:
fb9564b87b
2022-01-18 23:48:42 +01:00
Georges Basile Stavracas Neto
9d324452c5 display: Use AdwLeaflet in CcDisplayPanel
This makes the transition between the main page, night light,
and display preferences more inline with other GNOME apps
using GTK4.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
06caebd0ba display: Remove SINGLE mode
We control monitors individually now, making the SINGLE mode
unnecessary.

Remove the SINGLE monitor mode, and replace it with JOIN if
required.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
1d6bab12cf display: Add enabled switch to CcDisplaySettings
This allow enabling and disabling each display individually.
2022-01-18 17:03:14 +00:00
Georges Basile Stavracas Neto
ec2632de92 display: Make CcDisplaySettings subclass GtkBox
We'll need more widgets under it soon.
2022-01-18 17:03:14 +00:00
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