[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - vcl/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 8 10:19:46 UTC 2021
vcl/source/window/winproc.cxx | 48 +++++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 21 deletions(-)
New commits:
commit edb3138038cb3c4558a94538e7b881cc6e2b8b4f
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jun 23 08:18:08 2021 -0400
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Oct 8 12:19:11 2021 +0200
lok: reset and cancel properly Drag & Drop action
used patch from Henry as a template:
https://gerrit.libreoffice.org/c/core/+/118844/17
but without custom actions invocation
Change-Id: I8bce66deffee0de16f3c24f009cfee077eb26e82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123243
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index a73a94f0b44c..0341b7e469d5 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -828,18 +828,12 @@ bool ImplLOKHandleMouseEvent(const VclPtr<vcl::Window>& xWindow, MouseNotifyEven
css::uno::Reference<css::datatransfer::dnd::XDropTarget> xDropTarget(
pDragWin->ImplGetWindowImpl()->mxDNDListenerContainer, css::uno::UNO_QUERY);
- if ((nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) !=
+ if (!xDropTarget.is() ||
+ !xDropTargetDragContext.is() ||
+ (nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) !=
(MouseSettings::GetStartDragCode() & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)))
{
- pDragWin->ImplGetFrameData()->mbDragging = false;
- return false;
- }
-
- if (!xDropTargetDragContext.is() ||
- !xDropTarget.is())
- {
- // cancel dragdrop
- pDragWin->ImplGetFrameData()->mbDragging = false;
+ pFrameData->mbStartDragCalled = pFrameData->mbDragging = false;
return false;
}
@@ -859,28 +853,40 @@ bool ImplLOKHandleMouseEvent(const VclPtr<vcl::Window>& xWindow, MouseNotifyEven
nEvent == MouseNotifyEvent::MOUSEBUTTONUP &&
pFrameData->mbDragging)
{
+ css::uno::Reference<css::datatransfer::XTransferable> xTransfer;
css::uno::Reference<css::datatransfer::dnd::XDropTargetDropContext> xDropTargetDropContext =
new GenericDropTargetDropContext();
css::uno::Reference<css::datatransfer::dnd::XDropTarget> xDropTarget(
pDragWin->ImplGetWindowImpl()->mxDNDListenerContainer, css::uno::UNO_QUERY);
- if (xDropTargetDropContext.is() && xDropTarget.is())
+ if (!xDropTarget.is() || !xDropTargetDropContext.is())
{
- static_cast<DNDListenerContainer *>(xDropTarget.get())->fireDropEvent(
- xDropTargetDropContext,
- css::datatransfer::dnd::DNDConstants::ACTION_MOVE,
- aWinPos.X(),
- aWinPos.Y(),
- (css::datatransfer::dnd::DNDConstants::ACTION_COPY |
- css::datatransfer::dnd::DNDConstants::ACTION_MOVE |
- css::datatransfer::dnd::DNDConstants::ACTION_LINK),
- css::uno::Reference<css::datatransfer::XTransferable>());
+ pFrameData->mbStartDragCalled = pFrameData->mbDragging = false;
+ return false;
}
- pDragWin->ImplGetFrameData()->mbDragging = false;
+ Point dragOverPos = pDragWin->ImplFrameToOutput(aMousePos);
+ static_cast<DNDListenerContainer *>(xDropTarget.get())->fireDropEvent(
+ xDropTargetDropContext,
+ css::datatransfer::dnd::DNDConstants::ACTION_MOVE,
+ dragOverPos.X(),
+ dragOverPos.Y(),
+ (css::datatransfer::dnd::DNDConstants::ACTION_COPY |
+ css::datatransfer::dnd::DNDConstants::ACTION_MOVE |
+ css::datatransfer::dnd::DNDConstants::ACTION_LINK),
+ xTransfer);
+
+ pFrameData->mbStartDragCalled = pFrameData->mbDragging = false;
return true;
}
+ if (pFrameData->mbDragging)
+ {
+ // wrong status, reset
+ pFrameData->mbStartDragCalled = pFrameData->mbDragging = false;
+ return false;
+ }
+
vcl::Window* pDownWin = pFrameData->mpMouseDownWin;
if (pDownWin && nEvent == MouseNotifyEvent::MOUSEMOVE)
{
More information about the Libreoffice-commits
mailing list