summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2023-10-25 22:26:14 +0300
committerThorsten Behrens <thorsten.behrens@allotropia.de>2023-12-10 21:57:11 +0100
commitd9db9167ec711bfef14542851bc0060306abf771 (patch)
tree987cfc3296623f8fb917f14f86ef4285f5f4f78b
parent5a0fb95789651c05774cdc566eeda0d3151a811c (diff)
vcl: use Windows FlshWindow() feature feature/cib_contract8161
For improving UX of LibreOffice it will be great to bring attention to it's windows without hard window switch. For example, if dialog window is opening slowly and user did switch to another application this could be a signal to user that there are some updates in LO window. Change-Id: I6ca6706d2dda8902aea273ebe6e318ec9bf4beda
-rw-r--r--include/vcl/window.hxx3
-rw-r--r--vcl/inc/brdwin.hxx2
-rw-r--r--vcl/inc/salframe.hxx2
-rw-r--r--vcl/inc/win/salframe.h1
-rw-r--r--vcl/source/window/brdwin.cxx15
-rw-r--r--vcl/source/window/window.cxx5
-rw-r--r--vcl/win/window/salframe.cxx19
7 files changed, 47 insertions, 0 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index d23b34e397dd..1c55dea078b5 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1215,6 +1215,9 @@ public:
/// Same as MouseMove(), but coordinates are in logic unit. used for LOK
virtual void LogicMouseMove(const MouseEvent&) {};
+
+ virtual void FlashWindow() const {};
+
/** @name Accessibility
*/
///@{
diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx
index 0510006fa3ea..057415ce4a7c 100644
--- a/vcl/inc/brdwin.hxx
+++ b/vcl/inc/brdwin.hxx
@@ -171,6 +171,8 @@ public:
tools::Rectangle GetMenuRect() const;
virtual Size GetOptimalSize() const override;
+
+ virtual void FlashWindow() const override;
};
struct ImplBorderFrameData
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 4b540d61ca0e..74d4946eb262 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -208,6 +208,8 @@ public:
virtual void Beep() = 0;
+ virtual void FlashWindow() const {};
+
// returns system data (most prominent: window handle)
virtual const SystemEnvData*
GetSystemData() const = 0;
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 25c6819bb7e2..f7bf988de410 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -126,6 +126,7 @@ public:
virtual LanguageType GetInputLanguage() override;
virtual void UpdateSettings( AllSettings& rSettings ) override;
virtual void Beep() override;
+ virtual void FlashWindow() const override;
virtual const SystemEnvData* GetSystemData() const override;
virtual SalPointerState GetPointerState() override;
virtual KeyIndicatorState GetIndicatorState() override;
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 1b436b544700..329dd96f7535 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -21,6 +21,7 @@
#include <svdata.hxx>
#include <brdwin.hxx>
#include <window.h>
+#include <salframe.hxx>
#include <vcl/textrectinfo.hxx>
#include <vcl/event.hxx>
@@ -2070,4 +2071,18 @@ void ImplBorderWindow::queue_resize(StateChangedType eReason)
vcl::Window::queue_resize(eReason);
}
+void ImplBorderWindow::FlashWindow() const
+{
+ // We are showing top level window without focus received. Let's flash it
+ // Use OS features to bring user attention to this window: find topmost one and FlashWindow
+ vcl::Window* pMyParent = mpWindowImpl->mpParent;
+ while (pMyParent && pMyParent->mpWindowImpl && pMyParent->mpWindowImpl->mpParent)
+ {
+ pMyParent = pMyParent->mpWindowImpl->mpParent;
+ }
+ if (pMyParent) {
+ pMyParent->mpWindowImpl->mpFrame->FlashWindow();
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 9a5a6cde533b..b44749d3236b 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2277,6 +2277,11 @@ void Window::Show(bool bVisible, ShowFlags nFlags)
ImplFocusToTop( ToTopFlags::NONE, false );
}
+ if (!HasFocus() && GetParent()) {
+ SAL_WARN("vcl", "yeah, flashing");
+ GetParent()->FlashWindow();
+ }
+
// adjust mpWindowImpl->mbReallyVisible
bRealVisibilityChanged = !mpWindowImpl->mbReallyVisible;
ImplSetReallyVisible();
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index ab6db6aa41b3..5e85a0d86f40 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2843,6 +2843,25 @@ void WinSalFrame::Beep()
MessageBeep( 0 );
}
+void WinSalFrame::FlashWindow() const
+{
+ if (GetForegroundWindow() != mhWnd)
+ {
+ /*FLASHWINFO flash = {
+ sizeof(FLASHWINFO),
+ mhWnd,
+ FLASHW_ALL, // dwFlags
+ 10, // uCount
+ 0 // dwTimeout
+ };
+ ::FlashWindowEx(&flash);*/
+ ::FlashWindow(mhWnd, TRUE);
+ SAL_WARN("vcl", "superflash!");
+ }
+ /*else
+ ::FlashWindow(mhWnd, 1);*/
+}
+
SalFrame::SalPointerState WinSalFrame::GetPointerState()
{
SalPointerState aState;