[evince/wip/gpoo/gtk4-rebase-port: 83/96] ev-view: detect the selection color for Default theme




commit fc320c23753cda0aa2d3682a7f12727b6b5e5dea
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date:   Mon Aug 30 16:57:15 2021 +0800

    ev-view: detect the selection color for Default theme
    
    Since the previewer use Default theme by default.
    
    Signed-off-by: Qiu Wenbo <qiuwenbo kylinos com cn>

 libview/ev-view.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 934938ffd..83c0340ea 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -7193,17 +7193,28 @@ _ev_view_get_selection_colors (EvView  *view,
        GtkWidget       *widget = GTK_WIDGET (view);
        GtkStyleContext *context = gtk_widget_get_style_context (widget);
 
-       if (bg_color) {
-                gtk_style_context_lookup_color (context, "accent_bg_color", bg_color);
+       if (bg_color &&
+           !gtk_style_context_lookup_color (context, "accent_bg_color", bg_color) &&
+           !gtk_style_context_lookup_color (context, "theme_selected_bg_color", bg_color)) {
+               bg_color->red = 0;
+               bg_color->green = 0.623;
+               bg_color->blue = 1.;
+               bg_color->alpha = 1.;
+       }
 
-               if (gtk_widget_has_focus (widget))
-                       bg_color->alpha = 0.3;
-               else
-                       bg_color->alpha = 0.6;
-        }
+       if (gtk_widget_has_focus (widget))
+               bg_color->alpha = 0.3;
+       else
+               bg_color->alpha = 0.6;
 
-       if (fg_color)
-               gtk_style_context_lookup_color (context, "accent_fg_color", fg_color);
+       if (fg_color &&
+           !gtk_style_context_lookup_color (context, "accent_fg_color", fg_color) &&
+           !gtk_style_context_lookup_color (context, "theme_selected_fg_color", fg_color)) {
+               fg_color->red = 1.;
+               fg_color->green = 1.;
+               fg_color->blue = 1.;
+               fg_color->alpha = 1.;
+       }
 }
 
 static void


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