Allow to use ForceFullRepaintSync on Linux.

This commit is contained in:
John Preston 2023-11-22 12:17:32 +04:00
parent 69c8353746
commit cd4e9d378c
7 changed files with 16 additions and 20 deletions

View file

@ -23,9 +23,6 @@ inline void DeInitOnTopPanel(not_null<QWidget*> panel) {
inline void ReInitOnTopPanel(not_null<QWidget*> panel) { inline void ReInitOnTopPanel(not_null<QWidget*> panel) {
} }
inline void UpdateOverlayed(not_null<QWidget*> widget) {
}
inline void ShowOverAll(not_null<QWidget*> widget, bool canFocus) { inline void ShowOverAll(not_null<QWidget*> widget, bool canFocus) {
} }

View file

@ -17,9 +17,6 @@ inline bool TranslucentWindowsSupported() {
return true; return true;
} }
inline void UpdateOverlayed(not_null<QWidget*> widget) {
}
inline void ClearTransientParent(not_null<QWidget*> widget) { inline void ClearTransientParent(not_null<QWidget*> widget) {
} }

View file

@ -24,7 +24,6 @@ void InitOnTopPanel(not_null<QWidget*> panel);
void DeInitOnTopPanel(not_null<QWidget*> panel); void DeInitOnTopPanel(not_null<QWidget*> panel);
void ReInitOnTopPanel(not_null<QWidget*> panel); void ReInitOnTopPanel(not_null<QWidget*> panel);
void UpdateOverlayed(not_null<QWidget*> widget);
void ShowOverAll(not_null<QWidget*> widget, bool canFocus = true); void ShowOverAll(not_null<QWidget*> widget, bool canFocus = true);
void IgnoreAllActivation(not_null<QWidget*> widget); void IgnoreAllActivation(not_null<QWidget*> widget);
void ClearTransientParent(not_null<QWidget*> widget); void ClearTransientParent(not_null<QWidget*> widget);

View file

@ -24,18 +24,6 @@ bool IsApplicationActive() {
return QApplication::activeWindow() != nullptr; return QApplication::activeWindow() != nullptr;
} }
void UpdateOverlayed(not_null<QWidget*> widget) {
const auto wm = widget->testAttribute(Qt::WA_Mapped);
const auto wv = widget->testAttribute(Qt::WA_WState_Visible);
if (!wm) widget->setAttribute(Qt::WA_Mapped, true);
if (!wv) widget->setAttribute(Qt::WA_WState_Visible, true);
widget->update();
QEvent e(QEvent::UpdateRequest);
QGuiApplication::sendEvent(widget, &e);
if (!wm) widget->setAttribute(Qt::WA_Mapped, false);
if (!wv) widget->setAttribute(Qt::WA_WState_Visible, false);
}
void IgnoreAllActivation(not_null<QWidget*> widget) { void IgnoreAllActivation(not_null<QWidget*> widget) {
widget->createWinId(); widget->createWinId();

View file

@ -154,6 +154,18 @@ void ForceFullRepaint(not_null<QWidget*> widget) {
refresher->show(); refresher->show();
} }
void ForceFullRepaintSync(not_null<QWidget*> widget) {
const auto wm = widget->testAttribute(Qt::WA_Mapped);
const auto wv = widget->testAttribute(Qt::WA_WState_Visible);
if (!wm) widget->setAttribute(Qt::WA_Mapped, true);
if (!wv) widget->setAttribute(Qt::WA_WState_Visible, true);
ForceFullRepaint(widget);
QEvent e(QEvent::UpdateRequest);
QGuiApplication::sendEvent(widget, &e);
if (!wm) widget->setAttribute(Qt::WA_Mapped, false);
if (!wv) widget->setAttribute(Qt::WA_WState_Visible, false);
}
void PostponeCall(FnMut<void()> &&callable) { void PostponeCall(FnMut<void()> &&callable) {
Integration::Instance().postponeCall(std::move(callable)); Integration::Instance().postponeCall(std::move(callable));
} }

View file

@ -140,6 +140,7 @@ void RenderWidget(
= QWidget::DrawChildren | QWidget::IgnoreMask); = QWidget::DrawChildren | QWidget::IgnoreMask);
void ForceFullRepaint(not_null<QWidget*> widget); void ForceFullRepaint(not_null<QWidget*> widget);
void ForceFullRepaintSync(not_null<QWidget*> widget);
void PostponeCall(FnMut<void()> &&callable); void PostponeCall(FnMut<void()> &&callable);

View file

@ -1065,7 +1065,9 @@ void PopupMenu::showPrepared(TriggeredSource source) {
startShowAnimation(); startShowAnimation();
Platform::UpdateOverlayed(this); if (::Platform::IsWindows()) {
ForceFullRepaintSync(this);
}
show(); show();
Platform::ShowOverAll(this); Platform::ShowOverAll(this);
raise(); raise();