Revert "Workaround Wayland popup menu bug."

This reverts commit 8db6dcf125.
This commit is contained in:
Ilya Fedin 2023-09-21 23:37:07 +04:00 committed by John Preston
parent a22254860f
commit ea4c67408e
5 changed files with 0 additions and 62 deletions

View file

@ -8,7 +8,6 @@
#include "base/platform/base_platform_info.h" #include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_library.h" #include "base/platform/linux/base_linux_library.h"
#include "base/call_delayed.h"
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
#include "base/platform/linux/base_linux_xcb_utilities.h" #include "base/platform/linux/base_linux_xcb_utilities.h"
@ -45,10 +44,6 @@ namespace Platform {
namespace { namespace {
static const auto kXCBFrameExtentsAtomName = u"_GTK_FRAME_EXTENTS"_q; static const auto kXCBFrameExtentsAtomName = u"_GTK_FRAME_EXTENTS"_q;
constexpr auto kDelayDeactivateEventTimeout = crl::time(400);
bool PendingDeactivateEvent/* = false*/;
int ChildPopupsHiddenOnWayland/* = 0*/;
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION #ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
std::optional<bool> XCBWindowMapped(xcb_window_t window) { std::optional<bool> XCBWindowMapped(xcb_window_t window) {
@ -611,33 +606,5 @@ void ShowWindowMenu(not_null<QWidget*> widget, const QPoint &point) {
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
} }
void RegisterChildPopupHiding() {
if (!::Platform::IsWayland()) {
return;
}
++ChildPopupsHiddenOnWayland;
base::call_delayed(kDelayDeactivateEventTimeout, [] {
if (!--ChildPopupsHiddenOnWayland) {
if (base::take(PendingDeactivateEvent)) {
// We didn't receive ApplicationActivate event in time.
QEvent appDeactivate(QEvent::ApplicationDeactivate);
QCoreApplication::sendEvent(qApp, &appDeactivate);
}
}
});
}
bool SkipApplicationDeactivateEvent() {
if (!ChildPopupsHiddenOnWayland) {
return false;
}
PendingDeactivateEvent = true;
return true;
}
void GotApplicationActivateEvent() {
PendingDeactivateEvent = false;
}
} // namespace Platform } // namespace Platform
} // namespace Ui } // namespace Ui

View file

@ -147,15 +147,5 @@ std::optional<bool> IsOverlapped(
return false; return false;
} }
void RegisterChildPopupHiding() {
}
bool SkipApplicationDeactivateEvent() {
return false;
}
void GotApplicationActivateEvent() {
}
} // namespace Platform } // namespace Platform
} // namespace Ui } // namespace Ui

View file

@ -45,12 +45,6 @@ void ShowWindowMenu(not_null<QWidget*> widget, const QPoint &point);
void FixPopupMenuNativeEmojiPopup(not_null<PopupMenu*> menu); void FixPopupMenuNativeEmojiPopup(not_null<PopupMenu*> menu);
// Workaround for a Qt/Wayland bug that hides the parent popup when
// the child popup gets hidden, by sending Deactivate / Activate events.
void RegisterChildPopupHiding();
[[nodiscard]] bool SkipApplicationDeactivateEvent();
void GotApplicationActivateEvent();
} // namespace Ui::Platform } // namespace Ui::Platform
// Platform dependent implementations. // Platform dependent implementations.

View file

@ -189,14 +189,4 @@ void FixPopupMenuNativeEmojiPopup(not_null<PopupMenu*> menu) {
menu->lifetime().make_state<Filter>(menu)); menu->lifetime().make_state<Filter>(menu));
} }
void RegisterChildPopupHiding() {
}
bool SkipApplicationDeactivateEvent() {
return false;
}
void GotApplicationActivateEvent() {
}
} // namespace Ui::Platform } // namespace Ui::Platform

View file

@ -673,9 +673,6 @@ bool PopupMenu::eventFilter(QObject *o, QEvent *e) {
} }
void PopupMenu::hideMenu(bool fast) { void PopupMenu::hideMenu(bool fast) {
if (fast && _parent) {
Platform::RegisterChildPopupHiding();
}
if (isHidden() || (_hiding && !fast)) { if (isHidden() || (_hiding && !fast)) {
return; return;
} }