diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2018-02-24 12:19:57 +0530 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2018-02-24 19:22:54 +0100 |
commit | 743aee0ad16449ba0ecf506e0a650b45b89628bc (patch) | |
tree | 30cf39241cb97324ad5001f0bf5d6c334a193427 /include/vcl/ITiledRenderable.hxx | |
parent | 86ea687d3f19c04192ee2b7a82736e110c7be334 (diff) |
lok: All mouse,key events async
custom posting of mouse,key events on main thread
This still bypasses vcl while keeping the processing of events on the
main thread which is what we want.
Change-Id: Ia7a6f5ef1ac546245715abe418d261b49df12d4c
Reviewed-on: https://gerrit.libreoffice.org/50274
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'include/vcl/ITiledRenderable.hxx')
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index b14ee48f341e..cea97828d7ed 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -14,6 +14,8 @@ #include <LibreOfficeKit/LibreOfficeKitTypes.h> #include <tools/gen.hxx> #include <svx/ruler.hxx> +#include <vcl/event.hxx> +#include <vcl/vclevent.hxx> #include <vcl/pointr.hxx> #include <vcl/ptrstyle.hxx> #include <vcl/virdev.hxx> @@ -88,6 +90,48 @@ protected: int mnTilePixelWidth, mnTilePixelHeight; int mnTileTwipWidth, mnTileTwipHeight; public: + struct LOKAsyncEventData + { + VclPtr<vcl::Window> mpWindow; + sal_uLong mnEvent; + MouseEvent maMouseEvent; + KeyEvent maKeyEvent; + }; + + static void LOKPostAsyncEvent(void* pEv, void*) + { + LOKAsyncEventData* pLOKEv = static_cast<LOKAsyncEventData*>(pEv); + switch (pLOKEv->mnEvent) + { + case VCLEVENT_WINDOW_KEYINPUT: + pLOKEv->mpWindow->KeyInput(pLOKEv->maKeyEvent); + break; + case VCLEVENT_WINDOW_KEYUP: + pLOKEv->mpWindow->KeyUp(pLOKEv->maKeyEvent); + break; + case VCLEVENT_WINDOW_MOUSEBUTTONDOWN: + pLOKEv->mpWindow->LogicMouseButtonDown(pLOKEv->maMouseEvent); + // Invoke the context menu + if (pLOKEv->maMouseEvent.GetButtons() & MOUSE_RIGHT) + { + const CommandEvent aCEvt(pLOKEv->maMouseEvent.GetPosPixel(), CommandEventId::ContextMenu, true, nullptr); + pLOKEv->mpWindow->Command(aCEvt); + } + break; + case VCLEVENT_WINDOW_MOUSEBUTTONUP: + pLOKEv->mpWindow->LogicMouseButtonUp(pLOKEv->maMouseEvent); + break; + case VCLEVENT_WINDOW_MOUSEMOVE: + pLOKEv->mpWindow->LogicMouseMove(pLOKEv->maMouseEvent); + break; + default: + assert(false); + break; + } + + delete pLOKEv; + } + virtual ~ITiledRenderable(); /** @@ -329,6 +373,7 @@ public: return OUString(); } + }; } // namespace vcl |