[Libreoffice-commits] core.git: vcl/inc vcl/unx
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 15 09:48:31 UTC 2019
vcl/inc/unx/gtk/gtkgdi.hxx | 2
vcl/unx/gtk/salnativewidgets-gtk.cxx | 122 ++++++++++++++++-------------------
2 files changed, 58 insertions(+), 66 deletions(-)
New commits:
commit b0da0a45a6453a0ddebded83ae8401e7f3cccde3
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Apr 15 09:43:43 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Apr 15 11:47:39 2019 +0200
Related: tdf#97822 vcl opengl gtk2: fix missing slider widget
This had the same problem as the list node widget, fixed in commit
fb9c7e31f888a301fecb5257635e12ce7b907d14 (tdf#97822 vcl opengl gtk2: fix
missing list node widget, 2019-04-12). Render output was missing in the
GL / SAL_GTK_USE_PIXMAPPAINT=1 case.
Change-Id: I24252c697523214a93f715759e242d47352c8341
Reviewed-on: https://gerrit.libreoffice.org/70760
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 8187bdb5a043..87f1d0e14c3a 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -381,7 +381,7 @@ protected:
bool NWPaintGTKProgress(
const tools::Rectangle& rControlRectangle,
const ImplControlValue& aValue );
- bool NWPaintGTKSlider( ControlPart nPart,
+ bool NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlPart nPart,
const tools::Rectangle& rControlRectangle,
ControlState nState, const ImplControlValue& aValue );
bool NWPaintGTKListNode( GdkDrawable* gdkDrawable,
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 759fd14a2a3b..b965705eaa1c 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -1026,7 +1026,7 @@ bool GtkSalGraphics::DoDrawNativeControl(
}
else if( nType == ControlType::Slider )
{
- return NWPaintGTKSlider( nPart, aCtrlRect, nState, aValue );
+ return NWPaintGTKSlider(pDrawable, nPart, aCtrlRect, nState, aValue);
}
else if( nType == ControlType::WindowBackground )
{
@@ -3459,7 +3459,57 @@ bool GtkSalGraphics::NWPaintGTKProgress(
return true;
}
+namespace
+{
+void NWPaintGTKSliderReal(SalX11Screen nXScreen, GdkDrawable* gdkDrawable, ControlPart nPart,
+ const tools::Rectangle& rControlRectangle, ControlState nState,
+ const ImplControlValue& rValue)
+{
+ gint w, h;
+ w = rControlRectangle.GetWidth();
+ h = rControlRectangle.GetHeight();
+
+ const SliderValue* pVal = static_cast<const SliderValue*>(&rValue);
+
+ GtkWidget* pWidget = (nPart == ControlPart::TrackHorzArea)
+ ? GTK_WIDGET(gWidgetData[nXScreen].gHScale)
+ : GTK_WIDGET(gWidgetData[nXScreen].gVScale);
+ const gchar* pDetail = (nPart == ControlPart::TrackHorzArea) ? "hscale" : "vscale";
+ GtkOrientation eOri = (nPart == ControlPart::TrackHorzArea) ? GTK_ORIENTATION_HORIZONTAL
+ : GTK_ORIENTATION_VERTICAL;
+ gint slider_width = 10;
+ gint slider_length = 10;
+ gint trough_border = 0;
+ gtk_widget_style_get(pWidget, "slider-width", &slider_width, "slider-length", &slider_length,
+ "trough-border", &trough_border, nullptr);
+
+ GtkStateType eState
+ = (nState & ControlState::ENABLED) ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
+ if (nPart == ControlPart::TrackHorzArea)
+ {
+ gtk_paint_box(pWidget->style, gdkDrawable, eState, GTK_SHADOW_IN, nullptr, pWidget,
+ "trough", 0, (h - slider_width - 2 * trough_border) / 2, w,
+ slider_width + 2 * trough_border);
+ gint x
+ = (w - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin);
+ gtk_paint_slider(pWidget->style, gdkDrawable, eState, GTK_SHADOW_OUT, nullptr, pWidget,
+ pDetail, x, (h - slider_width) / 2, slider_length, slider_width, eOri);
+ }
+ else
+ {
+ gtk_paint_box(pWidget->style, gdkDrawable, eState, GTK_SHADOW_IN, nullptr, pWidget,
+ "trough", (w - slider_width - 2 * trough_border) / 2, 0,
+ slider_width + 2 * trough_border, h);
+ gint y
+ = (h - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin);
+ gtk_paint_slider(pWidget->style, gdkDrawable, eState, GTK_SHADOW_OUT, nullptr, pWidget,
+ pDetail, (w - slider_width) / 2, y, slider_width, slider_length, eOri);
+ }
+}
+}
+
bool GtkSalGraphics::NWPaintGTKSlider(
+ GdkDrawable* gdkDrawable,
ControlPart nPart,
const tools::Rectangle& rControlRectangle,
ControlState nState, const ImplControlValue& rValue )
@@ -3467,73 +3517,15 @@ bool GtkSalGraphics::NWPaintGTKSlider(
OSL_ASSERT( rValue.getType() == ControlType::Slider );
NWEnsureGTKSlider( m_nXScreen );
- gint w, h;
- w = rControlRectangle.GetWidth();
- h = rControlRectangle.GetHeight();
-
- const SliderValue* pVal = static_cast<const SliderValue*>(&rValue);
+ if (GtkSalGraphics::bNeedPixmapPaint)
+ {
+ NWPaintGTKSliderReal(m_nXScreen, gdkDrawable, nPart, rControlRectangle, nState, rValue);
+ return true;
+ }
BEGIN_PIXMAP_RENDER( rControlRectangle, pixDrawable )
{
- GtkWidget* pWidget = (nPart == ControlPart::TrackHorzArea)
- ? GTK_WIDGET(gWidgetData[m_nXScreen].gHScale)
- : GTK_WIDGET(gWidgetData[m_nXScreen].gVScale);
- const gchar* pDetail = (nPart == ControlPart::TrackHorzArea) ? "hscale" : "vscale";
- GtkOrientation eOri = (nPart == ControlPart::TrackHorzArea) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
- gint slider_width = 10;
- gint slider_length = 10;
- gint trough_border = 0;
- gtk_widget_style_get( pWidget,
- "slider-width", &slider_width,
- "slider-length", &slider_length,
- "trough-border", &trough_border,
- nullptr);
-
- GtkStateType eState = (nState & ControlState::ENABLED) ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
- if( nPart == ControlPart::TrackHorzArea )
- {
- gtk_paint_box( pWidget->style,
- pixDrawable,
- eState,
- GTK_SHADOW_IN,
- nullptr,
- pWidget,
- "trough",
- 0, (h-slider_width-2*trough_border)/2, w, slider_width + 2*trough_border);
- gint x = (w - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin);
- gtk_paint_slider( pWidget->style,
- pixDrawable,
- eState,
- GTK_SHADOW_OUT,
- nullptr,
- pWidget,
- pDetail,
- x, (h-slider_width)/2,
- slider_length, slider_width,
- eOri );
- }
- else
- {
- gtk_paint_box( pWidget->style,
- pixDrawable,
- eState,
- GTK_SHADOW_IN,
- nullptr,
- pWidget,
- "trough",
- (w-slider_width-2*trough_border)/2, 0, slider_width + 2*trough_border, h);
- gint y = (h - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin);
- gtk_paint_slider( pWidget->style,
- pixDrawable,
- eState,
- GTK_SHADOW_OUT,
- nullptr,
- pWidget,
- pDetail,
- (w-slider_width)/2, y,
- slider_width, slider_length,
- eOri );
- }
+ NWPaintGTKSliderReal(m_nXScreen, pixDrawable, nPart, rControlRectangle, nState, rValue);
}
END_PIXMAP_RENDER( rControlRectangle )
More information about the Libreoffice-commits
mailing list