[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - desktop/source include/vcl sc/qa sc/source vcl/source
Pranav Kant
pranavk at collabora.co.uk
Fri Feb 23 19:48:22 UTC 2018
desktop/source/lib/init.cxx | 79 ---------------------------
include/vcl/IDialogRenderable.hxx | 2
include/vcl/ITiledRenderable.hxx | 61 ++++++++++++++++++++
sc/qa/unit/tiledrendering/tiledrendering.cxx | 2
sc/source/ui/unoobj/docuno.cxx | 6 +-
vcl/source/window/mouse.cxx | 17 +++++
6 files changed, 85 insertions(+), 82 deletions(-)
New commits:
commit 7e8d9f156fc6650c49c3312f6f7a7a57abf1f285
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Fri Feb 23 21:27:33 2018 +0530
lok sc: Post mouse events to main thread
Change-Id: I1311938d7c01d0e3bfd239743e6cb2148da56cdf
Reviewed-on: https://gerrit.libreoffice.org/50253
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1bf6d00674a8..45cd0a0c18b2 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -211,66 +211,6 @@ static const ExtensionMap aDrawExtensionMap[] =
{ nullptr, nullptr }
};
-/*
- * Map directly to css cursor styles to avoid further mapping in the client.
- * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
- *
- * This was created partially with help of the mappings in gtkdata.cxx.
- * The list is incomplete as some cursor style simply aren't supported
- * by css, it might turn out to be worth mapping some of these missing cursors
- * to available cursors?
- */
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning( disable : 4592)
-#endif
-static const std::map <PointerStyle, OString> aPointerMap {
- { PointerStyle::Arrow, "default" },
- // PointerStyle::Null ?
- { PointerStyle::Wait, "wait" },
- { PointerStyle::Text, "text" },
- { PointerStyle::Help, "help" },
- { PointerStyle::Cross, "crosshair" },
- { PointerStyle::Fill, "fill" },
- { PointerStyle::Move, "move" },
- { PointerStyle::NSize, "n-resize" },
- { PointerStyle::SSize, "s-resize" },
- { PointerStyle::WSize, "w-resize" },
- { PointerStyle::ESize, "e-resize" },
- { PointerStyle::NWSize, "ne-resize" },
- { PointerStyle::NESize, "ne-resize" },
- { PointerStyle::SWSize, "sw-resize" },
- { PointerStyle::SESize, "se-resize" },
- // WindowNSize through WindowSESize
- { PointerStyle::HSplit, "col-resize" },
- { PointerStyle::VSplit, "row-resize" },
- { PointerStyle::HSizeBar, "col-resize" },
- { PointerStyle::VSizeBar, "row-resize" },
- { PointerStyle::Hand, "grab" },
- { PointerStyle::RefHand, "grabbing" },
- // Pen, Magnify, Fill, Rotate
- // HShear, VShear
- // Mirror, Crook, Crop, MovePoint, MoveBezierWeight
- // MoveData
- { PointerStyle::CopyData, "copy" },
- { PointerStyle::LinkData, "alias" },
- // MoveDataLink, CopyDataLink
- //MoveFile, CopyFile, LinkFile
- // MoveFileLink, CopyFileLink, MoveFiless, CopyFiles
- { PointerStyle::NotAllowed, "not-allowed" },
- // DrawLine through DrawCaption
- // Chart, Detective, PivotCol, PivotRow, PivotField, Chain, ChainNotAllowed
- // TimeEventMove, TimeEventSize
- // AutoScrollN through AutoScrollNSWE
- // Airbrush
- { PointerStyle::TextVertical, "vertical-text" }
- // Pivot Delete, TabSelectS through TabSelectSW
- // PaintBrush, HideWhiteSpace, ShowWhiteSpace
-};
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
static OUString getUString(const char* pString)
{
if (pString == nullptr)
@@ -2511,25 +2451,6 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX,
}
pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier);
-
- Pointer aPointer = pDoc->getPointer();
- // We don't map all possible pointers hence we need a default
- OString aPointerString = "default";
- auto aIt = aPointerMap.find(aPointer.GetStyle());
- if (aIt != aPointerMap.end())
- {
- aPointerString = aIt->second;
- }
-
- LibLODocument_Impl* pLib = static_cast<LibLODocument_Impl*>(pThis);
- int nView = SfxLokHelper::getView();
- if (nView < 0)
- return;
-
- if (pLib->mpCallbackFlushHandlers[nView])
- {
- pLib->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr());
- }
}
static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx
index ef8d42a4a46c..a2c9b8416ccd 100644
--- a/include/vcl/IDialogRenderable.hxx
+++ b/include/vcl/IDialogRenderable.hxx
@@ -34,6 +34,8 @@ public:
virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId,
const OUString& rAction,
const std::vector<LOKPayloadItem>& rPayload = std::vector<LOKPayloadItem>()) const = 0;
+
+ virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0;
};
} // namespace vcl
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index f6da97484bdc..b14ee48f341e 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -15,11 +15,72 @@
#include <tools/gen.hxx>
#include <svx/ruler.hxx>
#include <vcl/pointr.hxx>
+#include <vcl/ptrstyle.hxx>
#include <vcl/virdev.hxx>
#include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
namespace vcl
{
+ /*
+ * Map directly to css cursor styles to avoid further mapping in the client.
+ * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
+ *
+ * This was created partially with help of the mappings in gtkdata.cxx.
+ * The list is incomplete as some cursor style simply aren't supported
+ * by css, it might turn out to be worth mapping some of these missing cursors
+ * to available cursors?
+ */
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning( disable : 4592)
+#endif
+ static const std::map <PointerStyle, OString> gaLOKPointerMap {
+ { PointerStyle::Arrow, "default" },
+ // PointerStyle::Null ?
+ { PointerStyle::Wait, "wait" },
+ { PointerStyle::Text, "text" },
+ { PointerStyle::Help, "help" },
+ { PointerStyle::Cross, "crosshair" },
+ { PointerStyle::Fill, "fill" },
+ { PointerStyle::Move, "move" },
+ { PointerStyle::NSize, "n-resize" },
+ { PointerStyle::SSize, "s-resize" },
+ { PointerStyle::WSize, "w-resize" },
+ { PointerStyle::ESize, "e-resize" },
+ { PointerStyle::NWSize, "ne-resize" },
+ { PointerStyle::NESize, "ne-resize" },
+ { PointerStyle::SWSize, "sw-resize" },
+ { PointerStyle::SESize, "se-resize" },
+ // WindowNSize through WindowSESize
+ { PointerStyle::HSplit, "col-resize" },
+ { PointerStyle::VSplit, "row-resize" },
+ { PointerStyle::HSizeBar, "col-resize" },
+ { PointerStyle::VSizeBar, "row-resize" },
+ { PointerStyle::Hand, "grab" },
+ { PointerStyle::RefHand, "grabbing" },
+ // Pen, Magnify, Fill, Rotate
+ // HShear, VShear
+ // Mirror, Crook, Crop, MovePoint, MoveBezierWeight
+ // MoveData
+ { PointerStyle::CopyData, "copy" },
+ { PointerStyle::LinkData, "alias" },
+ // MoveDataLink, CopyDataLink
+ //MoveFile, CopyFile, LinkFile
+ // MoveFileLink, CopyFileLink, MoveFiless, CopyFiles
+ { PointerStyle::NotAllowed, "not-allowed" },
+ // DrawLine through DrawCaption
+ // Chart, Detective, PivotCol, PivotRow, PivotField, Chain, ChainNotAllowed
+ // TimeEventMove, TimeEventSize
+ // AutoScrollN through AutoScrollNSWE
+ // Airbrush
+ { PointerStyle::TextVertical, "vertical-text" }
+ // Pivot Delete, TabSelectS through TabSelectSW
+ // PaintBrush, HideWhiteSpace, ShowWhiteSpace
+ };
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
class VCL_DLLPUBLIC ITiledRenderable
{
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 11c5179622c6..2bb0c660ff69 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -309,6 +309,7 @@ void ScTiledRenderingTest::testSortAscendingDescending()
pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, 551, 129, 1, MOUSE_LEFT, 0);
pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, 820, 1336, 1, MOUSE_LEFT, 0);
pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, 820, 1359, 1, MOUSE_LEFT, 0);
+ Scheduler::ProcessEventsToIdle();
// sort ascending
uno::Sequence<beans::PropertyValue> aArgs;
@@ -860,6 +861,7 @@ void ScTiledRenderingTest::testGraphicInvalidate()
aView.m_bGraphicSelection = false;
pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, /*x=*/ 1,/*y=*/ 1,/*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0);
pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, /*x=*/ 1, /*y=*/ 1, /*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0);
+ Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView.m_bGraphicSelection);
// Drag Drop graphic
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index d191d14ba9a5..ae635323574e 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -677,7 +677,7 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt
switch (nType)
{
case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
- pGridWindow->MouseButtonDown(aEvent);
+ Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pGridWindow, &aEvent);
// Invoke the context menu
if (nButtons & MOUSE_RIGHT)
@@ -687,7 +687,7 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt
}
break;
case LOK_MOUSEEVENT_MOUSEBUTTONUP:
- pGridWindow->MouseButtonUp(aEvent);
+ Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONUP, pGridWindow, &aEvent);
// sometimes MouseButtonDown captures mouse and starts tracking, and VCL
// will not take care of releasing that with tiled rendering
@@ -696,7 +696,7 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt
break;
case LOK_MOUSEEVENT_MOUSEMOVE:
- pGridWindow->MouseMove(aEvent);
+ Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEMOVE, pGridWindow, &aEvent);
break;
default:
assert(false);
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 467bc089e388..2a9ec9765c29 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -22,6 +22,9 @@
#include <tools/time.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
+#include <vcl/ITiledRenderable.hxx>
#include <vcl/svapp.hxx>
#include <vcl/salgtype.hxx>
#include <vcl/window.hxx>
@@ -495,6 +498,20 @@ void Window::SetPointer( const Pointer& rPointer )
// possibly immediately move pointer
if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() );
+
+ if (VclPtr<vcl::Window> pWin = GetParentWithLOKNotifier())
+ {
+ Pointer aPointer = GetPointer();
+ // We don't map all possible pointers hence we need a default
+ OString aPointerString = "default";
+ auto aIt = vcl::gaLOKPointerMap.find(aPointer.GetStyle());
+ if (aIt != vcl::gaLOKPointerMap.end())
+ {
+ aPointerString = aIt->second;
+ }
+
+ pWin->GetLOKNotifier()->libreOfficeKitViewCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr());
+ }
}
void Window::EnableChildPointerOverwrite( bool bOverwrite )
More information about the Libreoffice-commits
mailing list