[Libreoffice-commits] core.git: vcl/inc vcl/unx
Caolán McNamara
caolanm at redhat.com
Wed Mar 9 09:38:06 UTC 2016
vcl/inc/unx/gtk/gtkgdi.hxx | 3 ++
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 34 +++++++++++++++++++++++++-----
2 files changed, 32 insertions(+), 5 deletions(-)
New commits:
commit 9885a4f10f6b900a2a870e5fe691c4a465522b75
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Mar 9 09:37:00 2016 +0000
gtk3: try and keep sync with yesterdays upstream scrollbar changes
Change-Id: If3942704602b82bc99ce49a230930ef59cc862da
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index a53ebaf..3aac4d1 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -47,6 +47,7 @@ enum class GtkControlPart
SpinButtonDownButton,
ScrollbarVertical,
ScrollbarHorizontal,
+ ScrollbarContents,
ScrollbarTrough,
ScrollbarSlider,
ScrollbarButton,
@@ -105,10 +106,12 @@ private:
static GtkStyleContext *mpEntryStyle;
static GtkStyleContext *mpTextViewStyle;
static GtkStyleContext *mpVScrollbarStyle;
+ static GtkStyleContext *mpVScrollbarContentsStyle;
static GtkStyleContext *mpVScrollbarTroughStyle;
static GtkStyleContext *mpVScrollbarSliderStyle;
static GtkStyleContext *mpVScrollbarButtonStyle;
static GtkStyleContext *mpHScrollbarStyle;
+ static GtkStyleContext *mpHScrollbarContentsStyle;
static GtkStyleContext *mpHScrollbarTroughStyle;
static GtkStyleContext *mpHScrollbarSliderStyle;
static GtkStyleContext *mpHScrollbarButtonStyle;
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 4bb6716..cc2055a 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -26,10 +26,12 @@ GtkStyleContext* GtkSalGraphics::mpLinkButtonStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpEntryStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpTextViewStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpVScrollbarStyle = nullptr;
+GtkStyleContext* GtkSalGraphics::mpVScrollbarContentsStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpVScrollbarTroughStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpVScrollbarSliderStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpVScrollbarButtonStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpHScrollbarStyle = nullptr;
+GtkStyleContext* GtkSalGraphics::mpHScrollbarContentsStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpHScrollbarTroughStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpHScrollbarSliderStyle = nullptr;
GtkStyleContext* GtkSalGraphics::mpHScrollbarButtonStyle = nullptr;
@@ -419,6 +421,14 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
bool has_slider = ( thumbRect.GetWidth() > 0 && thumbRect.GetHeight() > 0 );
+ // ----------------- CONTENTS
+ GtkStyleContext* pScrollbarContentsStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
+ mpVScrollbarContentsStyle : mpHScrollbarContentsStyle;
+ gtk_render_background(pScrollbarContentsStyle, cr, 0, 0,
+ scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
+ gtk_render_frame(pScrollbarContentsStyle, cr, 0, 0,
+ scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
+
// ----------------- TROUGH
GtkStyleContext* pScrollbarTroughStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
mpVScrollbarTroughStyle : mpHScrollbarTroughStyle;
@@ -442,12 +452,15 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
GtkBorder margin;
gtk_style_context_get_margin(pScrollbarSliderStyle, stateFlags, &margin);
+ gtk_render_background(pScrollbarSliderStyle, cr,
+ thumbRect.Left() + margin.left, thumbRect.Top() + margin.top,
+ thumbRect.GetWidth() - margin.left - margin.right,
+ thumbRect.GetHeight() - margin.top - margin.bottom);
- gtk_render_slider(pScrollbarSliderStyle, cr,
+ gtk_render_frame(pScrollbarSliderStyle, cr,
thumbRect.Left() + margin.left, thumbRect.Top() + margin.top,
thumbRect.GetWidth() - margin.left - margin.right,
- thumbRect.GetHeight() - margin.top - margin.bottom,
- scrollbarOrientation);
+ thumbRect.GetHeight() - margin.top - margin.bottom);
}
bool backwardButtonInsensitive =
@@ -894,6 +907,15 @@ static GtkStyleContext* createStyleContext(GtkControlPart ePart, GtkStyleContext
#endif
gtk_widget_path_iter_add_class(path, -1, ePart == GtkControlPart::ScrollbarVertical ? "vertical" : "horizontal");
break;
+ case GtkControlPart::ScrollbarContents:
+ gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
+#if GTK_CHECK_VERSION(3, 19, 2)
+ gtk_widget_path_iter_set_object_name(path, -1, "contents");
+#else
+ gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SCROLLBAR);
+ gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_CONTENTS);
+#endif
+ break;
case GtkControlPart::ScrollbarTrough:
gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
#if GTK_CHECK_VERSION(3, 19, 2)
@@ -2346,11 +2368,13 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
mpToolButtonStyle = gtk_widget_get_style_context(GTK_WIDGET(pButton));
mpVScrollbarStyle = createStyleContext(GtkControlPart::ScrollbarVertical);
- mpVScrollbarTroughStyle = createStyleContext(GtkControlPart::ScrollbarTrough, mpVScrollbarStyle);
+ mpVScrollbarContentsStyle = createStyleContext(GtkControlPart::ScrollbarContents, mpVScrollbarStyle);
+ mpVScrollbarTroughStyle = createStyleContext(GtkControlPart::ScrollbarTrough, mpVScrollbarContentsStyle);
mpVScrollbarSliderStyle = createStyleContext(GtkControlPart::ScrollbarSlider, mpVScrollbarTroughStyle);
mpVScrollbarButtonStyle = createStyleContext(GtkControlPart::ScrollbarButton, mpVScrollbarStyle);
mpHScrollbarStyle = createStyleContext(GtkControlPart::ScrollbarHorizontal);
- mpHScrollbarTroughStyle = createStyleContext(GtkControlPart::ScrollbarTrough, mpHScrollbarStyle);
+ mpHScrollbarContentsStyle = createStyleContext(GtkControlPart::ScrollbarContents, mpHScrollbarStyle);
+ mpHScrollbarTroughStyle = createStyleContext(GtkControlPart::ScrollbarTrough, mpHScrollbarContentsStyle);
mpHScrollbarSliderStyle = createStyleContext(GtkControlPart::ScrollbarSlider, mpHScrollbarTroughStyle);
mpHScrollbarButtonStyle = createStyleContext(GtkControlPart::ScrollbarButton, mpHScrollbarStyle);
More information about the Libreoffice-commits
mailing list