[Libreoffice-commits] core.git: 2 commits - vcl/unx
Caolán McNamara
caolanm at redhat.com
Mon Oct 17 20:31:05 UTC 2016
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 52 +++++++++++++-----------------
1 file changed, 24 insertions(+), 28 deletions(-)
New commits:
commit 352ddafd05c5de4335746d52c79e8cf9689cba86
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 17 21:30:20 2016 +0100
GTK_STYLE_CLASS_LABEL no defined in all versions
Change-Id: I648067e30d5a2e725111b2bc920367ac2d5e0f80
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index dc72bb6..336b12a 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -1358,6 +1358,9 @@ GtkStyleContext* GtkSalGraphics::createNewContext(GtkControlPart ePart, gtk_widg
#ifndef GTK_STYLE_CLASS_POPUP
#define GTK_STYLE_CLASS_POPUP "popup"
#endif
+#ifndef GTK_STYLE_CLASS_LABEL
+#define GTK_STYLE_CLASS_LABEL "label"
+#endif
GtkStyleContext* GtkSalGraphics::createOldContext(GtkControlPart ePart)
{
@@ -2484,9 +2487,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
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);
commit dcfddd3f079a45fc59fe50475020091c6c4694e2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 17 21:29:22 2016 +0100
gtk3: split tabitem rendering to a standalone thing
Change-Id: I88cd8926b733717c9ea0ecf64a9882eaa777dcfe
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 0ebc1a2..dc72bb6 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -143,6 +143,7 @@ enum class RenderType {
Expander,
Icon,
Progress,
+ TabItem,
Focus
};
@@ -1576,18 +1577,16 @@ GtkStyleContext* GtkSalGraphics::createOldContext(GtkControlPart ePart)
GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookHeaderTabsTabStyle));
gtk_widget_path_append_type(path, GTK_TYPE_LABEL);
gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_LABEL);
- GtkStyleContext* pRet = makeContext(path, mpNotebookHeaderTabsTabStyle);
- gtk_style_context_add_class(pRet, "active-page");
- return pRet;
+ gtk_widget_path_iter_add_class(path, -1, "active-page");
+ return makeContext(path, mpNotebookHeaderTabsTabStyle);
}
case GtkControlPart::NotebookHeaderTabsTabHoverLabel:
{
GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookHeaderTabsTabStyle));
gtk_widget_path_append_type(path, GTK_TYPE_LABEL);
gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_LABEL);
- GtkStyleContext* pRet = makeContext(path, mpNotebookHeaderTabsTabStyle);
- gtk_style_context_add_class(pRet, "prelight-page");
- return pRet;
+ gtk_widget_path_iter_add_class(path, -1, "prelight-page");
+ return makeContext(path, mpNotebookHeaderTabsTabStyle);
}
case GtkControlPart::FrameBorder:
{
@@ -1939,6 +1938,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
context = mpNotebookHeaderTabsTabStyle;
if (nState & ControlState::SELECTED)
flags = (GtkStateFlags) (flags | ACTIVE_TAB());
+ renderType = RenderType::TabItem;
break;
case ControlType::WindowBackground:
context = gtk_widget_get_style_context(mpWindow);
@@ -2013,26 +2013,6 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
long nHeight = rControlRegion.GetHeight();
style_context_set_state(context, flags);
- if (nType == ControlType::TabItem)
- {
- GtkBorder margin;
- if (gtk_check_version(3, 20, 0) == nullptr)
- {
- gtk_style_context_get_margin(mpNotebookHeaderTabsTabStyle,
- gtk_style_context_get_state(mpNotebookHeaderTabsTabStyle), &margin);
- }
- else
- {
- gint initial_gap(0);
- gtk_style_context_get_style(mpNotebookStyle,
- "initial-gap", &initial_gap,
- nullptr);
-
- margin.left = margin.right = initial_gap/2;
- }
- nX += margin.left;
- nWidth -= (margin.left + margin.right);
- }
if (styleClass)
{
@@ -2134,6 +2114,21 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
break;
}
+ case RenderType::TabItem:
+ {
+ if (gtk_check_version(3, 20, 0) != nullptr)
+ {
+ gint initial_gap(0);
+ gtk_style_context_get_style(mpNotebookStyle,
+ "initial-gap", &initial_gap,
+ nullptr);
+
+ nX += initial_gap/2;
+ nWidth -= initial_gap;
+ }
+ Rectangle aRect(Point(nX, nY), Size(nWidth, nHeight));
+ render_common(mpNotebookHeaderTabsTabStyle, cr, aRect, flags);
+ }
default:
break;
}
More information about the Libreoffice-commits
mailing list