[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source vcl/win
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jan 12 08:46:38 PST 2016
include/vcl/window.hxx | 2 +-
vcl/inc/window.h | 2 +-
vcl/source/window/mouse.cxx | 2 +-
vcl/source/window/syschild.cxx | 7 ++-----
vcl/source/window/window.cxx | 13 +++++--------
vcl/source/window/winproc.cxx | 21 +++++++--------------
vcl/win/window/salframe.cxx | 2 +-
7 files changed, 18 insertions(+), 31 deletions(-)
New commits:
commit e24ebfabf3dbcecaa52dba62397c4803571e5f81
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 12 17:44:52 2016 +0100
Revert "Re-work focus handling to use an idle handler"
This reverts commit 0ba752201dca6129cc6b4a19ec93eb369eb70890. It breaks
CppunitTest_desktop_lib on Linux.
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 3ade2a8..6b383bd 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -537,7 +537,7 @@ public:
DECL_DLLPRIVATE_LINK_TYPED( ImplHandlePaintHdl, Idle*, void );
DECL_DLLPRIVATE_LINK_TYPED( ImplGenerateMouseMoveHdl, void*, void );
DECL_DLLPRIVATE_LINK_TYPED( ImplTrackTimerHdl, Timer*, void );
- DECL_DLLPRIVATE_LINK_TYPED( ImplAsyncFocusHdl, Idle*, void );
+ DECL_DLLPRIVATE_LINK_TYPED( ImplAsyncFocusHdl, void*, void );
DECL_DLLPRIVATE_LINK_TYPED( ImplHandleResizeTimerHdl, Idle*, void );
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 4c8b541..64551af 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -143,7 +143,7 @@ struct ImplFrameData
sal_Int32 mnDPIY; //< Original Screen Resolution
ImplMapRes maMapUnitRes; //< for LogicUnitToPixel
sal_uIntPtr mnAllSaveBackSize; //< size of all bitmaps of saved backgrounds
- Idle * mpFocusIdle;
+ ImplSVEvent * mnFocusId; //< FocusId for PostUserLink
ImplSVEvent * mnMouseMoveId; //< MoveId for PostUserLink
long mnLastMouseX; //< last x mouse position
long mnLastMouseY; //< last y mouse position
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 4747abd..330cb70 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -256,7 +256,7 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
vcl::Window *pFrame = pSVData->maWinData.mpFirstFrame;
while( pFrame )
{
- if( pFrame != mpWindowImpl->mpFrameWindow.get() && pFrame->mpWindowImpl->mpFrameData->mpFocusIdle )
+ if( pFrame != mpWindowImpl->mpFrameWindow.get() && pFrame->mpWindowImpl->mpFrameData->mnFocusId )
{
bAsyncFocusWaiting = true;
break;
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index 7a007a9..d0c8e8c 100644
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -79,13 +79,10 @@ long ImplSysChildProc( void* pInst, SalObject* /* pObject */,
// trigger a LoseFocus which matches the status
// of the window with matching Activate-Status
pWindow->ImplGetFrameData()->mbSysObjFocus = false;
- if ( !pWindow->ImplGetFrameData()->mpFocusIdle )
+ if ( !pWindow->ImplGetFrameData()->mnFocusId )
{
pWindow->ImplGetFrameData()->mbStartFocusState = true;
- pWindow->ImplGetFrameData()->mpFocusIdle = new Idle("loseFocus");
- pWindow->ImplGetFrameData()->mpFocusIdle->SetIdleHdl(LINK( pWindow->ImplGetFrameWindow(), vcl::Window, ImplAsyncFocusHdl ));
- pWindow->ImplGetFrameData()->mpFocusIdle->SetPriority(SchedulerPriority::LOW);
- pWindow->ImplGetFrameData()->mpFocusIdle->Start();
+ pWindow->ImplGetFrameData()->mnFocusId = Application::PostUserEvent( LINK( pWindow->ImplGetFrameWindow(), vcl::Window, ImplAsyncFocusHdl ), nullptr, true );
}
break;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 61e62b3..d508719 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -498,12 +498,9 @@ void Window::dispose()
if ( mpWindowImpl->mpFrameData )
{
- if ( mpWindowImpl->mpFrameData->mpFocusIdle )
- {
- mpWindowImpl->mpFrameData->mpFocusIdle->Stop();
- delete mpWindowImpl->mpFrameData->mpFocusIdle;
- mpWindowImpl->mpFrameData->mpFocusIdle = nullptr;
- }
+ if ( mpWindowImpl->mpFrameData->mnFocusId )
+ Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId );
+ mpWindowImpl->mpFrameData->mnFocusId = nullptr;
if ( mpWindowImpl->mpFrameData->mnMouseMoveId )
Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId );
mpWindowImpl->mpFrameData->mnMouseMoveId = nullptr;
@@ -573,7 +570,7 @@ void Window::dispose()
}
mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr );
pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
- assert (mpWindowImpl->mpFrameData->mpFocusIdle == nullptr);
+ assert (mpWindowImpl->mpFrameData->mnFocusId == nullptr);
assert (mpWindowImpl->mpFrameData->mnMouseMoveId == nullptr);
delete mpWindowImpl->mpFrameData;
}
@@ -1039,7 +1036,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
mpWindowImpl->mpFrameData->mpFontCollection = pSVData->maGDIData.mpScreenFontList;
mpWindowImpl->mpFrameData->mpFontCache = pSVData->maGDIData.mpScreenFontCache;
mpWindowImpl->mpFrameData->mnAllSaveBackSize = 0;
- mpWindowImpl->mpFrameData->mpFocusIdle = nullptr;
+ mpWindowImpl->mpFrameData->mnFocusId = nullptr;
mpWindowImpl->mpFrameData->mnMouseMoveId = nullptr;
mpWindowImpl->mpFrameData->mnLastMouseX = -1;
mpWindowImpl->mpFrameData->mnLastMouseY = -1;
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index ad02eeb..e61ea10 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1135,7 +1135,7 @@ static bool ImplHandleExtTextInput( vcl::Window* pWindow,
if ( !pChild )
return false;
}
- if( !pChild->ImplGetWindowImpl()->mpFrameData->mpFocusIdle )
+ if( !pChild->ImplGetWindowImpl()->mpFrameData->mnFocusId )
break;
Application::Yield();
}
@@ -1739,10 +1739,9 @@ static void ImplActivateFloatingWindows( vcl::Window* pWindow, bool bActive )
}
}
-IMPL_LINK_NOARG_TYPED(vcl::Window, ImplAsyncFocusHdl, Idle *, void)
+IMPL_LINK_NOARG_TYPED(vcl::Window, ImplAsyncFocusHdl, void*, void)
{
- delete ImplGetWindowImpl()->mpFrameData->mpFocusIdle;
- ImplGetWindowImpl()->mpFrameData->mpFocusIdle = nullptr;
+ ImplGetWindowImpl()->mpFrameData->mnFocusId = nullptr;
// If the status has been preserved, because we got back the focus
// in the meantime, we do nothing
@@ -1853,13 +1852,10 @@ static void ImplHandleGetFocus( vcl::Window* pWindow )
// execute Focus-Events after a delay, such that SystemChildWindows
// do not blink when they receive focus
- if ( !pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle )
+ if ( !pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId )
{
pWindow->ImplGetWindowImpl()->mpFrameData->mbStartFocusState = !pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus;
- pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle = new Idle("getFocus");
- pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle->SetIdleHdl(LINK( pWindow, vcl::Window, ImplAsyncFocusHdl ));
- pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle->SetPriority(SchedulerPriority::LOW);
- pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle->Start();
+ pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId = Application::PostUserEvent( LINK( pWindow, vcl::Window, ImplAsyncFocusHdl ), nullptr, true);
vcl::Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
if ( pFocusWin && pFocusWin->ImplGetWindowImpl()->mpCursor )
pFocusWin->ImplGetWindowImpl()->mpCursor->ImplShow();
@@ -1885,13 +1881,10 @@ static void ImplHandleLoseFocus( vcl::Window* pWindow )
// execute Focus-Events after a delay, such that SystemChildWindows
// do not flicker when they receive focus
- if ( !pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle )
+ if ( !pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId )
{
pWindow->ImplGetWindowImpl()->mpFrameData->mbStartFocusState = !pWindow->ImplGetWindowImpl()->mpFrameData->mbHasFocus;
- pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle = new Idle("loseFocus2");
- pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle->SetIdleHdl(LINK( pWindow, vcl::Window, ImplAsyncFocusHdl ));
- pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle->SetPriority(SchedulerPriority::LOW);
- pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusIdle->Start();
+ pWindow->ImplGetWindowImpl()->mpFrameData->mnFocusId = Application::PostUserEvent( LINK( pWindow, vcl::Window, ImplAsyncFocusHdl ), nullptr, true );
}
vcl::Window* pFocusWin = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 56bce3d..6288326 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3031,7 +3031,7 @@ static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
// hopefully we will not receive the corresponding button up before this
// button down arrives again
vcl::Window *pWin = pFrame->GetWindow();
- if( pWin && pWin->ImplGetWindowImpl()->mpFrameData->mpFocusIdle )
+ if( pWin && pWin->ImplGetWindowImpl()->mpFrameData->mnFocusId )
{
PostMessageW( hWnd, nMsg, wParam, lParam );
return 1;
More information about the Libreoffice-commits
mailing list