Kaydet (Commit) 51c14b1c authored tarafından Jan Holesovsky's avatar Jan Holesovsky

tdf#92866 startcenter: Make the accellerators work again.

I still have no idea what is the root cause here (why the accellerators do not
work 'automagically') - I suspect it is because we don't have a shell there,
and instead only a vcl::Window, or something like that :-)

Either way, when we handle the accellerators already in PreNotify(), it works
as expected, so let's live with that for the time being.

Change-Id: Id050fd8f5fff38914821cb64eaa3ae7281fc6d50
üst 064fb1f7
...@@ -413,6 +413,7 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt ) ...@@ -413,6 +413,7 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt )
{ {
const KeyEvent* pEvt = rNEvt.GetKeyEvent(); const KeyEvent* pEvt = rNEvt.GetKeyEvent();
const vcl::KeyCode& rKeyCode(pEvt->GetKeyCode()); const vcl::KeyCode& rKeyCode(pEvt->GetKeyCode());
// Subwindows of BackingWindow: Sidebar and Thumbnail view // Subwindows of BackingWindow: Sidebar and Thumbnail view
if( rKeyCode.GetCode() == KEY_F6 ) if( rKeyCode.GetCode() == KEY_F6 )
{ {
...@@ -438,28 +439,20 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt ) ...@@ -438,28 +439,20 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt )
} }
} }
} }
}
return Window::PreNotify( rNEvt );
}
bool BackingWindow::Notify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
{
// try the 'normal' accelerators (so that eg. Ctrl+Q works) // try the 'normal' accelerators (so that eg. Ctrl+Q works)
if( !mpAccExec ) if (!mpAccExec)
{ {
mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper(); mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper();
mpAccExec->init( comphelper::getProcessComponentContext(), mxFrame); mpAccExec->init( comphelper::getProcessComponentContext(), mxFrame);
} }
const KeyEvent* pEvt = rNEvt.GetKeyEvent();
const vcl::KeyCode& rKeyCode(pEvt->GetKeyCode());
const OUString aCommand = mpAccExec->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode)); const OUString aCommand = mpAccExec->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rKeyCode));
if((aCommand != "vnd.sun.star.findbar:FocusToFindbar") && pEvt && mpAccExec->execute(rKeyCode)) if ((aCommand != "vnd.sun.star.findbar:FocusToFindbar") && pEvt && mpAccExec->execute(rKeyCode))
return true; return true;
} }
return Window::Notify( rNEvt ); return Window::PreNotify( rNEvt );
} }
void BackingWindow::GetFocus() void BackingWindow::GetFocus()
......
...@@ -123,7 +123,6 @@ public: ...@@ -123,7 +123,6 @@ public:
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
virtual void Resize() override; virtual void Resize() override;
virtual bool PreNotify(NotifyEvent& rNEvt) override; virtual bool PreNotify(NotifyEvent& rNEvt) override;
virtual bool Notify(NotifyEvent& rNEvt) override;
virtual void GetFocus() override; virtual void GetFocus() override;
virtual Size GetOptimalSize() const override; virtual Size GetOptimalSize() const override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment