[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/qt5

2022-02-07 Thread Caolán McNamara (via logerrit)
 vcl/qt5/Qt5Widget.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit de72b5f7dd3893ef0d4655cb7943ac0e8ed3c81d
Author: Caolán McNamara 
AuthorDate: Sat Feb 5 20:38:53 2022 +
Commit: Michael Stahl 
CommitDate: Mon Feb 7 15:14:06 2022 +0100

qt5: crash entering ë with french IM

which for me with french IM enabled on my keyboard is physically
AltGr+[ (crashes here on trying to underline ¨ with a length of 2)
then e.

Change-Id: Id59bd84af2ab4d8403b11b1a13efb2bbdb608199
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129539
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 6cb548c0d028..02bc22ee3d44 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -664,7 +664,15 @@ void Qt5Widget::inputMethodEvent(QInputMethodEvent* pEvent)
 if (aCharFormat.fontStrikeOut())
 aETIP |= ExtTextInputAttr::RedText;
 for (int j = rAttr.start; j < rAttr.start + 
rAttr.length; j++)
+{
+SAL_WARN_IF(j >= 
static_cast(aTextAttrs.size()), "vcl.qt5",
+"QInputMethodEvent::Attribute out of 
range. Broken range: "
+<< rAttr.start << "," << 
rAttr.start + rAttr.length
+<< " Legal range: 0," << 
aTextAttrs.size());
+if (j >= static_cast(aTextAttrs.size()))
+break;
 aTextAttrs[j] = aETIP;
+}
 }
 break;
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/qt5

2021-09-12 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/Qt5Widget.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 8da3a97e715be1364fa8ba0bc5d73e231480e76c
Author: Jan-Marek Glogowski 
AuthorDate: Fri Sep 10 12:02:20 2021 +0200
Commit: Michael Weghorn 
CommitDate: Mon Sep 13 07:14:42 2021 +0200

tdf#144412 Qt5 reset m_nModKeyCode on key input

Switching the input direction on Ctrl + L/R-Shift is actually no
bug but a feature. It is triggered on key release, so it can be
distinguished from / doesn't interfere with shortcut handling.
That's what should happen.

So trying to implement that behaviour correctly and seeing the
appearingly wrong modifier events for gtk3, I found gtk3 resets
the frames persistent mnModKeyCode for key input events, which
also seems to fix the problem for qt5.

Some additional discussion is also in tdf#103158.

Regression from commit 862fdb98ca271b60a831cd5420fd16d5f9c1c747
("tdf#143298 Qt5 send SalEvent::KeyModChange events").

Change-Id: Iafcd1db7abcdf078001ca0602ae6e374f2a169ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121858
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 61cb81d67ebf6b342a1cdb46bf6eb25a49eb5ff4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121887
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 64ad4f7539c4..ca23138b5739 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -514,6 +514,8 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const 
QWidget& rWidget, QKeyEve
 
 if (eState == ButtonKeyState::Released)
 {
+// sending the old mnModKeyCode mask on release is needed to
+// implement the writing direction switch with Ctrl + L/R-Shift
 aModEvt.mnModKeyCode = rFrame.m_nKeyModifiers;
 nModCode &= ~nModMask;
 rFrame.m_nKeyModifiers &= ~nExtModMask;
@@ -532,6 +534,9 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const 
QWidget& rWidget, QKeyEve
 return false;
 }
 
+// prevent interference of writing direction switch (Ctrl + L/R-Shift) 
with "normal" shortcuts
+rFrame.m_nKeyModifiers = ModKeyFlags::NONE;
+
 SalKeyEvent aEvent;
 aEvent.mnCharCode = (pEvent->text().isEmpty() ? 0 : 
pEvent->text().at(0).unicode());
 aEvent.mnRepeat = 0;
@@ -605,6 +610,7 @@ void Qt5Widget::closePopup()
 
 void Qt5Widget::focusOutEvent(QFocusEvent*)
 {
+m_rFrame.m_nKeyModifiers = ModKeyFlags::NONE;
 endExtTextInput();
 m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr);
 closePopup();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/qt5 vcl/unx

2021-08-26 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/Qt5Instance.cxx|   18 +++---
 vcl/unx/kf5/KF5SalInstance.cxx |   15 ---
 2 files changed, 27 insertions(+), 6 deletions(-)

New commits:
commit 76cb48b6a00cde41987a1b67b78fee68a133ad53
Author: Jan-Marek Glogowski 
AuthorDate: Thu Aug 26 13:49:13 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Aug 27 05:51:07 2021 +0200

tdf#144008 Qt5/Kf5 create frames in the GUI thread

There was a 50% chance my pick would have been correct... ok,
just half-true, as in hindsight, I should have preferred the
secure variant using RunInMain to start with.

I thought I could use some templated class functions to get rid
of all the copy and paste, but that looked even more ugly.

P.S. if you wonder - like myself - about the code formatting in
Qt5Instance::CreateFrame: that if from clang-format.

Change-Id: I3a6b0c12c9d71ad8e777ed82526d1515a249832c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121091
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 923b30aa27ceb377d6a540c012000e89ce5db31e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121063
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 432af5e6f718..f1e34d2761b1 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -285,13 +285,21 @@ void Qt5Instance::deleteObjectLater(QObject* pObject) { 
pObject->deleteLater();
 
 SalFrame* Qt5Instance::CreateChildFrame(SystemParentData* /*pParent*/, 
SalFrameStyleFlags nStyle)
 {
-return new Qt5Frame(nullptr, nStyle, m_bUseCairo);
+SalFrame* pRet(nullptr);
+RunInMainThread([&, this]() { pRet = new Qt5Frame(nullptr, nStyle, 
useCairo()); });
+assert(pRet);
+return pRet;
 }
 
 SalFrame* Qt5Instance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags 
nStyle)
 {
 assert(!pParent || dynamic_cast(pParent));
-return new Qt5Frame(static_cast(pParent), nStyle, m_bUseCairo);
+
+SalFrame* pRet(nullptr);
+RunInMainThread(
+[&, this]() { pRet = new Qt5Frame(static_cast(pParent), 
nStyle, useCairo()); });
+assert(pRet);
+return pRet;
 }
 
 void Qt5Instance::DestroyFrame(SalFrame* pFrame)
@@ -306,7 +314,11 @@ void Qt5Instance::DestroyFrame(SalFrame* pFrame)
 SalObject* Qt5Instance::CreateObject(SalFrame* pParent, SystemWindowData*, 
bool bShow)
 {
 assert(!pParent || dynamic_cast(pParent));
-return new Qt5Object(static_cast(pParent), bShow);
+
+SalObject* pRet(nullptr);
+RunInMainThread([&]() { pRet = new 
Qt5Object(static_cast(pParent), bShow); });
+assert(pRet);
+return pRet;
 }
 
 void Qt5Instance::DestroyObject(SalObject* pObject)
diff --git a/vcl/unx/kf5/KF5SalInstance.cxx b/vcl/unx/kf5/KF5SalInstance.cxx
index 608b5dccc4dc..9279ec50b98b 100644
--- a/vcl/unx/kf5/KF5SalInstance.cxx
+++ b/vcl/unx/kf5/KF5SalInstance.cxx
@@ -42,13 +42,22 @@ 
KF5SalInstance::KF5SalInstance(std::unique_ptr& pQApp, bool bUseCa
 
 SalFrame* KF5SalInstance::CreateChildFrame(SystemParentData* /*pParent*/, 
SalFrameStyleFlags nStyle)
 {
-return new KF5SalFrame(nullptr, nStyle, useCairo());
+SalFrame* pRet(nullptr);
+RunInMainThread([&, this]() { pRet = new KF5SalFrame(nullptr, nStyle, 
useCairo()); });
+assert(pRet);
+return pRet;
 }
 
-SalFrame* KF5SalInstance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags 
nState)
+SalFrame* KF5SalInstance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags 
nStyle)
 {
 assert(!pParent || dynamic_cast(pParent));
-return new KF5SalFrame(static_cast(pParent), nState, 
useCairo());
+
+SalFrame* pRet(nullptr);
+RunInMainThread([&, this]() {
+pRet = new KF5SalFrame(static_cast(pParent), nStyle, 
useCairo());
+});
+assert(pRet);
+return pRet;
 }
 
 bool KF5SalInstance::hasNativeFileSelection() const


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/qt5

2021-08-26 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/Qt5Widget.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7c1f4284562e905372b5c14b6017f1eb438f54b5
Author: Jan-Marek Glogowski 
AuthorDate: Thu Aug 26 14:23:29 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Aug 27 05:40:35 2021 +0200

tdf#144037 Qt5 just close popup with mouse outside

How hard could it be to close a popup window when losing focus or
clicking outside of it (AKA tdf#143114 problem 3)? At least with
Qt it feels like solving an NP problem...

So don't always force-close the popup window if clicked anywhere
on it. Seems to be consistent with gen and gtk3.

Change-Id: Ia1c231c0b51a55bec2c587feffcf14bb4b4cee55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121093
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit a1a83b6b3b4459de353e0cdc8cdf402370c0a5c4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121064
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 864701340ad3..64ad4f7539c4 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -182,7 +182,7 @@ void Qt5Widget::mousePressEvent(QMouseEvent* pEvent)
 {
 handleMousePressEvent(m_rFrame, pEvent);
 if (m_rFrame.isPopup()
-|| !geometry().translated(geometry().topLeft() * 
-1).contains(pEvent->pos()))
+&& !geometry().translated(geometry().topLeft() * 
-1).contains(pEvent->pos()))
 closePopup();
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/qt5

2021-07-22 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/Qt5Widget.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a42061523737e8d49778303c787af25cb29c9d6e
Author: Jan-Marek Glogowski 
AuthorDate: Thu Jul 22 18:14:01 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Jul 22 22:02:03 2021 +0200

tdf#143493 Qt5 key modifier events don't have text

Regression from commit 862fdb98ca271b60a831cd5420fd16d5f9c1c747
("tdf#143298 Qt5 send SalEvent::KeyModChange events").

Change-Id: I6981af06e3a73dee45ed10416f5d3b17b860a73b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119375
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 22997c4777eeb424493d1259b72db9a15ff37069)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119267
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 93da76ecad76..ebb11cef51ff 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -456,7 +456,7 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const 
QWidget& rWidget, QKeyEve
 return true;
 }
 
-if (nCode == 0)
+if (nCode == 0 && pEvent->text().isEmpty())
 {
 sal_uInt16 nModCode = GetKeyModCode(pEvent->modifiers());
 SalKeyModEvent aModEvt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/qt5

2021-07-20 Thread Jan-Marek Glogowski (via logerrit)
 vcl/qt5/Qt5Frame.cxx  |2 +-
 vcl/qt5/Qt5Widget.cxx |   12 ++--
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 7e6fee830116823b9cd8e46d6962df4ea2bc1ea6
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jul 19 22:13:21 2021 +0200
Commit: Michael Weghorn 
CommitDate: Wed Jul 21 04:06:52 2021 +0200

Qt5 fix Qt::Popup window handling

I guess to get popup windows somehow working, they were matched
to Qt::ToolTip. Fixing that by removing SalFrameStyleFlags::FLOAT
from the tooltip check, resulted in rather bizarre bahviour. The
Qt::Popup window is modal, as documented, but wouldn't close when
clicked outside, like normal popups. And I neither got any mouse
button or focus events, just some leave or enter. The only way
to interact with anything again, was by clicking somewhere on the
popup where it can't take focus... and it has nothing to do with
the transition setting either.

In the end it turned out that Qt::StrongFocus prevented the mouse
events to happen. Even without it the widget accepts mouse and
keyboard focus, so nothing seems lost by omitting that for the
Qt::Popup case; hopefully...

Change-Id: Icda7bbe87268293a400fe0da551d2804675d4c2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119236
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 63f92f185b78db5a575da58efac3f94a8cb5a5f6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119252
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 322f293828cd..02032d149d29 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -144,7 +144,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 else if ((nStyle & SalFrameStyleFlags::FLOAT)
  && (nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION))
 aWinFlags |= Qt::Tool | Qt::FramelessWindowHint;
-else if (nStyle & (SalFrameStyleFlags::FLOAT | 
SalFrameStyleFlags::TOOLTIP))
+else if (nStyle & SalFrameStyleFlags::TOOLTIP)
 aWinFlags |= Qt::ToolTip;
 else if ((nStyle & SalFrameStyleFlags::FLOAT)
  && !(nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION))
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 2e97132f5e75..93da76ecad76 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -177,7 +177,14 @@ void Qt5Widget::handleMouseButtonEvent(const Qt5Frame& 
rFrame, const QMouseEvent
 rFrame.CallCallback(nEventType, );
 }
 
-void Qt5Widget::mousePressEvent(QMouseEvent* pEvent) { 
handleMousePressEvent(m_rFrame, pEvent); }
+void Qt5Widget::mousePressEvent(QMouseEvent* pEvent)
+{
+if ((windowFlags() & Qt::Popup)
+&& !geometry().translated(geometry().topLeft() * 
-1).contains(pEvent->pos()))
+close();
+else
+handleMousePressEvent(m_rFrame, pEvent);
+}
 
 void Qt5Widget::mouseReleaseEvent(QMouseEvent* pEvent)
 {
@@ -601,7 +608,8 @@ Qt5Widget::Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f)
 {
 create();
 setMouseTracking(true);
-setFocusPolicy(Qt::StrongFocus);
+if (!(f & Qt::Popup))
+setFocusPolicy(Qt::StrongFocus);
 }
 
 static ExtTextInputAttr lcl_MapUndrelineStyle(QTextCharFormat::UnderlineStyle 
us)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits