summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-07-30 21:29:48 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-08-02 10:22:33 +0100
commit0321dbb9be72f92c02919457cdc3c4e76cfbd11d (patch)
treeda8db09d364c072899f7707d42144ed2ab2389ec
parent6d40c515fdf86d807c199ff4179b9c862a9fe5b2 (diff)
Resolves: tdf#99324 let sidebar toggle auto-mnemonics on/off with alt
this returns things to passing the alt to the thing with the focus and depends on ::Command handlers passing the alt-press/release back up through the Command hierarchy to get to the default top-level handler eventually Change-Id: I869120f43810adfa2fac4670c2db143b790a1f9b
-rw-r--r--include/svx/sidebar/PanelLayout.hxx4
-rw-r--r--sc/source/ui/app/inputwin.cxx7
-rw-r--r--sc/source/ui/view/gridwin.cxx6
-rw-r--r--sd/source/ui/view/sdwindow.cxx5
-rw-r--r--sfx2/source/dialog/backingwindow.cxx13
-rw-r--r--sfx2/source/dialog/backingwindow.hxx1
-rw-r--r--starmath/source/edit.cxx7
-rw-r--r--svx/source/sidebar/PanelLayout.cxx7
-rw-r--r--vcl/source/window/syswin.cxx8
-rw-r--r--vcl/source/window/winproc.cxx31
10 files changed, 40 insertions, 49 deletions
diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx
index 22b229c3dfc7..ddc2a0e5e084 100644
--- a/include/svx/sidebar/PanelLayout.hxx
+++ b/include/svx/sidebar/PanelLayout.hxx
@@ -29,7 +29,7 @@ private:
bool m_bInClose;
bool hasPanelPendingLayout() const;
- DECL_DLLPRIVATE_LINK_TYPED( ImplHandlePanelLayoutTimerHdl, Idle*, void );
+ DECL_DLLPRIVATE_LINK_TYPED(ImplHandlePanelLayoutTimerHdl, Idle*, void);
public:
PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
@@ -40,7 +40,7 @@ public:
virtual Size GetOptimalSize() const override;
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) override;
virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
-
+ virtual bool Notify(NotifyEvent& rNEvt) override;
};
#endif
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 433b7ee02a0f..b37e3765dd43 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1484,6 +1484,13 @@ void ScTextWnd::MouseButtonUp( const MouseEvent& rMEvt )
void ScTextWnd::Command( const CommandEvent& rCEvt )
{
+ //pass alt press/release to parent impl
+ if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
+ {
+ Window::Command(rCEvt);
+ return;
+ }
+
bInputMode = true;
CommandEventId nCommand = rCEvt.GetCommand();
if ( pEditView /* && nCommand == CommandEventId::StartDrag */ )
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 1e7a3bd41a0c..b56aeb07312a 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2842,6 +2842,12 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
ScModule* pScMod = SC_MOD();
OSL_ENSURE( nCmd != CommandEventId::StartDrag, "ScGridWindow::Command called with CommandEventId::StartDrag" );
+ if (nCmd == CommandEventId::ModKeyChange)
+ {
+ Window::Command(rCEvt);
+ return;
+ }
+
if ( nCmd == CommandEventId::StartExtTextInput ||
nCmd == CommandEventId::EndExtTextInput ||
nCmd == CommandEventId::ExtTextInput ||
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index dde0d8cc55de..4c51a511a169 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -261,8 +261,11 @@ void Window::MouseButtonUp(const MouseEvent& rMEvt)
void Window::Command(const CommandEvent& rCEvt)
{
- if ( mpViewShell )
+ if (mpViewShell)
mpViewShell->Command(rCEvt, this);
+ //pass at least alt press/release to parent impl
+ if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
+ vcl::Window::Command(rCEvt);
}
bool Window::Notify( NotifyEvent& rNEvt )
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 6059ca158307..2d0940a9049e 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -163,18 +163,6 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) :
// init background
SetBackground();
-
- GetParent()->AddEventListener(LINK(this, BackingWindow, WindowEventListener));
-}
-
-IMPL_LINK_TYPED(BackingWindow, WindowEventListener, VclWindowEvent&, rEvent, void)
-{
- if (rEvent.GetId() != VCLEVENT_WINDOW_COMMAND)
- return;
- CommandEvent* pCmdEvt = static_cast<CommandEvent*>(rEvent.GetData());
- if (pCmdEvt->GetCommand() != CommandEventId::ModKeyChange)
- return;
- Accelerator::ToggleMnemonicsOnHierarchy(*pCmdEvt, this);
}
BackingWindow::~BackingWindow()
@@ -184,7 +172,6 @@ BackingWindow::~BackingWindow()
void BackingWindow::dispose()
{
- GetParent()->RemoveEventListener(LINK(this, BackingWindow, WindowEventListener));
// deregister drag&drop helper
if (mxDropTargetListener.is())
{
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index 2a12b845fc78..abb68e9c765b 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -106,7 +106,6 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer
DECL_LINK_TYPED(CreateContextMenuHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(OpenTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK_TYPED(EditTemplateHdl, ThumbnailViewItem*, void);
- DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void);
void initControls();
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 780966900cd5..3cf5b1681407 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -335,6 +335,13 @@ void SmEditWindow::MouseButtonDown(const MouseEvent &rEvt)
void SmEditWindow::Command(const CommandEvent& rCEvt)
{
+ //pass alt press/release to parent impl
+ if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
+ {
+ Window::Command(rCEvt);
+ return;
+ }
+
bool bForwardEvt = true;
if (rCEvt.GetCommand() == CommandEventId::ContextMenu)
{
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index f4ec456bd6af..9e04f33b31ba 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -110,4 +110,11 @@ void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, P
VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight));
}
+bool PanelLayout::Notify(NotifyEvent& rNEvt)
+{
+ if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
+ Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this);
+ return Control::Notify( rNEvt );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index d482cbd5ba0a..1a75e4dbe976 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -164,6 +164,9 @@ bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::W
bool SystemWindow::Notify( NotifyEvent& rNEvt )
{
+ if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
+ Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this);
+
// capture KeyEvents for menu handling
if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ||
rNEvt.GetType() == MouseNotifyEvent::COMMAND)
@@ -185,11 +188,6 @@ bool SystemWindow::Notify( NotifyEvent& rNEvt )
}
if (bDone)
return true;
- if (rNEvt.GetType() == MouseNotifyEvent::COMMAND)
- {
- if (Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this))
- return true;
- }
}
return Window::Notify( rNEvt );
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 720ee3a705e3..04dd36043f7d 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -2086,33 +2086,10 @@ static void ImplHandleSalKeyMod( vcl::Window* pWindow, SalKeyModEvent* pEvent )
// #105224# send commandevent to allow special treatment of Ctrl-LeftShift/Ctrl-RightShift etc.
// + auto-accelerator feature, tdf#92630
- vcl::Window *pChild = nullptr;
-
- // Alt pressed or released => give SystemWindow a chance to handle auto-accelerator
- if ( pEvent->mnCode == KEY_MOD2 || (pEvent->mnModKeyCode & MODKEY_MOD2) != 0 )
- {
- // find window - first look to see a popup is open and send it there
- pChild = pSVData->maWinData.mpFirstFloat.get();
-
- if (!pChild)
- {
- // find window - then look to see if the system window is available
- pChild = pWindow->ImplGetWindowImpl()->mpFirstChild;
- while ( pChild )
- {
- if ( pChild->ImplGetWindowImpl()->mbSysWin )
- break;
- pChild = pChild->ImplGetWindowImpl()->mpNext;
- }
- }
- }
-
- //...if not, try to find a key input window...
- if (!pChild)
- pChild = ImplGetKeyInputWindow( pWindow );
- //...otherwise fail safe...
- if (!pChild)
- pChild = pWindow;
+ // find window
+ vcl::Window* pChild = ImplGetKeyInputWindow( pWindow );
+ if ( !pChild )
+ return;
CommandModKeyData data( pEvent->mnModKeyCode );
ImplCallCommand( pChild, CommandEventId::ModKeyChange, &data );