summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-02-21 13:40:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2023-02-21 19:56:26 +0000
commit87d756f3f5dfb55ee9edbcd5349f8107ee5945eb (patch)
tree275f5d978a1bfe1aa8d234ffa5c569f9fcf85279
parent53bcb6c42fcb6f9ca6bf568a965c99d6c2b5ffb5 (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>
-rw-r--r--include/vcl/ctrl.hxx1
-rw-r--r--include/vcl/toolkit/calendar.hxx1
-rw-r--r--vcl/source/control/calendar.cxx7
-rw-r--r--vcl/source/control/ctrl.cxx7
4 files changed, 15 insertions, 1 deletions
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index 17c40ae66067..6300e27a747a 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -151,6 +151,7 @@ protected:
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
+ virtual bool FocusWindowBelongsToControl(const vcl::Window* pFocusWin) const;
public:
SAL_DLLPRIVATE void ImplClearLayoutData() const;
/** draws a frame around the give rectangle, onto the given device
diff --git a/include/vcl/toolkit/calendar.hxx b/include/vcl/toolkit/calendar.hxx
index a1a1cd90105a..9652bb44640f 100644
--- a/include/vcl/toolkit/calendar.hxx
+++ b/include/vcl/toolkit/calendar.hxx
@@ -93,6 +93,7 @@ public:
private:
virtual void StateChanged( StateChangedType nStateChange ) override;
+ virtual bool FocusWindowBelongsToControl(const vcl::Window* pFocusWin) const override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 );