[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - 7 commits - sw/inc sw/source translations vcl/inc vcl/Library_vclplug_qt5.mk vcl/qt5 vcl/source vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Mon Jul 9 12:12:05 UTC 2018


Rebased ref, commits from common ancestor:
commit 73e7c823fe604ef046622ed6dc9ee42dc1326bc2
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Fri Jul 6 16:35:13 2018 +0200

    Implement reading screen count and screen geometry
    
    this improves restoring window location should it be within
    the secondary screen
    
    Change-Id: Iaac6bcead6bfcb7ae9eda579e5a4ad6b2482cc39

diff --git a/vcl/qt5/Qt5System.cxx b/vcl/qt5/Qt5System.cxx
index 0de1940d9eff..ca533923913b 100644
--- a/vcl/qt5/Qt5System.cxx
+++ b/vcl/qt5/Qt5System.cxx
@@ -7,21 +7,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QDesktopWidget>
+
 #include <string.h>
 #include <tools/gen.hxx>
 #include <Qt5System.hxx>
+#include <Qt5Tools.hxx>
 
 Qt5System::Qt5System() {}
 Qt5System::~Qt5System() {}
 
-unsigned int Qt5System::GetDisplayScreenCount() { return 1; }
+unsigned int Qt5System::GetDisplayScreenCount() { return QApplication::desktop()->screenCount(); }
 
 tools::Rectangle Qt5System::GetDisplayScreenPosSizePixel(unsigned int nScreen)
 {
-    tools::Rectangle aRect;
-    if (nScreen == 0)
-        aRect = tools::Rectangle(Point(0, 0), Size(1024, 768));
-    return aRect;
+    QRect qRect = QApplication::desktop()->screenGeometry(nScreen);
+    return toRectangle(qRect);
 }
 
 int Qt5System::ShowNativeDialog(const OUString&, const OUString&, const std::vector<OUString>&)
commit bc1945d264765ee87463a3cfb017b4b42312d361
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jul 5 11:45:45 2018 +0200

    Basic Qt5 system display data
    
    copied from dummy headless implementation
    
    Change-Id: I1b184745627acd065b4c0cc54f044c47ec980c93

diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 4fcd649e1777..1ad01555ed3a 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -96,6 +96,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/Qt5Object \
     vcl/qt5/Qt5Painter \
     vcl/qt5/Qt5Printer \
+    vcl/qt5/Qt5System \
     vcl/qt5/Qt5Timer \
     vcl/qt5/Qt5Tools \
     vcl/qt5/Qt5VirtualDevice \
diff --git a/vcl/inc/qt5/Qt5System.hxx b/vcl/inc/qt5/Qt5System.hxx
new file mode 100644
index 000000000000..fbc753757b36
--- /dev/null
+++ b/vcl/inc/qt5/Qt5System.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <vcl/sysdata.hxx>
+#include <unx/gensys.h>
+
+class Qt5System : public SalGenericSystem
+{
+public:
+    Qt5System();
+    virtual ~Qt5System() override;
+
+    virtual unsigned int GetDisplayScreenCount() override;
+    virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override;
+    virtual int ShowNativeDialog(const OUString& rTitle, const OUString& rMessage,
+                                 const std::vector<OUString>& rButtons) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 6ea2610e03f7..fc06d47d317b 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -26,6 +26,7 @@
 #include <Qt5Frame.hxx>
 #include <Qt5Menu.hxx>
 #include <Qt5Object.hxx>
+#include <Qt5System.hxx>
 #include <Qt5Timer.hxx>
 #include <Qt5VirtualDevice.hxx>
 
@@ -40,7 +41,6 @@
 #include <sal/log.hxx>
 #include <osl/process.h>
 
-#include <headless/svpdummies.hxx>
 #include <headless/svpbmp.hxx>
 
 Qt5Instance::Qt5Instance(SalYieldMutex* pMutex, bool bUseCairo)
@@ -128,7 +128,7 @@ std::unique_ptr<SalMenuItem> Qt5Instance::CreateMenuItem(const SalItemParams& rI
 
 SalTimer* Qt5Instance::CreateSalTimer() { return new Qt5Timer(); }
 
-SalSystem* Qt5Instance::CreateSalSystem() { return new SvpSalSystem(); }
+SalSystem* Qt5Instance::CreateSalSystem() { return new Qt5System(); }
 
 std::shared_ptr<SalBitmap> Qt5Instance::CreateSalBitmap()
 {
diff --git a/vcl/qt5/Qt5System.cxx b/vcl/qt5/Qt5System.cxx
new file mode 100644
index 000000000000..0de1940d9eff
--- /dev/null
+++ b/vcl/qt5/Qt5System.cxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <string.h>
+#include <tools/gen.hxx>
+#include <Qt5System.hxx>
+
+Qt5System::Qt5System() {}
+Qt5System::~Qt5System() {}
+
+unsigned int Qt5System::GetDisplayScreenCount() { return 1; }
+
+tools::Rectangle Qt5System::GetDisplayScreenPosSizePixel(unsigned int nScreen)
+{
+    tools::Rectangle aRect;
+    if (nScreen == 0)
+        aRect = tools::Rectangle(Point(0, 0), Size(1024, 768));
+    return aRect;
+}
+
+int Qt5System::ShowNativeDialog(const OUString&, const OUString&, const std::vector<OUString>&)
+{
+    return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 52b736acd26b3714ea80e289ce2ef94cebb6f10c
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jul 5 11:28:39 2018 +0200

    Don't draw focus around checkboxes and radiobuttons
    
    it is drawn separately around cb/rb's text
    
    Change-Id: I22737944048c4d501ba4dc5416fa79d4d081e91c

diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 9377a134fdc4..f26e559b921e 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -468,6 +468,8 @@ bool KDE5SalGraphics::drawNativeControl(ControlType type, ControlPart part,
         if (part == ControlPart::Entire)
         {
             QStyleOptionButton option;
+            // clear FOCUSED bit, focus is drawn separately
+            nControlState &= ~(ControlState::FOCUSED);
             draw(QStyle::CE_CheckBox, &option, m_image.get(),
                  vclStateValue2StateFlag(nControlState, value));
         }
@@ -548,6 +550,8 @@ bool KDE5SalGraphics::drawNativeControl(ControlType type, ControlPart part,
         if (part == ControlPart::Entire)
         {
             QStyleOptionButton option;
+            // clear FOCUSED bit, focus is drawn separately
+            nControlState &= ~(ControlState::FOCUSED);
             draw(QStyle::CE_RadioButton, &option, m_image.get(),
                  vclStateValue2StateFlag(nControlState, value));
         }
commit ac2456f92126b350972b53f29e19afc89246bc3d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Jul 4 10:22:23 2018 +0200

    Try to move adjusting focus rect down to gtk3 code
    
    as it makes the focus rect look oddly shifted for kde5 widgets
    
    Change-Id: Ia42ccf30207a8c804d23ba45870d839f94c3f858

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 6facf9159838..50b62c50b020 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2918,12 +2918,6 @@ void RadioButton::ShowFocus(const tools::Rectangle& rRect)
 
         aInRect.SetLeft( rRect.Left() );  // exclude the radio element itself from the focusrect
 
-        //to-do, figure out a better solution here
-        aInRect.AdjustLeft( -2 );
-        aInRect.AdjustRight(2 );
-        aInRect.AdjustTop( -2 );
-        aInRect.AdjustBottom(2 );
-
         DrawNativeControl(ControlType::Radiobutton, ControlPart::Focus, aInRect,
                           ControlState::FOCUSED, aControlValue, OUString());
     }
@@ -3743,12 +3737,6 @@ void CheckBox::ShowFocus(const tools::Rectangle& rRect)
 
         aInRect.SetLeft( rRect.Left() );  // exclude the checkbox itself from the focusrect
 
-        //to-do, figure out a better solution here
-        aInRect.AdjustLeft( -2 );
-        aInRect.AdjustRight(2 );
-        aInRect.AdjustTop( -2 );
-        aInRect.AdjustBottom(2 );
-
         DrawNativeControl(ControlType::Checkbox, ControlPart::Focus, aInRect,
                           ControlState::FOCUSED, aControlValue, OUString());
     }
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 9ed8d7c96dc3..180a050ebc59 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2499,7 +2499,13 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
         break;
     case RenderType::Focus:
     {
-        if (nType != ControlType::Checkbox)
+        if (nType == ControlType::Checkbox ||
+            nType == ControlType::Radiobutton)
+        {
+            nX -= 2; nY -=2;
+            nHeight += 4; nWidth += 4;
+        }
+        else
         {
             GtkBorder border;
 
commit 59b73e257dba49fc5cc5b374472e9d529a314155
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Mon Jul 9 12:59:09 2018 +0200

    Update git submodules
    
    * Update translations from branch 'master'
      - update translations for master
    
        Change-Id: I2445c79d846d0d30f34e5ba51bb8fe3a462530dc

diff --git a/translations b/translations
index b8215a9818b5..9590cc3e8616 160000
--- a/translations
+++ b/translations
@@ -1 +1 @@
-Subproject commit b8215a9818b5f37753c604654b02cebbb776f4e4
+Subproject commit 9590cc3e86168450d1c40c4136849bdf36474b84
commit 6899a161302aadd0e8412e347225b31adbb782bf
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Jul 6 16:18:18 2018 +0200

    Don't unload VclBuilder modules on shutdown
    
    Prevents crashing the CppunitTest_smoketest on Ubuntu Trusty.
    
    Probably this should be a subclass in osl:: with a proper virtual
    destructor. The release() function is actually called for a lot
    of osl::Module handling all over the code.
    
    The alternative would have been a custom allocator for the map.
    
    Change-Id: I10b86587556056b7080d0d04a27f07dbb8ca4d48
    Reviewed-on: https://gerrit.libreoffice.org/57067
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jenkins

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index fa0f1dc4ef30..9408d97e67e7 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1328,14 +1328,18 @@ void VclBuilder::cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, vcl::Wind
 
 extern "C" { static void thisModule() {} }
 
-// We store these forever, closing modules is non-ideal from a performance
-// perspective, code pages will be freed up by the OS anyway if unused for
-// a while in many cases, and this helps us pre-init.
-typedef std::map<OUString, std::shared_ptr<osl::Module>> ModuleMap;
+// Don't unload the module on destruction
+class NoAutoUnloadModule : public osl::Module
+{
+public:
+    ~NoAutoUnloadModule() { release(); }
+};
+
+typedef std::map<OUString, std::shared_ptr<NoAutoUnloadModule>> ModuleMap;
 static ModuleMap g_aModuleMap;
 
 #if ENABLE_MERGELIBS
-static std::shared_ptr<osl::Module> g_pMergedLib = std::make_shared<osl::Module>();
+static std::shared_ptr<NoAutoUnloadModule> g_pMergedLib = std::make_shared<NoAutoUnloadModule>();
 #endif
 
 #ifndef SAL_DLLPREFIX
@@ -1366,10 +1370,10 @@ void VclBuilder::preload()
         sModuleBuf.append(SAL_DLLPREFIX);
         sModuleBuf.append(OUString::createFromAscii(lib));
         sModuleBuf.append(SAL_DLLEXTENSION);
-        osl::Module* pModule = new osl::Module;
+        NoAutoUnloadModule* pModule = new NoAutoUnloadModule;
         OUString sModule = sModuleBuf.makeStringAndClear();
         if (pModule->loadRelative(&thisModule, sModule))
-            g_aModuleMap.insert(std::make_pair(sModule, std::unique_ptr<osl::Module>(pModule)));
+            g_aModuleMap.insert(std::make_pair(sModule, std::unique_ptr<NoAutoUnloadModule>(pModule)));
         else
             delete pModule;
     }
@@ -1908,7 +1912,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
             ModuleMap::iterator aI = g_aModuleMap.find(sModule);
             if (aI == g_aModuleMap.end())
             {
-                std::shared_ptr<osl::Module> pModule;
+                std::shared_ptr<NoAutoUnloadModule> pModule;
 #if ENABLE_MERGELIBS
                 if (!g_pMergedLib->is())
                     g_pMergedLib->loadRelative(&thisModule, SVLIBRARY("merged"));
@@ -1917,7 +1921,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
 #endif
                 if (!pFunction)
                 {
-                    pModule.reset(new osl::Module);
+                    pModule.reset(new NoAutoUnloadModule);
                     bool ok = pModule->loadRelative(&thisModule, sModule);
                     assert(ok && "bad module name in .ui");
                     (void) ok;
commit 67f3063b7c334d4d5c59132d90b938671aad09f0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jul 9 09:12:09 2018 +0200

    sw: prefix members of SwCompareConfig
    
    Change-Id: If475eb38df6851eccde4570c69d36df4bc522a4e
    Reviewed-on: https://gerrit.libreoffice.org/57176
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 857f3aa292f7..f4d82aaf2be3 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -94,12 +94,12 @@ class SwCompareConfig : public utl::ConfigItem
 {
     friend class SwModuleOptions;
 
-    SwCompareMode  eCmpMode;       //Compare/CompareDocuments;
-    bool            bUseRsid;       //Compare/Settings/Use RSID
+    SwCompareMode  m_eCmpMode;       //Compare/CompareDocuments;
+    bool            m_bUseRsid;       //Compare/Settings/Use RSID
     /// Compare/Settings/Store RSID
     bool            m_bStoreRsid;
-    bool            bIgnorePieces;  //Compare/Settings/Ignore pieces of length
-    sal_uInt16      nPieceLen;      //Compare/Settings/Ignore pieces of length
+    bool            m_bIgnorePieces;  //Compare/Settings/Ignore pieces of length
+    sal_uInt16      m_nPieceLen;      //Compare/Settings/Ignore pieces of length
 
     static const css::uno::Sequence<OUString>& GetPropertyNames();
 
@@ -351,20 +351,20 @@ public:
     bool    IsHideFieldTips() const {return bHideFieldTips;}
     void        SetHideFieldTips(bool bSet) {bHideFieldTips = bSet;}
 
-    SwCompareMode  GetCompareMode() const { return aCompareConfig.eCmpMode; }
-    void            SetCompareMode( SwCompareMode eMode ) { aCompareConfig.eCmpMode = eMode;
+    SwCompareMode  GetCompareMode() const { return aCompareConfig.m_eCmpMode; }
+    void            SetCompareMode( SwCompareMode eMode ) { aCompareConfig.m_eCmpMode = eMode;
                                                              aCompareConfig.SetModified(); }
 
-    bool    IsUseRsid() const { return aCompareConfig.bUseRsid; }
-    void        SetUseRsid( bool b ) { aCompareConfig.bUseRsid = b;
+    bool    IsUseRsid() const { return aCompareConfig.m_bUseRsid; }
+    void        SetUseRsid( bool b ) { aCompareConfig.m_bUseRsid = b;
                                                             aCompareConfig.SetModified(); }
 
-    bool    IsIgnorePieces() const { return aCompareConfig.bIgnorePieces; }
-    void        SetIgnorePieces( bool b ) { aCompareConfig.bIgnorePieces = b;
+    bool    IsIgnorePieces() const { return aCompareConfig.m_bIgnorePieces; }
+    void        SetIgnorePieces( bool b ) { aCompareConfig.m_bIgnorePieces = b;
                                                 aCompareConfig.SetModified(); }
 
-    sal_uInt16  GetPieceLen() const { return aCompareConfig.nPieceLen; }
-    void        SetPieceLen( sal_uInt16 nLen ) { aCompareConfig.nPieceLen = nLen;
+    sal_uInt16  GetPieceLen() const { return aCompareConfig.m_nPieceLen; }
+    void        SetPieceLen( sal_uInt16 nLen ) { aCompareConfig.m_nPieceLen = nLen;
                                                  aCompareConfig.SetModified(); }
 
     bool IsStoreRsid() const
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index dc605f7f644e..3d73202fdb70 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -1317,10 +1317,10 @@ SwCompareConfig::SwCompareConfig() :
         ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree)
     ,m_bStoreRsid(true)
 {
-    eCmpMode = SwCompareMode::Auto;
-    bUseRsid = false;
-    bIgnorePieces = false;
-    nPieceLen = 1;
+    m_eCmpMode = SwCompareMode::Auto;
+    m_bUseRsid = false;
+    m_bIgnorePieces = false;
+    m_nPieceLen = 1;
 
     Load();
 }
@@ -1335,10 +1335,10 @@ void SwCompareConfig::ImplCommit()
     Sequence<Any> aValues(aNames.getLength());
     Any* pValues = aValues.getArray();
 
-    pValues[0] <<= static_cast<sal_Int32>(eCmpMode);
-    pValues[1] <<= bUseRsid;
-    pValues[2] <<= bIgnorePieces;
-    pValues[3] <<= static_cast<sal_Int32>(nPieceLen);
+    pValues[0] <<= static_cast<sal_Int32>(m_eCmpMode);
+    pValues[1] <<= m_bUseRsid;
+    pValues[2] <<= m_bIgnorePieces;
+    pValues[3] <<= static_cast<sal_Int32>(m_nPieceLen);
     pValues[4] <<= m_bStoreRsid;
 
     PutProperties(aNames, aValues);
@@ -1359,10 +1359,10 @@ void SwCompareConfig::Load()
 
             switch(nProp)
             {
-                case 0 : eCmpMode = static_cast<SwCompareMode>(nVal); break;
-                case 1 : bUseRsid = *o3tl::doAccess<bool>(pValues[nProp]); break;
-                case 2 : bIgnorePieces = *o3tl::doAccess<bool>(pValues[nProp]); break;
-                case 3 : nPieceLen = nVal; break;
+                case 0 : m_eCmpMode = static_cast<SwCompareMode>(nVal); break;
+                case 1 : m_bUseRsid = *o3tl::doAccess<bool>(pValues[nProp]); break;
+                case 2 : m_bIgnorePieces = *o3tl::doAccess<bool>(pValues[nProp]); break;
+                case 3 : m_nPieceLen = nVal; break;
                 case 4 : m_bStoreRsid = *o3tl::doAccess<bool>(pValues[nProp]); break;
             }
         }


More information about the Libreoffice-commits mailing list