[Libreoffice-commits] core.git: 4 commits - vcl/inc vcl/Library_vclplug_qt5.mk vcl/qt5 vcl/source vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Mon Jul 9 13:41:46 UTC 2018


 vcl/Library_vclplug_qt5.mk                |    1 
 vcl/inc/qt5/Qt5System.hxx                 |   27 +++++++++++++++++++++++
 vcl/qt5/Qt5Instance.cxx                   |    4 +--
 vcl/qt5/Qt5System.cxx                     |   34 ++++++++++++++++++++++++++++++
 vcl/source/control/button.cxx             |   12 ----------
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |    8 ++++++-
 vcl/unx/kde5/KDE5SalGraphics.cxx          |    4 +++
 7 files changed, 75 insertions(+), 15 deletions(-)

New commits:
commit fa62b9c4b857eab162282972bc33d2aa001f73e4
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 1bb7761b0aa0c7c62806ccf8a8fde365d640cb37
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 5f33fa5ded2bb168a51f2b6f8e42a1373d15a0ac
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 b7ae14ba2f90507cab1925cd3c63dfe996cf76c7
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;
 


More information about the Libreoffice-commits mailing list