mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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)
|
MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
||||||
: Window::MainWindow(controller)
|
: Window::MainWindow(controller)
|
||||||
, _private(std::make_unique<Private>())
|
, _private(std::make_unique<Private>())
|
||||||
, ps_tbHider_hWnd(createTaskbarHider()) {
|
, ps_tbHider_hWnd(createTaskbarHider())
|
||||||
|
, ps_tbHider(QWindow::fromWinId(WId(ps_tbHider_hWnd))) {
|
||||||
QCoreApplication::instance()->installNativeEventFilter(
|
QCoreApplication::instance()->installNativeEventFilter(
|
||||||
EventFilter::CreateInstance(this));
|
EventFilter::CreateInstance(this));
|
||||||
|
|
||||||
|
@ -238,6 +239,7 @@ void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) {
|
||||||
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
||||||
if (psOwner) {
|
if (psOwner) {
|
||||||
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, 0);
|
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, 0);
|
||||||
|
windowHandle()->setTransientParent(nullptr);
|
||||||
psRefreshTaskbarIcon();
|
psRefreshTaskbarIcon();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
@ -247,6 +249,7 @@ void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) {
|
||||||
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
||||||
if (!psOwner) {
|
if (!psOwner) {
|
||||||
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, (LONG_PTR)ps_tbHider_hWnd);
|
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, (LONG_PTR)ps_tbHider_hWnd);
|
||||||
|
windowHandle()->setTransientParent(ps_tbHider);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -260,6 +263,7 @@ void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) {
|
||||||
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
HWND psOwner = (HWND)GetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT);
|
||||||
if (psOwner) {
|
if (psOwner) {
|
||||||
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, 0);
|
SetWindowLongPtr(ps_hWnd, GWLP_HWNDPARENT, 0);
|
||||||
|
windowHandle()->setTransientParent(nullptr);
|
||||||
psRefreshTaskbarIcon();
|
psRefreshTaskbarIcon();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
@ -533,6 +537,7 @@ MainWindow::~MainWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
psDestroyIcons();
|
psDestroyIcons();
|
||||||
|
if (ps_tbHider) delete ps_tbHider;
|
||||||
if (ps_tbHider_hWnd) DestroyWindow(ps_tbHider_hWnd);
|
if (ps_tbHider_hWnd) DestroyWindow(ps_tbHider_hWnd);
|
||||||
|
|
||||||
EventFilter::Destroy();
|
EventFilter::Destroy();
|
||||||
|
|
|
@ -87,6 +87,7 @@ private:
|
||||||
|
|
||||||
HWND ps_hWnd = nullptr;
|
HWND ps_hWnd = nullptr;
|
||||||
HWND ps_tbHider_hWnd = nullptr;
|
HWND ps_tbHider_hWnd = nullptr;
|
||||||
|
QWindow *ps_tbHider = nullptr;
|
||||||
HICON ps_iconBig = nullptr;
|
HICON ps_iconBig = nullptr;
|
||||||
HICON ps_iconSmall = nullptr;
|
HICON ps_iconSmall = nullptr;
|
||||||
HICON ps_iconOverlay = nullptr;
|
HICON ps_iconOverlay = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue