diff --git a/ui/platform/win/ui_window_shadow_win.cpp b/ui/platform/win/ui_window_shadow_win.cpp index 7661e50..644749b 100644 --- a/ui/platform/win/ui_window_shadow_win.cpp +++ b/ui/platform/win/ui_window_shadow_win.cpp @@ -43,7 +43,6 @@ base::flat_map> ShadowByHandle; WindowShadow::WindowShadow(not_null window, QColor color) : _window(window) , _handle(GetWindowHandle(window)) { - window->hide(); init(color); } @@ -173,12 +172,11 @@ void WindowShadow::init(QColor color) { _widthMax = std::max(avail.width(), 1); _heightMax = std::max(avail.height(), 1); - const auto instance = (HINSTANCE)GetModuleHandle(nullptr); - for (auto i = 0; i != 4; ++i) { - const auto className = "WindowShadow" + QString::number(i); - const auto wcharClassName = className.toStdWString(); + static const auto instance = (HINSTANCE)GetModuleHandle(nullptr); + static const auto className = u"WindowShadow"_q; + static const auto wcharClassName = className.toStdWString(); + static const auto registered = [] { auto wc = WNDCLASSEX(); - wc.cbSize = sizeof(wc); wc.style = 0; wc.lpfnWndProc = WindowCallback; @@ -191,10 +189,12 @@ void WindowShadow::init(QColor color) { wc.lpszMenuName = NULL; wc.lpszClassName = wcharClassName.c_str(); wc.hIconSm = 0; - if (!RegisterClassEx(&wc)) { - return; - } - + return RegisterClassEx(&wc) ? true : false; + }(); + if (!registered) { + return; + } + for (auto i = 0; i != 4; ++i) { _handles[i] = CreateWindowEx( WS_EX_LAYERED | WS_EX_TOOLWINDOW, wcharClassName.c_str(), diff --git a/ui/text/text.cpp b/ui/text/text.cpp index 3acc621..9d1f8a1 100644 --- a/ui/text/text.cpp +++ b/ui/text/text.cpp @@ -3173,7 +3173,7 @@ void String::enumerateText(TextSelection selection, AppendPartCallback appendPar flagsChangeCallback(flags, blockFlags); flags = blockFlags; } - if (i == e || blockFrom >= selection.to) { + if (i == e || (lnkIndex ? lnkFrom : blockFrom) >= selection.to) { break; }