[gnome-control-center/wip/carlosg/display-papercuts: 7/11] display: Set CSS class on the display arrangement widget




commit 2f9ec8b0a843a75ddb193b39141e1453f75206da
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 5 18:29:28 2022 +0200

    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.

 panels/display/cc-display-arrangement.c | 7 ++-----
 panels/display/display-arrangement.css  | 6 +++---
 2 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/panels/display/cc-display-arrangement.c b/panels/display/cc-display-arrangement.c
index efe8d5718..75c5f3df3 100644
--- a/panels/display/cc-display-arrangement.c
+++ b/panels/display/cc-display-arrangement.c
@@ -523,9 +523,6 @@ cc_display_arrangement_draw (GtkDrawingArea *drawing_area,
 
   cc_display_arrangement_update_matrices (self);
 
-  gtk_style_context_save (context);
-  gtk_style_context_add_class (context, "display-arrangement");
-
   /* Draw in reverse order so that hit detection matches visual. Also pull
    * the selected output to the back. */
   outputs = g_list_copy (cc_display_config_get_monitors (self->config));
@@ -635,8 +632,6 @@ cc_display_arrangement_draw (GtkDrawingArea *drawing_area,
       gtk_style_context_restore (context);
       cairo_restore (cr);
     }
-
-  gtk_style_context_restore (context);
 }
 
 static gboolean
@@ -849,6 +844,8 @@ cc_display_arrangement_class_init (CcDisplayArrangementClass *klass)
                 G_SIGNAL_RUN_LAST,
                 0, NULL, NULL, NULL,
                 G_TYPE_NONE, 0);
+
+  gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "display-arrangement");
 }
 
 static void
diff --git a/panels/display/display-arrangement.css b/panels/display/display-arrangement.css
index 22775b54b..6b2bdcf25 100644
--- a/panels/display/display-arrangement.css
+++ b/panels/display/display-arrangement.css
@@ -1,16 +1,16 @@
 
-.display-arrangement.monitor {
+display-arrangement.monitor {
   border: solid 1px @borders;
   margin: 0px 0px 1px 1px;
   background: @theme_bg_color;
   padding: 0.4em;
 }
 
-.display-arrangement.monitor.primary {
+display-arrangement.monitor.primary {
   border-top: 0.4em solid #000000;
 }
 
-.display-arrangement.monitor-label {
+display-arrangement.monitor-label {
   font-size: larger;
   font-weight: bold;
   border-radius: 0.3em;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]