diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-10-18 13:08:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-10-18 13:10:55 +0100 |
commit | 3498ed37527b7af795f00dc6a55c11e65a313186 (patch) | |
tree | ded89d5e4b26df6e057429204c8322ab1228a146 /vcl/unx/gtk3 | |
parent | f5c54089b50718abf7c35aa81b150c509809d5c4 (diff) |
Resolves: tdf#100251 gtk3 toolbar separators are white in Adwaita
Change-Id: Iceeba474535026cd13393432ef9a2e25121c134a
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index c1cb651d7665..3d5ee0f6a434 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -2048,10 +2048,37 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co rControlRegion.GetWidth() - 1, rControlRegion.GetHeight() / 2); break; case RenderType::ToolbarSeparator: - gtk_render_line(context, cr, - rControlRegion.GetWidth() / 2, rControlRegion.GetHeight() * 0.2, - rControlRegion.GetWidth() / 2, rControlRegion.GetHeight() * 0.8 ); + { + const bool bNewStyle = gtk_check_version(3, 20, 0) == nullptr; + + gint nSeparatorWidth = 1; + + if (bNewStyle) + { + gtk_style_context_get(context, + gtk_style_context_get_state(context), + "min-width", &nSeparatorWidth, nullptr); + } + + gint nHalfSeparatorWidth = nSeparatorWidth / 2; + gint nHalfRegionWidth = rControlRegion.GetWidth() / 2; + + nX = nX + nHalfRegionWidth - nHalfSeparatorWidth; + nWidth = nSeparatorWidth; + nY = rControlRegion.GetHeight() * 0.1; + nHeight = rControlRegion.GetHeight() - (2 * nY); + + if (bNewStyle) + { + gtk_render_background(context, cr, nX, nY, nSeparatorWidth, nHeight); + gtk_render_frame(context, cr, nX, nY, nSeparatorWidth, nHeight); + } + else + { + gtk_render_line(context, cr, nX, nY, nX, nY + nHeight); + } break; + } case RenderType::Separator: if (nPart == ControlPart::SeparatorHorz) gtk_render_line(context, cr, 0, nHeight / 2, nWidth - 1, nHeight / 2); @@ -2903,6 +2930,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) mpLinkButtonStyle = createStyleContext(set_object_name, GtkControlPart::LinkButton); GtkWidget* pToolbar = gtk_toolbar_new(); + gtk_container_add(GTK_CONTAINER(gDumbContainer), pToolbar); mpToolbarStyle = gtk_widget_get_style_context(pToolbar); gtk_style_context_add_class(mpToolbarStyle, GTK_STYLE_CLASS_PRIMARY_TOOLBAR); gtk_style_context_add_class(mpToolbarStyle, GTK_STYLE_CLASS_TOOLBAR); |