mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Inform Qt about taskbar hider
This allows the feature to work without patching Qt
This commit is contained in:
parent
fc8a0d0efd
commit
c2212c719e
2 changed files with 7 additions and 1 deletions
|
@ -115,7 +115,8 @@ struct MainWindow::Private {
|
|||
MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
||||
: Window::MainWindow(controller)
|
||||
, _private(std::make_unique<Private>())
|
||||
, ps_tbHider_hWnd(createTaskbarHider()) {
|
||||
, ps_tbHider_hWnd(createTaskbarHider())
|
||||
, ps_tbHider(QWindow::fromWinId(WId(ps_tbHider_hWnd))) {
|
||||
QCoreApplication::instance()->installNativeEventFilter(
|
||||
EventFilter::CreateInstance(this));
|
||||
|
||||
|
@ -238,6 +239,7 @@ void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) {
|
|||
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
||||
if (psOwner) {
|
||||
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, 0);
|
||||
windowHandle()->setTransientParent(nullptr);
|
||||
psRefreshTaskbarIcon();
|
||||
}
|
||||
} break;
|
||||
|
@ -247,6 +249,7 @@ void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) {
|
|||
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
||||
if (!psOwner) {
|
||||
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, (LONG_PTR)ps_tbHider_hWnd);
|
||||
windowHandle()->setTransientParent(ps_tbHider);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
@ -260,6 +263,7 @@ void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) {
|
|||
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
||||
if (psOwner) {
|
||||
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, 0);
|
||||
windowHandle()->setTransientParent(nullptr);
|
||||
psRefreshTaskbarIcon();
|
||||
}
|
||||
} break;
|
||||
|
@ -533,6 +537,7 @@ MainWindow::~MainWindow() {
|
|||
}
|
||||
|
||||
psDestroyIcons();
|
||||
if (ps_tbHider) delete ps_tbHider;
|
||||
if (ps_tbHider_hWnd) DestroyWindow(ps_tbHider_hWnd);
|
||||
|
||||
EventFilter::Destroy();
|
||||
|
|
|
@ -87,6 +87,7 @@ private:
|
|||
|
||||
HWND ps_hWnd = nullptr;
|
||||
HWND ps_tbHider_hWnd = nullptr;
|
||||
QWindow *ps_tbHider = nullptr;
|
||||
HICON ps_iconBig = nullptr;
|
||||
HICON ps_iconSmall = nullptr;
|
||||
HICON ps_iconOverlay = nullptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue