diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index beb06a6fb..169745533 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/local_url_handlers.h" #include "core/update_checker.h" #include "core/deadlock_detector.h" +#include "base/options.h" #include "base/timer.h" #include "base/concurrent_timer.h" #include "base/invoke_queued.h" @@ -37,6 +38,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Core { namespace { +base::options::toggle OptionForceWaylandFractionalScaling({ + .id = kOptionForceWaylandFractionalScaling, + .name = "Force enable fractional-scale-v1", + .description = "Enable fractional-scale-v1 on Wayland without " + "precise High DPI scaling. " + "Requires Qt with Desktop App Toolkit patches.", + .scope = [] { +#ifdef DESKTOP_APP_QT_PATCHED + return Platform::IsWayland(); +#else // DESKTOP_APP_QT_PATCHED + return false; +#endif // !DESKTOP_APP_QT_PATCHED + }, + .restartRequired = true, +}); + QChar _toHex(ushort v) { v = v & 0x000F; return QChar::fromLatin1((v >= 10) ? ('a' + (v - 10)) : ('0' + v)); @@ -77,12 +94,17 @@ QString _escapeFrom7bit(const QString &str) { } // namespace +const char kOptionForceWaylandFractionalScaling[] = "force-wayland-fractional-scaling"; + bool Sandbox::QuitOnStartRequested = false; Sandbox::Sandbox(int &argc, char **argv) : QApplication(argc, argv) , _mainThreadId(QThread::currentThreadId()) { setQuitOnLastWindowClosed(false); + if (OptionForceWaylandFractionalScaling.value()) { + setProperty("_q_force_wayland_fractional_scale", true); + } } int Sandbox::start() { diff --git a/Telegram/SourceFiles/core/sandbox.h b/Telegram/SourceFiles/core/sandbox.h index 4c15c2828..39d16296c 100644 --- a/Telegram/SourceFiles/core/sandbox.h +++ b/Telegram/SourceFiles/core/sandbox.h @@ -19,6 +19,8 @@ class QLockFile; namespace Core { +extern const char kOptionForceWaylandFractionalScaling[]; + class UpdateChecker; class Application; diff --git a/Telegram/SourceFiles/settings/settings_experimental.cpp b/Telegram/SourceFiles/settings/settings_experimental.cpp index 2d91f6d99..dfc85fb2c 100644 --- a/Telegram/SourceFiles/settings/settings_experimental.cpp +++ b/Telegram/SourceFiles/settings/settings_experimental.cpp @@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/chat/chat_style_radius.h" #include "base/options.h" #include "core/application.h" +#include "core/sandbox.h" #include "core/launcher.h" #include "chat_helpers/tabbed_panel.h" #include "dialogs/dialogs_widget.h" @@ -142,6 +143,7 @@ void SetupExperimental( addToggle(ChatHelpers::kOptionTabbedPanelShowOnClick); addToggle(Dialogs::kOptionForumHideChatsList); addToggle(Core::kOptionFractionalScalingEnabled); + addToggle(Core::kOptionForceWaylandFractionalScaling); addToggle(Window::kOptionViewProfileInChatsListContextMenu); addToggle(Info::Profile::kOptionShowPeerIdBelowAbout); addToggle(Ui::GL::kOptionAllowLinuxNvidiaOpenGL); diff --git a/Telegram/build/docker/centos_env/Dockerfile b/Telegram/build/docker/centos_env/Dockerfile index d4199e5d1..16341b04d 100644 --- a/Telegram/build/docker/centos_env/Dockerfile +++ b/Telegram/build/docker/centos_env/Dockerfile @@ -54,7 +54,7 @@ FROM builder AS patches RUN git init patches \ && cd patches \ && git remote add origin {{ GIT }}/desktop-app/patches.git \ - && git fetch --depth=1 origin c80c0d530200e3f27a9a39b4f230919529e73bd2 \ + && git fetch --depth=1 origin 90a7f1b55da69c99699e6b6776268184c20387f8 \ && git reset --hard FETCH_HEAD \ && rm -rf .git @@ -758,8 +758,7 @@ RUN git clone -b {{ QT_TAG }} --depth=1 {{ GIT }}/qt/qt5.git qt_{{ QT }} \ && cd qtbase \ && find ../../patches/qtbase_{{ QT }} -type f -print0 | sort -z | xargs -r0 git apply \ && cd ../qtwayland \ - && git fetch origin aae65c885d8e38d8abc2959cded7b5e9e5fc88b3 \ - && git cherry-pick -n FETCH_HEAD \ + && find ../../patches/qtwayland_{{ QT }} -type f -print0 | sort -z | xargs -r0 git apply \ && cd .. \ && ./configure -prefix "{{ QT_PREFIX }}" \ CMAKE_BUILD_TYPE=None \ diff --git a/Telegram/lib_ui b/Telegram/lib_ui index d6133525d..69c835374 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit d6133525dc1649745ac94698c02e533ecc6f0281 +Subproject commit 69c8353746dbb36808b8349eff0cac0f057fa2f4 diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 4b1c64246..2631ca9b0 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -489,8 +489,7 @@ parts: git fetch origin v6.5.3 git checkout FETCH_HEAD cd ../qtwayland - git fetch origin aae65c885d8e38d8abc2959cded7b5e9e5fc88b3 - git cherry-pick -n FETCH_HEAD + find $CRAFT_STAGE/patches/qtwayland_${QT} -type f -print0 | sort -z | xargs -r0 git apply sed -i 's/qMin(version, 8)/qMin(version, 7)/' src/client/qwaylandinputdevice.cpp cd .. override-build: |