Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 753737 | Differences between
and this patch

Collapse All | Expand All

(-)a/cmake/external/CMakeLists.txt (-1 / +1 lines)
Lines 35-41 endif() Link Here
35
add_checked_subdirectory(iconv)
35
add_checked_subdirectory(iconv)
36
add_checked_subdirectory(jpeg)
36
add_checked_subdirectory(jpeg)
37
add_checked_subdirectory(lz4)
37
add_checked_subdirectory(lz4)
38
if (LINUX)
38
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
39
    add_checked_subdirectory(materialdecoration)
39
    add_checked_subdirectory(materialdecoration)
40
endif()
40
endif()
41
add_checked_subdirectory(minizip)
41
add_checked_subdirectory(minizip)
(-)a/cmake/external/qt/package.cmake (-2 / +4 lines)
Lines 24-31 find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED) Link Here
24
find_package(Qt5Gui COMPONENTS QWebpPlugin REQUIRED)
24
find_package(Qt5Gui COMPONENTS QWebpPlugin REQUIRED)
25
25
26
if (LINUX)
26
if (LINUX)
27
    find_package(Qt5 COMPONENTS WaylandClient REQUIRED)
27
    if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
28
    find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET)
28
        find_package(Qt5 COMPONENTS WaylandClient REQUIRED)
29
        find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET)
30
    endif()
29
31
30
    if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES)
32
    if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES)
31
        find_package(Qt5 COMPONENTS Svg REQUIRED)
33
        find_package(Qt5 COMPONENTS Svg REQUIRED)
(-)a/cmake/options.cmake (+7 lines)
Lines 26-31 if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION) Link Here
26
    )
26
    )
27
endif()
27
endif()
28
28
29
if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
30
    target_compile_definitions(common_options
31
    INTERFACE
32
        DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
33
    )
34
endif()
35
29
if (DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION)
36
if (DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION)
30
    target_compile_definitions(common_options
37
    target_compile_definitions(common_options
31
    INTERFACE
38
    INTERFACE
(-)a/cmake/variables.cmake (+1 lines)
Lines 29-34 endif() Link Here
29
29
30
option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON)
30
option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON)
31
option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration (Linux only)." OFF)
31
option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration (Linux only)." OFF)
32
option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration (Linux only)." OFF)
32
option(DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION "Disable all code for WebRTC integration." OFF)
33
option(DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION "Disable all code for WebRTC integration." OFF)
33
option(DESKTOP_APP_USE_GLIBC_WRAPS "Use wraps for new GLIBC features." OFF)
34
option(DESKTOP_APP_USE_GLIBC_WRAPS "Use wraps for new GLIBC features." OFF)
34
option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ${no_special_target})
35
option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ${no_special_target})
(-)a/.github/workflows/linux.yml (+1 lines)
Lines 54-59 jobs: Link Here
54
        defines:
54
        defines:
55
          - ""
55
          - ""
56
          - "DESKTOP_APP_DISABLE_DBUS_INTEGRATION"
56
          - "DESKTOP_APP_DISABLE_DBUS_INTEGRATION"
57
          - "DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION"
57
          - "TDESKTOP_DISABLE_GTK_INTEGRATION"
58
          - "TDESKTOP_DISABLE_GTK_INTEGRATION"
58
59
59
    env:
60
    env:
(-)a/Telegram/CMakeLists.txt (-7 / +22 lines)
Lines 70-76 PRIVATE Link Here
70
if (LINUX)
70
if (LINUX)
71
    target_link_libraries(Telegram
71
    target_link_libraries(Telegram
72
    PRIVATE
72
    PRIVATE
73
        desktop-app::external_materialdecoration
74
        desktop-app::external_nimf_qt5
73
        desktop-app::external_nimf_qt5
75
        desktop-app::external_qt5ct_support
74
        desktop-app::external_qt5ct_support
76
        desktop-app::external_xcb_screensaver
75
        desktop-app::external_xcb_screensaver
Lines 89-102 if (LINUX) Link Here
89
        )
88
        )
90
    endif()
89
    endif()
91
90
92
    if (DESKTOP_APP_USE_PACKAGED AND Qt5WaylandClient_VERSION VERSION_LESS 5.13.0)
91
    if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
93
        find_package(PkgConfig REQUIRED)
92
        target_link_libraries(Telegram
94
        pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
95
96
        target_include_directories(Telegram
97
        PRIVATE
93
        PRIVATE
98
            ${WAYLAND_CLIENT_INCLUDE_DIRS}
94
            desktop-app::external_materialdecoration
99
        )
95
        )
96
97
        if (DESKTOP_APP_USE_PACKAGED
98
            AND Qt5WaylandClient_VERSION VERSION_LESS 5.13.0)
99
            find_package(PkgConfig REQUIRED)
100
            pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
101
102
            target_include_directories(Telegram
103
            PRIVATE
104
                ${WAYLAND_CLIENT_INCLUDE_DIRS}
105
            )
106
        endif()
100
    endif()
107
    endif()
101
108
102
    if (NOT TDESKTOP_DISABLE_GTK_INTEGRATION)
109
    if (NOT TDESKTOP_DISABLE_GTK_INTEGRATION)
Lines 796-801 PRIVATE Link Here
796
    platform/linux/linux_gdk_helper.h
803
    platform/linux/linux_gdk_helper.h
797
    platform/linux/linux_libs.cpp
804
    platform/linux/linux_libs.cpp
798
    platform/linux/linux_libs.h
805
    platform/linux/linux_libs.h
806
    platform/linux/linux_wayland_integration.cpp
807
    platform/linux/linux_wayland_integration.h
799
    platform/linux/linux_xlib_helper.cpp
808
    platform/linux/linux_xlib_helper.cpp
800
    platform/linux/linux_xlib_helper.h
809
    platform/linux/linux_xlib_helper.h
801
    platform/linux/file_utilities_linux.cpp
810
    platform/linux/file_utilities_linux.cpp
Lines 808-813 PRIVATE Link Here
808
    platform/linux/notifications_manager_linux.h
817
    platform/linux/notifications_manager_linux.h
809
    platform/linux/specific_linux.cpp
818
    platform/linux/specific_linux.cpp
810
    platform/linux/specific_linux.h
819
    platform/linux/specific_linux.h
820
    platform/linux/window_title_linux.cpp
811
    platform/linux/window_title_linux.h
821
    platform/linux/window_title_linux.h
812
    platform/mac/file_utilities_mac.mm
822
    platform/mac/file_utilities_mac.mm
813
    platform/mac/file_utilities_mac.h
823
    platform/mac/file_utilities_mac.h
Lines 1081-1086 if (NOT LINUX) Link Here
1081
    )
1091
    )
1082
endif()
1092
endif()
1083
1093
1094
if (LINUX AND DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
1095
    remove_target_sources(Telegram ${src_loc} platform/linux/linux_wayland_integration.cpp)
1096
    nice_target_sources(Telegram ${src_loc} PRIVATE platform/linux/linux_wayland_integration_dummy.cpp)
1097
endif()
1098
1084
if (NOT DESKTOP_APP_USE_PACKAGED)
1099
if (NOT DESKTOP_APP_USE_PACKAGED)
1085
    nice_target_sources(Telegram ${src_loc} PRIVATE platform/mac/mac_iconv_helper.c)
1100
    nice_target_sources(Telegram ${src_loc} PRIVATE platform/mac/mac_iconv_helper.c)
1086
endif()
1101
endif()
(-)a/Telegram/SourceFiles/platform/linux/linux_wayland_integration.cpp (+117 lines)
Line 0 Link Here
1
/*
2
This file is part of Telegram Desktop,
3
the official desktop application for the Telegram messaging service.
4
5
For license and copyright information please follow this link:
6
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7
*/
8
#include "platform/linux/linux_wayland_integration.h"
9
10
#include "base/platform/base_platform_info.h"
11
12
#include <QtGui/QWindow>
13
14
#include <private/qwaylanddisplay_p.h>
15
#include <private/qwaylandwindow_p.h>
16
#include <private/qwaylandshellsurface_p.h>
17
18
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) && !defined DESKTOP_APP_QT_PATCHED
19
#include <wayland-client.h>
20
#endif // Qt < 5.13 && !DESKTOP_APP_QT_PATCHED
21
22
using QtWaylandClient::QWaylandWindow;
23
24
namespace Platform {
25
namespace internal {
26
27
namespace {
28
29
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) && !defined DESKTOP_APP_QT_PATCHED
30
enum wl_shell_surface_resize WlResizeFromEdges(Qt::Edges edges) {
31
	if (edges == (Qt::TopEdge | Qt::LeftEdge))
32
		return WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
33
	if (edges == Qt::TopEdge)
34
		return WL_SHELL_SURFACE_RESIZE_TOP;
35
	if (edges == (Qt::TopEdge | Qt::RightEdge))
36
		return WL_SHELL_SURFACE_RESIZE_TOP_RIGHT;
37
	if (edges == Qt::RightEdge)
38
		return WL_SHELL_SURFACE_RESIZE_RIGHT;
39
	if (edges == (Qt::RightEdge | Qt::BottomEdge))
40
		return WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
41
	if (edges == Qt::BottomEdge)
42
		return WL_SHELL_SURFACE_RESIZE_BOTTOM;
43
	if (edges == (Qt::BottomEdge | Qt::LeftEdge))
44
		return WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
45
	if (edges == Qt::LeftEdge)
46
		return WL_SHELL_SURFACE_RESIZE_LEFT;
47
48
	return WL_SHELL_SURFACE_RESIZE_NONE;
49
}
50
#endif // Qt < 5.13 && !DESKTOP_APP_QT_PATCHED
51
52
} // namespace
53
54
WaylandIntegration::WaylandIntegration() {
55
}
56
57
WaylandIntegration *WaylandIntegration::Instance() {
58
	if (!IsWayland()) return nullptr;
59
	static WaylandIntegration instance;
60
	return &instance;
61
}
62
63
bool WaylandIntegration::startMove(QWindow *window) {
64
	// There are startSystemMove on Qt 5.15
65
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) && !defined DESKTOP_APP_QT_PATCHED
66
	if (const auto waylandWindow = static_cast<QWaylandWindow*>(
67
		window->handle())) {
68
		if (const auto seat = waylandWindow->display()->lastInputDevice()) {
69
			if (const auto shellSurface = waylandWindow->shellSurface()) {
70
				return shellSurface->move(seat);
71
			}
72
		}
73
	}
74
#endif // Qt < 5.15 && !DESKTOP_APP_QT_PATCHED
75
76
	return false;
77
}
78
79
bool WaylandIntegration::startResize(QWindow *window, Qt::Edges edges) {
80
	// There are startSystemResize on Qt 5.15
81
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) && !defined DESKTOP_APP_QT_PATCHED
82
	if (const auto waylandWindow = static_cast<QWaylandWindow*>(
83
		window->handle())) {
84
		if (const auto seat = waylandWindow->display()->lastInputDevice()) {
85
			if (const auto shellSurface = waylandWindow->shellSurface()) {
86
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
87
				shellSurface->resize(seat, edges);
88
				return true;
89
#else // Qt >= 5.13
90
				shellSurface->resize(seat, WlResizeFromEdges(edges));
91
				return true;
92
#endif // Qt < 5.13
93
			}
94
		}
95
	}
96
#endif // Qt < 5.15 && !DESKTOP_APP_QT_PATCHED
97
98
	return false;
99
}
100
101
bool WaylandIntegration::showWindowMenu(QWindow *window) {
102
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) || defined DESKTOP_APP_QT_PATCHED
103
	if (const auto waylandWindow = static_cast<QWaylandWindow*>(
104
		window->handle())) {
105
		if (const auto seat = waylandWindow->display()->lastInputDevice()) {
106
			if (const auto shellSurface = waylandWindow->shellSurface()) {
107
				return shellSurface->showWindowMenu(seat);
108
			}
109
		}
110
	}
111
#endif // Qt >= 5.13 || DESKTOP_APP_QT_PATCHED
112
113
	return false;
114
}
115
116
} // namespace internal
117
} // namespace Platform
(-)a/Telegram/SourceFiles/platform/linux/linux_wayland_integration.h (+27 lines)
Line 0 Link Here
1
/*
2
This file is part of Telegram Desktop,
3
the official desktop application for the Telegram messaging service.
4
5
For license and copyright information please follow this link:
6
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7
*/
8
#pragma once
9
10
class QWindow;
11
12
namespace Platform {
13
namespace internal {
14
15
class WaylandIntegration {
16
public:
17
	static WaylandIntegration *Instance();
18
	bool startMove(QWindow *window);
19
	bool startResize(QWindow *window, Qt::Edges edges);
20
	bool showWindowMenu(QWindow *window);
21
22
private:
23
	WaylandIntegration();
24
};
25
26
} // namespace internal
27
} // namespace Platform
(-)a/Telegram/SourceFiles/platform/linux/linux_wayland_integration_dummy.cpp (+37 lines)
Line 0 Link Here
1
/*
2
This file is part of Telegram Desktop,
3
the official desktop application for the Telegram messaging service.
4
5
For license and copyright information please follow this link:
6
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7
*/
8
#include "platform/linux/linux_wayland_integration.h"
9
10
#include "base/platform/base_platform_info.h"
11
12
namespace Platform {
13
namespace internal {
14
15
WaylandIntegration::WaylandIntegration() {
16
}
17
18
WaylandIntegration *WaylandIntegration::Instance() {
19
	if (!IsWayland()) return nullptr;
20
	static WaylandIntegration instance;
21
	return &instance;
22
}
23
24
bool WaylandIntegration::startMove(QWindow *window) {
25
	return false;
26
}
27
28
bool WaylandIntegration::startResize(QWindow *window, Qt::Edges edges) {
29
	return false;
30
}
31
32
bool WaylandIntegration::showWindowMenu(QWindow *window) {
33
	return false;
34
}
35
36
} // namespace internal
37
} // namespace Platform
(-)a/Telegram/SourceFiles/platform/linux/specific_linux.cpp (-91 / +8 lines)
Lines 16-21 For license and copyright information please follow this link: Link Here
16
#include "mainwindow.h"
16
#include "mainwindow.h"
17
#include "platform/linux/linux_desktop_environment.h"
17
#include "platform/linux/linux_desktop_environment.h"
18
#include "platform/linux/file_utilities_linux.h"
18
#include "platform/linux/file_utilities_linux.h"
19
#include "platform/linux/linux_wayland_integration.h"
19
#include "platform/platform_notifications_manager.h"
20
#include "platform/platform_notifications_manager.h"
20
#include "storage/localstorage.h"
21
#include "storage/localstorage.h"
21
#include "core/crash_reports.h"
22
#include "core/crash_reports.h"
Lines 31-40 For license and copyright information please follow this link: Link Here
31
#include <QtCore/QLibraryInfo>
32
#include <QtCore/QLibraryInfo>
32
#include <QtGui/QWindow>
33
#include <QtGui/QWindow>
33
34
34
#include <private/qwaylanddisplay_p.h>
35
#include <private/qwaylandwindow_p.h>
36
#include <private/qwaylandshellsurface_p.h>
37
38
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
35
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
39
#include <QtDBus/QDBusInterface>
36
#include <QtDBus/QDBusInterface>
40
#include <QtDBus/QDBusConnection>
37
#include <QtDBus/QDBusConnection>
Lines 46-55 For license and copyright information please follow this link: Link Here
46
#include <xcb/xcb.h>
43
#include <xcb/xcb.h>
47
#include <xcb/screensaver.h>
44
#include <xcb/screensaver.h>
48
45
49
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) && !defined DESKTOP_APP_QT_PATCHED
50
#include <wayland-client.h>
51
#endif // Qt < 5.13 && !DESKTOP_APP_QT_PATCHED
52
53
#include <glib.h>
46
#include <glib.h>
54
47
55
extern "C" {
48
extern "C" {
Lines 69-75 extern "C" { Link Here
69
62
70
using namespace Platform;
63
using namespace Platform;
71
using Platform::File::internal::EscapeShell;
64
using Platform::File::internal::EscapeShell;
72
using QtWaylandClient::QWaylandWindow;
65
using Platform::internal::WaylandIntegration;
73
66
74
namespace Platform {
67
namespace Platform {
75
namespace {
68
namespace {
Lines 334-362 uint XCBMoveResizeFromEdges(Qt::Edges edges) { Link Here
334
	return 0;
327
	return 0;
335
}
328
}
336
329
337
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) && !defined DESKTOP_APP_QT_PATCHED
338
enum wl_shell_surface_resize WlResizeFromEdges(Qt::Edges edges) {
339
	if (edges == (Qt::TopEdge | Qt::LeftEdge))
340
		return WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
341
	if (edges == Qt::TopEdge)
342
		return WL_SHELL_SURFACE_RESIZE_TOP;
343
	if (edges == (Qt::TopEdge | Qt::RightEdge))
344
		return WL_SHELL_SURFACE_RESIZE_TOP_RIGHT;
345
	if (edges == Qt::RightEdge)
346
		return WL_SHELL_SURFACE_RESIZE_RIGHT;
347
	if (edges == (Qt::RightEdge | Qt::BottomEdge))
348
		return WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
349
	if (edges == Qt::BottomEdge)
350
		return WL_SHELL_SURFACE_RESIZE_BOTTOM;
351
	if (edges == (Qt::BottomEdge | Qt::LeftEdge))
352
		return WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
353
	if (edges == Qt::LeftEdge)
354
		return WL_SHELL_SURFACE_RESIZE_LEFT;
355
356
	return WL_SHELL_SURFACE_RESIZE_NONE;
357
}
358
#endif // Qt < 5.13 && !DESKTOP_APP_QT_PATCHED
359
360
bool StartXCBMoveResize(QWindow *window, int edges) {
330
bool StartXCBMoveResize(QWindow *window, int edges) {
361
	const auto connection = base::Platform::XCB::GetConnectionFromQt();
331
	const auto connection = base::Platform::XCB::GetConnectionFromQt();
362
	if (!connection) {
332
	if (!connection) {
Lines 449-507 bool ShowXCBWindowMenu(QWindow *window) { Link Here
449
	return true;
419
	return true;
450
}
420
}
451
421
452
bool StartWaylandMove(QWindow *window) {
453
	// There are startSystemMove on Qt 5.15
454
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) && !defined DESKTOP_APP_QT_PATCHED
455
	if (const auto waylandWindow = static_cast<QWaylandWindow*>(
456
		window->handle())) {
457
		if (const auto seat = waylandWindow->display()->lastInputDevice()) {
458
			if (const auto shellSurface = waylandWindow->shellSurface()) {
459
				return shellSurface->move(seat);
460
			}
461
		}
462
	}
463
#endif // Qt < 5.15 && !DESKTOP_APP_QT_PATCHED
464
465
	return false;
466
}
467
468
bool StartWaylandResize(QWindow *window, Qt::Edges edges) {
469
	// There are startSystemResize on Qt 5.15
470
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) && !defined DESKTOP_APP_QT_PATCHED
471
	if (const auto waylandWindow = static_cast<QWaylandWindow*>(
472
		window->handle())) {
473
		if (const auto seat = waylandWindow->display()->lastInputDevice()) {
474
			if (const auto shellSurface = waylandWindow->shellSurface()) {
475
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
476
				shellSurface->resize(seat, edges);
477
				return true;
478
#else // Qt >= 5.13
479
				shellSurface->resize(seat, WlResizeFromEdges(edges));
480
				return true;
481
#endif // Qt < 5.13
482
			}
483
		}
484
	}
485
#endif // Qt < 5.15 && !DESKTOP_APP_QT_PATCHED
486
487
	return false;
488
}
489
490
bool ShowWaylandWindowMenu(QWindow *window) {
491
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) || defined DESKTOP_APP_QT_PATCHED
492
	if (const auto waylandWindow = static_cast<QWaylandWindow*>(
493
		window->handle())) {
494
		if (const auto seat = waylandWindow->display()->lastInputDevice()) {
495
			if (const auto shellSurface = waylandWindow->shellSurface()) {
496
				return shellSurface->showWindowMenu(seat);
497
			}
498
		}
499
	}
500
#endif // Qt >= 5.13 || DESKTOP_APP_QT_PATCHED
501
502
	return false;
503
}
504
505
bool XCBFrameExtentsSupported() {
422
bool XCBFrameExtentsSupported() {
506
	const auto connection = base::Platform::XCB::GetConnectionFromQt();
423
	const auto connection = base::Platform::XCB::GetConnectionFromQt();
507
	if (!connection) {
424
	if (!connection) {
Lines 859-882 bool SkipTaskbarSupported() { Link Here
859
}
776
}
860
777
861
bool StartSystemMove(QWindow *window) {
778
bool StartSystemMove(QWindow *window) {
862
	if (IsWayland()) {
779
	if (const auto integration = WaylandIntegration::Instance()) {
863
		return StartWaylandMove(window);
780
		return integration->startMove(window);
864
	} else {
781
	} else {
865
		return StartXCBMoveResize(window, 16);
782
		return StartXCBMoveResize(window, 16);
866
	}
783
	}
867
}
784
}
868
785
869
bool StartSystemResize(QWindow *window, Qt::Edges edges) {
786
bool StartSystemResize(QWindow *window, Qt::Edges edges) {
870
	if (IsWayland()) {
787
	if (const auto integration = WaylandIntegration::Instance()) {
871
		return StartWaylandResize(window, edges);
788
		return integration->startResize(window, edges);
872
	} else {
789
	} else {
873
		return StartXCBMoveResize(window, edges);
790
		return StartXCBMoveResize(window, edges);
874
	}
791
	}
875
}
792
}
876
793
877
bool ShowWindowMenu(QWindow *window) {
794
bool ShowWindowMenu(QWindow *window) {
878
	if (IsWayland()) {
795
	if (const auto integration = WaylandIntegration::Instance()) {
879
		return ShowWaylandWindowMenu(window);
796
		return integration->showWindowMenu(window);
880
	} else {
797
	} else {
881
		return ShowXCBWindowMenu(window);
798
		return ShowXCBWindowMenu(window);
882
	}
799
	}
(-)a/Telegram/SourceFiles/platform/linux/window_title_linux.cpp (+38 lines)
Line 0 Link Here
1
/*
2
This file is part of Telegram Desktop,
3
the official desktop application for the Telegram messaging service.
4
5
For license and copyright information please follow this link:
6
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7
*/
8
#include "platform/linux/window_title_linux.h"
9
10
#include "platform/linux/linux_desktop_environment.h"
11
#include "base/platform/base_platform_info.h"
12
13
namespace Platform {
14
namespace {
15
16
bool SystemMoveResizeSupported() {
17
#if !defined DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION || QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED
18
	return true;
19
#else // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION || Qt >= 5.15 || DESKTOP_APP_QT_PATCHED
20
	return !IsWayland();
21
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION || Qt >= 5.15 || DESKTOP_APP_QT_PATCHED
22
}
23
24
} // namespace
25
26
bool AllowNativeWindowFrameToggle() {
27
	return SystemMoveResizeSupported()
28
		// https://gitlab.gnome.org/GNOME/mutter/-/issues/217
29
		&& !(DesktopEnvironment::IsGnome() && IsWayland());
30
}
31
32
object_ptr<Window::TitleWidget> CreateTitleWidget(QWidget *parent) {
33
	return SystemMoveResizeSupported()
34
		? object_ptr<Window::TitleWidgetQt>(parent)
35
		: object_ptr<Window::TitleWidgetQt>{ nullptr };
36
}
37
38
} // namespace Platform
(-)a/Telegram/SourceFiles/platform/linux/window_title_linux.h (-10 / +2 lines)
Lines 8-15 For license and copyright information please follow this link: Link Here
8
#pragma once
8
#pragma once
9
9
10
#include "platform/platform_window_title.h"
10
#include "platform/platform_window_title.h"
11
#include "platform/linux/linux_desktop_environment.h"
12
#include "base/platform/base_platform_info.h"
13
#include "base/object_ptr.h"
11
#include "base/object_ptr.h"
14
12
15
namespace Window {
13
namespace Window {
Lines 23-36 void DefaultPreviewWindowFramePaint(QImage &preview, const style::palette &palet Link Here
23
21
24
namespace Platform {
22
namespace Platform {
25
23
26
inline bool AllowNativeWindowFrameToggle() {
24
bool AllowNativeWindowFrameToggle();
27
	// https://gitlab.gnome.org/GNOME/mutter/-/issues/217
25
object_ptr<Window::TitleWidget> CreateTitleWidget(QWidget *parent);
28
	return !(DesktopEnvironment::IsGnome() && IsWayland());
29
}
30
31
inline object_ptr<Window::TitleWidget> CreateTitleWidget(QWidget *parent) {
32
	return object_ptr<Window::TitleWidgetQt>(parent);
33
}
34
26
35
inline bool NativeTitleRequiresShadow() {
27
inline bool NativeTitleRequiresShadow() {
36
	return false;
28
	return false;
(-)a/Telegram/SourceFiles/qt_static_plugins.cpp (-12 / +16 lines)
Lines 21-26 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) Link Here
21
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
21
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
22
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
22
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
23
#elif defined Q_OS_UNIX // Q_OS_WIN | Q_OS_MAC
23
#elif defined Q_OS_UNIX // Q_OS_WIN | Q_OS_MAC
24
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
25
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
26
Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
27
Q_IMPORT_PLUGIN(QSvgPlugin)
28
Q_IMPORT_PLUGIN(QSvgIconPlugin)
29
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
30
Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
31
Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
32
Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
33
Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin)
34
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
35
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
24
Q_IMPORT_PLUGIN(ShmServerBufferPlugin)
36
Q_IMPORT_PLUGIN(ShmServerBufferPlugin)
25
Q_IMPORT_PLUGIN(DmaBufServerBufferPlugin)
37
Q_IMPORT_PLUGIN(DmaBufServerBufferPlugin)
26
Q_IMPORT_PLUGIN(DrmEglServerBufferPlugin)
38
Q_IMPORT_PLUGIN(DrmEglServerBufferPlugin)
Lines 31-61 Q_IMPORT_PLUGIN(QWaylandXdgShellV5IntegrationPlugin) Link Here
31
Q_IMPORT_PLUGIN(QWaylandXdgShellV6IntegrationPlugin)
43
Q_IMPORT_PLUGIN(QWaylandXdgShellV6IntegrationPlugin)
32
Q_IMPORT_PLUGIN(QWaylandXdgShellIntegrationPlugin)
44
Q_IMPORT_PLUGIN(QWaylandXdgShellIntegrationPlugin)
33
Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin)
45
Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin)
34
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
35
Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin)
46
Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin)
36
Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin)
47
Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin)
37
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
48
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
38
Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
39
Q_IMPORT_PLUGIN(QSvgPlugin)
40
Q_IMPORT_PLUGIN(QSvgIconPlugin)
41
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
42
Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
43
Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
44
Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
45
Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin)
46
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
47
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_UNIX
49
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_UNIX
48
#endif // !DESKTOP_APP_USE_PACKAGED
50
#endif // !DESKTOP_APP_USE_PACKAGED
49
51
50
#if defined Q_OS_UNIX && !defined Q_OS_MAC
52
#if defined Q_OS_UNIX && !defined Q_OS_MAC
51
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY
53
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY
52
Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin)
53
Q_IMPORT_PLUGIN(NimfInputContextPlugin)
54
Q_IMPORT_PLUGIN(NimfInputContextPlugin)
54
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
55
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
55
Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
56
Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
56
Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin)
57
Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin)
57
Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
58
Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
58
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
59
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
60
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
61
Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin)
62
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
59
#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY
63
#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY
60
64
61
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES
65
#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES

Return to bug 753737