File: 2006-No-random-popups.patch

package info (click to toggle)
telegram-desktop 5.7.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 63,488 kB
  • sloc: cpp: 756,228; python: 4,383; ansic: 1,505; javascript: 1,366; sh: 884; makefile: 820; objc: 652; xml: 565
file content (137 lines) | stat: -rw-r--r-- 4,765 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Description: More extensive use of "tabbed-panel-show-on-click"
 Extend the use of the experimental setting "Show tabbed panel by click" to the
 bottom-right menu in the media viewer, to the speed controller in the video
 player, to the ordering button in the audio player, and to the folder icon in
 the settings.
Author: Nicholas Guriev <guriev-ns@ya.ru>
Last-Update: Wed, 19 Nov 2025 07:00:19 +0300

--- a/Telegram/SourceFiles/media/player/media_player_dropdown.cpp
+++ b/Telegram/SourceFiles/media/player/media_player_dropdown.cpp
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesk
 #include "media/player/media_player_dropdown.h"
 
 #include "base/invoke_queued.h"
+#include "base/options.h"
 #include "base/timer.h"
 #include "lang/lang_keys.h"
 #include "media/player/media_player_button.h"
@@ -21,6 +22,7 @@ https://github.com/telegramdesktop/tdesk
 #include "ui/ui_utility.h"
 #include "styles/style_media_player.h"
 #include "styles/style_widgets.h"
+#include "chat_helpers/tabbed_panel.h"
 
 namespace Media::Player {
 namespace {
@@ -501,6 +503,9 @@ WithDropdownController::WithDropdownCont
 , _menuSt(menuSt)
 , _menuAlign(menuAlign)
 , _menuOverCallback(std::move(menuOverCallback)) {
+	const auto &opt = base::options::lookup<bool>(
+		ChatHelpers::kOptionTabbedPanelShowOnClick);
+	if (opt.value()) return;
 	button->events(
 	) | rpl::filter([=](not_null<QEvent*> e) {
 		return (e->type() == QEvent::Enter)
--- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
+++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
@@ -73,6 +73,7 @@ https://github.com/telegramdesktop/tdesk
 #include "window/themes/window_theme_preview.h"
 #include "window/window_peer_menu.h"
 #include "window/window_controller.h"
+#include "base/options.h"
 #include "base/platform/base_platform_info.h"
 #include "base/power_save_blocker.h"
 #include "base/random.h"
@@ -92,6 +93,7 @@ https://github.com/telegramdesktop/tdesk
 #include "styles/style_calls.h"
 #include "styles/style_chat.h"
 #include "styles/style_menu_icons.h"
+#include "chat_helpers/tabbed_panel.h"
 
 #ifdef Q_OS_MAC
 #include "platform/mac/touchbar/mac_touchbar_media_view.h"
@@ -2447,7 +2449,8 @@ void OverlayWidget::dropdownHidden() {
 	_ignoringDropdown = true;
 	_lastMouseMovePos = _widget->mapFromGlobal(QCursor::pos());
 	updateOver(_lastMouseMovePos);
-	_ignoringDropdown = false;
+	_ignoringDropdown = base::options::lookup<bool>(
+		ChatHelpers::kOptionTabbedPanelShowOnClick).value();
 	if (!_controlsHideTimer.isActive()) {
 		hideControls(true);
 	}
@@ -3376,6 +3379,8 @@ void OverlayWidget::clearControlsState()
 	if (!_animationOpacities.empty()) {
 		_animationOpacities.clear();
 	}
+	_ignoringDropdown = base::options::lookup<bool>(
+		ChatHelpers::kOptionTabbedPanelShowOnClick).value();
 }
 
 not_null<QWindow*> OverlayWidget::window() const {
--- a/Telegram/SourceFiles/storage/localstorage.cpp
+++ b/Telegram/SourceFiles/storage/localstorage.cpp
@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesk
 #include "data/data_session.h"
 #include "data/data_document.h"
 #include "data/data_document_media.h"
+#include "base/options.h"
 #include "base/platform/base_platform_info.h"
 #include "base/random.h"
 #include "ui/power_saving.h"
@@ -29,6 +30,7 @@ https://github.com/telegramdesktop/tdesk
 #include "main/main_session.h"
 #include "window/themes/window_theme.h"
 #include "lang/lang_instance.h"
+#include "chat_helpers/tabbed_panel.h"
 
 #include <QtCore/QDirIterator>
 
@@ -411,6 +413,17 @@ void start() {
 
 	applyReadContext(std::move(context));
 	if (context.legacyRead) {
+		if (_oldSettingsVersion < 3005002 /* v3.5.2 */) {
+			QFile toggle(cWorkingDir() + u"tdata/nopopupdropdown"_q);
+			if (toggle.exists()) {
+				base::options::lookup<bool>(
+					ChatHelpers::kOptionTabbedPanelShowOnClick).set(true);
+				if (toggle.size() == 0) {
+					toggle.remove();
+				}
+			}
+		}
+
 		writeSettings();
 	}
 
--- a/Telegram/SourceFiles/ui/filter_icon_panel.cpp
+++ b/Telegram/SourceFiles/ui/filter_icon_panel.cpp
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesk
 */
 #include "ui/filter_icon_panel.h"
 
+#include "base/options.h"
 #include "ui/widgets/shadow.h"
 #include "ui/image/image_prepare.h"
 #include "ui/effects/panel_animation.h"
@@ -18,6 +19,7 @@ https://github.com/telegramdesktop/tdesk
 #include "core/application.h"
 #include "styles/style_chat_helpers.h"
 #include "styles/style_window.h"
+#include "chat_helpers/tabbed_panel.h"
 
 namespace Ui {
 namespace {
@@ -300,6 +302,9 @@ void FilterIconPanel::leaveEventHook(QEv
 }
 
 void FilterIconPanel::otherEnter() {
+	const auto &opt = base::options::lookup<bool>(
+		ChatHelpers::kOptionTabbedPanelShowOnClick);
+	if (opt.value()) return;
 	showAnimated();
 }