Commit graph

18 commits

Author SHA1 Message Date
Pablo Correa Gómez
624023d633
display: avoid unnecessary gtk_style_context_get_margin call
The margin went unused after the monitor labels moved to the center
of the displays.

Fixes: e7e80efc ("display: Change appearance and size of monitor labels")
2022-07-18 17:58:46 +02:00
Carlos Garnacho
e7e80efcbc display: Change appearance and size of monitor labels
Make these rounded everywhere, and have a lighter background and be
centered as per the latest mockups.

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1850
2022-07-08 13:28:44 -03:00
Carlos Garnacho
2f9ec8b0a8 display: Set CSS class on the display arrangement widget
Instead of doing it via push/pop on the style context at draw time.
This way we will be able to specify and propagate some font style
to the monitor label, since style fonts are per-widget.
2022-07-08 13:28:44 -03:00
Georges Basile Stavracas Neto
f598fb3ed6 display: Port to GTK4 2021-12-14 22:34:21 -03:00
Benjamin Berg
afe8661704 display: Allow config to be modified in arrangement widget 2019-01-29 12:05:43 +01:00
Benjamin Berg
be3fbd8bef display: Redraw arrangement widget after monitor selection change 2019-01-29 12:05:43 +01:00
Benjamin Berg
e520ab8952 display: Chain up CcDisplayArrangement finalize handler 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
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
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
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
Robert Ancell
961b41a291 display: Use g_auto for variables 2018-05-29 22:35:32 +00: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
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