summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-01-29 21:07:42 +0100
committerJan Holesovsky <kendy@collabora.com>2014-01-31 12:06:46 +0000
commit5b1e68bd852cac4534c5ce2e548187dce1d4561a (patch)
tree2f03db39ff8ed9807d27d8330708ff3271e0d1aa /vcl
parent82300f367dda20e3e83477dae9dd37124ac9831b (diff)
fdo#71763: F6 key moves focus on this trip: Menu -> Sidebar -> Thumbnail view
Sidebar and thumbnail View are actually not separate windows but F6 key traversal should simulate it as they would be. Define a new getfocus flag called GETFOCUS_F6 which means focus were grabed as a result of pressing F6 key. Use this and other two (GETFOCUS_FORWARD, GETFOCUS_BACKWARD) flags to indicate the focus were grabbed along subwindow relation (define a new ImplGrabFocusToDocument method with a flag parameter on the analogy of GrabFocus() <-> ImplGrabFocus()). Handle F6, Shift+F6 inside BackingWindow as it would have two subwindow (sidebar and thumbnail view). Plus Ctrl+F6 -> grab focus to the thumbnail view. Change-Id: Ie43d761e7cb0269afb79481a81947a4b96e1dde0 Reviewed-on: https://gerrit.libreoffice.org/7486 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/taskpanelist.cxx12
-rw-r--r--vcl/source/window/window.cxx25
2 files changed, 21 insertions, 16 deletions
diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx
index 5a5eb0efb4ff..459f557272d0 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -77,13 +77,13 @@ struct LTRSortBackward : public ::std::binary_function< const Window*, const Win
// --------------------------------------------------
-static void ImplTaskPaneListGrabFocus( Window *pWindow )
+static void ImplTaskPaneListGrabFocus( Window *pWindow, bool bForward )
{
// put focus in child of floating windows which is typically a toolbar
// that can deal with the focus
if( pWindow->ImplIsFloatingWindow() && pWindow->GetWindow( WINDOW_FIRSTCHILD ) )
pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD );
- pWindow->GrabFocus();
+ pWindow->ImplGrabFocus( GETFOCUS_F6 | (bForward ? GETFOCUS_FORWARD : GETFOCUS_BACKWARD));
}
// --------------------------------------------------
@@ -195,7 +195,7 @@ sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent )
// Ctrl-F6 goes directly to the document
if( !pWin->IsDialog() && aKeyCode.IsMod1() && !aKeyCode.IsShift() )
{
- pWin->GrabFocusToDocument();
+ pWin->ImplGrabFocusToDocument( GETFOCUS_F6 );
return sal_True;
}
@@ -210,7 +210,7 @@ sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent )
if( pNextWin != pWin )
{
ImplGetSVData()->maWinData.mbNoSaveFocus = sal_True;
- ImplTaskPaneListGrabFocus( pNextWin );
+ ImplTaskPaneListGrabFocus( pNextWin, bForward );
ImplGetSVData()->maWinData.mbNoSaveFocus = sal_False;
}
else
@@ -221,7 +221,7 @@ sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent )
// we did not find another taskpane, so
// put focus back into document
- pWin->GrabFocusToDocument();
+ pWin->ImplGrabFocusToDocument( GETFOCUS_F6 | (bForward ? GETFOCUS_FORWARD : GETFOCUS_BACKWARD));
}
return sal_True;
@@ -240,7 +240,7 @@ sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent )
pWin = FindNextFloat( NULL, bForward );
if( pWin )
{
- ImplTaskPaneListGrabFocus( pWin );
+ ImplTaskPaneListGrabFocus( pWin, bForward );
return sal_True;
}
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 64e535ad6ff9..a79fecf9911e 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -4167,6 +4167,20 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
}
}
+void Window::ImplGrabFocusToDocument( sal_uInt16 nFlags )
+{
+ Window *pWin = this;
+ while( pWin )
+ {
+ if( !pWin->GetParent() )
+ {
+ pWin->ImplGetFrameWindow()->GetWindow( WINDOW_CLIENT )->ImplGrabFocus(nFlags);
+ return;
+ }
+ pWin = pWin->GetParent();
+ }
+}
+
// -----------------------------------------------------------------------
void Window::ImplNewInputContext()
@@ -7506,16 +7520,7 @@ sal_Bool Window::HasFocus() const
void Window::GrabFocusToDocument()
{
- Window *pWin = this;
- while( pWin )
- {
- if( !pWin->GetParent() )
- {
- pWin->ImplGetFrameWindow()->GetWindow( WINDOW_CLIENT )->GrabFocus();
- return;
- }
- pWin = pWin->GetParent();
- }
+ ImplGrabFocusToDocument(0);
}
void Window::SetFakeFocus( bool bFocus )