[Libreoffice-commits] core.git: Branch 'feature/kde5' - vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Fri Sep 29 08:56:03 UTC 2017


 vcl/unx/kde5/KDE5Data.cxx        |    9 ++++--
 vcl/unx/kde5/KDE5Data.hxx        |   20 ++++++++-----
 vcl/unx/kde5/KDE5SalFrame.cxx    |   11 +++----
 vcl/unx/kde5/KDE5SalFrame.hxx    |   58 +++++++++++++++++++++++++++++++++++++--
 vcl/unx/kde5/KDE5SalInstance.hxx |    3 +-
 vcl/unx/kde5/KDE5XLib.cxx        |    4 ++
 vcl/unx/kde5/main.cxx            |    2 -
 7 files changed, 87 insertions(+), 20 deletions(-)

New commits:
commit 568f822563b21a114b967974eb76b51840529d2f
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Sep 28 11:56:55 2017 +0200

    Convert X11SalFrame to SalFrame
    
    this is WIP and crashes and leaks left'n'right
    
    Change-Id: If4be8cf6d426b705b5dbb5893a18cdbce2aa541a

diff --git a/vcl/unx/kde5/KDE5Data.cxx b/vcl/unx/kde5/KDE5Data.cxx
index b066c7d9f955..66bcde41210e 100644
--- a/vcl/unx/kde5/KDE5Data.cxx
+++ b/vcl/unx/kde5/KDE5Data.cxx
@@ -35,7 +35,10 @@ void KDE5Data::Init()
 {
     pXLib_ = new KDE5XLib();
     pXLib_->Init();
-    SetDisplay( SalKDE5Display::self() );
+    //SetDisplay( SalKDE5Display::self() );
+
+    int argc = 1;
+    qMyApp = new QApplication(argc, nullptr);
 }
 
 void KDE5Data::initNWF()
@@ -52,7 +55,8 @@ void KDE5Data::initNWF()
     pSVData->maNWFData.mbNoFocusRects = true;
 
     // Styled menus need additional space
-    QStyle *style = QApplication::style();
+    //QStyle *style = QApplication::style();
+    QStyle *style = qMyApp->style();
     pSVData->maNWFData.mnMenuFormatBorderX =
        style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
        style->pixelMetric( QStyle::PM_MenuHMargin );
@@ -63,6 +67,7 @@ void KDE5Data::initNWF()
 
 void KDE5Data::deInitNWF()
 {
+    delete qMyApp;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5Data.hxx b/vcl/unx/kde5/KDE5Data.hxx
index 9791089ce57d..1106663d3910 100644
--- a/vcl/unx/kde5/KDE5Data.hxx
+++ b/vcl/unx/kde5/KDE5Data.hxx
@@ -22,16 +22,22 @@
 #include <unx/saldisp.hxx>
 #include <unx/saldata.hxx>
 
-class KDE5Data : public X11SalData
+class KDE5SalInstance;
+class KDE5XLib;
+
+class KDE5Data //: public X11SalData
 {
     public:
-        explicit KDE5Data( SalInstance *pInstance )
-                        : X11SalData( SAL_DATA_KDE5, pInstance ) {}
-        virtual ~KDE5Data() override;
+        explicit KDE5Data( SalInstance *pInstance ) {}
+                       // : X11SalData( SAL_DATA_KDE5, pInstance ) {}
+        virtual ~KDE5Data();
 
-        virtual void Init() override;
-        virtual void initNWF() override;
-        virtual void deInitNWF() override;
+        virtual void Init() ;
+        virtual void initNWF() ;
+        virtual void deInitNWF() ;
+    private:
+        KDE5XLib *pXLib_;
+        QApplication* qMyApp;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 2419da16e4d4..1cdc503ff4f8 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -47,20 +47,19 @@
 #include <boost/optional.hpp>
 
 
-KDE5SalFrame::KDE5SalFrame( SalFrame* pParent, SalFrameStyleFlags nState ) :
-    X11SalFrame( pParent, nState )
+KDE5SalFrame::KDE5SalFrame( SalFrame* pParent, SalFrameStyleFlags nState )
 {
 }
 
 void KDE5SalFrame::Show( bool bVisible, bool bNoActivate )
 {
-    if ( !GetParent() && ! (GetStyle() & SalFrameStyleFlags::INTRO) )
+    if ( !GetParent() /*&& ! (GetStyle() & SalFrameStyleFlags::INTRO)*/ )
     {
-        KDE5XLib* pXLib = static_cast<KDE5XLib*>(GetDisplay()->GetXLib());
+        KDE5XLib* pXLib = new KDE5XLib();//static_cast<KDE5XLib*>(GetDisplay()->GetXLib());
         pXLib->doStartup();
     }
 
-    X11SalFrame::Show( bVisible, bNoActivate );
+    //X11SalFrame::Show( bVisible, bNoActivate );
 }
 
 /** Helper function to convert colors.
@@ -348,7 +347,7 @@ void KDE5SalFrame::ReleaseGraphics( SalGraphics *pGraphics )
 
 void KDE5SalFrame::updateGraphics( bool bClear )
 {
-    Drawable aDrawable = bClear ? None : GetWindow();
+    vcl::Window* pWindow = GetWindow();
     for( int i = 0; i < nMaxGraphics; i++ )
     {
         /*if( m_aGraphics[i].bInUse )
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
index 01539a458abe..7d0fa51d2eb6 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -30,7 +30,7 @@
 class QWidget;
 class KDE5SalGraphics;
 
-class KDE5SalFrame : public X11SalFrame
+class KDE5SalFrame : public SalFrame
 {
     private:
         static const int nMaxGraphics = 2;
@@ -52,9 +52,63 @@ class KDE5SalFrame : public X11SalFrame
 
         virtual SalGraphics* AcquireGraphics() override;
         virtual void ReleaseGraphics( SalGraphics *pGraphics ) override;
-        virtual void updateGraphics( bool bClear ) override;
+        void updateGraphics( bool bClear );
         virtual void UpdateSettings( AllSettings& rSettings ) override;
         virtual void Show( bool bVisible, bool bNoActivate = false ) override;
+
+        virtual bool PostEvent(ImplSVEvent* pData) override { return false; }
+
+        virtual void SetTitle( const OUString& rTitle ) override { return; }
+        virtual void SetIcon( sal_uInt16 nIcon ) override { return; }
+
+        virtual void SetMenu( SalMenu *pSalMenu ) override { return; }
+        virtual void DrawMenuBar() override { return; }
+
+        virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override { return; }
+        virtual void SetMinClientSize( long nWidth, long nHeight ) override { return; }
+        virtual void SetMaxClientSize( long nWidth, long nHeight ) override { return; }
+
+        virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) override { return; }
+        virtual void GetClientSize( long& rWidth, long& rHeight ) override { return; }
+        virtual void GetWorkArea( tools::Rectangle& rRect ) override { return; }
+        virtual SalFrame* GetParent() const override { return nullptr; }
+        virtual void SetWindowState( const SalFrameState* pState ) override { return; }
+        virtual bool GetWindowState( SalFrameState* pState ) override { return false; }
+        virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override { return; }
+        virtual void StartPresentation( bool bStart ) override { return; }
+        virtual void SetAlwaysOnTop( bool bOnTop ) override { return; }
+
+        virtual void  ToTop( SalFrameToTop nFlags ) override { return; }
+        virtual void  SetPointer( PointerStyle ePointerStyle ) override { return; }
+        virtual void  CaptureMouse( bool bMouse ) override { return; }
+        virtual void  SetPointerPos( long nX, long nY ) override { return; }
+
+        virtual void SetInputContext( SalInputContext* pContext ) override { return; }
+        virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) override { return; }
+        virtual OUString GetKeyName( sal_uInt16 nKeyCode ) override { return OUString(); }
+        virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) override { return false; }
+
+        virtual LanguageType GetInputLanguage() override { return LANGUAGE_SYSTEM; }
+        virtual void Beep() override { return; }
+        virtual const SystemEnvData* GetSystemData() const override { return nullptr; }
+        virtual SalPointerState GetPointerState() override { return SalPointerState(); }
+        virtual KeyIndicatorState GetIndicatorState() override { return KeyIndicatorState(); }
+        virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override { return; }
+
+        // set new parent window
+        virtual void SetParent( SalFrame* pNewParent ) override { return; }
+        virtual bool SetPluginParent( SystemParentData* pNewParent ) override { return false; }
+
+        virtual void SetScreenNumber( unsigned int ) override { return; }
+        virtual void SetApplicationID( const OUString &rWMClass ) override { return; }
+
+        virtual void ResetClipRegion() override { return; }
+        virtual void BeginSetClipRegion( sal_uLong nRects ) override { return; }
+        virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override { return; }
+        virtual void EndSetClipRegion() override { return; }
+
+        virtual void Flush() override { return; }
+
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 5c0247518246..e6169256020e 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -26,8 +26,9 @@ class SalFrame;
 
 class KDE5SalInstance : public SvpSalInstance
 {
+
 protected:
-//    virtual SalX11Display* CreateDisplay() const override;
+    //SalX11Display* CreateDisplay() const;
 
 public:
     explicit KDE5SalInstance(SalYieldMutex* pMutex);
diff --git a/vcl/unx/kde5/KDE5XLib.cxx b/vcl/unx/kde5/KDE5XLib.cxx
index 2c85ab7fa3f9..d9b8e747f3c8 100644
--- a/vcl/unx/kde5/KDE5XLib.cxx
+++ b/vcl/unx/kde5/KDE5XLib.cxx
@@ -235,7 +235,9 @@ bool KDE5XLib::nativeEventFilter(const QByteArray &eventType, void *message, lon
 
 void KDE5XLib::setupEventLoop()
 {
-    QAbstractEventDispatcher::instance()->installNativeEventFilter( this );
+    QAbstractEventDispatcher *qDispatcher = QAbstractEventDispatcher::instance();
+
+    //qDispatcher->installNativeEventFilter( this );
 #if KF5_HAVE_GLIB
     if( m_isGlibEventLoopType )
     {
diff --git a/vcl/unx/kde5/main.cxx b/vcl/unx/kde5/main.cxx
index 654a9d654ee8..c26d2ab25c4f 100644
--- a/vcl/unx/kde5/main.cxx
+++ b/vcl/unx/kde5/main.cxx
@@ -79,7 +79,7 @@ extern "C" {
         KDE5Data *salData = new KDE5Data( pInstance );
         salData->Init();
         salData->initNWF();
-        pInstance->SetLib(salData->GetLib());
+        //pInstance->SetLib(salData->GetLib());
 
         return pInstance;
     }


More information about the Libreoffice-commits mailing list