2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Add support for showing window menu on Wayland

This commit is contained in:
Ilya Fedin
2020-08-08 01:59:45 +04:00
committed by John Preston
parent 08b67e383e
commit dc9d0aae54
5 changed files with 44 additions and 4 deletions

View File

@@ -585,6 +585,21 @@ bool StartWaylandResize(QWindow *window, Qt::Edges edges) {
return false;
}
bool ShowWaylandWindowMenu(QWindow *window) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) || defined DESKTOP_APP_QT_PATCHED
if (const auto waylandWindow = static_cast<QWaylandWindow*>(
window->handle())) {
if (const auto seat = waylandWindow->display()->lastInputDevice()) {
if (const auto shellSurface = waylandWindow->shellSurface()) {
return shellSurface->showWindowMenu(seat);
}
}
}
#endif // Qt >= 5.13 || DESKTOP_APP_QT_PATCHED
return false;
}
Window::Control GtkKeywordToWindowControl(const QString &keyword) {
if (keyword == qstr("minimize")) {
return Window::Control::Minimize;
@@ -956,6 +971,14 @@ bool StartSystemResize(QWindow *window, Qt::Edges edges) {
}
}
bool ShowWindowMenu(QWindow *window) {
if (IsWayland()) {
return ShowWaylandWindowMenu(window);
}
return false;
}
Window::ControlsLayout WindowControlsLayout() {
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
if (Libs::GtkSettingSupported()