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

Caolán McNamara caolanm at redhat.com
Fri Feb 12 11:37:44 UTC 2016


 vcl/inc/unx/gtk/gtkgdi.hxx                |    2 +
 vcl/source/control/fixedhyper.cxx         |    5 ++--
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |   35 +++++++++++++++---------------
 3 files changed, 23 insertions(+), 19 deletions(-)

New commits:
commit 6603564716694a1211e9a451bf868b2fc8f29460
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 12 11:36:16 2016 +0000

    gtk3: we don't render whatever a CTRL_LISTNET is
    
    Change-Id: I21a64250182b4630fa41583d7536081adf441ec5

diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 1cda456..675b098 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -1316,6 +1316,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
         }
         break;
     case CTRL_LISTNET:
+        return true;
         break;
     case CTRL_TAB_PANE:
         context = mpNotebookStyle;
commit 06e8c58acb6ba667f8fd8c5587a3b3037324971a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 12 11:32:53 2016 +0000

    Related: rhbz#1287593 subissue 6, get suitable hyperlink colors for dark theme
    
    Change-Id: Ieb5ed52fa8a9c26b3e839388a58cff295166eed9

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 13ac198..2bb6029 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -36,6 +36,7 @@
 enum class GtkControlPart
 {
     Button,
+    LinkButton,
     CheckButton,
     CheckButtonCheck,
     RadioButton,
@@ -100,6 +101,7 @@ public:
 private:
     GtkWidget       *mpWindow;
     static GtkStyleContext *mpButtonStyle;
+    static GtkStyleContext *mpLinkButtonStyle;
     static GtkStyleContext *mpEntryStyle;
     static GtkStyleContext *mpTextViewStyle;
     static GtkStyleContext *mpVScrollbarStyle;
diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx
index da53f9a..7f940dd2 100644
--- a/vcl/source/control/fixedhyper.cxx
+++ b/vcl/source/control/fixedhyper.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <vcl/fixedhyper.hxx>
+#include <vcl/svapp.hxx>
 
 FixedHyperlink::FixedHyperlink(vcl::Window* pParent, WinBits nWinStyle)
     : FixedText(pParent, nWinStyle)
@@ -35,8 +36,8 @@ void FixedHyperlink::Initialize()
     // to underline
     aFont.SetUnderline( LINESTYLE_SINGLE );
     SetControlFont( aFont );
-    // changes the color to light blue
-    SetControlForeground( Color( COL_LIGHTBLUE ) );
+    // changes the color to link color
+    SetControlForeground( Application::GetSettings().GetStyleSettings().GetLinkColor() );
     // calculates text len
     m_nTextLen = GetCtrlTextWidth( GetText() );
 }
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 33117b0..1cda456 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -22,6 +22,7 @@
 #include <boost/optional.hpp>
 
 GtkStyleContext* GtkSalGraphics::mpButtonStyle = nullptr;
+GtkStyleContext* GtkSalGraphics::mpLinkButtonStyle = nullptr;
 GtkStyleContext* GtkSalGraphics::mpEntryStyle = nullptr;
 GtkStyleContext* GtkSalGraphics::mpTextViewStyle = nullptr;
 GtkStyleContext* GtkSalGraphics::mpVScrollbarStyle = nullptr;
@@ -821,6 +822,15 @@ static GtkStyleContext* createStyleContext(GtkControlPart ePart, GtkStyleContext
             gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
 #endif
             break;
+        case GtkControlPart::LinkButton:
+            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+            gtk_widget_path_iter_set_object_name(path, -1, "button");
+#else
+            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
+#endif
+            gtk_widget_path_iter_add_class(path, -1, "link");
+            break;
         case GtkControlPart::CheckButton:
             gtk_widget_path_append_type(path, GTK_TYPE_CHECK_BUTTON);
 #if GTK_CHECK_VERSION(3, 19, 2)
@@ -1989,23 +1999,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     aStyleSet.SetMenuHighlightTextColor( aHighlightTextColor );
 
     // hyperlink colors
-    GdkColor *link_color = nullptr;
-    gtk_style_context_get_style(pStyle,
-                                 "link-color", &link_color,
-                                 nullptr);
-    if (link_color) {
-        aStyleSet.SetLinkColor(getColorFromColor(*link_color));
-        gdk_color_free(link_color);
-    }
-
-    link_color = nullptr;
-    gtk_style_context_get_style(pStyle,
-                                "visited-link-color", &link_color,
-                                nullptr);
-    if (link_color) {
-        aStyleSet.SetVisitedLinkColor(getColorFromColor(*link_color));
-        gdk_color_free(link_color);
-    }
+    gtk_style_context_set_state(mpLinkButtonStyle, GTK_STATE_FLAG_LINK);
+    gtk_style_context_get_color(mpLinkButtonStyle, gtk_style_context_get_state(mpLinkButtonStyle), &text_color);
+    aStyleSet.SetLinkColor(getColor(text_color));
+    gtk_style_context_set_state(mpLinkButtonStyle, GTK_STATE_FLAG_VISITED);
+    gtk_style_context_get_color(mpLinkButtonStyle, gtk_style_context_get_state(mpLinkButtonStyle), &text_color);
+    aStyleSet.SetVisitedLinkColor(getColor(text_color));
 
 #if GTK_CHECK_VERSION(3, 19, 2)
     {
@@ -2344,6 +2343,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
     getStyleContext(&mpTextViewStyle, gtk_text_view_new());
 
     mpButtonStyle = createStyleContext(GtkControlPart::Button);
+    mpLinkButtonStyle = createStyleContext(GtkControlPart::LinkButton);
 
     GtkWidget* pToolbar = gtk_toolbar_new();
     mpToolbarStyle = gtk_widget_get_style_context(pToolbar);


More information about the Libreoffice-commits mailing list