|
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 |
} |