summaryrefslogtreecommitdiff
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
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
-rw-r--r--include/vcl/edit.hxx1
-rw-r--r--include/vcl/lstbox.hxx1
-rw-r--r--include/vcl/window.hxx1
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx5
-rw-r--r--sc/source/ui/inc/checklistmenu.hxx1
-rw-r--r--sc/source/ui/view/gridwin.cxx8
-rw-r--r--svx/source/tbxctrls/lboxctrl.cxx8
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx25
-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
17 files changed, 5 insertions, 101 deletions
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 57a8e07cafab..ce686d4cbc52 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -186,7 +186,6 @@ public:
virtual void Command( const CommandEvent& rCEvt ) override;
virtual void StateChanged( StateChangedType nType ) override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual void Modify();
virtual void UpdateData();
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 09067d26b712..3276e3eaa667 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -134,7 +134,6 @@ public:
virtual void DoubleClick();
virtual void GetFocus() override;
virtual void LoseFocus() override;
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual const Wallpaper& GetDisplayBackground() const override;
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 5b0fd1634415..1f0cddd37d72 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -824,7 +824,6 @@ public:
virtual void DataChanged( const DataChangedEvent& rDCEvt );
virtual bool PreNotify( NotifyEvent& rNEvt );
virtual bool Notify( NotifyEvent& rNEvt );
- virtual vcl::Window* GetPreferredKeyInputWindow();
// These methods call the relevant virtual method when not in/post dispose
void CompatGetFocus();
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index be5f3563dfd3..fa943fc85ddb 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1327,11 +1327,6 @@ void ScCheckListMenuWindow::Paint(vcl::RenderContext& rRenderContext, const Rect
rRenderContext.DrawRect(Rectangle(aPos,aSize));
}
-vcl::Window* ScCheckListMenuWindow::GetPreferredKeyInputWindow()
-{
- return maTabStops.GetCurrentControl();
-}
-
Reference<XAccessible> ScCheckListMenuWindow::CreateAccessible()
{
if (!mxAccessible.is())
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index fa104edef031..8824acb17534 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -299,7 +299,6 @@ public:
virtual void MouseMove(const MouseEvent& rMEvt) override;
virtual bool Notify(NotifyEvent& rNEvt) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
void setMemberSize(size_t n);
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 33de00a7a216..1a8ed514f6ec 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -347,8 +347,6 @@ public:
ScFilterFloatingWindow( vcl::Window* pParent, WinBits nStyle = WB_STDFLOATWIN );
virtual ~ScFilterFloatingWindow();
virtual void dispose() override;
- // required for System FloatingWindows that will not process KeyInput by themselves
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
};
ScFilterFloatingWindow::ScFilterFloatingWindow( vcl::Window* pParent, WinBits nStyle ) :
@@ -366,12 +364,6 @@ void ScFilterFloatingWindow::dispose()
FloatingWindow::dispose();
}
-vcl::Window* ScFilterFloatingWindow::GetPreferredKeyInputWindow()
-{
- // redirect keyinput in the child window
- return GetWindow(GetWindowType::FirstChild) ? GetWindow(GetWindowType::FirstChild)->GetPreferredKeyInputWindow() : nullptr; // will be the FilterBox
-}
-
static bool lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange )
{
// If it is a editable range and if there is a Matrix cell at the bottom right with an
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index e5e83d60f42a..e5141f15324c 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -73,7 +73,6 @@ public:
bool IsUserSelected() const { return bUserSel; }
void SetUserSelected( bool bVal ) { bUserSel = bVal; }
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
};
SvxPopupWindowListBox::SvxPopupWindowListBox(sal_uInt16 nSlotId, const OUString& rCommandURL, sal_uInt16 nId, ToolBox& rTbx)
@@ -128,13 +127,6 @@ void SvxPopupWindowListBox::StateChanged(
SfxPopupWindow::StateChanged( nSID, eState, pState );
}
-vcl::Window* SvxPopupWindowListBox::GetPreferredKeyInputWindow()
-{
- // allows forwarding key events in the correct window
- // without setting the focus
- return m_pListBox->GetPreferredKeyInputWindow();
-}
-
SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
:SfxToolBoxControl( nSlotId, nId, rTbx ),
pPopupWin ( nullptr )
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 66376264ba1e..dc70581cb383 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -259,7 +259,6 @@ private:
protected:
virtual void Resize() override;
virtual bool Close() override;
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual void GetFocus() override;
public:
@@ -285,9 +284,7 @@ private:
protected:
virtual void Resize() override;
virtual bool Close() override;
- virtual vcl::Window* GetPreferredKeyInputWindow() override;
virtual void GetFocus() override;
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
public:
SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow );
virtual ~SvxLineWindow_Impl() { disposeOnce(); }
@@ -1659,11 +1656,6 @@ void SvxFrameWindow_Impl::dispose()
SfxPopupWindow::dispose();
}
-vcl::Window* SvxFrameWindow_Impl::GetPreferredKeyInputWindow()
-{
- return aFrameSet.get();
-}
-
void SvxFrameWindow_Impl::GetFocus()
{
if (aFrameSet)
@@ -2043,28 +2035,11 @@ bool SvxLineWindow_Impl::Close()
return SfxPopupWindow::Close();
}
-vcl::Window* SvxLineWindow_Impl::GetPreferredKeyInputWindow()
-{
- return m_aLineStyleLb.get();
-}
-
void SvxLineWindow_Impl::GetFocus()
{
m_aLineStyleLb->GrabFocus();
}
-void SvxLineWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
-{
- SfxPopupWindow::DataChanged( rDCEvt );
-#if 0
- if( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) )
- {
- CreateBitmaps();
- Invalidate();
- }
-#endif
-}
-
SfxStyleControllerItem_Impl::SfxStyleControllerItem_Impl(
const Reference< XDispatchProvider >& rDispatchProvider,
sal_uInt16 nSlotId, // Family-ID
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 )