[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara caolanm at redhat.com
Fri May 15 05:41:32 PDT 2015


 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   31 +++++++++++++++++---------
 1 file changed, 21 insertions(+), 10 deletions(-)

New commits:
commit 32bccdb8feebb1145cfb75e61c39c317b4931553
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 15 13:41:00 2015 +0100

    gtk3: get tooltip color
    
    Change-Id: I3328d4fad140793ddd4f6f1f1ac99741c20ba659

diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 7ae15ef..d8cd408 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -1324,15 +1324,28 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     aStyleSet.SetCheckedColorSpecialCase( );
 
     // tooltip colors
-    GdkRGBA tooltip_bg_color, tooltip_fg_color;
-    gtk_style_context_save (pStyle);
-    gtk_style_context_add_class (pStyle, GTK_STYLE_CLASS_TOOLTIP);
-    gtk_style_context_get_color (pStyle, GTK_STATE_FLAG_NORMAL, &tooltip_fg_color);
-    gtk_style_context_get_background_color (pStyle, GTK_STATE_FLAG_NORMAL, &tooltip_bg_color);
-    gtk_style_context_restore (pStyle);
+    {
+        GtkStyleContext *pCStyle = gtk_style_context_new();
+        gtk_style_context_set_screen( pCStyle, gtk_window_get_screen( GTK_WINDOW( mpWindow ) ) );
+        GtkWidgetPath *pCPath = gtk_widget_path_new();
+        guint pos = gtk_widget_path_append_type(pCPath, GTK_TYPE_WINDOW);
+        gtk_widget_path_iter_add_class(pCPath, pos, GTK_STYLE_CLASS_TOOLTIP);
+        pos = gtk_widget_path_append_type (pCPath, GTK_TYPE_LABEL);
+#if GTK_CHECK_VERSION(3,16,0)
+        gtk_widget_path_iter_add_class(pCPath, pos, GTK_STYLE_CLASS_LABEL);
+#endif
+        pCStyle = gtk_style_context_new();
+        gtk_style_context_set_path(pCStyle, pCPath);
+        gtk_widget_path_free(pCPath);
 
-    aStyleSet.SetHelpColor( getColor( tooltip_bg_color ));
-    aStyleSet.SetHelpTextColor( getColor( tooltip_fg_color ));
+        GdkRGBA tooltip_bg_color, tooltip_fg_color;
+        gtk_style_context_get_color(pCStyle, GTK_STATE_FLAG_NORMAL, &tooltip_fg_color);
+        gtk_style_context_get_background_color(pCStyle, GTK_STATE_FLAG_NORMAL, &tooltip_bg_color);
+        g_object_unref( pCStyle );
+
+        aStyleSet.SetHelpColor( getColor( tooltip_bg_color ));
+        aStyleSet.SetHelpTextColor( getColor( tooltip_fg_color ));
+    }
 
     {
         // construct style context for text view
@@ -1442,8 +1455,6 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
         pos = gtk_widget_path_append_type (pCPath, GTK_TYPE_LABEL);
 #if GTK_CHECK_VERSION(3,16,0)
         gtk_widget_path_iter_add_class(pCPath, pos, GTK_STYLE_CLASS_LABEL);
-#else
-        gtk_widget_path_iter_set_name(pCPath, pos, "first tab label");
 #endif
         pCStyle = gtk_style_context_new();
         gtk_style_context_set_path(pCStyle, pCPath);


More information about the Libreoffice-commits mailing list