Force enable fractional-scale-v1 experimental option

This commit is contained in:
Ilya Fedin 2023-11-13 23:29:38 +04:00 committed by John Preston
parent 0f9d83f34b
commit 4696f731da
6 changed files with 30 additions and 6 deletions

View file

@ -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() {

View file

@ -19,6 +19,8 @@ class QLockFile;
namespace Core {
extern const char kOptionForceWaylandFractionalScaling[];
class UpdateChecker;
class Application;

View file

@ -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);

View file

@ -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 \

@ -1 +1 @@
Subproject commit d6133525dc1649745ac94698c02e533ecc6f0281
Subproject commit 69c8353746dbb36808b8349eff0cac0f057fa2f4

View file

@ -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: |