Unity doesn't support _NET_WM_MOVERESIZE

This commit is contained in:
Ilya Fedin 2020-06-29 18:19:26 +04:00 committed by John Preston
parent 5e8e654324
commit 0ede4bba72
5 changed files with 56 additions and 13 deletions

View File

@ -843,6 +843,7 @@ PRIVATE
platform/linux/notifications_manager_linux.h
platform/linux/specific_linux.cpp
platform/linux/specific_linux.h
platform/linux/window_title_linux.h
platform/mac/file_utilities_mac.mm
platform/mac/file_utilities_mac.h
platform/mac/launcher_mac.mm

View File

@ -0,0 +1,43 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "platform/platform_window_title.h"
#include "platform/linux/linux_desktop_environment.h"
#include "base/object_ptr.h"
namespace Window {
namespace Theme {
int DefaultPreviewTitleHeight();
void DefaultPreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth);
} // namespace Theme
} // namespace Window
namespace Platform {
inline object_ptr<Window::TitleWidget> CreateTitleWidget(QWidget *parent) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED
if (!DesktopEnvironment::IsUnity()) {
return object_ptr<Window::TitleWidgetQt>(parent);
}
#endif // Qt >= 5.15 || DESKTOP_APP_QT_PATCHED
return { nullptr };
}
inline int PreviewTitleHeight() {
return Window::Theme::DefaultPreviewTitleHeight();
}
inline void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth) {
return Window::Theme::DefaultPreviewWindowFramePaint(preview, palette, body, outerWidth);
}
} // namespace Platform

View File

@ -27,7 +27,9 @@ void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRe
#include "platform/mac/window_title_mac.h"
#elif defined Q_OS_WIN // Q_OS_MAC
#include "platform/win/window_title_win.h"
#else // Q_OS_MAC || Q_OS_WIN
#elif defined Q_OS_UNIX // Q_OS_MAC || Q_OS_WIN
#include "platform/linux/window_title_linux.h"
#else // Q_OS_MAC || Q_OS_WIN || Q_OS_UNIX
namespace Platform {
@ -49,4 +51,4 @@ inline void PreviewWindowFramePaint(QImage &preview, const style::palette &palet
} // namespace Platform
#endif // Q_OS_MAC || Q_OS_WIN
#endif // Q_OS_MAC || Q_OS_WIN || Q_OS_UNIX

View File

@ -555,12 +555,15 @@ void SeparatePanel::mousePressEvent(QMouseEvent *e) {
if (e->button() == Qt::LeftButton) {
if (dragArea.contains(e->pos())) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED
windowHandle()->startSystemMove();
const auto dragViaSystem = windowHandle()->startSystemMove();
#else // Qt >= 5.15 || DESKTOP_APP_QT_PATCHED
_dragging = true;
_dragStartMousePosition = e->globalPos();
_dragStartMyPosition = QPoint(x(), y());
const auto dragViaSystem = false;
#endif // Qt < 5.15 && !DESKTOP_APP_QT_PATCHED
if (!dragViaSystem) {
_dragging = true;
_dragStartMousePosition = e->globalPos();
_dragStartMyPosition = QPoint(x(), y());
}
} else if (!rect().contains(e->pos()) && _hideOnDeactivate) {
LOG(("Export Info: Panel Hide On Click."));
hideGetDuration();
@ -569,7 +572,6 @@ void SeparatePanel::mousePressEvent(QMouseEvent *e) {
}
void SeparatePanel::mouseMoveEvent(QMouseEvent *e) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) && !defined DESKTOP_APP_QT_PATCHED
if (_dragging) {
if (!(e->buttons() & Qt::LeftButton)) {
_dragging = false;
@ -578,15 +580,12 @@ void SeparatePanel::mouseMoveEvent(QMouseEvent *e) {
+ (e->globalPos() - _dragStartMousePosition));
}
}
#endif // Qt < 5.15 && !DESKTOP_APP_QT_PATCHED
}
void SeparatePanel::mouseReleaseEvent(QMouseEvent *e) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) && !defined DESKTOP_APP_QT_PATCHED
if (e->button() == Qt::LeftButton) {
if (e->button() == Qt::LeftButton && _dragging) {
_dragging = false;
}
#endif // Qt < 5.15 && !DESKTOP_APP_QT_PATCHED
}
void SeparatePanel::leaveEventHook(QEvent *e) {

View File

@ -93,11 +93,9 @@ private:
bool _useTransparency = true;
style::margins _padding;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) && !defined DESKTOP_APP_QT_PATCHED
bool _dragging = false;
QPoint _dragStartMousePosition;
QPoint _dragStartMyPosition;
#endif // Qt < 5.15 && !DESKTOP_APP_QT_PATCHED
Ui::Animations::Simple _titleLeft;
bool _visible = false;