Extents should be updated on each event only on Wayland

This commit is contained in:
Ilya Fedin 2020-08-28 16:24:54 +04:00 committed by John Preston
parent ea8e256a23
commit 78a2835bbf

View file

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_title_qt.h" #include "window/window_title_qt.h"
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "base/platform/base_platform_info.h"
#include "ui/platform/ui_platform_utility.h" #include "ui/platform/ui_platform_utility.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/shadow.h" #include "ui/widgets/shadow.h"
@ -237,9 +238,10 @@ void TitleWidgetQt::mouseDoubleClickEvent(QMouseEvent *e) {
bool TitleWidgetQt::eventFilter(QObject *obj, QEvent *e) { bool TitleWidgetQt::eventFilter(QObject *obj, QEvent *e) {
// I tried to listen only QEvent::Move and QEvent::Resize // I tried to listen only QEvent::Move and QEvent::Resize
// but that didn't work // but that doesn't work on Wayland
if (obj->isWidgetType() if (obj->isWidgetType()
&& window() == static_cast<QWidget*>(obj)) { && window() == static_cast<QWidget*>(obj)
&& Platform::IsWayland()) {
updateWindowExtents(); updateWindowExtents();
} }
@ -265,6 +267,11 @@ bool TitleWidgetQt::eventFilter(QObject *obj, QEvent *e) {
if (window() == static_cast<QWidget*>(obj)) { if (window() == static_cast<QWidget*>(obj)) {
restoreCursor(); restoreCursor();
} }
} else if (e->type() == QEvent::Move
|| e->type() == QEvent::Resize) {
if (window() == static_cast<QWidget*>(obj)) {
updateWindowExtents();
}
} }
return TitleWidget::eventFilter(obj, e); return TitleWidget::eventFilter(obj, e);