Commit graph

145 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Robert Ancell
961b41a291 display: Use g_auto for variables 2018-05-29 22:35:32 +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
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
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
Benjamin Berg
3f3c4bed87 display: Reset configuration when switching layouting modes
When switching between screen mirroring and joining displays the
configuration needs to be reset. Otherwise the monitor scaling will
not be set back to the current scaling again.

Split out the code to reset the current configuration and call that when
the mode is switched to ensure the changes are minimal.

https://bugzilla.gnome.org/show_bug.cgi?id=790768
2017-12-08 16:09:58 +00:00
Elias Entrup
154101448a display: Wrap frame subtitle label
Currently, the display window is very wide due to the subtitle label.
This patch adds line wrapping to the label and sets xalign to 0.

https://bugzilla.gnome.org/show_bug.cgi?id=790449
2017-11-16 18:07:40 +01:00
Rui Matos
cc329621e2 display: Ignore disabled and closed builtin panels in layout geometry
Extend the existing checks for this kind of outputs to the layout
geometry routines.

https://bugzilla.gnome.org/show_bug.cgi?id=789711
2017-11-15 15:10:15 +01:00
Rui Matos
46c2d43e62 display: Replace modal dialogs with popovers
The existing modal dialogs are cumbersome to use so let's replace them
with popovers that dismiss themselves automatically when an item is
activated.

https://bugzilla.gnome.org/show_bug.cgi?id=786726
2017-11-10 17:34:57 +01:00
Rui Matos
23d5ea29aa display: Round the displayed scale values logically
Mutter currently generates 4 scales per integer scale. Knowing that,
we can nicely "round" the values we display to what the ideal scales
are even though the real values might be skewed since mutter creates
scale values close to the ideal ones that yield integer logical sizes.

https://bugzilla.gnome.org/show_bug.cgi?id=786922
2017-08-28 18:58:05 +02:00
Rui Matos
bbccf27488 display: Simplify scale filtering
This is prone to miss intermediate values that users might actually
want to use so, for now, just show the 5 first scales.
2017-08-28 18:58:05 +02:00
Rui Matos
7ed4efef50 display: Show refresh rates with two digits after the radix
One digit isn't enough to distinguish between some modes. We probably
should do better mode filtering and/or grouping but that needs to
happen in mutter.
2017-08-25 16:49:02 +02:00
Rui Matos
6a9274a165 display: Don't show inactive monitors in the arrangement widget
Inactive monitors are not part of the configuration global geometry,
i.e. they don't have a position set, so it doesn't make sense to show
them.
2017-08-25 16:49:02 +02:00
Rui Matos
dae238cc5f display: Avoid crashing when a monitor doesn't have a mode set
In this case just avoid showing information we don't have.
2017-08-25 16:49:02 +02:00
Rui Matos
337802315c display: Ensure we generate the UI initially on two output mode
We rely on visible-child-name notifications to generate the
appropriate UI, unfortunately it doesn't happen for the first added
stack page if the widget is already visible. Work around this by
adding a dummy page first.
2017-08-25 16:49:02 +02:00
Rui Matos
6c4eb9fc86 display: Fix the two output UI to start with the current configuration
gtk_stack_set_visible_child_name() doesn't actually make a child
visible if the child widget isn't visible already which means we'd
always start in the first ("join") stack page even if the currently
applied configuration is one of the others.

https://bugzilla.gnome.org/show_bug.cgi?id=786767
2017-08-25 15:17:12 +02:00
Rui Matos
57a82a89cd display: Cancel pending changes on Escape key press 2017-08-23 18:32:28 +02:00
Rui Matos
566d2cf6ac display: Add mnemonics to Cancel and Apply buttons 2017-08-23 18:32:28 +02:00
Rui Matos
a8071322a7 display: Move scale row above refresh rate
It's a bit closer to the mockups, in spirit at least.
2017-08-23 18:32:28 +02:00
Rui Matos
566b0c137c display: Make rows created for a new current output be the same size
We need the rows size group to exist when creating output UIs.
2017-08-23 18:32:27 +02:00
Rui Matos
0a0ac31b51 display: Handle lid being closed a bit better
If the lid is closed we shouldn't allow the builtin display to be
configured.
2017-08-23 18:32:27 +02:00
Rui Matos
088f35617c display: Make scale row be the same height as others 2017-08-23 18:32:27 +02:00
Rui Matos
e5a1afee9c display: Fix a crash when opening the panel with the lid closed
The configuration manager might not be ready yet when we're called
from the lid state monitor handler. Don't do anything in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=786080
2017-08-22 19:26:39 +02:00
Rui Matos
ef0cbf45f3 display: Make arrangement and scale rows non-activatable 2017-08-22 19:21:41 +02:00
Rui Matos
47919bcfb1 display: Fix underscanning switch [de]activating the output instead 2017-08-22 19:21:41 +02:00
Rui Matos
7c7c0b75d5 display: Switch to a toggle buttons design for scale
The slider design wasn't fit for this since we allow only a finite set
of scales.
2017-08-22 19:21:41 +02:00
Rui Matos
c50062a48b display: Update the two display mode switcher design
This makes us follow the updated design mockups more closely.
2017-08-22 19:21:41 +02:00
Rui Matos
90cf23a70a display: Redraw the arrangement area widget when outputs change
This ensures the arrangement area always reflects the current
changes.
2017-08-22 19:21:41 +02:00
Rui Matos
52d61d52b2 display: Force content to always have a fixed minimum width
This makes switching between configurations and/or active monitor look
a bit more polished.
2017-08-21 14:47:17 +02:00
Rui Matos
93a3bbe0fc display: Remove a few no longer needed variables
These are not needed since last commit.
2017-08-21 14:47:17 +02:00
Jonas Ådahl
ff30244c5c panels/display: Remove support for old config system
As mutter now has removed the legacy monitor config system and the
associated property on org.gnome.Mutter.DisplayConfig, also remove the
support from gnome-control-center.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-08-21 12:33:38 +08:00
Rui Matos
c0f686bb0f display: Re-design the panel
This implements most of the new Display panel re-design by Allan
Day.

Left out for now is brightness setting which still is in the
Power panel because the plumbing layers don't yet associate backlights
with outputs.

Also left out is the presentation mode and trimming of options due to
hardware constraints since we don't have a mutter implementation for
those yet.

https://bugzilla.gnome.org/show_bug.cgi?id=785949
2017-08-09 19:27:08 +02:00