summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-04-05 15:27:38 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-04-05 20:24:51 +0100
commitdd46727b99d4bb5135451aa7e5e1bdb197373843 (patch)
tree47ee49810362bb405339682d27d36092d101cffc /vcl
parent92d43df81e282d20c129b105b2c7300a312091eb (diff)
Resolves; tdf#87120 no keyboard navigation inside floating windows
lets try and treat these the same as we do normal toplevels like dialogs if they popup with GrabFocus. This way focus can be set on widgets inside the floating windows, and so keyboard traversal of widgets etc all works. Change-Id: If447429756cf5d136b9c2e2f62fafb37c167b1ce
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/listbox.hxx1
-rw-r--r--vcl/source/control/edit.cxx8
-rw-r--r--vcl/source/control/imp_listbox.cxx5
-rw-r--r--vcl/source/control/listbox.cxx13
-rw-r--r--vcl/source/window/dockmgr.cxx11
-rw-r--r--vcl/source/window/floatwin.cxx2
-rw-r--r--vcl/source/window/mouse.cxx4
-rw-r--r--vcl/source/window/window.cxx7
-rw-r--r--vcl/source/window/winproc.cxx5
9 files changed, 5 insertions, 51 deletions
diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx
index 863bef640f76..3cd6944d6c75 100644
--- a/vcl/inc/listbox.hxx
+++ b/vcl/inc/listbox.hxx
@@ -406,7 +406,6 @@ public:
virtual void Resize() override;
virtual const Wallpaper& GetDisplayBackground() const override;
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr );
sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage );
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 9dab05886997..231422dae317 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1945,14 +1945,6 @@ void Edit::GetFocus()
Control::GetFocus();
}
-vcl::Window* Edit::GetPreferredKeyInputWindow()
-{
- if ( mpSubEdit )
- return mpSubEdit->GetPreferredKeyInputWindow();
- else
- return this;
-}
-
void Edit::LoseFocus()
{
if ( mpUpdateDataTimer && !mbIsSubEdit && mpUpdateDataTimer->IsActive() )
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index 61b9373ca166..2d3424f2cba7 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -2224,11 +2224,6 @@ void ImplListBox::GetFocus()
Control::GetFocus();
}
-vcl::Window* ImplListBox::GetPreferredKeyInputWindow()
-{
- return maLBWindow.get();
-}
-
void ImplListBox::Resize()
{
Control::Resize();
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index 36022324a919..1cbcc4d9e8d7 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -496,19 +496,6 @@ void ListBox::GetFocus()
Control::GetFocus();
}
-vcl::Window* ListBox::GetPreferredKeyInputWindow()
-{
- if ( mpImplLB )
- {
- if( IsDropDownBox() )
- return mpImplWin->GetPreferredKeyInputWindow();
- else
- return mpImplLB->GetPreferredKeyInputWindow();
- }
-
- return Control::GetPreferredKeyInputWindow();
-}
-
void ListBox::LoseFocus()
{
if( IsDropDownBox() )
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 653b663b328d..7e9172fd9481 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -488,7 +488,6 @@ public:
virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
virtual void Tracking( const TrackingEvent& rTEvt ) override;
virtual void Resize() override;
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
Rectangle GetDragRect() const;
Point GetToolboxPosition() const;
@@ -536,14 +535,6 @@ css::uno::Reference< css::accessibility::XAccessible > ImplPopupFloatWin::Create
return css::uno::Reference< css::accessibility::XAccessible >();
}
-vcl::Window* ImplPopupFloatWin::GetPreferredKeyInputWindow()
-{
- if( mpWindowImpl->mpClientWindow )
- return mpWindowImpl->mpClientWindow;
- else
- return FloatingWindow::GetPreferredKeyInputWindow();
-}
-
void ImplPopupFloatWin::ImplSetBorder()
{
// although we have no border in the sense of a borderwindow
@@ -1152,7 +1143,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
{
// send HOME key to subtoolbar in order to select first item
KeyEvent aEvent( 0, vcl::KeyCode( KEY_HOME ) );
- mpFloatWin->GetPreferredKeyInputWindow()->KeyInput( aEvent );
+ mpFloatWin->KeyInput(aEvent);
}
}
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 6553f947440c..9492e9c0d66b 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -715,6 +715,8 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags
{
// force key input even without focus (useful for menus)
mbGrabFocus = true;
+ mpWindowImpl->mpFrameData->mbHasFocus = true;
+ GrabFocus();
}
Show( true, ShowFlags::NoActivate );
}
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 892d419074a2..4782c15aa5ac 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -273,9 +273,7 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
vcl::Window *pParent = this;
while( pParent )
{
- // #102158#, ignore grabfocus only if the floating parent grabs keyboard focus by itself (GrabsFocus())
- // otherwise we cannot set the focus in a floating toolbox
- if( ( (pParent->mpWindowImpl->mbFloatWin && static_cast<FloatingWindow*>(pParent)->GrabsFocus()) || ( pParent->GetStyle() & WB_SYSTEMFLOATWIN ) ) && !( pParent->GetStyle() & WB_MOVEABLE ) )
+ if ((pParent->GetStyle() & WB_SYSTEMFLOATWIN) && !(pParent->GetStyle() & WB_MOVEABLE))
{
bMustNotGrabFocus = true;
break;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 1092c4e9be6a..5d630fa100c7 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3443,13 +3443,6 @@ void Window::DrawSelectionBackground( const Rectangle& rRect,
SetLineColor( oldLineCol );
}
-// controls should return the window that gets the
-// focus by default, so keyevents can be sent to that window directly
-vcl::Window* Window::GetPreferredKeyInputWindow()
-{
- return this;
-}
-
bool Window::IsScrollable() const
{
// check for scrollbars
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index b2de412866d4..062136e363de 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -821,10 +821,7 @@ static vcl::Window* ImplGetKeyInputWindow( vcl::Window* pWindow )
if( !pChild || ( pChild->ImplGetWindowImpl()->mbFloatWin && !static_cast<FloatingWindow *>(pChild)->GrabsFocus() ) )
pChild = pWindow->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
else
- {
- // allow floaters to forward keyinput to some member
- pChild = pChild->GetPreferredKeyInputWindow();
- }
+ pChild = pChild->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
// no child - than no input
if ( !pChild )