[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5 vcl/unx

2019-08-22 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5DragAndDrop.hxx  |   21 +
 vcl/inc/qt5/Qt5Frame.hxx|   10 +-
 vcl/inc/qt5/Qt5Tools.hxx|3 
 vcl/inc/qt5/Qt5Transferable.hxx |2 
 vcl/inc/qt5/Qt5Widget.hxx   |2 
 vcl/qt5/Qt5DragAndDrop.cxx  |   93 
 vcl/qt5/Qt5Frame.cxx|  153 
 vcl/qt5/Qt5Tools.cxx|   12 +++
 vcl/qt5/Qt5Widget.cxx   |   32 +---
 vcl/unx/kde5/KDE5SalFrame.hxx   |4 -
 10 files changed, 174 insertions(+), 158 deletions(-)

New commits:
commit 658ab1db3abce8941352d8d9def1468496985a60
Author: Jan-Marek Glogowski 
AuthorDate: Thu Aug 8 17:59:20 2019 +
Commit: Michael Weghorn 
CommitDate: Thu Aug 22 16:38:04 2019 +0200

tdf#126560 Qt5 fix D'n'D key-modifier handling

The patch has still one problem: the key-modifier state isn't
reflected by the cursor, unless the user moves the mouse. There is
an upstream Qt bug, reported in 2016-09 against Qt 5.6.1! It is
supposed to be fixed in Qt 5.12, according to the bug report at
https://bugreports.qt.io/browse/QTBUG-56218, which is still open.

I thought about adding a configure test, but I couldn't imagine
any realistic way to write it. And after Michael Weghorn found the
bug is actually not fixed, as claimed in one of the comments, I
decided to drop the warning.

Change-Id: Ice8ebc4ea149282b4c1551e755efe3d4856cf782
Reviewed-on: https://gerrit.libreoffice.org/77174
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 3355be0616c24c5e44b71e7623c4191ed9c69074)
Reviewed-on: https://gerrit.libreoffice.org/77956

diff --git a/vcl/inc/qt5/Qt5DragAndDrop.hxx b/vcl/inc/qt5/Qt5DragAndDrop.hxx
index dcd6cb5e4048..0ec9ce5bbcb2 100644
--- a/vcl/inc/qt5/Qt5DragAndDrop.hxx
+++ b/vcl/inc/qt5/Qt5DragAndDrop.hxx
@@ -25,7 +25,6 @@ class Qt5DragSource
 osl::Mutex m_aMutex;
 Qt5Frame* m_pFrame;
 css::uno::Reference 
m_xListener;
-css::uno::Reference m_xTrans;
 
 public:
 Qt5DragSource()
@@ -55,17 +54,7 @@ public:
 
 css::uno::Sequence SAL_CALL getSupportedServiceNames() override;
 
-void dragFailed();
-void fire_dragEnd(sal_Int8 nAction);
-
-static Qt5DragSource* m_ActiveDragSource;
-static bool m_bDropSuccessSet;
-static bool m_bDropSuccess;
-
-css::uno::Reference const& 
GetTransferable() const
-{
-return m_xTrans;
-}
+void fire_dragEnd(sal_Int8 nAction, bool bSuccessful);
 };
 
 class Qt5DropTarget
@@ -76,11 +65,11 @@ class Qt5DropTarget
 {
 osl::Mutex m_aMutex;
 Qt5Frame* m_pFrame;
-sal_Int8 mnDragAction;
-sal_Int8 mnDropAction;
+sal_Int8 m_nDropAction;
 bool m_bActive;
 sal_Int8 m_nDefaultActions;
 
std::vector> 
m_aListeners;
+bool m_bDropSuccessful;
 
 public:
 Qt5DropTarget();
@@ -115,10 +104,12 @@ public:
 css::uno::Sequence SAL_CALL getSupportedServiceNames() override;
 
 void fire_dragEnter(const 
css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
+void fire_dragExit(const css::datatransfer::dnd::DropTargetEvent& dte);
 void fire_dragOver(const css::datatransfer::dnd::DropTargetDragEnterEvent& 
dtde);
 void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde);
 
-sal_Int8 proposedDragAction() const { return mnDragAction; }
+sal_Int8 proposedDropAction() const { return m_nDropAction; }
+bool dropSuccessful() const { return m_bDropSuccessful; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 4c94b846bc93..e296ce92db29 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -56,6 +56,8 @@ class Qt5MainWindow;
 class Qt5Menu;
 class Qt5SvpGraphics;
 
+class QDragMoveEvent;
+class QDropEvent;
 class QImage;
 class QMimeData;
 class QPaintDevice;
@@ -159,10 +161,10 @@ public:
 virtual void deregisterDragSource(Qt5DragSource const* pDragSource);
 virtual void registerDropTarget(Qt5DropTarget* pDropTarget);
 virtual void deregisterDropTarget(Qt5DropTarget const* pDropTarget);
-void draggingStarted(const int x, const int y, Qt::DropActions eActions,
- Qt::KeyboardModifiers eKeyMod, const QMimeData* 
pQMimeData);
-void dropping(const int x, const int y, Qt::KeyboardModifiers eKeyMod,
-  const QMimeData* pQMimeData);
+
+void handleDragLeave();
+void handleDragMove(QDragMoveEvent* pEvent);
+void handleDrop(QDropEvent* pEvent);
 
 virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override;
 virtual void Show(bool bVisible, bool bNoActivate = false) override;
diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx
index 6b1fb1adcc7e..697b703e28f4 100644
--- a/vcl/inc/qt5/Qt5Tools.hxx
+++ b/vcl/inc/qt5/Qt5Tools.hxx
@@ -70,6 +70,7 @@ inline QColor toQColor(const Color& rColor)
 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-07-15 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Graphics_Controls.hxx |3 --
 vcl/qt5/Qt5Graphics_Controls.cxx |   36 ++-
 2 files changed, 7 insertions(+), 32 deletions(-)

New commits:
commit 24ead97534d7fde86c3593705f36a39e7e7cbb08
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jul 11 02:22:16 2019 +
Commit: Thorsten Behrens 
CommitDate: Tue Jul 16 00:27:34 2019 +0200

Qt5 drop special QPushButton handling

Basically reverts commit 3f0dbdd61df ("Draw button focus so that
it doesn't obscure the actual button") and declares qt5 doesn't
support an extra native focus for a button.

LO's own "ant" focus is prevented by Qt5Data::Qt5Data():

pSVData->maNWFData.mbNoFocusRects = true;
pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;

Change-Id: Ifdce615cac92f69b008780cf986cdfd0915ccd14
Reviewed-on: https://gerrit.libreoffice.org/75415
Tested-by: Jenkins
Reviewed-by: Katarina Behrens 
(cherry picked from commit 77eb3a7ff88c30d6145a3aa6d454d08ed93206df)
Reviewed-on: https://gerrit.libreoffice.org/75494
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/inc/qt5/Qt5Graphics_Controls.hxx 
b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
index 50d1de3b1cec..2676fa6413a4 100644
--- a/vcl/inc/qt5/Qt5Graphics_Controls.hxx
+++ b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
@@ -31,12 +31,9 @@
 
 class VCLPLUG_QT5_PUBLIC Qt5Graphics_Controls final : public 
vcl::WidgetDrawInterface
 {
-std::unique_ptr m_focusedButton;
 std::unique_ptr m_image;
 QRect m_lastPopupRect;
 
-void initStyles();
-
 public:
 Qt5Graphics_Controls();
 
diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index 08e57f53f5a6..c82bcdcc7064 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -21,7 +21,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -65,7 +64,7 @@ static QStyle::State vclStateValue2StateFlag(ControlState 
nControlState,
 return nState;
 }
 
-Qt5Graphics_Controls::Qt5Graphics_Controls() { initStyles(); }
+Qt5Graphics_Controls::Qt5Graphics_Controls() {}
 
 bool Qt5Graphics_Controls::isNativeControlSupported(ControlType type, 
ControlPart part)
 {
@@ -78,8 +77,9 @@ bool 
Qt5Graphics_Controls::isNativeControlSupported(ControlType type, ControlPar
 
 case ControlType::Radiobutton:
 case ControlType::Checkbox:
-case ControlType::Pushbutton:
 return (part == ControlPart::Entire) || (part == 
ControlPart::Focus);
+case ControlType::Pushbutton:
+return (part == ControlPart::Entire);
 
 case ControlType::ListHeader:
 return (part == ControlPart::Button);
@@ -250,21 +250,10 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType 
type, ControlPart part,
 
 if (type == ControlType::Pushbutton)
 {
-if (part == ControlPart::Entire)
-{
-QStyleOptionButton option;
-draw(QStyle::CE_PushButton, &option, m_image.get(),
- vclStateValue2StateFlag(nControlState, value));
-}
-else if (part == ControlPart::Focus)
-{
-QStyleOptionButton option;
-option.state = QStyle::State_HasFocus;
-option.rect = m_image->rect();
-QPainter painter(m_image.get());
-m_focusedButton->style()->drawControl(QStyle::CE_PushButton, 
&option, &painter,
-  m_focusedButton.get());
-}
+assert(part == ControlPart::Entire);
+QStyleOptionButton option;
+draw(QStyle::CE_PushButton, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value));
 }
 else if (type == ControlType::Menubar)
 {
@@ -1050,15 +1039,4 @@ bool 
Qt5Graphics_Controls::hitTestNativeControl(ControlType nType, ControlPart n
 return false;
 }
 
-void Qt5Graphics_Controls::initStyles()
-{
-// button focus
-m_focusedButton.reset(new QPushButton());
-QString aHighlightColor = 
QApplication::palette().color(QPalette::Highlight).name();
-QString focusStyleSheet("background-color: rgb(0,0,0,0%); border: 1px; 
border-radius: 2px; "
-"border-color: %1; border-style:solid;");
-focusStyleSheet.replace("%1", aHighlightColor);
-m_focusedButton->setStyleSheet(focusStyleSheet);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5 vcl/unx

2019-07-14 Thread Stephan Bergmann (via logerrit)
 vcl/inc/qt5/Qt5FilePicker.hxx|5 -
 vcl/inc/qt5/Qt5Instance.hxx  |4 +++-
 vcl/qt5/Qt5FilePicker.cxx|   27 +--
 vcl/qt5/Qt5Instance.cxx  |   16 +---
 vcl/unx/kde5/KDE5FilePicker.hxx  |3 ++-
 vcl/unx/kde5/KDE5FilePicker2.cxx |5 +++--
 vcl/unx/kde5/KDE5SalInstance.cxx |   10 ++
 vcl/unx/kde5/KDE5SalInstance.hxx |3 ++-
 8 files changed, 54 insertions(+), 19 deletions(-)

New commits:
commit 4cbcbb0a45b243971eb2e1da88b28bc03829a18e
Author: Stephan Bergmann 
AuthorDate: Wed Jun 19 15:03:04 2019 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sun Jul 14 20:43:48 2019 +0200

tdf#125971: map file URLs from QFileDialog to LO internal format

jmux' suggestion at
 turns out 
to be
the correct fix after all; explained in a lengthy comment why that seemingly
wrong call of translateToInternal happens to do the right thing.

(Much of this patch is about passing the XComponentContext down to where it 
is
now needed in Qt5FilePicker::getSelectedFiles.)

Change-Id: I235554f8494cd3094a011d5a903059326db499fc
Reviewed-on: https://gerrit.libreoffice.org/74359
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit e2589f4584efcf0306ab69f7223abdd7469e3604)
Reviewed-on: https://gerrit.libreoffice.org/75587
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/Qt5FilePicker.hxx b/vcl/inc/qt5/Qt5FilePicker.hxx
index 74d082a83aa0..d4e74b92ba15 100644
--- a/vcl/inc/qt5/Qt5FilePicker.hxx
+++ b/vcl/inc/qt5/Qt5FilePicker.hxx
@@ -58,6 +58,8 @@ class VCLPLUG_QT5_PUBLIC Qt5FilePicker : public QObject, 
public Qt5FilePicker_Ba
 Q_OBJECT
 
 private:
+css::uno::Reference m_context;
+
 // whether to show (i.e. not remove) the file extension in the filter 
title,
 // e.g. whether to use "ODF Text Document (*.odt)" or just
 // "ODF Text Document" as filter title
@@ -88,7 +90,8 @@ protected:
 public:
 // use non-native file dialog by default; there's no easy way to add 
custom widgets
 // in a generic way in the native one
-explicit Qt5FilePicker(QFileDialog::FileMode, bool 
bShowFileExtensionInFilterTitle = false,
+explicit Qt5FilePicker(css::uno::Reference 
const& context,
+   QFileDialog::FileMode, bool 
bShowFileExtensionInFilterTitle = false,
bool bUseNativeDialog = false);
 virtual ~Qt5FilePicker() override;
 
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 2411cdb7f52c..881ac17803d4 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -78,7 +78,9 @@ Q_SIGNALS:
 void deleteObjectLaterSignal(QObject* pObject);
 
 protected:
-virtual Qt5FilePicker* createPicker(QFileDialog::FileMode);
+virtual Qt5FilePicker*
+createPicker(css::uno::Reference const& 
context,
+ QFileDialog::FileMode);
 
 public:
 explicit Qt5Instance(std::unique_ptr& pQApp, bool bUseCairo 
= false);
diff --git a/vcl/qt5/Qt5FilePicker.cxx b/vcl/qt5/Qt5FilePicker.cxx
index 084aa7622a0a..63b3ff79a2bc 100644
--- a/vcl/qt5/Qt5FilePicker.cxx
+++ b/vcl/qt5/Qt5FilePicker.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -77,9 +78,11 @@ uno::Sequence FilePicker_getSupportedServiceNames()
 }
 }
 
-Qt5FilePicker::Qt5FilePicker(QFileDialog::FileMode eMode, bool 
bShowFileExtensionInFilterTitle,
+Qt5FilePicker::Qt5FilePicker(css::uno::Reference 
const& context,
+ QFileDialog::FileMode eMode, bool 
bShowFileExtensionInFilterTitle,
  bool bUseNativeDialog)
 : Qt5FilePicker_Base(m_aHelperMutex)
+, m_context(context)
 , m_bShowFileExtensionInFilterTitle(bShowFileExtensionInFilterTitle)
 , m_pFileDialog(new QFileDialog(nullptr, {}, QDir::homePath()))
 , m_bIsFolderPicker(eMode == QFileDialog::Directory)
@@ -254,9 +257,29 @@ uno::Sequence SAL_CALL 
Qt5FilePicker::getSelectedFiles()
 
 uno::Sequence seq(urls.size());
 
+auto const trans = 
css::uri::ExternalUriReferenceTranslator::create(m_context);
 size_t i = 0;
 for (const QUrl& aURL : urls)
-seq[i++] = toOUString(aURL.toString());
+{
+// Unlike LO, QFileDialog () 
apparently always
+// treats file-system pathnames as UTF-8--encoded, regardless of 
LANG/LC_CTYPE locale
+// setting.  And pathnames containing byte sequences that are not 
valid UTF-8 are apparently
+// filtered out and not even displayed by QFileDialog, so aURL will 
always have a "payload"
+// that matches the pathname's byte sequence.  So the pathname's byte 
sequence (which
+// happens to also be aURL's payload) in the LANG/LC_CTYPE encoding 
needs to be converted
+// into LO's internal UTF-8 file U

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-24 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Frame.hxx |2 -
 vcl/qt5/Qt5Frame.cxx |   48 +--
 2 files changed, 19 insertions(+), 31 deletions(-)

New commits:
commit e17e30dceb110e780a7e7e89c2ede854d4bc38a7
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jun 24 06:37:45 2019 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Tue Jun 25 01:49:54 2019 +0200

Qt5 don't assert broken height or width

At least maths element docking window has a floating height of zero.
So the original gtk comment about broken values is still true.

And the initial SalFrameGeometry is ok, so no need to initialize it.
And set default size and position on show, if not explicitly set.

Reviewed-on: https://gerrit.libreoffice.org/74614
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit bbbc820d7920a31669cb7e9aaeb5beb072eae175)

Change-Id: Ibe4969a164b50b666745ce010f5100af4b3ff2f6
Reviewed-on: https://gerrit.libreoffice.org/74623
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 5b1bc1025445..4c94b846bc93 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -109,7 +109,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public 
SalFrame
 ScreenSaverInhibitor m_ScreenSaverInhibitor;
 #endif
 
-void Center();
+void SetDefaultPos();
 Size CalcDefaultSize();
 void SetDefaultSize();
 
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 20cb4483295c..da3dc665379e 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -163,21 +163,6 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 pChildWindow->setTransientParent(pParentWindow);
 }
 
-// fake an initial geometry, gets updated via configure event or SetPosSize
-if (m_bDefaultPos || m_bDefaultSize)
-{
-maGeometry.nDisplayScreenNumber = 0;
-Size aDefSize = CalcDefaultSize();
-maGeometry.nX = 0;
-maGeometry.nY = 0;
-maGeometry.nWidth = aDefSize.Width();
-maGeometry.nHeight = aDefSize.Height();
-maGeometry.nTopDecoration = 0;
-maGeometry.nBottomDecoration = 0;
-maGeometry.nLeftDecoration = 0;
-maGeometry.nRightDecoration = 0;
-}
-
 m_aSystemData.nSize = sizeof(SystemEnvData);
 
 // Calling 'QWidget::winId()' implicitly enables native windows to be used
@@ -370,6 +355,7 @@ void Qt5Frame::Show(bool bVisible, bool /*bNoActivate*/)
 assert(m_pQWidget);
 
 SetDefaultSize();
+SetDefaultPos();
 
 auto* pSalInst(static_cast(GetSalData()->m_pInstance));
 assert(pSalInst);
@@ -388,15 +374,22 @@ void Qt5Frame::SetMaxClientSize(long nWidth, long nHeight)
 asChild()->setMaximumSize(nWidth, nHeight);
 }
 
-void Qt5Frame::Center()
+void Qt5Frame::SetDefaultPos()
 {
+if (!m_bDefaultPos)
+return;
+
+// center on parent
 if (m_pParent)
 {
-QWidget* pWindow = m_pParent->GetQWidget()->window();
+QWidget* const pWindow = m_pParent->GetQWidget()->window();
 QWidget* const pWidget = asChild();
-pWidget->move(pWindow->frameGeometry().topLeft() + 
pWindow->rect().center()
-  - pWidget->rect().center());
+QPoint aPos = pWindow->rect().center() - pWidget->rect().center();
+SetPosSize(aPos.x(), aPos.y(), 0, 0, SAL_FRAME_POSSIZE_X | 
SAL_FRAME_POSSIZE_Y);
+assert(!m_bDefaultPos);
 }
+else
+m_bDefaultPos = false;
 }
 
 Size Qt5Frame::CalcDefaultSize()
@@ -443,31 +436,30 @@ void Qt5Frame::SetPosSize(long nX, long nY, long nWidth, 
long nHeight, sal_uInt1
 
 if (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT))
 {
-m_bDefaultSize = false;
 if (isChild(false) || !m_pQWidget->isMaximized())
 {
 if (!(nFlags & SAL_FRAME_POSSIZE_WIDTH))
 nWidth = maGeometry.nWidth;
 else if (!(nFlags & SAL_FRAME_POSSIZE_HEIGHT))
 nHeight = maGeometry.nHeight;
-assert(nWidth > 0 && nHeight > 0);
 
 if (nWidth > 0 && nHeight > 0)
 {
+m_bDefaultSize = false;
 if (m_nStyle & SalFrameStyleFlags::SIZEABLE)
 asChild()->resize(nWidth, nHeight);
 else
 asChild()->setFixedSize(nWidth, nHeight);
+}
 
-// assume the resize happened
-// needed for calculations and will eventuall be corrected by 
events
+// assume the resize happened
+// needed for calculations and will eventually be corrected by 
events
+if (nWidth > 0)
 maGeometry.nWidth = nWidth;
+if (nHeight > 0)
 maGeometry.nHeight = nHeight;
-}
 }
 }
-else
-SetDefaultSize();
 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-22 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Frame.hxx  |3 ---
 vcl/inc/qt5/Qt5Widget.hxx |3 ---
 vcl/qt5/Qt5Frame.cxx  |   10 +-
 vcl/qt5/Qt5Widget.cxx |7 ---
 4 files changed, 5 insertions(+), 18 deletions(-)

New commits:
commit e3988fa785c0430ae708527cbc5a7baa6d9d55a6
Author: Jan-Marek Glogowski 
AuthorDate: Sat Jun 22 02:25:24 2019 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 22 20:17:19 2019 +0200

Qt5 directly show tooltips + respect the help area

I'm not sure why this redirection was implemented, which also ommited
the provided help area. I tried hard to use vc::Window code in the
beginning, but that also mirrors the cursor position for the window.
Using Qt here is simply straight forward, so just do that,

Change-Id: Ia8c4efc1e43b915c4b071ee26d4da37d7580817c
Reviewed-on: https://gerrit.libreoffice.org/74548
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit ab5f341efd144adb6b7d0e00fece76a2153acd10)
Reviewed-on: https://gerrit.libreoffice.org/74571

diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index d7f8f1aa6e1f..5b1bc1025445 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -133,9 +133,6 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public 
SalFrame
 void TriggerPaintEvent();
 void TriggerPaintEvent(QRect aRect);
 
-Q_SIGNALS:
-void tooltipRequest(const OUString& rTooltip);
-
 public:
 Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nSalFrameStyle, bool 
bUseCairo);
 virtual ~Qt5Frame() override;
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 8ead4b3ec945..85523951cda2 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -70,9 +70,6 @@ class Qt5Widget : public QWidget
 void inputMethodEvent(QInputMethodEvent*) override;
 QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
 
-public slots:
-static void showTooltip(const OUString& rTip);
-
 public:
 Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
 
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index b009847456e7..20cb4483295c 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -155,9 +155,6 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 else
 m_pQWidget = new Qt5Widget(*this, aWinFlags);
 
-connect(this, &Qt5Frame::tooltipRequest, 
static_cast(m_pQWidget),
-&Qt5Widget::showTooltip);
-
 if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
 {
 QWindow* pParentWindow = 
pParent->GetQWidget()->window()->windowHandle();
@@ -743,9 +740,12 @@ void Qt5Frame::Flush()
 // destroyed, so that state should be safely flushed.
 }
 
-bool Qt5Frame::ShowTooltip(const OUString& rText, const tools::Rectangle& 
/*rHelpArea*/)
+bool Qt5Frame::ShowTooltip(const OUString& rText, const tools::Rectangle& 
rHelpArea)
 {
-emit tooltipRequest(rText);
+QRect aHelpArea(toQRect(rHelpArea));
+if (QGuiApplication::isRightToLeft())
+aHelpArea.moveLeft(maGeometry.nWidth - aHelpArea.width() - 
aHelpArea.left() - 1);
+QToolTip::showText(QCursor::pos(), toQString(rText), m_pQWidget, 
aHelpArea);
 return true;
 }
 
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 3b4c114a0a45..8dca7aa03001 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -502,12 +501,6 @@ void Qt5Widget::focusOutEvent(QFocusEvent*)
 m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr);
 }
 
-void Qt5Widget::showTooltip(const OUString& rTooltip)
-{
-QPoint pt = QCursor::pos();
-QToolTip::showText(pt, toQString(rTooltip));
-}
-
 Qt5Widget::Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f)
 : QWidget(Q_NULLPTR, f)
 , m_rFrame(rFrame)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-22 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5MainWindow.hxx |3 +
 vcl/inc/salframe.hxx  |3 +
 vcl/qt5/Qt5Frame.cxx  |   83 +-
 vcl/qt5/Qt5MainWindow.cxx |   11 -
 vcl/qt5/Qt5Widget.cxx |   35 ++---
 5 files changed, 84 insertions(+), 51 deletions(-)

New commits:
commit dd0bca3ac7ad2e498ba420718df703f651efdc21
Author: Jan-Marek Glogowski 
AuthorDate: Fri Jun 21 04:09:02 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 22 20:01:34 2019 +0200

tdf#123779 Qt5 correctly fill Qt5Frame::maGeometry

The tooltip in the bug is actually not one, but the VCL implementation
of Gtk's popover widget triggered by SalFrame::ShowPopover. This has
no Qt equivalent, so we currently rely on the crude VCL version.

But for this maGeometry must contain the correct information, AKA the
absolute, unmirrored, paintable system geometry of the frame. Then the
window can be positioned correctly.

The patch gets rid of most of the code initially copied from gtk, when
this VCL backend was in a very early state.

Change-Id: Id44e4dc2aac41f1f01d51c4d8107892e644ef243
Reviewed-on: https://gerrit.libreoffice.org/74546
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 337b592a721bef2c54cbe8c4927e5cc5a68c2138)
Reviewed-on: https://gerrit.libreoffice.org/74566

diff --git a/vcl/inc/qt5/Qt5MainWindow.hxx b/vcl/inc/qt5/Qt5MainWindow.hxx
index a2a7e184c291..a0836170f644 100644
--- a/vcl/inc/qt5/Qt5MainWindow.hxx
+++ b/vcl/inc/qt5/Qt5MainWindow.hxx
@@ -28,9 +28,10 @@ class Qt5MainWindow : public QMainWindow
 {
 Q_OBJECT
 
-Qt5Frame* m_pFrame;
+Qt5Frame& m_rFrame;
 
 virtual void closeEvent(QCloseEvent* pEvent) override;
+void moveEvent(QMoveEvent*) override;
 
 public:
 Qt5MainWindow(Qt5Frame& rFrame, QWidget* parent = Q_NULLPTR,
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 86ad6da98b6e..19293b913621 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -124,7 +124,7 @@ public:
 SalFrame();
 virtual ~SalFrame() override;
 
-SalFrameGeometrymaGeometry;
+SalFrameGeometrymaGeometry; ///< absolute, unmirrored values
 
 // SalGeometryProvider
 virtual long GetWidth() const override { return maGeometry.nWidth; }
@@ -165,6 +165,7 @@ public:
 const SalFrameGeometry& GetUnmirroredGeometry() const { return maGeometry; 
}
 
 virtual voidSetWindowState( const SalFrameState* pState ) = 0;
+// return the absolute, unmirrored system frame state
 // if this returns false the structure is uninitialised
 [[nodiscard]]
 virtual boolGetWindowState( SalFrameState* pState ) = 0;
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 6307a70233fe..b009847456e7 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -171,8 +171,8 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 {
 maGeometry.nDisplayScreenNumber = 0;
 Size aDefSize = CalcDefaultSize();
-maGeometry.nX = -1;
-maGeometry.nY = -1;
+maGeometry.nX = 0;
+maGeometry.nY = 0;
 maGeometry.nWidth = aDefSize.Width();
 maGeometry.nHeight = aDefSize.Height();
 maGeometry.nTopDecoration = 0;
@@ -372,8 +372,7 @@ void Qt5Frame::Show(bool bVisible, bool /*bNoActivate*/)
 {
 assert(m_pQWidget);
 
-if (m_bDefaultSize)
-SetDefaultSize();
+SetDefaultSize();
 
 auto* pSalInst(static_cast(GetSalData()->m_pInstance));
 assert(pSalInst);
@@ -431,9 +430,13 @@ Size Qt5Frame::CalcDefaultSize()
 
 void Qt5Frame::SetDefaultSize()
 {
+if (!m_bDefaultSize)
+return;
+
 Size aDefSize = CalcDefaultSize();
 SetPosSize(0, 0, aDefSize.Width(), aDefSize.Height(),
SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT);
+assert(!m_bDefaultSize);
 }
 
 void Qt5Frame::SetPosSize(long nX, long nY, long nWidth, long nHeight, 
sal_uInt16 nFlags)
@@ -441,38 +444,57 @@ void Qt5Frame::SetPosSize(long nX, long nY, long nWidth, 
long nHeight, sal_uInt1
 if (!isWindow() || isChild(true, false))
 return;
 
-if ((nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT))
-&& (nWidth > 0 && nHeight > 0) // sometimes stupid things happen
-)
+if (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT))
 {
 m_bDefaultSize = false;
 if (isChild(false) || !m_pQWidget->isMaximized())
 {
-if (m_nStyle & SalFrameStyleFlags::SIZEABLE)
-asChild()->resize(nWidth, nHeight);
-else
-asChild()->setFixedSize(nWidth, nHeight);
+if (!(nFlags & SAL_FRAME_POSSIZE_WIDTH))
+nWidth = maGeometry.nWidth;
+else if (!(nFlags & SAL_FRAME_POSSIZE_HEIGHT))
+nH

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-21 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Object.hxx |3 +--
 vcl/qt5/Qt5Object.cxx |   10 ++
 2 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 86eb298506464a6138015168c00253096e3c6d05
Author: Jan-Marek Glogowski 
AuthorDate: Fri Jun 21 01:49:59 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jun 21 16:10:38 2019 +0200

tdf#126020 Qt5 delete orphan Qt5ObjectWindows

The Qt5ObjectWindow is "adopted" by Qt5Frame's QWidget, which
is needed for the correct display. But since the Qt5Object is
itself a child of the Qt5Frame, it'll be deleted before the
Qt5Frame, which keeps the Qt5ObjectWindows alive.
But the Qt5ObjectWindows child relies on the Qt5Object parent,
so reap it, when the real parent is destructed.

And just in case the Qt5Frame will delete the QWidget with the
child while the Qt5Object is still alive, update the pointer to
the child on its destruction.

Change-Id: I563ddc2294b7b1651f56abdde75319c7455dd9b7
Reviewed-on: https://gerrit.libreoffice.org/74482
Tested-by: Jenkins
Reviewed-by: Aleksei Nikiforov 
(cherry picked from commit f0c9b93e5bc7976dea5de4a49be87cc9892941a7)
Reviewed-on: https://gerrit.libreoffice.org/74496
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/Qt5Object.hxx b/vcl/inc/qt5/Qt5Object.hxx
index 6bfdd81b0327..c6dce6e944be 100644
--- a/vcl/inc/qt5/Qt5Object.hxx
+++ b/vcl/inc/qt5/Qt5Object.hxx
@@ -33,8 +33,6 @@ class Qt5Object : public QObject, public SalObject
 {
 Q_OBJECT
 
-friend class Qt5OpenGLContext;
-
 SystemEnvData m_aSystemData;
 Qt5Frame* m_pParent;
 QWidget* m_pQWidget; // main widget, container
@@ -43,6 +41,7 @@ class Qt5Object : public QObject, public SalObject
 
 public:
 Qt5Object(Qt5Frame* pParent, bool bShow);
+~Qt5Object() override;
 
 Qt5Frame* frame() const { return m_pParent; }
 QWidget* widget() const { return m_pQWidget; }
diff --git a/vcl/qt5/Qt5Object.cxx b/vcl/qt5/Qt5Object.cxx
index cf0bd05b89cf..a0afe811a40c 100644
--- a/vcl/qt5/Qt5Object.cxx
+++ b/vcl/qt5/Qt5Object.cxx
@@ -36,6 +36,7 @@ Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow)
 m_pQWindow = new Qt5ObjectWindow(*this);
 m_pQWidget = QWidget::createWindowContainer(m_pQWindow, 
pParent->GetQWidget());
 m_pQWidget->setAttribute(Qt::WA_NoSystemBackground);
+connect(m_pQWidget, &QObject::destroyed, this, [this]() { m_pQWidget = 
nullptr; });
 
 if (bShow)
 m_pQWidget->show();
@@ -65,6 +66,15 @@ Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow)
 }
 }
 
+Qt5Object::~Qt5Object()
+{
+if (m_pQWidget)
+{
+m_pQWidget->setParent(nullptr);
+delete m_pQWidget;
+}
+}
+
 void Qt5Object::ResetClipRegion()
 {
 if (m_pQWidget)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-17 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Clipboard.hxx |   44 +++-
 vcl/qt5/Qt5Clipboard.cxx |   76 ++-
 vcl/qt5/Qt5DragAndDrop.cxx   |   33 +-
 vcl/qt5/Qt5Instance.cxx  |   12 +++---
 4 files changed, 84 insertions(+), 81 deletions(-)

New commits:
commit 901b2956839fa117de6d0dbcd320ffdf48ef0360
Author: Jan-Marek Glogowski 
AuthorDate: Fri May 31 16:34:37 2019 +
Commit: Michael Weghorn 
CommitDate: Tue Jun 18 07:38:32 2019 +0200

Qt5 remove header using namespaces and Vcl prefix

This is mainly about the using namespace in the Qt5Clipboard
header. While at it get rid of the Vcl prefix.

Change-Id: I62a804a83afe2feb4bf130eb5475790bc52365c4
Reviewed-on: https://gerrit.libreoffice.org/73287
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 6e8448cdf0541f017e8b54734dd0928e935c73fa)
Reviewed-on: https://gerrit.libreoffice.org/74204
Reviewed-by: Michael Weghorn 

diff --git a/vcl/inc/qt5/Qt5Clipboard.hxx b/vcl/inc/qt5/Qt5Clipboard.hxx
index 7539b748dc23..fb79ec463717 100644
--- a/vcl/inc/qt5/Qt5Clipboard.hxx
+++ b/vcl/inc/qt5/Qt5Clipboard.hxx
@@ -21,10 +21,6 @@
 
 #include 
 
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-
 class Qt5Transferable : public 
cppu::WeakImplHelper
 {
 public:
@@ -44,31 +40,30 @@ private:
 QClipboard::Mode m_aClipboardMode;
 };
 
-class VclQt5Clipboard
+class Qt5Clipboard
 : public QObject,
-  public 
cppu::WeakComponentImplHelper
+  public 
cppu::WeakComponentImplHelper
 {
 Q_OBJECT
 
-private Q_SLOTS:
-void handleClipboardChange(QClipboard::Mode mode);
-
-private:
 osl::Mutex m_aMutex;
-Reference m_aContents;
-Reference m_aOwner;
-std::vector> 
m_aListeners;
+css::uno::Reference m_aContents;
+css::uno::Reference 
m_aOwner;
+
std::vector>
 m_aListeners;
 OUString m_aClipboardName;
 QClipboard::Mode m_aClipboardMode;
 // custom MIME type to detect whether clipboard content was added by self 
or externally
 const QString m_sMimeTypeUuid = "application/x-libreoffice-clipboard-uuid";
 const QByteArray m_aUuid;
 
+private Q_SLOTS:
+void handleClipboardChange(QClipboard::Mode mode);
+
 public:
-explicit VclQt5Clipboard(const OUString& aModeString);
-virtual ~VclQt5Clipboard() override;
+explicit Qt5Clipboard(const OUString& aModeString);
+virtual ~Qt5Clipboard() override;
 
 /*
  * XServiceInfo
@@ -76,17 +71,18 @@ public:
 
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
-virtual Sequence SAL_CALL getSupportedServiceNames() override;
+virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() 
override;
 
 /*
  * XClipboard
  */
 
-virtual Reference SAL_CALL getContents() 
override;
+virtual css::uno::Reference SAL_CALL 
getContents() override;
 
 virtual void SAL_CALL setContents(
-const Reference& xTrans,
-const Reference& 
xClipboardOwner) override;
+const css::uno::Reference& xTrans,
+const 
css::uno::Reference& 
xClipboardOwner)
+override;
 
 virtual OUString SAL_CALL getName() override;
 
@@ -105,10 +101,12 @@ public:
  * XClipboardNotifier
  */
 virtual void SAL_CALL addClipboardListener(
-const Reference& 
listener) override;
+const 
css::uno::Reference& listener)
+override;
 
 virtual void SAL_CALL removeClipboardListener(
-const Reference& 
listener) override;
+const 
css::uno::Reference& listener)
+override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx
index 6d333d498ff2..8f9c373836bb 100644
--- a/vcl/qt5/Qt5Clipboard.cxx
+++ b/vcl/qt5/Qt5Clipboard.cxx
@@ -25,6 +25,8 @@
 
 #include 
 
+using namespace com::sun::star;
+
 namespace
 {
 std::map g_nameToClipboardMap
@@ -95,7 +97,7 @@ std::vector 
Qt5Transferable::getTransferDataFlavo
 else
 {
 aFlavor.MimeType = toOUString(rMimeType);
-aFlavor.DataType = cppu::UnoType>::get();
+aFlavor.DataType = 
cppu::UnoType>::get();
 aVector.push_back(aFlavor);
 }
 }
@@ -143,7 +145,8 @@ Qt5Transferable::getTransferData(const 
css::datatransfer::DataFlavor& rFlavor)
 {
 QString clipboardContent = mimeData->html();
 std::string aStr = clipboardContent.toStdString();
-Sequence aSeq(reinterpret_cast(aStr.c_str()), aStr.length());
+uno::Sequence aSeq(reinterpret_cast(aStr.c_str()),
+ aStr.length());
 aRet <<= aSeq;
 }
 else if (rFlavor.MimeType.startsWith("image") && mimeData->hasImage())
@@ -

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-15 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Instance.hxx |1 +
 vcl/qt5/Qt5Instance.cxx |6 ++
 2 files changed, 7 insertions(+)

New commits:
commit fda85282ee11d4be5239ea15ee59d37f5f8cf062
Author: Jan-Marek Glogowski 
AuthorDate: Sat Jun 15 11:55:08 2019 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 15 16:17:15 2019 +0200

tdf#125934 Qt5 set the desktop file name

This is a preliminary fix, so LO on Wayland has an application
icon at all. As the result, the start center icon will appear as
the application icon on Wayland for all windows.

For the proper, per QWindow fix, we need some QtCore and QtWayland
changes, to allow setting the appId per QWindow and eventually a
Waylnad XDG shell spec update, to officially allow a top level
window to change its appId.

Change-Id: Icefcfc992836e0c657237984d7d88561b26b06a2
Reviewed-on: https://gerrit.libreoffice.org/74097
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 045de7a51f402062f23a3deeb15a199fd039a6f2)
Reviewed-on: https://gerrit.libreoffice.org/74103

diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index c87f3c93c1ac..69d871a6368c 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -65,6 +65,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Instance : public QObject,
 bool m_bUpdateFonts;
 
 DECL_LINK(updateStyleHdl, Timer*, void);
+void AfterAppInit() override;
 
 private Q_SLOTS:
 bool ImplYield(bool bWait, bool bHandleAllCurrentEvents);
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index a7b7aeb8638a..7256ea77ed49 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -240,6 +240,12 @@ Qt5Instance::~Qt5Instance()
 m_pQApplication.reset();
 }
 
+void Qt5Instance::AfterAppInit()
+{
+// sets the default application icon on Wayland
+
QGuiApplication::setDesktopFileName(QStringLiteral("libreoffice-startcenter.desktop"));
+}
+
 void Qt5Instance::deleteObjectLater(QObject* pObject) { 
pObject->deleteLater(); }
 
 SalFrame* Qt5Instance::CreateChildFrame(SystemParentData* /*pParent*/, 
SalFrameStyleFlags nStyle)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5 vcl/source

2019-06-12 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Frame.hxx   |3 ---
 vcl/inc/qt5/Qt5Object.hxx  |2 ++
 vcl/inc/salobj.hxx |7 ---
 vcl/qt5/Qt5Frame.cxx   |   24 ++--
 vcl/qt5/Qt5Object.cxx  |   12 
 vcl/source/window/syschild.cxx |6 --
 6 files changed, 32 insertions(+), 22 deletions(-)

New commits:
commit a7ab534afee3d92d92c51759dcb733da6545d7a2
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jun 2 21:01:33 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Thu Jun 13 07:00:03 2019 +0200

tdf#125692 SalObject always holds a SystemChildWindow

Let's just face reality and store it as a VclPtr.

And this is needed, because Qt, like VCL, uses deferred deletion,
and has no way to filter events to QObjects out of its event queue
easily. This way the qt5 plugin can report focus changes for
SalObjects without a crash, which happens when you close a
presentation with a video by click.

And in addition it reverts the workaround introduced in commit
e770bacc85a0 ("Qt5 workaround modal change after show bug"), as it
seems this bug is a use-after-free error, introduced by LO.
Thanks Michael Weghorn for catching that!

Maybe someone should also rename SalObject...

Change-Id: I0bc64ea64f95dfc7a838799c4a04de183adfefcf
Reviewed-on: https://gerrit.libreoffice.org/73567
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 2dc6bdd1d5789ace0500cad90f5d2eb930888bb9)
Reviewed-on: https://gerrit.libreoffice.org/73921

diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 3b590bd8e28c..c70171869aa8 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -111,9 +111,6 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public 
SalFrame
 void TriggerPaintEvent();
 void TriggerPaintEvent(QRect aRect);
 
-private:
-void setVisible(bool);
-
 Q_SIGNALS:
 void tooltipRequest(const OUString& rTooltip);
 
diff --git a/vcl/inc/qt5/Qt5Object.hxx b/vcl/inc/qt5/Qt5Object.hxx
index e27d549ca51d..6bfdd81b0327 100644
--- a/vcl/inc/qt5/Qt5Object.hxx
+++ b/vcl/inc/qt5/Qt5Object.hxx
@@ -66,6 +66,8 @@ class Qt5ObjectWindow : public QWindow
 Qt5Object& m_rParent;
 
 bool event(QEvent*) override;
+void focusInEvent(QFocusEvent*) override;
+void focusOutEvent(QFocusEvent*) override;
 void mousePressEvent(QMouseEvent*) override;
 void mouseReleaseEvent(QMouseEvent*) override;
 // keyPressEvent(QKeyEvent*) is handled via event(QEvent*); see comment in 
Qt5Widget::event
diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx
index 56ca04985a7d..83024fec339d 100644
--- a/vcl/inc/salobj.hxx
+++ b/vcl/inc/salobj.hxx
@@ -21,16 +21,17 @@
 #define INCLUDED_VCL_INC_SALOBJ_HXX
 
 #include 
+#include 
 #include 
 #include "salwtype.hxx"
 
 struct SystemEnvData;
 
-typedef void (*SALOBJECTPROC)( void* pInst, SalObjEvent nEvent );
+typedef void (*SALOBJECTPROC)(SystemChildWindow* pInst, SalObjEvent nEvent);
 
 class VCL_PLUGIN_PUBLIC SalObject
 {
-void*   m_pInst;
+VclPtr m_pInst;
 SALOBJECTPROC   m_pCallback;
 boolm_bMouseTransparent:1,
 m_bEraseBackground:1;
@@ -54,7 +55,7 @@ public:
 
 virtual const SystemEnvData*GetSystemData() const = 0;
 
-voidSetCallback( void* pInst, SALOBJECTPROC 
pProc )
+voidSetCallback( SystemChildWindow* pInst, 
SALOBJECTPROC pProc )
 { m_pInst = pInst; m_pCallback = 
pProc; }
 voidCallCallback( SalObjEvent nEvent )
 { if (m_pCallback) m_pCallback( 
m_pInst, nEvent ); }
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 541bb4b2e7ce..7a2c67b809d5 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -360,8 +361,6 @@ void Qt5Frame::DrawMenuBar() { /* not needed */}
 
 void Qt5Frame::SetExtendedFrameStyle(SalExtStyle /*nExtStyle*/) { /* not 
needed */}
 
-void Qt5Frame::setVisible(bool bVisible) { asChild()->setVisible(bVisible); }
-
 void Qt5Frame::Show(bool bVisible, bool /*bNoActivate*/)
 {
 assert(m_pQWidget);
@@ -371,7 +370,7 @@ void Qt5Frame::Show(bool bVisible, bool /*bNoActivate*/)
 
 auto* pSalInst(static_cast(GetSalData()->m_pInstance));
 assert(pSalInst);
-pSalInst->RunInMainThread([this, bVisible]() { setVisible(bVisible); });
+pSalInst->RunInMainThread([this, bVisible]() { 
asChild()->setVisible(bVisible); });
 }
 
 void Qt5Frame::SetMinClientSize(long nWidth, long nHeight)
@@ -506,21 +505,18 @@ void Qt5Frame::SetModal(bool bModal)
 auto* pSalInst(static_cast(GetSalData()->m_pInstance));
 assert(pSalInst);
 pSalInst->RunInMainThread([this, bModal]() {
-   

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-12 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Frame.hxx |1 
 vcl/qt5/Qt5Frame.cxx |  123 ++-
 2 files changed, 28 insertions(+), 96 deletions(-)

New commits:
commit d96d87b5043ed2a75ec7421d046d12568da3926d
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jun 2 15:38:25 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Thu Jun 13 06:27:37 2019 +0200

Qt5 introduce Qt5Frame::asChild() helper

Just a little refactoring.

Gets rid of the common used idom in the code:
  m_pTopLevel ? m_pTopLevel : m_pQWidget

Change-Id: I3e96687d9d02c0b1a5537c6b6cea53e1ca3a2067
Reviewed-on: https://gerrit.libreoffice.org/73414
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit d8d8cdecdb760500b06cacef3d17c8e05332967d)
Reviewed-on: https://gerrit.libreoffice.org/73920

diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 16743edc0fc6..3b590bd8e28c 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -123,6 +123,7 @@ public:
 
 QWidget* GetQWidget() const { return m_pQWidget; }
 Qt5MainWindow* GetTopLevelWindow() const { return m_pTopLevel; }
+QWidget* asChild() const;
 
 void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 
nExtentsWidth,
 sal_Int32 nExtentsHeight) const;
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 6d19d825fa1c..541bb4b2e7ce 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -139,13 +139,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 
 if (aWinFlags == Qt::Window)
 {
-QWidget* pParentWidget = nullptr;
-if (m_pParent)
-{
-pParentWidget
-= (m_pParent->m_pTopLevel) ? m_pParent->m_pTopLevel : 
m_pParent->m_pQWidget;
-}
-
+QWidget* pParentWidget = m_pParent ? m_pParent->asChild() : nullptr;
 m_pTopLevel = new Qt5MainWindow(*this, pParentWidget, aWinFlags);
 m_pQWidget = new Qt5Widget(*this, aWinFlags);
 m_pTopLevel->setCentralWidget(m_pQWidget);
@@ -159,8 +153,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
 {
 QWindow* pParentWindow = 
pParent->GetQWidget()->window()->windowHandle();
-QWindow* pChildWindow = (m_pTopLevel ? 
m_pTopLevel->window()->windowHandle()
- : 
m_pQWidget->window()->windowHandle());
+QWindow* pChildWindow = asChild()->window()->windowHandle();
 if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow))
 pChildWindow->setTransientParent(pParentWindow);
 }
@@ -217,10 +210,7 @@ Qt5Frame::~Qt5Frame()
 {
 Qt5Instance* pInst = static_cast(GetSalData()->m_pInstance);
 pInst->eraseFrame(this);
-if (m_pTopLevel)
-delete m_pTopLevel;
-else
-delete m_pQWidget;
+delete asChild();
 m_aSystemData.aShellWindow = 0;
 }
 
@@ -302,60 +292,31 @@ bool Qt5Frame::PostEvent(std::unique_ptr 
pData)
 return true;
 }
 
-bool Qt5Frame::isWindow() const
-{
-if (m_pTopLevel)
-return m_pTopLevel->isWindow();
-else
-return m_pQWidget->isWindow();
-}
+QWidget* Qt5Frame::asChild() const { return m_pTopLevel ? m_pTopLevel : 
m_pQWidget; }
+
+bool Qt5Frame::isWindow() const { return asChild()->isWindow(); }
 
 QWindow* Qt5Frame::windowHandle() const
 {
 // set attribute 'Qt::WA_NativeWindow' first to make sure a window handle 
actually exists
-if (m_pTopLevel)
-{
-m_pTopLevel->setAttribute(Qt::WA_NativeWindow);
-return m_pTopLevel->windowHandle();
-}
-else
-{
-m_pQWidget->setAttribute(Qt::WA_NativeWindow);
-return m_pQWidget->windowHandle();
-}
+QWidget* pChild = asChild();
+pChild->setAttribute(Qt::WA_NativeWindow);
+return pChild->windowHandle();
 }
 
 QScreen* Qt5Frame::screen() const
 {
 QWindow* const pWindow = windowHandle();
-if (pWindow)
-return pWindow->screen();
-else
-return nullptr;
+return pWindow ? pWindow->screen() : nullptr;
 }
 
-bool Qt5Frame::isMinimized() const
-{
-if (m_pTopLevel)
-return m_pTopLevel->isMinimized();
-else
-return m_pQWidget->isMinimized();
-}
+bool Qt5Frame::isMinimized() const { return asChild()->isMinimized(); }
 
-bool Qt5Frame::isMaximized() const
-{
-if (m_pTopLevel)
-return m_pTopLevel->isMaximized();
-else
-return m_pQWidget->isMaximized();
-}
+bool Qt5Frame::isMaximized() const { return asChild()->isMaximized(); }
 
 void Qt5Frame::SetWindowStateImpl(Qt::WindowStates eState)
 {
-if (m_pTopLevel)
-m_pTopLevel->setWindowState(eState);
-else
-m_pQWidget->setWindowState(eState);
+return asChild()->setWindowState(eState);
 }
 
 void Qt5Frame::SetTitle(const OUString& rTitle)
@@ 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-12 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Object.hxx|   20 -
 vcl/inc/qt5/Qt5Widget.hxx|   45 +-
 vcl/qt5/Qt5Object.cxx|   35 +--
 vcl/qt5/Qt5OpenGLContext.cxx |3 +-
 vcl/qt5/Qt5Widget.cxx|   63 +--
 5 files changed, 122 insertions(+), 44 deletions(-)

New commits:
commit 03352dc301bb7e67445e81d017376aa24264e9a3
Author: Jan-Marek Glogowski 
AuthorDate: Thu May 30 13:39:11 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Thu Jun 13 03:56:19 2019 +0200

tdf#125517 Qt5 implement a minimal Qt5ObjectWindow

Since we can't use an input and visual transparent widget, like a
GtkGrid, we have to implement input forwarding in the QWindow.

Using a Qt5Widget directly results in other problems on Qt 5.12+,
like these warnings (depending on the tested Qt::WA_* flags):
* Attempted flush to non-raster surface QWidgetWindow(0xa386c10,
  name="QWidgetClassWindow") of type QSurface::OpenGLSurface
  (consider using Qt::WA_PaintOnScreen to exclude from
  backingstore sync)
* QWidget::paintEngine: Should no longer be called

So the current QWidget::createWindowContainer has to stay and key
and mouse handling must be implemented as in Qt5Widget. And the
QWindow is strangely not accessible through the windowHandle() of
the container QWwidget.

As a result this patch is mostly boilerplate code, publishing the
Qt5Widget mouse and key handling as static functions.

Change-Id: I5be5f5fa1379c6bdefab0f96604251801c252b38
Reviewed-on: https://gerrit.libreoffice.org/73566
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 25edbded9946801effd117b9c46de0f8b4bc5632)
Reviewed-on: https://gerrit.libreoffice.org/73917

diff --git a/vcl/inc/qt5/Qt5Object.hxx b/vcl/inc/qt5/Qt5Object.hxx
index 88cd8baa78da..e27d549ca51d 100644
--- a/vcl/inc/qt5/Qt5Object.hxx
+++ b/vcl/inc/qt5/Qt5Object.hxx
@@ -24,10 +24,10 @@
 
 #include 
 #include 
+#include 
 
 class Qt5Frame;
 class QWidget;
-class QWindow;
 
 class Qt5Object : public QObject, public SalObject
 {
@@ -44,6 +44,10 @@ class Qt5Object : public QObject, public SalObject
 public:
 Qt5Object(Qt5Frame* pParent, bool bShow);
 
+Qt5Frame* frame() const { return m_pParent; }
+QWidget* widget() const { return m_pQWidget; }
+QWindow* windowHandle() const { return m_pQWindow; }
+
 virtual void ResetClipRegion() override;
 virtual void BeginSetClipRegion(sal_uInt32 nRects) override;
 virtual void UnionClipRegion(long nX, long nY, long nWidth, long nHeight) 
override;
@@ -57,4 +61,18 @@ public:
 virtual const SystemEnvData* GetSystemData() const override { return 
&m_aSystemData; }
 };
 
+class Qt5ObjectWindow : public QWindow
+{
+Qt5Object& m_rParent;
+
+bool event(QEvent*) override;
+void mousePressEvent(QMouseEvent*) override;
+void mouseReleaseEvent(QMouseEvent*) override;
+// keyPressEvent(QKeyEvent*) is handled via event(QEvent*); see comment in 
Qt5Widget::event
+void keyReleaseEvent(QKeyEvent*) override;
+
+public:
+explicit Qt5ObjectWindow(Qt5Object& rParent);
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index ce4e068cbbec..8ead4b3ec945 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -27,17 +27,6 @@
 
 class Qt5Frame;
 class Qt5Object;
-class QEvent;
-class QFocusEvent;
-class QInputMethodEvent;
-class QKeyEvent;
-class QMouseEvent;
-class QMoveEvent;
-class QPaintEvent;
-class QResizeEvent;
-class QShowEvent;
-class QWheelEvent;
-class QVariant;
 
 class Qt5Widget : public QWidget
 {
@@ -48,9 +37,15 @@ class Qt5Widget : public QWidget
 int m_nDeltaX;
 int m_nDeltaY;
 
-bool handleKeyEvent(QKeyEvent*, bool);
-void handleMouseButtonEvent(QMouseEvent*, bool);
-void commitText(const QString& aText) const;
+enum class ButtonKeyState
+{
+Pressed,
+Released
+};
+
+static void commitText(Qt5Frame&, const QString& aText);
+static bool handleKeyEvent(Qt5Frame&, const QWidget&, QKeyEvent*, const 
ButtonKeyState);
+static void handleMouseButtonEvent(const Qt5Frame&, QMouseEvent*, const 
ButtonKeyState);
 
 virtual bool event(QEvent*) override;
 
@@ -84,6 +79,28 @@ public:
 Qt5Frame& getFrame() const { return m_rFrame; }
 void startDrag(sal_Int8 nSourceActions);
 void endExtTextInput();
+
+static bool handleEvent(Qt5Frame&, const QWidget&, QEvent*);
+// key events might be propagated further down => call base on false
+static inline bool handleKeyReleaseEvent(Qt5Frame&, const QWidget&, 
QKeyEvent*);
+// mouse events are always accepted
+static inline void handleMousePressEvent(const Qt5Frame&, QMouseEvent*);
+static inline void handleMouseReleaseEvent(const Qt5Frame&, QMouseEvent*);
 };
 
+bool Qt5Widget:

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5 vcl/unx

2019-06-08 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Instance.hxx  |5 +
 vcl/qt5/Qt5Instance.cxx  |   18 --
 vcl/unx/kde5/KDE5SalInstance.cxx |   25 +++--
 vcl/unx/kde5/KDE5SalInstance.hxx |   20 ++--
 4 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 33ca4dbcc91164a3725263d8a8f61d9f2866da8f
Author: Jan-Marek Glogowski 
AuthorDate: Sun Jun 2 20:17:49 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Sat Jun 8 21:15:43 2019 +0200

Qt5/KDE5 always use either Qt5 or KDE5 pickers

And use RunInMain for both SalInstances and for both picker types,
as there is no reason to assume just the file and not the folder
picker can be called from the non-GUI thread.

Little drawback is the inclusion of Qt5FilePicker header in the
Qt5Instance header, as Qt's enums aren't forward-declarable.

Change-Id: Ie170d247a76134df9aff835393c71c9d6e907d32
Reviewed-on: https://gerrit.libreoffice.org/73416
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit ca69a1e17782d88580f2449e0252be52c26cae42)
Reviewed-on: https://gerrit.libreoffice.org/73721

diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 52b45b12d2b8..c87f3c93c1ac 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -33,6 +33,8 @@
 #include 
 #include 
 
+#include "Qt5FilePicker.hxx"
+
 class QApplication;
 class SalYieldMutex;
 class SalFrame;
@@ -74,6 +76,9 @@ Q_SIGNALS:
 void ImplRunInMainSignal();
 void deleteObjectLaterSignal(QObject* pObject);
 
+protected:
+virtual Qt5FilePicker* createPicker(QFileDialog::FileMode);
+
 public:
 explicit Qt5Instance(std::unique_ptr& pQApp, bool bUseCairo 
= false);
 virtual ~Qt5Instance() override;
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 1949d426de69..a7b7aeb8638a 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -394,18 +394,32 @@ void Qt5Instance::ProcessEvent(SalUserEvent aEvent)
 aEvent.m_pFrame->CallCallback(aEvent.m_nEvent, aEvent.m_pData);
 }
 
+Qt5FilePicker* Qt5Instance::createPicker(QFileDialog::FileMode eMode)
+{
+if (!IsMainThread())
+{
+SolarMutexGuard g;
+Qt5FilePicker* pPicker;
+RunInMainThread(std::function([&, this]() { pPicker = 
createPicker(eMode); }));
+assert(pPicker);
+return pPicker;
+}
+
+return new Qt5FilePicker(eMode);
+}
+
 css::uno::Reference
 Qt5Instance::createFilePicker(const 
css::uno::Reference&)
 {
 return css::uno::Reference(
-new Qt5FilePicker(QFileDialog::ExistingFile));
+createPicker(QFileDialog::ExistingFile));
 }
 
 css::uno::Reference
 Qt5Instance::createFolderPicker(const 
css::uno::Reference&)
 {
 return css::uno::Reference(
-new Qt5FilePicker(QFileDialog::Directory));
+createPicker(QFileDialog::Directory));
 }
 
 css::uno::Reference
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index 63ce689518f5..e2bd75277d23 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -50,34 +50,23 @@ SalFrame* KDE5SalInstance::CreateFrame(SalFrame* pParent, 
SalFrameStyleFlags nSt
 return pRet;
 }
 
-uno::Reference
-KDE5SalInstance::createFilePicker(const 
uno::Reference& xMSF)
+Qt5FilePicker* KDE5SalInstance::createPicker(QFileDialog::FileMode eMode)
 {
 if (!IsMainThread())
 {
 SolarMutexGuard g;
-uno::Reference xRet;
-RunInMainThread(
-std::function([&xRet, this, xMSF]() { xRet = 
this->createFilePicker(xMSF); }));
-assert(xRet);
-return xRet;
+Qt5FilePicker* pPicker;
+RunInMainThread(std::function([&, this]() { pPicker = 
createPicker(eMode); }));
+assert(pPicker);
+return pPicker;
 }
 
 // In order to insert custom controls, KDE5FilePicker currently relies on 
KFileWidget
 // being used in the native file picker, which is only the case for KDE 
Plasma.
 // Therefore, return the plain qt5 one in order to not lose custom 
controls.
 if (Application::GetDesktopEnvironment() == "KDE5")
-{
-return uno::Reference(
-new KDE5FilePicker(QFileDialog::ExistingFile));
-}
-return Qt5Instance::createFilePicker(xMSF);
-}
-
-uno::Reference
-KDE5SalInstance::createFolderPicker(const 
uno::Reference& /*xMSF*/)
-{
-return uno::Reference(new 
KDE5FilePicker(QFileDialog::Directory));
+return new KDE5FilePicker(eMode);
+return Qt5Instance::createPicker(eMode);
 }
 
 extern "C" {
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 11276be3f4ec..53993a5ecc34 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -21,23 +21,15 @@
 
 #include 
 
-class QApplication;
-
-class KDE5SalInstance : public Qt5Instance
+class KDE5SalInstance fi

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Widget.hxx |2 ++
 vcl/qt5/Qt5Widget.cxx |   33 +++--
 2 files changed, 25 insertions(+), 10 deletions(-)

New commits:
commit 06c92cf8ff1fa6c72d20579d54eb75b5fc9d25e6
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jun 6 01:01:11 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Fri Jun 7 03:08:26 2019 +0200

tdf#125201 fix QWheelEvent angleDelta() handling

Comming back to my initial, known broken implementation from
2017-11 (see commit 1426437be053 ("QT5 implement some mouse
handling")), which just works with mouse scroll wheels.

This just fixes angleDelta() based scrolling. An additional
patch might be needed, if some driver just uses pixelDelta()
values, but Qt explicitly states: "On X11 the pixelDelta()
value is driver specific and unreliable, use angleDelta()
instead.", so we'll do just that for now.

Change-Id: I1be5f9392ed475aea7ab4d965a07e1e3c2574fe7
Reviewed-on: https://gerrit.libreoffice.org/73614
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 1d959beba1cfef5fde035a4a74ee4611e7a04869)
Reviewed-on: https://gerrit.libreoffice.org/73622

diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 6398fa7db55c..ce4e068cbbec 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -45,6 +45,8 @@ class Qt5Widget : public QWidget
 
 Qt5Frame& m_rFrame;
 bool m_bNonEmptyIMPreeditSeen;
+int m_nDeltaX;
+int m_nDeltaY;
 
 bool handleKeyEvent(QKeyEvent*, bool);
 void handleMouseButtonEvent(QMouseEvent*, bool);
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 63eb68577da1..4b378cd44cb2 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -179,20 +179,31 @@ void Qt5Widget::wheelEvent(QWheelEvent* pEvent)
 aEvent.mnY = pEvent->pos().y();
 aEvent.mnCode = GetKeyModCode(pEvent->modifiers()) | 
GetMouseModCode(pEvent->buttons());
 
-int nDelta = pEvent->angleDelta().x();
-aEvent.mbHorz = true;
-if (!nDelta)
+// mouse wheel ticks are 120, which we map to 3 lines.
+// we have to accumulate for touch scroll to keep track of the absolute 
delta.
+
+int nDelta = pEvent->angleDelta().y(), lines;
+aEvent.mbHorz = nDelta == 0;
+if (aEvent.mbHorz)
+{
+nDelta = pEvent->angleDelta().x();
+if (!nDelta)
+return;
+
+m_nDeltaX += nDelta;
+lines = m_nDeltaX / 40;
+m_nDeltaX = m_nDeltaX % 40;
+}
+else
 {
-nDelta = pEvent->angleDelta().y();
-aEvent.mbHorz = false;
+m_nDeltaY += nDelta;
+lines = m_nDeltaY / 40;
+m_nDeltaY = m_nDeltaY % 40;
 }
-if (!nDelta)
-return;
-nDelta /= 8;
 
 aEvent.mnDelta = nDelta;
-aEvent.mnNotchDelta = nDelta > 0 ? 1 : -1;
-aEvent.mnScrollLines = 3;
+aEvent.mnNotchDelta = nDelta < 0 ? -1 : 1;
+aEvent.mnScrollLines = std::abs(lines);
 
 m_rFrame.CallCallback(SalEvent::WheelMouse, &aEvent);
 pEvent->accept();
@@ -479,6 +490,8 @@ Qt5Widget::Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f)
 : QWidget(Q_NULLPTR, f)
 , m_rFrame(rFrame)
 , m_bNonEmptyIMPreeditSeen(false)
+, m_nDeltaX(0)
+, m_nDeltaY(0)
 {
 create();
 setMouseTracking(true);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5

2019-06-06 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/Qt5Widget.hxx |1 
 vcl/qt5/Qt5Widget.cxx |   50 --
 2 files changed, 32 insertions(+), 19 deletions(-)

New commits:
commit 47caedee74fd5a66f89a062fa0997be473bd56e2
Author: Jan-Marek Glogowski 
AuthorDate: Sat Jun 1 19:46:16 2019 +
Commit: Jan-Marek Glogowski 
CommitDate: Thu Jun 6 23:35:07 2019 +0200

tdf#124118 Qt5 post non-code keys via ExtTextInput

Originally I tried to implement the gtk3 way by shoving all key
input in some way through the QInputMethod. But that turned out
to be impossible, because all the nice input event filtering is
privately hidden in the platform abstraction. And it took me
much longer to realize that gtk3 is doing this.

Still the delivered code point in the KeyEvent is correct, so
this simply uses ExtTextInput events for non-code key events,
if LO has enabled input method support for a frame.

Change-Id: Ia9bb6baf013cf790deecb9675f8309e32294e982
Reviewed-on: https://gerrit.libreoffice.org/73322
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 7140da917bbe80ad39610fdac28f03859f089461)
Reviewed-on: https://gerrit.libreoffice.org/73620

diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index af48dbe5e4f5..6398fa7db55c 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -48,6 +48,7 @@ class Qt5Widget : public QWidget
 
 bool handleKeyEvent(QKeyEvent*, bool);
 void handleMouseButtonEvent(QMouseEvent*, bool);
+void commitText(const QString& aText) const;
 
 virtual bool event(QEvent*) override;
 
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index a6b3d29e69a8..63eb68577da1 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -394,13 +394,35 @@ static sal_uInt16 GetKeyCode(int keyval, 
Qt::KeyboardModifiers modifiers)
 return nCode;
 }
 
+void Qt5Widget::commitText(const QString& aText) const
+{
+SalExtTextInputEvent aInputEvent;
+aInputEvent.mpTextAttr = nullptr;
+aInputEvent.mnCursorFlags = 0;
+aInputEvent.maText = toOUString(aText);
+aInputEvent.mnCursorPos = aInputEvent.maText.getLength();
+
+SolarMutexGuard aGuard;
+vcl::DeletionListener aDel(&m_rFrame);
+m_rFrame.CallCallback(SalEvent::ExtTextInput, &aInputEvent);
+if (!aDel.isDeleted())
+m_rFrame.CallCallback(SalEvent::EndExtTextInput, nullptr);
+}
+
 bool Qt5Widget::handleKeyEvent(QKeyEvent* pEvent, bool bDown)
 {
-SalKeyEvent aEvent;
+sal_uInt16 nCode = GetKeyCode(pEvent->key(), pEvent->modifiers());
+if (bDown && nCode == 0 && !pEvent->text().isEmpty()
+&& testAttribute(Qt::WA_InputMethodEnabled))
+{
+commitText(pEvent->text());
+return true;
+}
 
+SalKeyEvent aEvent;
 aEvent.mnCharCode = (pEvent->text().isEmpty() ? 0 : 
pEvent->text().at(0).unicode());
 aEvent.mnRepeat = 0;
-aEvent.mnCode = GetKeyCode(pEvent->key(), pEvent->modifiers());
+aEvent.mnCode = nCode;
 aEvent.mnCode |= GetKeyModCode(pEvent->modifiers());
 
 QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle);
@@ -483,24 +505,13 @@ static ExtTextInputAttr 
lcl_MapUndrelineStyle(QTextCharFormat::UnderlineStyle us
 
 void Qt5Widget::inputMethodEvent(QInputMethodEvent* pEvent)
 {
-SolarMutexGuard aGuard;
-SalExtTextInputEvent aInputEvent;
-aInputEvent.mpTextAttr = nullptr;
-aInputEvent.mnCursorFlags = 0;
-
-vcl::DeletionListener aDel(&m_rFrame);
-
 if (!pEvent->commitString().isEmpty())
-{
-aInputEvent.maText = toOUString(pEvent->commitString());
-aInputEvent.mnCursorPos = aInputEvent.maText.getLength();
-if (!aDel.isDeleted())
-m_rFrame.CallCallback(SalEvent::ExtTextInput, &aInputEvent);
-if (!aDel.isDeleted())
-m_rFrame.CallCallback(SalEvent::EndExtTextInput, nullptr);
-}
+commitText(pEvent->commitString());
 else
 {
+SalExtTextInputEvent aInputEvent;
+aInputEvent.mpTextAttr = nullptr;
+aInputEvent.mnCursorFlags = 0;
 aInputEvent.maText = toOUString(pEvent->preeditString());
 aInputEvent.mnCursorPos = 0;
 
@@ -549,8 +560,9 @@ void Qt5Widget::inputMethodEvent(QInputMethodEvent* pEvent)
 const bool bIsEmpty = aInputEvent.maText.isEmpty();
 if (m_bNonEmptyIMPreeditSeen || !bIsEmpty)
 {
-if (!aDel.isDeleted())
-m_rFrame.CallCallback(SalEvent::ExtTextInput, &aInputEvent);
+SolarMutexGuard aGuard;
+vcl::DeletionListener aDel(&m_rFrame);
+m_rFrame.CallCallback(SalEvent::ExtTextInput, &aInputEvent);
 if (!aDel.isDeleted() && bIsEmpty)
 m_rFrame.CallCallback(SalEvent::EndExtTextInput, nullptr);
 m_bNonEmptyIMPreeditSeen = !bIsEmpty;
___
Libreoffice-commits mailing list
libreoffic