Commit graph

17 commits

Author SHA1 Message Date
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
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
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
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
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
9e4c6e89a0 display: Use the new API to determine whether a scale is valid 2019-07-15 03:14:23 +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
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
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
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