mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Allow force-disabling OpenGL.
This commit is contained in:
@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "window/section_widget.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "webrtc/webrtc_create_adm.h"
|
||||
#include "ui/gl/gl_detection.h"
|
||||
#include "facades.h"
|
||||
|
||||
namespace Core {
|
||||
@@ -194,6 +195,7 @@ QByteArray Settings::serialize() const {
|
||||
for (const auto &[id, variant] : _emojiVariants) {
|
||||
stream << id << quint8(variant);
|
||||
}
|
||||
stream << qint32(_disableOpenGL ? 1 : 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -269,6 +271,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||
QByteArray windowPosition;
|
||||
std::vector<RecentEmojiId> recentEmojiPreload;
|
||||
base::flat_map<QString, uint8> emojiVariants;
|
||||
qint32 disableOpenGL = _disableOpenGL ? 1 : 0;
|
||||
|
||||
stream >> themesAccentColors;
|
||||
if (!stream.atEnd()) {
|
||||
@@ -397,6 +400,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!stream.atEnd()) {
|
||||
stream >> disableOpenGL;
|
||||
}
|
||||
if (stream.status() != QDataStream::Ok) {
|
||||
LOG(("App Error: "
|
||||
"Bad data for Core::Settings::constructFromSerialized()"));
|
||||
@@ -502,6 +508,10 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||
}
|
||||
_recentEmojiPreload = std::move(recentEmojiPreload);
|
||||
_emojiVariants = std::move(emojiVariants);
|
||||
_disableOpenGL = (disableOpenGL == 1);
|
||||
if (!Platform::IsMac()) {
|
||||
Ui::GL::ForceDisable(_disableOpenGL);
|
||||
}
|
||||
}
|
||||
|
||||
bool Settings::chatWide() const {
|
||||
|
@@ -532,6 +532,13 @@ public:
|
||||
void saveEmojiVariant(EmojiPtr emoji);
|
||||
void setLegacyEmojiVariants(QMap<QString, int> data);
|
||||
|
||||
[[nodiscard]] bool disableOpenGL() const {
|
||||
return _disableOpenGL;
|
||||
}
|
||||
void setDisableOpenGL(bool value) {
|
||||
_disableOpenGL = value;
|
||||
}
|
||||
|
||||
[[nodiscard]] static bool ThirdColumnByDefault();
|
||||
[[nodiscard]] static float64 DefaultDialogsWidthRatio();
|
||||
[[nodiscard]] static qint32 SerializePlaybackSpeed(float64 speed) {
|
||||
@@ -624,6 +631,7 @@ private:
|
||||
rpl::variable<std::optional<bool>> _systemDarkMode = std::nullopt;
|
||||
rpl::variable<bool> _systemDarkModeEnabled = false;
|
||||
WindowPosition _windowPosition; // per-window
|
||||
bool _disableOpenGL = false;
|
||||
|
||||
bool _tabbedReplacedWithInfo = false; // per-window
|
||||
rpl::event_stream<bool> _tabbedReplacedWithInfoValue; // per-window
|
||||
|
Reference in New Issue
Block a user