mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
Use QWindow::setFlag that doesn't hide the windw
This commit is contained in:
parent
772bd81ea5
commit
d7ef484aec
3 changed files with 2 additions and 30 deletions
|
@ -13,7 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/platform/ui_platform_utility.h"
|
#include "ui/platform/ui_platform_utility.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
#include "window/window_title_qt.h" // kShowAfterWindowFlagChangeDelay
|
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "window/window_lock_widgets.h"
|
#include "window/window_lock_widgets.h"
|
||||||
#include "window/window_outdated_bar.h"
|
#include "window/window_outdated_bar.h"
|
||||||
|
@ -365,20 +364,9 @@ void MainWindow::refreshTitleWidget() {
|
||||||
_titleShadow.destroy();
|
_titleShadow.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
|
||||||
// setWindowFlag calls setParent(parentWidget(), newFlags), which
|
|
||||||
// always calls hide() explicitly, we have to show() the window back.
|
|
||||||
const auto hidden = isHidden();
|
|
||||||
const auto withShadow = hasShadow();
|
const auto withShadow = hasShadow();
|
||||||
setWindowFlag(Qt::NoDropShadowWindowHint, withShadow);
|
windowHandle()->setFlag(Qt::NoDropShadowWindowHint, withShadow);
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, !withShadow);
|
setAttribute(Qt::WA_OpaquePaintEvent, !withShadow);
|
||||||
if (!hidden) {
|
|
||||||
base::call_delayed(
|
|
||||||
kShowAfterWindowFlagChangeDelay,
|
|
||||||
this,
|
|
||||||
[=] { show(); });
|
|
||||||
}
|
|
||||||
#endif // Q_OS_UNIX && !Q_OS_MAC
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateMinimumSize() {
|
void MainWindow::updateMinimumSize() {
|
||||||
|
|
|
@ -91,17 +91,7 @@ TitleWidgetQt::~TitleWidgetQt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleWidgetQt::toggleFramelessWindow(bool enabled) {
|
void TitleWidgetQt::toggleFramelessWindow(bool enabled) {
|
||||||
// setWindowFlag calls setParent(parentWidget(), newFlags), which
|
window()->windowHandle()->setFlag(Qt::FramelessWindowHint, enabled);
|
||||||
// always calls hide() explicitly, we have to show() the window back.
|
|
||||||
const auto top = window();
|
|
||||||
const auto hidden = top->isHidden();
|
|
||||||
top->setWindowFlag(Qt::FramelessWindowHint, enabled);
|
|
||||||
if (!hidden) {
|
|
||||||
base::call_delayed(
|
|
||||||
kShowAfterWindowFlagChangeDelay,
|
|
||||||
top,
|
|
||||||
[=] { top->show(); });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleWidgetQt::init() {
|
void TitleWidgetQt::init() {
|
||||||
|
|
|
@ -22,12 +22,6 @@ class PlainShadow;
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
|
||||||
// If we toggle frameless window hint in maximized window, and
|
|
||||||
// show it back too quickly, the mouse position inside the window
|
|
||||||
// won't be correct (from Qt-s point of view) until we Alt-Tab from
|
|
||||||
// that window. If we show the window back with this delay it works.
|
|
||||||
inline constexpr auto kShowAfterWindowFlagChangeDelay = crl::time(1000);
|
|
||||||
|
|
||||||
class TitleWidgetQt : public TitleWidget {
|
class TitleWidgetQt : public TitleWidget {
|
||||||
public:
|
public:
|
||||||
TitleWidgetQt(QWidget *parent);
|
TitleWidgetQt(QWidget *parent);
|
||||||
|
|
Loading…
Add table
Reference in a new issue