Add unfocused auto-scroll option (#178)
This commit is contained in:
parent
c49444b152
commit
52f2998576
8 changed files with 23 additions and 0 deletions
|
|
@ -2820,6 +2820,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
"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_chat_list_compact" = "Compact chat list";
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
"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_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_chat_list_compact": "Compact chat list",
|
||||
"ktg_fonts_title": "Fonts",
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
"ktg_settings_sticker_scale_both_about": "При включении максимальная ширина стикера будет изменяться вместе с высотой.",
|
||||
"ktg_settings_emoji_outline": "Обводка у больших эмодзи",
|
||||
"ktg_settings_disable_up_edit": "Отключить редактирование по «Вверх»",
|
||||
"ktg_settings_auto_scroll_unfocused": "Прокрутка, когда окно неактивно",
|
||||
"ktg_settings_always_show_scheduled": "Всегда показывать отложенные",
|
||||
"ktg_settings_chat_list_compact": "Компактный список чатов",
|
||||
"ktg_fonts_title": "Шрифты",
|
||||
|
|
|
|||
|
|
@ -369,6 +369,7 @@ QByteArray GenerateSettingsJson(bool areDefault = false) {
|
|||
settings.insert(qsl("show_phone_in_drawer"), cShowPhoneInDrawer());
|
||||
settings.insert(qsl("chat_list_lines"), DialogListLines());
|
||||
settings.insert(qsl("disable_up_edit"), cDisableUpEdit());
|
||||
settings.insert(qsl("auto_scroll_unfocused"), cAutoScrollUnfocused());
|
||||
settings.insert(qsl("confirm_before_calls"), cConfirmBeforeCall());
|
||||
settings.insert(qsl("native_decorations"), cUseNativeDecorations());
|
||||
settings.insert(qsl("recent_stickers_limit"), RecentStickersLimit());
|
||||
|
|
@ -581,6 +582,10 @@ bool Manager::readCustomFile() {
|
|||
cSetDisableUpEdit(v);
|
||||
});
|
||||
|
||||
ReadBoolOption(settings, "auto_scroll_unfocused", [&](auto v) {
|
||||
cSetAutoScrollUnfocused(v);
|
||||
});
|
||||
|
||||
ReadArrayOption(settings, "replaces", [&](auto v) {
|
||||
for (auto i = v.constBegin(), e = v.constEnd(); i != e; ++i) {
|
||||
if (!(*i).isArray()) {
|
||||
|
|
|
|||
|
|
@ -246,4 +246,6 @@ bool gForwardCaptioned = true;
|
|||
bool gForwardAlbumsAsIs = true;
|
||||
bool gForwardGrouped = false;
|
||||
|
||||
bool gAutoScrollUnfocused = false;
|
||||
|
||||
LocalFolderVector gLocalFolders;
|
||||
|
|
|
|||
|
|
@ -146,6 +146,8 @@ DeclareSetting(bool, ForwardCaptioned);
|
|||
DeclareSetting(bool, ForwardAlbumsAsIs);
|
||||
DeclareSetting(bool, ForwardGrouped);
|
||||
|
||||
DeclareSetting(bool, AutoScrollUnfocused);
|
||||
|
||||
struct LocalFolder {
|
||||
int id = 0;
|
||||
uint64 ownerId = 0;
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@ void SetupKotatoChats(
|
|||
|
||||
SettingsMenuCSwitch(ktg_settings_top_bar_mute, ProfileTopBarNotifications);
|
||||
SettingsMenuCSwitch(ktg_settings_disable_up_edit, DisableUpEdit);
|
||||
SettingsMenuCSwitch(ktg_settings_auto_scroll_unfocused, AutoScrollUnfocused);
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
|
|
|
|||
|
|
@ -556,6 +556,15 @@ bool MainWindow::doWeMarkAsRead() {
|
|||
if (!_main || Ui::isLayerShown()) {
|
||||
return false;
|
||||
}
|
||||
if (cAutoScrollUnfocused()) {
|
||||
// for tile grid in case other windows have shadows
|
||||
// i've seen some windows with >70px shadow margins
|
||||
const auto margin = style::ConvertScale(100);
|
||||
return Ui::IsContentVisible(
|
||||
this,
|
||||
inner().marginsRemoved(QMargins(margin, margin, margin, margin)))
|
||||
&& _main->doWeMarkAsRead();
|
||||
}
|
||||
updateIsActive();
|
||||
return isActive() && _main->doWeMarkAsRead();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue