From 355a401a67ffe90f3cb92e94edfa160818e183df Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 28 Apr 2020 14:51:03 +0000 Subject: [PATCH] CtrlLib: Fixed chgtk3 issue for Raspbian git-svn-id: svn://ultimatepp.org/upp/trunk@14396 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/ChGtk3.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/uppsrc/CtrlLib/ChGtk3.cpp b/uppsrc/CtrlLib/ChGtk3.cpp index 7a1bc5c3e..3cc24fa5a 100644 --- a/uppsrc/CtrlLib/ChGtk3.cpp +++ b/uppsrc/CtrlLib/ChGtk3.cpp @@ -229,6 +229,20 @@ Color GetBackgroundColor() return AvgColor(b); } +Color GetInkColorBk() +{ + Color ink = GetInkColor(); + Color bk = GetBackgroundColor(); + if(Diff(ink, bk) < 100) { + Color dk = SColorText(); + Color wh = SColorPaper(); + if(IsDark(wh)) + Swap(dk, wh); + return IsDark(bk) ? wh : dk; + } + return ink; +} + Image Gtk_Icon(const char *icon_name, int size) { GdkPixbuf *pixbuf = gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(), icon_name, @@ -372,10 +386,11 @@ void ChHostSkin() for(int i = 0; i < 4; i++) { Gtk_State(i); s.look[i] = Hot3(CairoImage()); - s.monocolor[i] = s.textcolor[i] = GetInkColor(); + Color ink = GetInkColorBk(); + s.monocolor[i] = s.textcolor[i] = ink; if(pass == 0) { button[i] = WithHotSpots(CairoImage(100, 100), DPI(4), DPI(4), 0, 0); - text[i] = GetInkColor(); + text[i] = ink; } } s.ok = Gtk_IconAdjusted("gtk-ok", DPI(16));