[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/source sd/source sw/source

2018-02-22 Thread Pranav Kant
 sc/source/ui/unoobj/docuno.cxx|4 ++--
 sd/source/ui/unoidl/unomodel.cxx  |5 +++--
 sw/source/uibase/uno/unotxdoc.cxx |4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit d5f0b3d725f678c1a7eb4b8b4ab3a2279742260c
Author: Pranav Kant 
Date:   Thu Feb 22 17:40:35 2018 +0530

Revert posting key events on the main thread

This partially reverts commit f2d3192e8a4ae743fcaab27ab6d829d57ae8fb60.

Change-Id: Ic273e3f742d48dbfb73060a6ecb4feb80afdcfaa
Reviewed-on: https://gerrit.libreoffice.org/50174
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index f415a7b5cd4c..b6cbc5e46fac 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -623,10 +623,10 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, 
int nKeyCode)
 switch (nType)
 {
 case LOK_KEYEVENT_KEYINPUT:
-Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, &aEvent);
+pWindow->KeyInput(aEvent);
 break;
 case LOK_KEYEVENT_KEYUP:
-Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, &aEvent);
+pWindow->KeyUp(aEvent);
 break;
 default:
 assert(false);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 30971a584e49..d9ea81e4982e 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2507,13 +2507,14 @@ void SdXImpressDocument::postKeyEvent(int nType, int 
nCharCode, int nKeyCode)
 return;
 
 KeyEvent aEvent(nCharCode, nKeyCode, 0);
+
 switch (nType)
 {
 case LOK_KEYEVENT_KEYINPUT:
-Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, &aEvent);
+pWindow->KeyInput(aEvent);
 break;
 case LOK_KEYEVENT_KEYUP:
-Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, &aEvent);
+pWindow->KeyUp(aEvent);
 break;
 default:
 assert(false);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 103ae13f9111..0244b3db6a2b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3499,10 +3499,10 @@ void SwXTextDocument::postKeyEvent(int nType, int 
nCharCode, int nKeyCode)
 switch (nType)
 {
 case LOK_KEYEVENT_KEYINPUT:
-Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, &aEvent);
+pWindow->KeyInput(aEvent);
 break;
 case LOK_KEYEVENT_KEYUP:
-Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, &aEvent);
+pWindow->KeyUp(aEvent);
 break;
 default:
 assert(false);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/source sd/source sw/source

2018-02-21 Thread Pranav Kant
 sc/source/ui/unoobj/docuno.cxx|   28 
 sd/source/ui/unoidl/unomodel.cxx  |   24 +---
 sw/source/uibase/uno/unotxdoc.cxx |   23 +++
 3 files changed, 32 insertions(+), 43 deletions(-)

New commits:
commit f2d3192e8a4ae743fcaab27ab6d829d57ae8fb60
Author: Pranav Kant 
Date:   Tue Feb 20 21:32:34 2018 +0530

lok: Factor out the code for finding vcl::Window of a document

This should also help with IME input on charts

Change-Id: Ie513790a5d0c87397c39301a328a44b59d394a45
Reviewed-on: https://gerrit.libreoffice.org/50094
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 63a7b757bf9a..7df255a31ebd 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -549,10 +549,19 @@ OUString ScModelObj::getPartHash( int nPart )
 VclPtr ScModelObj::getDocWindow()
 {
 SolarMutexGuard aGuard;
+
+// There seems to be no clear way of getting the grid window for this
+// particular document, hence we need to hope we get the right window.
 ScViewData* pViewData = ScDocShell::GetViewData();
 VclPtr pWindow;
 if (pViewData)
 pWindow = pViewData->GetActiveWin();
+
+LokChartHelper aChartHelper(pViewData->GetViewShell());
+vcl::Window* pChartWindow = aChartHelper.GetWindow();
+if (pChartWindow)
+pWindow = pChartWindow;
+
 return pWindow;
 }
 
@@ -594,31 +603,18 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, 
int nKeyCode)
 {
 SolarMutexGuard aGuard;
 
-// There seems to be no clear way of getting the grid window for this
-// particular document, hence we need to hope we get the right window.
-ScViewData* pViewData = ScDocShell::GetViewData();
-vcl::Window* pWindow = pViewData->GetActiveWin();
-
+VclPtr pWindow = getDocWindow();
 if (!pWindow)
 return;
 
 KeyEvent aEvent(nCharCode, nKeyCode, 0);
-
-ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
-LokChartHelper aChartHelper(pTabViewShell);
-vcl::Window* pChartWindow = aChartHelper.GetWindow();
-if (pChartWindow)
-{
-pWindow = pChartWindow;
-}
-
 switch (nType)
 {
 case LOK_KEYEVENT_KEYINPUT:
-pWindow->KeyInput(aEvent);
+Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, &aEvent);
 break;
 case LOK_KEYEVENT_KEYUP:
-pWindow->KeyUp(aEvent);
+Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, &aEvent);
 break;
 default:
 assert(false);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 4933b87742f9..30971a584e49 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2374,6 +2374,12 @@ VclPtr SdXImpressDocument::getDocWindow()
 VclPtr pWindow;
 if (pViewShell)
 pWindow = pViewShell->GetActiveWindow();
+
+LokChartHelper aChartHelper(pViewShell->GetViewShell());
+VclPtr pChartWindow = aChartHelper.GetWindow();
+if (pChartWindow)
+pWindow = pChartWindow;
+
 return pWindow;
 }
 
@@ -2496,30 +2502,18 @@ void SdXImpressDocument::postKeyEvent(int nType, int 
nCharCode, int nKeyCode)
 {
 SolarMutexGuard aGuard;
 
-DrawViewShell* pViewShell = GetViewShell();
-if (!pViewShell)
-return;
-
-vcl::Window* pWindow = pViewShell->GetActiveWindow();
+VclPtr pWindow = getDocWindow();
 if (!pWindow)
 return;
 
-LokChartHelper aChartHelper(pViewShell->GetViewShell());
-vcl::Window* pChartWindow = aChartHelper.GetWindow();
-if (pChartWindow)
-{
-pWindow = pChartWindow;
-}
-
 KeyEvent aEvent(nCharCode, nKeyCode, 0);
-
 switch (nType)
 {
 case LOK_KEYEVENT_KEYINPUT:
-pWindow->KeyInput(aEvent);
+Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, &aEvent);
 break;
 case LOK_KEYEVENT_KEYUP:
-pWindow->KeyUp(aEvent);
+Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, &aEvent);
 break;
 default:
 assert(false);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 43101853987a..103ae13f9111 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3409,6 +3409,12 @@ VclPtr SwXTextDocument::getDocWindow()
 SwView* pView = pDocShell->GetView();
 if (pView)
 pWindow = &(pView->GetEditWin());
+
+LokChartHelper aChartHelper(pView);
+VclPtr pChartWindow = aChartHelper.GetWindow();
+if (pChartWindow)
+pWindow = pChartWindow;
+
 return pWindow;
 }
 
@@ -3485,25 +3491,18 @@ void SwXTextDocument::postKeyEvent(int nType, int 
nCharCode, int nKeyCode)
 {
 SolarMutexGuard aGuard;
 
-vcl::Window* pWindow = &(pDocShell->GetView()->GetEditWin());
-
-SfxViewShell* pViewShell = pDocShell->Ge