[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 2 commits - include/vcl vcl/inc vcl/source vcl/unx
Jan Holesovsky
kendy at collabora.com
Sun May 31 15:47:08 PDT 2015
include/vcl/salnativewidgets.hxx | 5 +++--
vcl/inc/opengl/x11/salvd.hxx | 1 +
vcl/inc/unx/gtk/gtkgdi.hxx | 3 ++-
vcl/inc/unx/salinst.h | 6 ++++++
vcl/inc/unx/salvd.h | 7 +++----
vcl/source/outdev/nativecontrols.cxx | 4 ++++
vcl/unx/generic/gdi/salvd.cxx | 27 ++++++++++++++++-----------
vcl/unx/gtk/app/gtkinst.cxx | 6 +++++-
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 11 ++++-------
9 files changed, 44 insertions(+), 26 deletions(-)
New commits:
commit 9f46ac8a7e7b65156a138c3d3d1fc480de8533f3
Author: Jan Holesovsky <kendy at collabora.com>
Date: Sat May 23 15:31:51 2015 +0200
rendercontext: Initialize X11SalVirtualDevice with appropriate SalGraphics.
Change-Id: I4230412ccc389b8ba6768229b569d7075e7ac466
Reviewed-on: https://gerrit.libreoffice.org/15979
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/vcl/inc/opengl/x11/salvd.hxx b/vcl/inc/opengl/x11/salvd.hxx
index 2d60898..e4e6ecd 100644
--- a/vcl/inc/opengl/x11/salvd.hxx
+++ b/vcl/inc/opengl/x11/salvd.hxx
@@ -18,6 +18,7 @@
class SalDisplay;
class X11OpenGLSalGraphics;
+class X11SalGraphics;
class X11OpenGLSalVirtualDevice : public SalVirtualDevice
{
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index e0d0881..60b1513 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -26,12 +26,13 @@
#include <gdk/gdkkeysyms.h>
#include <postx.h>
+#include <unx/gtk/gtkframe.hxx>
+
#if GTK_CHECK_VERSION(3,0,0)
#include <headless/svpgdi.hxx>
#include "textrender.hxx"
-class GtkSalFrame;
class GtkSalGraphics : public SvpSalGraphics
{
GtkSalFrame *mpFrame;
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index b8feb71..381ddda 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -34,6 +34,8 @@ namespace com { namespace sun { namespace star { namespace datatransfer {
} } } }
class SalXLib;
+class X11SalGraphics;
+
class VCLPLUG_GEN_PUBLIC X11SalInstance : public SalGenericInstance
{
private:
@@ -53,6 +55,10 @@ public:
virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) SAL_OVERRIDE;
virtual void DestroyObject( SalObject* pObject ) SAL_OVERRIDE;
+ /// Gtk vclplug needs to pass GtkSalGraphics to X11SalVirtualDevice, so create it, and pass as pNewGraphics.
+ virtual SalVirtualDevice* CreateX11VirtualDevice(SalGraphics* pGraphics, long &nDX, long &nDY,
+ sal_uInt16 nBitCount, const SystemGraphicsData* pData, X11SalGraphics* pNewGraphics);
+
virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
long &nDX, long &nDY,
sal_uInt16 nBitCount, const SystemGraphicsData *pData = NULL ) SAL_OVERRIDE;
diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h
index 4f98c0c..14ad97e 100644
--- a/vcl/inc/unx/salvd.h
+++ b/vcl/inc/unx/salvd.h
@@ -44,10 +44,9 @@ class X11SalVirtualDevice : public SalVirtualDevice
bool bExternPixmap_;
public:
- X11SalVirtualDevice( SalGraphics *pGraphics,
- long &nDX, long &nDY,
- sal_uInt16 nBitCount,
- const SystemGraphicsData *pData );
+ X11SalVirtualDevice(SalGraphics *pGraphics, long &nDX, long &nDY,
+ sal_uInt16 nBitCount, const SystemGraphicsData *pData, X11SalGraphics* pNewGraphics);
+
virtual ~X11SalVirtualDevice();
Display *GetXDisplay() const
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index f64612b..847ea9d 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -35,14 +35,20 @@
#include <vcl/opengl/OpenGLHelper.hxx>
#include <opengl/x11/salvd.hxx>
-SalVirtualDevice* X11SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
- long &nDX, long &nDY,
- sal_uInt16 nBitCount, const SystemGraphicsData *pData )
+SalVirtualDevice* X11SalInstance::CreateX11VirtualDevice(SalGraphics* pGraphics,
+ long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData,
+ X11SalGraphics* pNewGraphics)
{
if (OpenGLHelper::isVCLOpenGLEnabled())
return new X11OpenGLSalVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData );
else
- return new X11SalVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData );
+ return new X11SalVirtualDevice(pGraphics, nDX, nDY, nBitCount, pData, pNewGraphics);
+}
+
+SalVirtualDevice* X11SalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
+ long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData)
+{
+ return CreateX11VirtualDevice(pGraphics, nDX, nDY, nBitCount, pData, new X11SalGraphics());
}
void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap,
@@ -81,12 +87,12 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap,
mxImpl->Init();
}
-X11SalVirtualDevice::X11SalVirtualDevice( SalGraphics* pGraphics,
- long &nDX, long &nDY,
- sal_uInt16 nBitCount,
- const SystemGraphicsData *pData ) :
- m_nXScreen( 0 ),
- bGraphics_( false )
+X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics* pGraphics, long &nDX, long &nDY,
+ sal_uInt16 nBitCount, const SystemGraphicsData *pData,
+ X11SalGraphics* pNewGraphics) :
+ pGraphics_(pNewGraphics),
+ m_nXScreen(0),
+ bGraphics_(false)
{
SalColormap* pColormap = NULL;
bool bDeleteColormap = false;
@@ -95,7 +101,6 @@ X11SalVirtualDevice::X11SalVirtualDevice( SalGraphics* pGraphics,
nBitCount = pGraphics->GetBitCount();
pDisplay_ = vcl_sal::getSalDisplay(GetGenericData());
- pGraphics_ = new X11SalGraphics();
nDepth_ = nBitCount;
if( pData && pData->hDrawable != None )
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index f9883c8..11a18e5 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -23,6 +23,7 @@
#include <unx/gtk/gtkdata.hxx>
#include <unx/gtk/gtkinst.hxx>
#include <unx/salobj.h>
+#include <unx/gtk/gtkgdi.hxx>
#include <unx/gtk/gtkframe.hxx>
#include <unx/gtk/gtkobject.hxx>
#include <unx/gtk/atkbridge.hxx>
@@ -320,7 +321,10 @@ SalVirtualDevice* GtkInstance::CreateVirtualDevice( SalGraphics *pG,
pNew->SetSize( nDX, nDY );
return pNew;
#else
- return X11SalInstance::CreateVirtualDevice( pG, nDX, nDY, nBitCount, pGd );
+ GtkSalGraphics *pGtkSalGraphics = dynamic_cast<GtkSalGraphics*>(pG);
+ assert(pGtkSalGraphics);
+ return CreateX11VirtualDevice(pG, nDX, nDY, nBitCount, pGd,
+ new GtkSalGraphics(pGtkSalGraphics->GetGtkFrame(), pGtkSalGraphics->GetGtkWidget()));
#endif
}
commit 42e15c0b0473699c6fda0cc9ee8ae755df7760f1
Author: Jan Holesovsky <kendy at collabora.com>
Date: Sat May 23 21:37:25 2015 +0200
rendercontext: Make the Gtk+ native widgets work with double-buffering.
Change-Id: Ic7101ab7cbaa7fd5f6b073a73ef0c0088b1af4c6
Reviewed-on: https://gerrit.libreoffice.org/15980
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 6cab0ba..66bc744 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -246,11 +246,12 @@ enum class ControlState {
HIDDEN = 0x0010,
DEFAULT = 0x0020,
SELECTED = 0x0040,
- CACHING_ALLOWED = 0x8000, // set when the control is completely visible (i.e. not clipped)
+ DOUBLEBUFFERING = 0x4000, ///< Set when the control is painted using double-buffering via VirtualDevice.
+ CACHING_ALLOWED = 0x8000, ///< Set when the control is completely visible (i.e. not clipped).
};
namespace o3tl
{
- template<> struct typed_flags<ControlState> : is_typed_flags<ControlState, 0x8007f> {};
+ template<> struct typed_flags<ControlState> : is_typed_flags<ControlState, 0xc007f> {};
}
/* ButtonValue:
diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx
index e46df33..7011dfb 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -18,6 +18,7 @@
*/
#include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
#include <vcl/window.hxx>
#include <vcl/salnativewidgets.hxx>
@@ -300,6 +301,9 @@ bool OutputDevice::DrawNativeControl( ControlType nType,
if (aTestRegion == vcl::Region(rControlRegion))
nState |= ControlState::CACHING_ALLOWED; // control is not clipped, caching allowed
+ if (dynamic_cast<VirtualDevice*>(this))
+ nState |= ControlState::DOUBLEBUFFERING;
+
bool bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, *aScreenCtrlValue, aCaption, this );
return bRet;
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index b4f1ba0..6eb6043 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -860,12 +860,9 @@ bool GtkSalGraphics::hitTestNativeControl( ControlType nType,
* aValue: An optional value (tristate/numerical/string)
* rCaption: A caption or title string (like button text etc)
*/
-bool GtkSalGraphics::drawNativeControl( ControlType nType,
- ControlPart nPart,
- const Rectangle& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- const OUString& rCaption )
+bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
+ const Rectangle& rControlRegion, ControlState nState,
+ const ImplControlValue& aValue, const OUString& rCaption)
{
// get a GC with current clipping region set
GetFontGC();
@@ -891,7 +888,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType,
std::unique_ptr<GdkX11Pixmap> xPixmap;
std::unique_ptr<GdkX11Pixmap> xMask;
Rectangle aPixmapRect;
- if( ( bNeedPixmapPaint )
+ if ((bNeedPixmapPaint || (nState & ControlState::DOUBLEBUFFERING))
&& nType != CTRL_SCROLLBAR
&& nType != CTRL_SPINBOX
&& nType != CTRL_TAB_ITEM
More information about the Libreoffice-commits
mailing list