Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Eric Kotato 2020-01-23 21:14:48 +03:00
commit 3ec3d0f2a8
16 changed files with 68 additions and 582 deletions

View file

@ -33,7 +33,6 @@ PRIVATE
ui/colors.palette
emoji_suggestions/emoji_autocomplete.json
fonts/fonts.qrc
qt_conf/mac.qrc
qt_conf/win.qrc
@ -189,6 +188,10 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
nice_target_sources(lib_ui ${src_loc} PRIVATE qt_conf/linux.qrc)
endif()
if (NOT DESKTOP_APP_USE_PACKAGED_FONTS)
nice_target_sources(lib_ui ${src_loc} PRIVATE fonts/fonts.qrc)
endif()
target_include_directories(lib_ui
PUBLIC
${src_loc}

View file

@ -1,55 +0,0 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
{
'actions': [{
'action_name': 'codegen_palette',
'inputs': [
'<(PRODUCT_DIR)/codegen_style<(exe_ext)',
'<(style_timestamp)',
'<(src_loc)/ui/colors.palette',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/styles/palette.h',
'<(SHARED_INTERMEDIATE_DIR)/styles/palette.cpp',
],
'action': [
'<(PRODUCT_DIR)/codegen_style<(exe_ext)',
'-I', '<(src_loc)',
'-o', '<(SHARED_INTERMEDIATE_DIR)/styles',
'-w', '<(PRODUCT_DIR)/..',
# GYP/Ninja bug workaround: if we specify just <(RULE_INPUT_PATH)
# the <(RULE_INPUT_ROOT) variables won't be available in Ninja,
# and the 'message' will be just 'codegen_style-ing .style..'
# Looks like the using the <(RULE_INPUT_ROOT) here "exports" it
# for using in the 'message' field.
'<(src_loc)/ui/colors.palette',
],
'message': 'codegen_palette-ing colors..',
'process_outputs_as_sources': 1,
}, {
'action_name': 'codegen_emoji',
'inputs': [
'<(PRODUCT_DIR)/codegen_emoji<(exe_ext)',
'<(emoji_suggestions_loc)/emoji_autocomplete.json',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/emoji.cpp',
'<(SHARED_INTERMEDIATE_DIR)/emoji.h',
'<(SHARED_INTERMEDIATE_DIR)/emoji_suggestions_data.cpp',
'<(SHARED_INTERMEDIATE_DIR)/emoji_suggestions_data.h',
],
'action': [
'<(PRODUCT_DIR)/codegen_emoji<(exe_ext)',
'<(emoji_suggestions_loc)/emoji_autocomplete.json',
'-o', '<(SHARED_INTERMEDIATE_DIR)',
],
'message': 'codegen_emoji-ing..',
'process_outputs_as_sources': 1,
}],
}

View file

@ -1,72 +0,0 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
{
'variables': {
'qrc_files': [
'<(submodules_loc)/lib_ui/fonts/fonts.qrc',
],
},
'conditions': [
[ 'build_linux', {
'variables': {
'qrc_files': [
'<(submodules_loc)/lib_ui/qt_conf/linux.qrc',
],
}
}],
[ 'build_mac', {
'variables': {
'qrc_files': [
'<(submodules_loc)/lib_ui/qt_conf/mac.qrc',
],
},
}],
[ 'build_win', {
'variables': {
'qrc_files': [
'<(submodules_loc)/lib_ui/qt_conf/win.qrc',
],
}
}],
],
'actions': [{
'action_name': 'update_dependent_qrc',
'inputs': [
'update_dependent.py',
'<@(qrc_files)',
'<!@(python <(submodules_loc)/lib_ui/gyp/update_dependent.py --qrc_list <@(qrc_files))',
],
'outputs': [
'<(qrc_timestamp)',
],
'action': [
'python', '<(submodules_loc)/lib_ui/gyp/update_dependent.py', '--qrc',
'-o', '<(qrc_timestamp)',
'<@(qrc_files)',
],
'message': 'Updating dependent qrc files..',
}],
'rules': [{
'rule_name': 'qt_rcc',
'extension': 'qrc',
'inputs': [
'<(qrc_timestamp)',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'action': [
'<(qt_loc)/bin/rcc<(exe_ext)',
'-name', '<(RULE_INPUT_ROOT)',
'-no-compress',
'<(RULE_INPUT_PATH)',
'-o', '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
],
'message': 'Rcc-ing <(RULE_INPUT_ROOT).qrc..',
'process_outputs_as_sources': 1,
}],
}

View file

@ -1,146 +0,0 @@
<(src_loc)/ui/effects/animation_value.cpp
<(src_loc)/ui/effects/animation_value.h
<(src_loc)/ui/effects/animations.cpp
<(src_loc)/ui/effects/animations.h
<(src_loc)/ui/effects/cross_animation.cpp
<(src_loc)/ui/effects/cross_animation.h
<(src_loc)/ui/effects/fade_animation.cpp
<(src_loc)/ui/effects/fade_animation.h
<(src_loc)/ui/effects/numbers_animation.cpp
<(src_loc)/ui/effects/numbers_animation.h
<(src_loc)/ui/effects/panel_animation.cpp
<(src_loc)/ui/effects/panel_animation.h
<(src_loc)/ui/effects/radial_animation.cpp
<(src_loc)/ui/effects/radial_animation.h
<(src_loc)/ui/effects/ripple_animation.cpp
<(src_loc)/ui/effects/ripple_animation.h
<(src_loc)/ui/effects/slide_animation.cpp
<(src_loc)/ui/effects/slide_animation.h
<(src_loc)/ui/image/image_prepare.cpp
<(src_loc)/ui/image/image_prepare.h
<(src_loc)/ui/layers/box_content.cpp
<(src_loc)/ui/layers/box_content.h
<(src_loc)/ui/layers/box_layer_widget.cpp
<(src_loc)/ui/layers/box_layer_widget.h
<(src_loc)/ui/layers/generic_box.cpp
<(src_loc)/ui/layers/generic_box.h
<(src_loc)/ui/layers/layer_manager.cpp
<(src_loc)/ui/layers/layer_manager.h
<(src_loc)/ui/layers/layer_widget.cpp
<(src_loc)/ui/layers/layer_widget.h
<(src_loc)/ui/platform/linux/ui_window_linux.cpp
<(src_loc)/ui/platform/linux/ui_window_linux.h
<(src_loc)/ui/platform/linux/ui_utility_linux.cpp
<(src_loc)/ui/platform/linux/ui_utility_linux.h
<(src_loc)/ui/platform/mac/ui_window_mac.h
<(src_loc)/ui/platform/mac/ui_window_mac.mm
<(src_loc)/ui/platform/mac/ui_window_title_mac.h
<(src_loc)/ui/platform/mac/ui_window_title_mac.mm
<(src_loc)/ui/platform/mac/ui_utility_mac.h
<(src_loc)/ui/platform/mac/ui_utility_mac.mm
<(src_loc)/ui/platform/win/ui_window_shadow_win.cpp
<(src_loc)/ui/platform/win/ui_window_shadow_win.h
<(src_loc)/ui/platform/win/ui_window_title_win.cpp
<(src_loc)/ui/platform/win/ui_window_title_win.h
<(src_loc)/ui/platform/win/ui_window_win.cpp
<(src_loc)/ui/platform/win/ui_window_win.h
<(src_loc)/ui/platform/win/ui_utility_win.cpp
<(src_loc)/ui/platform/win/ui_utility_win.h
<(src_loc)/ui/platform/ui_platform_window.h
<(src_loc)/ui/platform/ui_platform_utility.h
<(src_loc)/ui/style/style_core.cpp
<(src_loc)/ui/style/style_core.h
<(src_loc)/ui/style/style_core_color.cpp
<(src_loc)/ui/style/style_core_color.h
<(src_loc)/ui/style/style_core_direction.cpp
<(src_loc)/ui/style/style_core_direction.h
<(src_loc)/ui/style/style_core_font.cpp
<(src_loc)/ui/style/style_core_font.h
<(src_loc)/ui/style/style_core_icon.cpp
<(src_loc)/ui/style/style_core_icon.h
<(src_loc)/ui/style/style_core_scale.cpp
<(src_loc)/ui/style/style_core_scale.h
<(src_loc)/ui/style/style_core_types.cpp
<(src_loc)/ui/style/style_core_types.h
<(src_loc)/ui/text/text.cpp
<(src_loc)/ui/text/text.h
<(src_loc)/ui/text/text_block.cpp
<(src_loc)/ui/text/text_block.h
<(src_loc)/ui/text/text_entity.cpp
<(src_loc)/ui/text/text_entity.h
<(src_loc)/ui/text/text_isolated_emoji.h
<(src_loc)/ui/text/text_utilities.cpp
<(src_loc)/ui/text/text_utilities.h
<(src_loc)/ui/toast/toast.cpp
<(src_loc)/ui/toast/toast.h
<(src_loc)/ui/toast/toast_manager.cpp
<(src_loc)/ui/toast/toast_manager.h
<(src_loc)/ui/toast/toast_widget.cpp
<(src_loc)/ui/toast/toast_widget.h
<(src_loc)/ui/widgets/box_content_divider.cpp
<(src_loc)/ui/widgets/box_content_divider.h
<(src_loc)/ui/widgets/buttons.cpp
<(src_loc)/ui/widgets/buttons.h
<(src_loc)/ui/widgets/checkbox.cpp
<(src_loc)/ui/widgets/checkbox.h
<(src_loc)/ui/widgets/dropdown_menu.cpp
<(src_loc)/ui/widgets/dropdown_menu.h
<(src_loc)/ui/widgets/inner_dropdown.cpp
<(src_loc)/ui/widgets/inner_dropdown.h
<(src_loc)/ui/widgets/input_fields.cpp
<(src_loc)/ui/widgets/input_fields.h
<(src_loc)/ui/widgets/labels.cpp
<(src_loc)/ui/widgets/labels.h
<(src_loc)/ui/widgets/menu.cpp
<(src_loc)/ui/widgets/menu.h
<(src_loc)/ui/widgets/popup_menu.cpp
<(src_loc)/ui/widgets/popup_menu.h
<(src_loc)/ui/widgets/scroll_area.cpp
<(src_loc)/ui/widgets/scroll_area.h
<(src_loc)/ui/widgets/shadow.cpp
<(src_loc)/ui/widgets/shadow.h
<(src_loc)/ui/widgets/tooltip.cpp
<(src_loc)/ui/widgets/tooltip.h
<(src_loc)/ui/widgets/window.cpp
<(src_loc)/ui/widgets/window.h
<(src_loc)/ui/wrap/fade_wrap.cpp
<(src_loc)/ui/wrap/fade_wrap.h
<(src_loc)/ui/wrap/padding_wrap.cpp
<(src_loc)/ui/wrap/padding_wrap.h
<(src_loc)/ui/wrap/slide_wrap.cpp
<(src_loc)/ui/wrap/slide_wrap.h
<(src_loc)/ui/wrap/vertical_layout.cpp
<(src_loc)/ui/wrap/vertical_layout.h
<(src_loc)/ui/wrap/wrap.h
<(src_loc)/ui/abstract_button.cpp
<(src_loc)/ui/abstract_button.h
<(src_loc)/ui/basic_click_handlers.cpp
<(src_loc)/ui/basic_click_handlers.h
<(src_loc)/ui/click_handler.cpp
<(src_loc)/ui/click_handler.h
<(src_loc)/ui/delayed_activation.cpp
<(src_loc)/ui/delayed_activation.h
<(src_loc)/ui/emoji_config.cpp
<(src_loc)/ui/emoji_config.h
<(src_loc)/ui/focus_persister.h
<(src_loc)/ui/inactive_press.cpp
<(src_loc)/ui/inactive_press.h
<(src_loc)/ui/integration.cpp
<(src_loc)/ui/integration.h
<(src_loc)/ui/main_queue_processor.cpp
<(src_loc)/ui/main_queue_processor.h
<(src_loc)/ui/painter.h
<(src_loc)/ui/ph.cpp
<(src_loc)/ui/ph.h
<(src_loc)/ui/rect_part.h
<(src_loc)/ui/round_rect.cpp
<(src_loc)/ui/round_rect.h
<(src_loc)/ui/rp_widget.cpp
<(src_loc)/ui/rp_widget.h
<(src_loc)/ui/ui_log.cpp
<(src_loc)/ui/ui_log.h
<(src_loc)/ui/ui_utility.cpp
<(src_loc)/ui/ui_utility.h
<(emoji_suggestions_loc)/emoji_suggestions.cpp
<(emoji_suggestions_loc)/emoji_suggestions.h
<(emoji_suggestions_loc)/emoji_suggestions_helper.h

View file

@ -1,55 +0,0 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
{
'actions': [{
'action_name': 'update_dependent_styles',
'inputs': [
'update_dependent.py',
'<@(style_files)',
'<@(dependent_style_files)',
],
'outputs': [
'<(style_timestamp)',
],
'action': [
'python', '<(submodules_loc)/lib_ui/gyp/update_dependent.py', '--styles',
'-I', '<(src_loc)', '-I', '<(submodules_loc)/lib_ui',
'-o', '<(style_timestamp)',
'<@(style_files)',
],
'message': 'Updating dependent style files..',
}],
'rules': [{
'rule_name': 'codegen_style',
'extension': 'style',
'inputs': [
'<(PRODUCT_DIR)/codegen_style<(exe_ext)',
'<(style_timestamp)',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/styles/style_<(RULE_INPUT_ROOT).h',
'<(SHARED_INTERMEDIATE_DIR)/styles/style_<(RULE_INPUT_ROOT).cpp',
],
'action': [
'<(PRODUCT_DIR)/codegen_style<(exe_ext)',
'-I', '<(src_loc)', '-I', '<(submodules_loc)/lib_ui',
'-I', '<(DEPTH)/../Resources',
'-o', '<(SHARED_INTERMEDIATE_DIR)/styles',
'-w', '<(PRODUCT_DIR)/..',
# GYP/Ninja bug workaround: if we specify just <(RULE_INPUT_PATH)
# the <(RULE_INPUT_ROOT) variables won't be available in Ninja,
# and the 'message' will be just 'codegen_style-ing .style..'
# Looks like the using the <(RULE_INPUT_ROOT) here "exports" it
# for using in the 'message' field.
'<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
],
'message': 'codegen_style-ing <(RULE_INPUT_ROOT).style..',
'process_outputs_as_sources': 1,
}],
}

View file

@ -1,170 +0,0 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
from __future__ import print_function
import sys
import os
import re
import time
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
sys.exit(1)
my_path = os.path.dirname(os.path.realpath(__file__)).replace('\\', '/')
def get_qrc_dependencies(file_path):
global one_modified
dependencies = {}
if not os.path.isfile(file_path):
eprint('File not found: ' + file_path)
dir_name = os.path.dirname(file_path).replace('\\', '/')
with open(file_path) as f:
for line in f:
file_match = re.match('^\s*<file(\s[^>]*)?>([^<]+)</file>', line)
if file_match:
full_path = dir_name + '/' + file_match.group(2)
dependencies[full_path] = 1
return dependencies
def list_qrc_dependencies(file_path):
global one_modified
dependencies = get_qrc_dependencies(file_path)
for path in dependencies:
print(path)
one_modified = 0
def handle_qrc_dependencies(file_path):
global one_modified
dependencies = get_qrc_dependencies(file_path)
file_modified = os.path.getmtime(file_path)
latest_modified = file_modified
for path in dependencies:
if os.path.isfile(path):
dependency_modified = os.path.getmtime(path)
if latest_modified < dependency_modified:
latest_modified = dependency_modified
else:
eprint('File not found: ' + path)
if file_modified < latest_modified:
os.utime(file_path, None);
one_modified = 1
def get_direct_style_dependencies(file_path):
dependencies = {}
dependencies[file_path] = 1
if not os.path.isfile(file_path):
eprint('File not found: ' + file_path)
with open(file_path) as f:
for line in f:
using_match = re.match('^\s*using "([^"]+)"', line)
if using_match:
path = using_match.group(1)
found = 0
for include_dir in include_dirs:
full_path = include_dir + '/' + path
if os.path.isfile(full_path):
try:
if dependencies[full_path]:
eprint('Cyclic dependencies: ' + full_path)
except KeyError:
dependencies[full_path] = 1
found = 1
break
if found != 1:
eprint('File not found: ' + path)
return dependencies
include_dirs = []
def handle_style_dependencies(file_path):
global one_modified
all_dependencies = {}
all_dependencies[file_path] = 1
added_from = {}
while len(added_from) != len(all_dependencies):
for dependency in all_dependencies:
try:
if added_from[dependency]:
continue
except KeyError:
added_from[dependency] = 1
add = get_direct_style_dependencies(dependency)
for new_dependency in add:
all_dependencies[new_dependency] = 1
break
file_modified = os.path.getmtime(file_path)
latest_modified = file_modified
for path in all_dependencies:
if path != file_path:
dependency_modified = os.path.getmtime(path)
if latest_modified < dependency_modified:
latest_modified = dependency_modified
if file_modified < latest_modified:
os.utime(file_path, None);
one_modified = 1
file_paths = []
request = ''
output_file = ''
next_include_dir = 0
next_output_file = 0
next_self = 1
for arg in sys.argv:
if next_self != 0:
next_self = 0
continue
if arg == '--styles' or arg == '--qrc_list' or arg == '--qrc':
if request == '':
request = arg[2:]
else:
eprint('Only one request required.')
continue
if next_include_dir != 0:
next_include_dir = 0
include_dirs.append(arg)
continue
if next_output_file != 0:
next_output_file = 0
output_file = arg
continue
include_dir_match = re.match(r'^\-I(.*)$', arg)
if include_dir_match:
include_dir = include_dir_match.group(1)
if include_dir == '':
next_include_dir = 1
else:
include_dirs.append(include_dir)
continue
output_match = re.match(r'^-o(.*)$', arg)
if output_match:
output_file = output_match.group(1)
if output_file == '':
next_output_file = 1
continue
file_paths.append(arg)
if request == 'styles':
for file_path in file_paths:
handle_style_dependencies(file_path)
elif request == 'qrc':
for file_path in file_paths:
handle_qrc_dependencies(file_path)
elif request == 'qrc_list':
for file_path in file_paths:
list_qrc_dependencies(file_path)
sys.exit(0)
else:
eprint('Request required.')
if not os.path.isfile(output_file):
with open(output_file, "w") as f:
f.write('1')
elif one_modified != 0:
os.utime(output_file, None);

View file

@ -1,70 +0,0 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
{
'includes': [
'../gyp/helpers/common/common.gypi',
],
'targets': [{
'target_name': 'lib_ui',
'hard_dependency': 1,
'includes': [
'../gyp/helpers/common/library.gypi',
'../gyp/helpers/modules/qt.gypi',
'../gyp/helpers/modules/qt_moc.gypi',
'../gyp/helpers/modules/pch.gypi',
'../gyp/helpers/modules/openssl.gypi',
'gyp/styles_rule.gypi',
'gyp/codegen_actions.gypi',
],
'dependencies': [
'<(submodules_loc)/codegen/codegen.gyp:codegen_emoji',
'<(submodules_loc)/codegen/codegen.gyp:codegen_style',
'<(submodules_loc)/lib_base/lib_base.gyp:lib_base',
],
'export_dependent_settings': [
'<(submodules_loc)/lib_base/lib_base.gyp:lib_base',
],
'variables': {
'src_loc': '.',
'emoji_suggestions_loc': '<(src_loc)/emoji_suggestions',
'style_files': [
'<(src_loc)/ui/colors.palette',
'<(src_loc)/ui/basic.style',
'<(src_loc)/ui/layers/layers.style',
'<(src_loc)/ui/widgets/widgets.style',
],
'dependent_style_files': [
],
'style_timestamp': '<(SHARED_INTERMEDIATE_DIR)/update_dependent_styles_ui.timestamp',
'list_sources_command': 'python <(submodules_loc)/lib_base/gyp/list_sources.py --input gyp/sources.txt --replace src_loc=<(src_loc)',
'pch_source': '<(src_loc)/ui/ui_pch.cpp',
'pch_header': '<(src_loc)/ui/ui_pch.h',
},
'defines': [
],
'include_dirs': [
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
'<(emoji_suggestions_loc)',
],
'direct_dependent_settings': {
'include_dirs': [
'<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)',
'<(emoji_suggestions_loc)',
],
},
'sources': [
'<@(style_files)',
'gyp/sources.txt',
'<!@(<(list_sources_command) <(qt_moc_list_sources_arg))',
],
'sources!': [
'<!@(<(list_sources_command) <(qt_moc_list_sources_arg) --exclude_for <(build_os))',
],
}],
}

View file

@ -31,7 +31,8 @@ void RadialAnimation::start(float64 prg) {
bool RadialAnimation::update(float64 prg, bool finished, crl::time ms) {
const auto iprg = qRound(qMax(prg, 0.0001) * kAlmostFullArcLength);
const auto result = (iprg != qRound(_arcEnd.to()));
const auto result = (iprg != qRound(_arcEnd.to()))
|| (_finished != finished);
if (_finished != finished) {
_arcEnd.start(iprg);
_finished = finished;

View file

@ -831,9 +831,10 @@ void Instance::generateCache() {
universal = Universal,
guard = _generating.make_guard()
]() mutable {
auto image = universal->generate(size, index);
crl::on_main(std::move(guard), [
=,
image = universal->generate(size, index)
image = std::move(image)
]() mutable {
if (universal != Universal) {
return;

View file

@ -469,10 +469,10 @@ void prepareRound(
Assert(image.bytesPerLine() == (imageIntsPerLine << 2));
auto ints = reinterpret_cast<uint32*>(image.bits());
auto intsTopLeft = ints + target.x() + target.y() * imageWidth;
auto intsTopRight = ints + target.x() + target.width() - cornerWidth + target.y() * imageWidth;
auto intsBottomLeft = ints + target.x() + (target.y() + target.height() - cornerHeight) * imageWidth;
auto intsBottomRight = ints + target.x() + target.width() - cornerWidth + (target.y() + target.height() - cornerHeight) * imageWidth;
auto intsTopLeft = ints + target.x() + target.y() * imageIntsPerLine;
auto intsTopRight = ints + target.x() + target.width() - cornerWidth + target.y() * imageIntsPerLine;
auto intsBottomLeft = ints + target.x() + (target.y() + target.height() - cornerHeight) * imageIntsPerLine;
auto intsBottomRight = ints + target.x() + target.width() - cornerWidth + (target.y() + target.height() - cornerHeight) * imageIntsPerLine;
auto maskCorner = [&](uint32 *imageInts, const QImage &mask) {
auto maskWidth = mask.width();
auto maskHeight = mask.height();

View file

@ -6,6 +6,7 @@
//
#pragma once
#include "base/platform/base_platform_info.h"
#include <QtCore/QPoint>
namespace Ui {
@ -19,7 +20,7 @@ inline void UpdateOverlayed(not_null<QWidget*> widget) {
}
inline constexpr bool UseMainQueueGeneric() {
return false;
return ::Platform::IsMacStoreBuild();
}
} // namespace Platform

View file

@ -14,9 +14,11 @@
#include <Cocoa/Cocoa.h>
#ifndef OS_MAC_STORE
extern "C" {
void _dispatch_main_queue_callback_4CF(mach_msg_header_t *msg);
} // extern "C"
#endif // OS_MAC_STORE
namespace Ui {
namespace Platform {
@ -88,7 +90,9 @@ void BringToBack(not_null<QWidget*> widget) {
}
void DrainMainQueue() {
#ifndef OS_MAC_STORE
_dispatch_main_queue_callback_4CF(nullptr);
#endif // OS_MAC_STORE
}
void IgnoreAllActivation(not_null<QWidget*> widget) {

View file

@ -15,7 +15,9 @@
#include <QtGui/QFontDatabase>
void style_InitFontsResource() {
#ifndef DESKTOP_APP_USE_PACKAGED_FONTS
Q_INIT_RESOURCE(fonts);
#endif // !DESKTOP_APP_USE_PACKAGED_FONTS
#ifdef Q_OS_WIN
Q_INIT_RESOURCE(win);
#elif defined Q_OS_MAC // Q_OS_WIN
@ -133,6 +135,7 @@ enum {
FontTypesCount,
};
#ifndef DESKTOP_APP_USE_PACKAGED_FONTS
QString FontTypeNames[FontTypesCount] = {
"DAOpenSansRegular",
"DAOpenSansRegularItalic",
@ -141,6 +144,7 @@ QString FontTypeNames[FontTypesCount] = {
"DAOpenSansSemibold",
"DAOpenSansSemiboldItalic",
};
#endif // !DESKTOP_APP_USE_PACKAGED_FONTS
int32 FontTypeFlags[FontTypesCount] = {
0,
FontItalic,
@ -149,6 +153,7 @@ int32 FontTypeFlags[FontTypesCount] = {
0,
FontItalic,
};
#ifdef Q_OS_WIN
QString FontTypeWindowsFallback[FontTypesCount] = {
"Segoe UI",
"Segoe UI",
@ -157,6 +162,7 @@ QString FontTypeWindowsFallback[FontTypesCount] = {
"Segoe UI Semibold",
"Segoe UI Semibold",
};
#endif // Q_OS_WIN
bool Started = false;
QString Overrides[FontTypesCount];
@ -187,6 +193,7 @@ void StartFonts() {
style_InitFontsResource();
#ifndef DESKTOP_APP_USE_PACKAGED_FONTS
bool areGood[FontTypesCount] = { false };
for (auto i = 0; i != FontTypesCount; ++i) {
const auto name = FontTypeNames[i];
@ -211,6 +218,7 @@ void StartFonts() {
//QFont::insertSubstitution(name, fallback);
#endif // Q_OS_WIN
}
#endif // !DESKTOP_APP_USE_PACKAGED_FONTS
#ifdef Q_OS_MAC
auto list = QStringList();
list.append(".SF NS Text");
@ -295,6 +303,10 @@ FontData::FontData(int size, uint32 flags, int family, Font *other)
f.setBold(true);
} else if (fontFamilies[family] == "Open Sans Semibold" && CustomSemiboldIsBold) {
f.setBold(true);
#ifdef DESKTOP_APP_USE_PACKAGED_FONTS
} else if (fontFamilies[family] == "Open Sans Semibold") {
f.setWeight(QFont::DemiBold);
#endif
}
f.setItalic(_flags & FontItalic);
f.setUnderline(_flags & FontUnderline);

View file

@ -32,11 +32,6 @@ public:
Font(int size, uint32 flags, const QString &family);
Font(int size, uint32 flags, int family);
Font &operator=(const Font &other) {
ptr = other.ptr;
return (*this);
}
FontData *operator->() const {
return ptr;
}

View file

@ -760,6 +760,26 @@ void Parser::parseCurrentChar() {
if (_ptr + 1 >= _end || !(_ptr + 1)->isLowSurrogate()) {
return true;
}
const auto ucs4 = QChar::surrogateToUcs4(_ch, *(_ptr + 1));
if (ucs4 >= 0xE0000) {
// Unicode tags are skipped.
// Only place they work is in some flag emoji,
// but in that case they were already parsed as emoji before.
//
// For unknown reason in some unknown cases strings with such
// symbols lead to crashes on some Linux distributions, see
// https://github.com/telegramdesktop/tdesktop/issues/7005
//
// At least one crashing text was starting that way:
//
// 0xd83d 0xdcda 0xdb40 0xdc69 0xdb40 0xdc64 0xdb40 0xdc6a
// 0xdb40 0xdc77 0xdb40 0xdc7f 0x32 ... simple text here ...
//
// or in codepoints:
//
// 0x1f4da 0xe0069 0xe0064 0xe006a 0xe0077 0xe007f 0x32 ...
return true;
}
}
return false;
}();

View file

@ -7,6 +7,7 @@
#include "ui/text/text_block.h"
#include "styles/style_basic.h"
#include "base/integration.h"
#include <private/qfontengine_p.h>
@ -124,6 +125,10 @@ struct LineBreakHelper
//const QFixed LineBreakHelper::RightBearingNotCalculated = QFixed(1);
QString DebugCurrentParsingString, DebugCurrentParsingPart;
int DebugCurrentParsingFrom = 0;
int DebugCurrentParsingLength = 0;
static inline void addNextCluster(int &pos, int end, ScriptLine &line, int &glyphCount,
const QScriptItem &current, const unsigned short *logClusters,
const QGlyphLayout &glyphs)
@ -139,6 +144,15 @@ static inline void addNextCluster(int &pos, int end, ScriptLine &line, int &glyp
++glyphPosition;
} while (glyphPosition < current.num_glyphs && !glyphs.attributes[glyphPosition].clusterStart);
if (!((pos == end && glyphPosition == current.num_glyphs) || logClusters[pos] == glyphPosition)) {
auto str = QStringList();
for (auto i = 0; i < pos; ++i) {
str.append(QString::number(logClusters[i]));
}
base::Integration::Instance().logAssertionViolation(QString("text: %1 (from: %2, length: %3) part: %4").arg(DebugCurrentParsingString).arg(DebugCurrentParsingFrom).arg(DebugCurrentParsingLength).arg(DebugCurrentParsingPart));
base::Integration::Instance().logAssertionViolation(QString("pos: %1, end: %2, glyphPosition: %3, glyphCount: %4, lineLength: %5, num_glyphs: %6, logClusters[0..pos]: %7").arg(pos).arg(end).arg(glyphPosition).arg(glyphCount).arg(line.length).arg(current.num_glyphs).arg(str.join(",")));
Unexpected("Values in addNextCluster()");
}
Q_ASSERT((pos == end && glyphPosition == current.num_glyphs) || logClusters[pos] == glyphPosition);
++glyphCount;
@ -329,7 +343,10 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi
}
}
const auto part = str.mid(_from, length);
DebugCurrentParsingString = str;
DebugCurrentParsingFrom = _from;
DebugCurrentParsingLength = length;
const auto part = DebugCurrentParsingPart = str.mid(_from, length);
QStackTextEngine engine(part, blockFont->f);
BlockParser parser(&engine, this, minResizeWidth, _from, part);