@@ -3299,36 +3299,36 @@ void initializeSystemColorsTitle(long shellContext) {
32993299}
33003300
33013301private void initializeSystemColorsLink () {
3302- /*
3303- * Note: GTK has two types of link at least:
3304- *
3305- * 1) GtkLabel with HTML-like markup
3306- * 2) GtkLinkButton
3307- *
3308- * The 'HighContrast' theme has different colors for these.
3309- * GtkLabel is easier to work with, and obtained color matches color in previous SWT versions.
3310- */
3311-
3312- // The 'Clearlooks-Phenix' theme sets 'color:' for 'window {' css node, so a stand-alone label is not enough
3313- long window ;
3314- if (GTK .GTK4 ) {
3315- window = GTK4 .gtk_window_new ();
3316- } else {
3317- window = GTK3 .gtk_window_new (GTK .GTK_WINDOW_TOPLEVEL );
3318- }
3319- long label = GTK .gtk_label_new (null );
33203302 if (GTK .GTK4 ) {
3321- GTK4 .gtk_window_set_child (window , label );
3322- } else {
3323- GTK3 .gtk_container_add (window , label );
3324- }
3303+ /*
3304+ * GTK 4 needs the "link" CSS class to retrieve the correct link color.
3305+ */
3306+ long window = GTK4 .gtk_window_new ();
3307+ long button = GTK .gtk_button_new ();
3308+ GTK4 .gtk_window_set_child (window , button );
3309+ GTK .gtk_widget_add_css_class (button , Converter .wcsToMbcs ("link" , true ));
33253310
3326- long styleContextLink = GTK .gtk_widget_get_style_context ( label );
3327- COLOR_LINK_FOREGROUND_RGBA = styleContextGetColor ( styleContextLink , GTK .GTK_STATE_FLAG_LINK );
3311+ long styleContextButton = GTK .gtk_widget_get_style_context ( button );
3312+ COLOR_LINK_FOREGROUND_RGBA = styleContextGetColor ( styleContextButton , GTK .GTK_STATE_FLAG_LINK );
33283313
3329- if (GTK .GTK4 ) {
33303314 GTK4 .gtk_window_destroy (window );
33313315 } else {
3316+ /*
3317+ * Note: GTK has two types of link at least:
3318+ *
3319+ * 1) GtkLabel with HTML-like markup
3320+ * 2) GtkLinkButton
3321+ *
3322+ * GtkLabel is easier to work with, and obtained color matches color in previous SWT versions.
3323+ */
3324+ // The 'Clearlooks-Phenix' theme sets 'color:' for 'window {' css node, so a stand-alone label is not enough
3325+ long window = GTK3 .gtk_window_new (GTK .GTK_WINDOW_TOPLEVEL );
3326+ long label = GTK .gtk_label_new (null );
3327+ GTK3 .gtk_container_add (window , label );
3328+
3329+ long styleContextLink = GTK .gtk_widget_get_style_context (label );
3330+ COLOR_LINK_FOREGROUND_RGBA = styleContextGetColor (styleContextLink , GTK .GTK_STATE_FLAG_LINK );
3331+
33323332 GTK3 .gtk_widget_destroy (window );
33333333 }
33343334}
0 commit comments