mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-03 21:54:05 +02:00
Update skip taskbar hint on Linux without QWindow events
This commit is contained in:
parent
d2d5226dc7
commit
671a15d763
3 changed files with 14 additions and 42 deletions
|
@ -136,35 +136,6 @@ MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
||||||
: Window::MainWindow(controller) {
|
: Window::MainWindow(controller) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::initHook() {
|
|
||||||
events() | rpl::start_with_next([=](not_null<QEvent*> e) {
|
|
||||||
if (e->type() == QEvent::ThemeChange) {
|
|
||||||
updateWindowIcon();
|
|
||||||
}
|
|
||||||
}, lifetime());
|
|
||||||
|
|
||||||
base::install_event_filter(windowHandle(), [=](not_null<QEvent*> e) {
|
|
||||||
if (e->type() == QEvent::Expose) {
|
|
||||||
auto ee = static_cast<QExposeEvent*>(e.get());
|
|
||||||
if (ee->region().isNull()) {
|
|
||||||
return base::EventFilterResult::Continue;
|
|
||||||
}
|
|
||||||
if (!windowHandle()
|
|
||||||
|| windowHandle()->parent()
|
|
||||||
|| !windowHandle()->isVisible()) {
|
|
||||||
return base::EventFilterResult::Continue;
|
|
||||||
}
|
|
||||||
handleNativeSurfaceChanged(true);
|
|
||||||
} else if (e->type() == QEvent::Hide) {
|
|
||||||
if (!windowHandle() || windowHandle()->parent()) {
|
|
||||||
return base::EventFilterResult::Continue;
|
|
||||||
}
|
|
||||||
handleNativeSurfaceChanged(false);
|
|
||||||
}
|
|
||||||
return base::EventFilterResult::Continue;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) {
|
void MainWindow::workmodeUpdated(Core::Settings::WorkMode mode) {
|
||||||
if (!TrayIconSupported()) {
|
if (!TrayIconSupported()) {
|
||||||
return;
|
return;
|
||||||
|
@ -514,19 +485,22 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *evt) {
|
||||||
updateGlobalMenu();
|
updateGlobalMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (obj == this && t == QEvent::Paint) {
|
||||||
|
if (!_exposed) {
|
||||||
|
_exposed = true;
|
||||||
|
SkipTaskbar(
|
||||||
|
windowHandle(),
|
||||||
|
(Core::App().settings().workMode() == WorkMode::TrayOnly)
|
||||||
|
&& TrayIconSupported());
|
||||||
|
}
|
||||||
|
} else if (obj == this && t == QEvent::Hide) {
|
||||||
|
_exposed = false;
|
||||||
|
} else if (obj == this && t == QEvent::ThemeChange) {
|
||||||
|
updateWindowIcon();
|
||||||
}
|
}
|
||||||
return Window::MainWindow::eventFilter(obj, evt);
|
return Window::MainWindow::eventFilter(obj, evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::handleNativeSurfaceChanged(bool exist) {
|
|
||||||
if (exist) {
|
|
||||||
SkipTaskbar(
|
|
||||||
windowHandle(),
|
|
||||||
(Core::App().settings().workMode() == WorkMode::TrayOnly)
|
|
||||||
&& TrayIconSupported());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *evt) override;
|
bool eventFilter(QObject *obj, QEvent *evt) override;
|
||||||
|
|
||||||
void initHook() override;
|
|
||||||
void unreadCounterChangedHook() override;
|
void unreadCounterChangedHook() override;
|
||||||
void updateGlobalMenuHook() override;
|
void updateGlobalMenuHook() override;
|
||||||
|
|
||||||
|
@ -37,7 +36,6 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateUnityCounter();
|
void updateUnityCounter();
|
||||||
void handleNativeSurfaceChanged(bool exist);
|
|
||||||
|
|
||||||
QMenuBar *psMainMenu = nullptr;
|
QMenuBar *psMainMenu = nullptr;
|
||||||
QAction *psLogout = nullptr;
|
QAction *psLogout = nullptr;
|
||||||
|
@ -61,6 +59,8 @@ private:
|
||||||
QAction *psMonospace = nullptr;
|
QAction *psMonospace = nullptr;
|
||||||
QAction *psClearFormat = nullptr;
|
QAction *psClearFormat = nullptr;
|
||||||
|
|
||||||
|
bool _exposed = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] inline int32 ScreenNameChecksum(const QString &name) {
|
[[nodiscard]] inline int32 ScreenNameChecksum(const QString &name) {
|
||||||
|
|
|
@ -455,8 +455,6 @@ QRect MainWindow::desktopRect() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::init() {
|
void MainWindow::init() {
|
||||||
createWinId();
|
|
||||||
|
|
||||||
initHook();
|
initHook();
|
||||||
|
|
||||||
updatePalette();
|
updatePalette();
|
||||||
|
|
Loading…
Add table
Reference in a new issue