diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-02-21 13:40:43 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-02-21 19:56:26 +0000 |
commit | 87d756f3f5dfb55ee9edbcd5349f8107ee5945eb (patch) | |
tree | 275f5d978a1bfe1aa8d234ffa5c569f9fcf85279 /vcl/source | |
parent | 53bcb6c42fcb6f9ca6bf568a965c99d6c2b5ffb5 (diff) |
tdf#142783 consider the Calendar Edit and DropDown as one compound control
for the purpose of notification of loss of focus from the control
Change-Id: I9191b413978549c6f8e1775dc96a696059150e4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147398
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/calendar.cxx | 7 | ||||
-rw-r--r-- | vcl/source/control/ctrl.cxx | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx index 421e159eee81..5f437ff0300e 100644 --- a/vcl/source/control/calendar.cxx +++ b/vcl/source/control/calendar.cxx @@ -1724,4 +1724,11 @@ void CalendarField::StateChanged( StateChangedType nStateChange ) } } +// tdf#142783 consider the Edit and its DropDown as one compound control for the purpose of +// notification of loss of focus from the control +bool CalendarField::FocusWindowBelongsToControl(const vcl::Window* pFocusWin) const +{ + return DateField::FocusWindowBelongsToControl(pFocusWin) || (mpFloatWin && mpFloatWin->ImplIsWindowOrChild(pFocusWin)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 09fb464e662e..6d6843b9c6e4 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -223,6 +223,11 @@ OUString Control::GetDisplayText() const return mxLayoutData ? mxLayoutData->m_aDisplayText : GetText(); } +bool Control::FocusWindowBelongsToControl(const vcl::Window* pFocusWin) const +{ + return ImplIsWindowOrChild(pFocusWin); +} + bool Control::EventNotify( NotifyEvent& rNEvt ) { if ( rNEvt.GetType() == NotifyEventType::GETFOCUS ) @@ -241,7 +246,7 @@ bool Control::EventNotify( NotifyEvent& rNEvt ) if ( rNEvt.GetType() == NotifyEventType::LOSEFOCUS ) { vcl::Window* pFocusWin = Application::GetFocusWindow(); - if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) ) + if ( !pFocusWin || !FocusWindowBelongsToControl(pFocusWin) ) { mbHasControlFocus = false; CompatStateChanged( StateChangedType::ControlFocus ); |