mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54: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 "history/history.h"
|
||||
#include "window/themes/window_theme.h"
|
||||
#include "window/window_title_qt.h" // kShowAfterWindowFlagChangeDelay
|
||||
#include "window/window_session_controller.h"
|
||||
#include "window/window_lock_widgets.h"
|
||||
#include "window/window_outdated_bar.h"
|
||||
|
@ -365,20 +364,9 @@ void MainWindow::refreshTitleWidget() {
|
|||
_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();
|
||||
setWindowFlag(Qt::NoDropShadowWindowHint, withShadow);
|
||||
windowHandle()->setFlag(Qt::NoDropShadowWindowHint, withShadow);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, !withShadow);
|
||||
if (!hidden) {
|
||||
base::call_delayed(
|
||||
kShowAfterWindowFlagChangeDelay,
|
||||
this,
|
||||
[=] { show(); });
|
||||
}
|
||||
#endif // Q_OS_UNIX && !Q_OS_MAC
|
||||
}
|
||||
|
||||
void MainWindow::updateMinimumSize() {
|
||||
|
|
|
@ -91,17 +91,7 @@ TitleWidgetQt::~TitleWidgetQt() {
|
|||
}
|
||||
|
||||
void TitleWidgetQt::toggleFramelessWindow(bool enabled) {
|
||||
// setWindowFlag calls setParent(parentWidget(), newFlags), which
|
||||
// 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(); });
|
||||
}
|
||||
window()->windowHandle()->setFlag(Qt::FramelessWindowHint, enabled);
|
||||
}
|
||||
|
||||
void TitleWidgetQt::init() {
|
||||
|
|
|
@ -22,12 +22,6 @@ class PlainShadow;
|
|||
|
||||
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 {
|
||||
public:
|
||||
TitleWidgetQt(QWidget *parent);
|
||||
|
|
Loading…
Add table
Reference in a new issue