Commit graph

465 commits

Author SHA1 Message Date
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
Benjamin Berg
4db431d7f1 display: Correctly round scaled monitor size
We were converting the floating point numbers to integers using a cast,
which causes them to be always rounded down. The result is that a
monitor may be too small by a pixel, creating broken configurations.

Also fix the same issue when calculating whether a scale should be
supported.

See https://gitlab.gnome.org/GNOME/mutter/issues/412
2019-01-18 11:19:16 +01:00
Jeremy Bicha
d9e07460ae night-light: Add a frame around Schedule section for accessibility
This way the Schedule label is correctly read as a header
for the section by screen readers
2019-01-07 10:57:17 -05:00
Jeremy Bicha
7f6d19441f night-light: Add mnemonic_widget and ATK descriptions for a11y 2019-01-07 10:41:32 -05:00
Jeremy Bicha
0858fd5d36 night-light: Turn on Night Light for 5 seconds when adjusting Color Temp
Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/147
2019-01-07 14:13:38 +00:00
Jeremy Bicha
bc68377e77 night-light: minor adjustments to dialog layout
- Move Schedule label to its own row
- Center align "From" and "To" labels

https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/displays/night-light.png
2019-01-07 14:13:38 +00:00
Jeremy Bicha
d1fc7e64b3 night-light: Add Color Temperature slider
This adds a scale to change the color temperature from 3000K to
6000K. A mark is added to the default value and a second one for
aesthetics.

Initial implementation by Benjamin Berg
Color choices by Daniel Foré and elementary OS

Closes #147
2019-01-07 14:13:37 +00:00
Jeremy Bicha
a5f902c124 night-light: Update UI when gsettings schemas are nonwritable
Presumably, they are nonwritable because a system administrator has locked
these settings down.

https://help.gnome.org/admin/system-admin-guide/stable/dconf-lockdown.html

If Night Light is locked on, don't show the Off button.

If Night Light is locked off, don't show the Manual or "Sunset to Sunrise" buttons.

If Manual is force-enabled, don't show "Sunset to Sunrise" or the other way around.
2019-01-07 14:13:37 +00:00
Jeremy Bicha
07c1de1893 night-light: Move Off to the schedule switcher row
As recommended by the mockup:
https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/displays/night-light.png
2019-01-07 14:13:37 +00:00
Jeremy Bicha
e5d8b6275a night-light: Drop the sunrise/sunset indicator
It's not in the latest design mockup:

https://gitlab.gnome.org/Teams/Design/settings-mockups/raw/master/displays/night-light.png
2019-01-07 14:13:37 +00:00
Alex Hirsch
b4809cd210 display: Mode compare takes interlaced into account
When changing the display mode, the apply button does not appear if the
current mode and new mode differ only in their interlaced flag.

The display mode comparison function now takes the interlaced flag into
account.
2018-11-10 20:38:02 +01:00
Benjamin Berg
c9fc833ddc display: typedef data structures related to snapping
Simply a small cleanup to typedef the relevant data structures.
2018-10-24 10:36:13 +02:00
Benjamin Berg
32a6f9befa display: Run snapping after certain modifications
Anything that affects the size of the screen (or its existance) may
result in invalid configurations. Do a small effort in trying to fix
this by calling into the snapping algorithm for the modified monitor.

Addresses issue #247 to a large extend.
2018-10-24 10:36:13 +02:00
Benjamin Berg
adf7cb26ea display: Add function to run the snapping algorithm on a monitor
This is a function working only on a configuration which runs the
snapping with infinite snapping. This allows forcing a monitor that has
been modified to be adjacent to at least one monitor.
2018-10-24 10:36:13 +02:00
Benjamin Berg
1ad0eaba7c display: Do not require widget for snapping
Just move everything needed into the SnapData struct.
2018-10-24 10:36:13 +02:00
Daniel Drake
79dc78b819 display: Hide unsupported resolutions again
Previously, low resolutions were hidden from the control center
because when such display modes are activated, GNOME is unusable;
many important UI elements do not fit on the screen at all.
https://bugzilla.gnome.org/show_bug.cgi?id=626822

This was removed in c0f686bb0f
without explanation; reinstate it here.

Also prevent the scaling from being selected or activated if the
effective scaled resolution would result in an equivalently low
resolution being used.
2018-10-17 22:08:03 +00:00
Benjamin Berg
f95ded101c display: Sync scale button state after update
We need to re-sync the scale button scale when updating the state
dynamically. Otherwise changing the resolution will always show a scale
of 100% (first item) rather than the actual active one.
2018-10-17 22:08:03 +00:00
Benjamin Berg
d534f67047 display: Do not show scale and refresh rate rows
The visibility is explicitly controlled in the functions that create the
rows in question. This regression was introduced in commit 3d177b67
(display: Don't use gtk_widget_show_all).
2018-10-17 22:08:03 +00:00
Robert Ancell
04b0b68be4 display: Fix compile warnings using g_clear_pointer 2018-10-17 09:19:37 +13:00
Robert Ancell
044eeb0d06 display: Stop night light dialog being destroyed twice
The night light dialog is both marked as "destroy_with_parent" and explicitly
destroyed in the panel. Drop one of these.

Causes the warning after opening the dialog then closing the app:
(gnome-control-center:19887): Gtk-CRITICAL **: 11:00:01.370: gtk_widget_destroy: assertion 'GTK_IS_WIDGET (widget)' failed

This bug was introduced in ed36688c58
2018-10-14 22:51:22 +00:00
Robert Ancell
3d177b6769 display: Don't use gtk_widget_show_all
It is removed in GTK+ 4
2018-10-11 22:21:34 +00:00
Benjamin Berg
22a512f032 display: Correctly add minor axis to snapping
There was an issue where the "minor" axis snapping would not be done if
the "major" axis snapping had a zero distance. This could be seen when e.g.
moving a monitor on the right up/down slightly. In that case, no
snapping to align the bottom/top edges were done unless you also moved
the mouse sideways a bit.

Fixes #211
2018-10-04 04:58:22 +00:00
Benjamin Berg
57578e1331 display: Reset the window title after removing custom headerbar
As the main headerbar used by the shell is split, the title is not
propagated to the window. However, the "apply" header bar is not split
and the title is propagated to the toplevel GtkWindow.

Fix this issue by resetting the window title again.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/81
2018-08-03 14:43:47 +02:00
Georges Basile Stavracas Neto
6c28263e6b night-light: Uncomment signal handler
This was mistakenly introduced ed36688c and was causing
a crash when opening the Night Light dialog multiple times.
2018-07-23 11:36:39 -03:00
Robert Ancell
961b41a291 display: Use g_auto for variables 2018-05-29 22:35:32 +00:00
Robert Ancell
72a3516389 display: Replace ifdefs with #pragma once 2018-05-29 21:53:28 +00:00
Robert Ancell
40520d7b7f display: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-29 21:53:28 +00:00
Georges Basile Stavracas Neto
ed36688c58 night-light: Rework implementation
This commit improves the Night Light code in various
ways:

 * Turn it into a template class, subclass of GtkDialog,
   and adapts all the code to reflect that.

 * Update the code style in various places, to make it
   more conformant with the documented code style.

 * Reorganize the code a bit, moving functions around,
   to make it more conformant with the documented order.
2018-05-29 12:30:16 -03:00
Georges Basile Stavracas Neto
f0bba59699 night-light: Use "#pragma once" in header
Let's use modern code practices around.
2018-05-29 12:29:42 -03:00
Robert Ancell
4aee26cc77 display: Fix double free of GError 2018-05-29 15:01:03 +12:00
Georges Basile Stavracas Neto
02f0353fc4 display: Various style fixes
It makes @feaneron happier, and fixes a couple of
memory leaks.
2018-05-28 21:24:41 -03:00
Benjamin Berg
9a4449dfa9 display: Implement major/minor axis snapping and infinit for edges
This improves the snapping behaviour in a number of ways. It allows
increasing the snapping distance while still helping the user to align
monitors by snapping a different distance for the minor axis. The patch
also allows setting this distance to infinity so that we get the correct
behaviour in the case of two monitors for the corners.
2018-05-28 20:57:20 -03:00
Benjamin Berg
d54c356aa5 display: Enable infinit snapping when arranging two monitors
Two monitors are a special case where it is easy to ensure that the
monitors are always adjacent to each other by special casing the
snapping code. Do so by increasing the snapping distance to infinity and
adding extra snapping points so that corner cases are covered.
2018-05-28 20:57:20 -03:00
Benjamin Berg
08a7f7cb53 display: Move output utility functions into CcDisplayMonitor
This adds the following API:
 * cc_display_config_get_ui_sorted_monitors
   Returns the monitors in UI order
 * cc_display_config_count_useful_monitors
   Counts the useful monitors (active and usable)
 * cc_display_monitor_is_useful
   Checks if a monitor is active and usable
 * cc_display_monitor_is_useable
   Check if a monitor is marked as useable
 * cc_display_monitor_set_usable
   Used to mark builtin monitors as unusable if the lid is closed
 * cc_display_monitor_get_ui_*
   Get the UI number and strings for display

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00
Benjamin Berg
6fa9368f38 display: Remove incorrect comment
The comment was not updated when the workaround in the code was removed.

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00
Benjamin Berg
e17e9daa19 display: Remove unused old display arrangement code
Remove the code that has become unused with the new arrangement widget.

There are more possible cleanups as there is some code duplication
between cc-display-panel.c and cc-display-arrangment.c at this point.

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00
Benjamin Berg
199a7117f2 display: Add new arrangement widget and hook it up
This commits adds a new arrangement widget, refactoring the existing
code and addressing a number of issues:
 * Forced snapping made laying out more than 2 monitors hard
 * Random gaps would be shown between monitors
 * The scaling was fixed and usually tiny

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00
Benjamin Berg
32be5bd1d9 display: Add signal to monitor notifying about position changes
This is in preparation to a new arrangement widget.

https://bugzilla.gnome.org/show_bug.cgi?id=786971
2018-05-28 20:57:20 -03:00
Benjamin Berg
faaf402c82 display: Re-indent cc-display-config.h
This commit has no functional changes.
2018-05-28 20:57:20 -03:00
Andrea Azzarone
f9b65046e9 night-light-dialog: Ignore G_IO_ERROR_CANCELLED errors
We should ignore G_IO_ERROR_CANCELLED errors and avoid displaying useless
warnings. Also use g_clear_object instead of g_object_unref.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/87
2018-05-12 02:31:12 +00:00
Andrea Azzarone
1d26f63b18 night-ligth-dialog: Avoid dereferencing invalid pointer
dialog_got_proxy_cb and dialog_got_proxy_props_cb may be called after the
instance of CcNightLightDialog has been disposed. Make sure 'self' pointer is
not dereferenced if not valid.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/86
2018-05-10 00:56:19 +02:00
Benjamin Berg
c2f601a9d4 Move common panel code from shell/ to panel/common
This creates a new static library called libwidget which the shell links
against.
2018-04-17 15:26:59 +02:00
Georges Basile Stavracas Neto
cbf0dc99da display: Cache the D-Bus proxy 2018-04-06 22:23:38 -03:00
Benjamin Berg
adf5a42f01 display: Show insensitive apply button for invalid configurations
When the user creates temporary invalid configurations the dialog used
to hide the apply button as if no change had been done so far. Change
this to show the normal "Apply"/"Cancel" titlebar but make the "Apply"
button insensitive and modify the title to indicate the error.

Unfortunately we don't currently get the reason in a way that we could
translate it. Ideally we would special case common error scenarios and
present the user with a better explanation or even correct the mistake.

See https://bugzilla.gnome.org/show_bug.cgi?id=790891 for the related
mutter bug.

https://bugzilla.gnome.org/show_bug.cgi?id=790792
2018-03-29 12:09:59 +02:00
Mohammed Sadiq
f6b3afb9d2 display: Increase popover margins to match mockup
https://bugzilla.gnome.org/show_bug.cgi?id=793165
2018-03-16 02:32:55 -03:00
Mario Sanchez Prada
ca9228bb59 display: Early return in monitor_labeler_show() if no outputs are available
The GVariant constructed here would be useless otherwise, since there are
no outputs to show the labels for. Besides, calling g_variant_builder_close
in this scenario would hit an assertion and the program would crash.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/12
2018-03-14 23:27:44 +00:00
Piotr Drąg
7265bd53a0 Add translator comments to .desktop files
Icons are confusing translators, and gettext
is unlikely to get fixed any time soon.
2018-02-23 18:49:35 +01:00
danielps
77aaf3146b display: Fix night light minute selection
The night light schedule dialog stores the time as a single floating
point value, which is then converted into hours and minutes for the
time selection fields.

Previously, the minutes were calculated using the remainder of the
stored value and the hours. This caused undesired behaviour when the
hour field was set to zero, as fmod(value, 0) returns NaN. As a result,
the user was not able to set the time between 00:00 and 00:59.

This patch rewrites the time retrieval logic using modf.

https://bugzilla.gnome.org/show_bug.cgi?id=792944
2018-01-30 09:38:11 -02:00
Iñigo Martínez
0dd386f405 build: Migrate from Intltool to Gettext
Recent versions of Gettext are able to translate several formats
that are used in GNOME applications. This patch migrates from
Intltool to Gettext by using meson's i18n features.

https://bugzilla.gnome.org/show_bug.cgi?id=787588
2018-01-23 10:49:31 +01:00
Rui Matos
1fe3f5c5fe display: Add support for mutter's global scale requirement
If mutter requires the same scale on all logical monitors we must
propagate a scale set on one monitor to the remaining ones or we'll
fail validation leaving users wondering why it doesn't work.

https://bugzilla.gnome.org/show_bug.cgi?id=790809
2018-01-21 12:24:54 -02:00