[Option][GUI] Unfocused autoscroll
This commit is contained in:
parent
c815639bbb
commit
b4a08ae851
4 changed files with 21 additions and 0 deletions
|
|
@ -33,6 +33,7 @@
|
||||||
"ktg_settings_sticker_scale_both_about": "When enabled, sticker maximum width will be changed along with sticker height.",
|
"ktg_settings_sticker_scale_both_about": "When enabled, sticker maximum width will be changed along with sticker height.",
|
||||||
"ktg_settings_emoji_outline": "Big emoji outline",
|
"ktg_settings_emoji_outline": "Big emoji outline",
|
||||||
"ktg_settings_disable_up_edit": "Disable edit by Up key",
|
"ktg_settings_disable_up_edit": "Disable edit by Up key",
|
||||||
|
"ktg_settings_auto_scroll_unfocused": "Unfocused auto-scroll",
|
||||||
"ktg_settings_always_show_scheduled": "Always show scheduled",
|
"ktg_settings_always_show_scheduled": "Always show scheduled",
|
||||||
"ktg_settings_chat_list_compact": "Compact chat list",
|
"ktg_settings_chat_list_compact": "Compact chat list",
|
||||||
"ktg_fonts_title": "Fonts",
|
"ktg_fonts_title": "Fonts",
|
||||||
|
|
|
||||||
|
|
@ -406,6 +406,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
|
||||||
{ "profile_top_mute", {
|
{ "profile_top_mute", {
|
||||||
.type = SettingType::BoolSetting,
|
.type = SettingType::BoolSetting,
|
||||||
.defaultValue = false, }},
|
.defaultValue = false, }},
|
||||||
|
{ "auto_scroll_unfocused", {
|
||||||
|
.type = SettingType::BoolSetting,
|
||||||
|
.defaultValue = false, }},
|
||||||
{ "folders/local", {
|
{ "folders/local", {
|
||||||
.scope = SettingScope::Account,
|
.scope = SettingScope::Account,
|
||||||
.type = SettingType::QJsonArraySetting, }},
|
.type = SettingType::QJsonArraySetting, }},
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,12 @@ void SetupKotatoChats(
|
||||||
SettingsMenuJsonSwitch(ktg_settings_top_bar_mute, profile_top_mute);
|
SettingsMenuJsonSwitch(ktg_settings_top_bar_mute, profile_top_mute);
|
||||||
SettingsMenuJsonSwitch(ktg_settings_disable_up_edit, disable_up_edit);
|
SettingsMenuJsonSwitch(ktg_settings_disable_up_edit, disable_up_edit);
|
||||||
|
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
|
if (Ui::Platform::IsOverlapped(container, QRect()).has_value()) {
|
||||||
|
SettingsMenuJsonSwitch(ktg_settings_auto_scroll_unfocused, auto_scroll_unfocused);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
AddButton(
|
AddButton(
|
||||||
container,
|
container,
|
||||||
rktr("ktg_settings_chat_list_compact"),
|
rktr("ktg_settings_chat_list_compact"),
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_settings.h"
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_document_media.h"
|
#include "data/data_document_media.h"
|
||||||
|
|
@ -543,6 +544,16 @@ bool MainWindow::doWeMarkAsRead() {
|
||||||
if (!_main || Ui::isLayerShown()) {
|
if (!_main || Ui::isLayerShown()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (::Kotato::JsonSettings::GetBool("auto_scroll_unfocused")) {
|
||||||
|
// for tile grid in case other windows have shadows
|
||||||
|
// i've seen some windows with >70px shadow margins
|
||||||
|
const auto margin = style::ConvertScale(100);
|
||||||
|
const auto inner = body()->rect();
|
||||||
|
return Ui::IsContentVisible(
|
||||||
|
this,
|
||||||
|
inner.marginsRemoved(QMargins(margin, margin, margin, margin)))
|
||||||
|
&& _main->doWeMarkAsRead();
|
||||||
|
}
|
||||||
return isActive() && _main->doWeMarkAsRead();
|
return isActive() && _main->doWeMarkAsRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue