Updated lib_ui sources to TDesktop version 2.4.3
This commit is contained in:
commit
1c102f2e6a
7 changed files with 77 additions and 11 deletions
|
|
@ -42,6 +42,10 @@ void Integration::startFontsBegin() {
|
||||||
void Integration::startFontsEnd() {
|
void Integration::startFontsEnd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Integration::timeFormat() {
|
||||||
|
return u"hh:mm"_q;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<ClickHandler> Integration::createLinkHandler(
|
std::shared_ptr<ClickHandler> Integration::createLinkHandler(
|
||||||
const EntityLinkData &data,
|
const EntityLinkData &data,
|
||||||
const std::any &context) {
|
const std::any &context) {
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@ public:
|
||||||
virtual void startFontsBegin();
|
virtual void startFontsBegin();
|
||||||
virtual void startFontsEnd();
|
virtual void startFontsEnd();
|
||||||
|
|
||||||
|
[[nodiscard]] virtual QString timeFormat();
|
||||||
|
|
||||||
[[nodiscard]] virtual std::shared_ptr<ClickHandler> createLinkHandler(
|
[[nodiscard]] virtual std::shared_ptr<ClickHandler> createLinkHandler(
|
||||||
const EntityLinkData &data,
|
const EntityLinkData &data,
|
||||||
const std::any &context);
|
const std::any &context);
|
||||||
|
|
|
||||||
|
|
@ -225,8 +225,11 @@ void BoxLayerWidget::updateTitlePosition() {
|
||||||
_titleLeft = st::boxTitlePosition.x();
|
_titleLeft = st::boxTitlePosition.x();
|
||||||
_titleTop = st::boxTitlePosition.y();
|
_titleTop = st::boxTitlePosition.y();
|
||||||
if (_title) {
|
if (_title) {
|
||||||
const auto buttonWidth = (_topButton ? _titleLeft : 0);
|
const auto topButtonSkip = _topButton ? (_topButton->width() / 2) : 0;
|
||||||
_title->resizeToWidth(qMin(_title->naturalWidth(), width() - _titleLeft * 2 - buttonWidth));
|
_title->resizeToWidth(
|
||||||
|
std::min(
|
||||||
|
_title->naturalWidth(),
|
||||||
|
width() - _titleLeft * 2 - topButtonSkip));
|
||||||
_title->moveToLeft(_titleLeft, _titleTop);
|
_title->moveToLeft(_titleLeft, _titleTop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ namespace Platform {
|
||||||
|
|
||||||
BasicWindowHelper::BasicWindowHelper(not_null<RpWidget*> window)
|
BasicWindowHelper::BasicWindowHelper(not_null<RpWidget*> window)
|
||||||
: _window(window) {
|
: _window(window) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
|
||||||
|
_window->setWindowFlag(Qt::Window);
|
||||||
|
#else // Qt >= 5.9
|
||||||
|
_window->setWindowFlags(_window->windowFlags() | Qt::Window);
|
||||||
|
#endif // Qt >= 5.9
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<RpWidget*> BasicWindowHelper::body() {
|
not_null<RpWidget*> BasicWindowHelper::body() {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include "ui/platform/win/ui_window_title_win.h"
|
#include "ui/platform/win/ui_window_title_win.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/platform/win/base_windows_safe_library.h"
|
#include "base/platform/win/base_windows_safe_library.h"
|
||||||
|
#include "base/integration.h"
|
||||||
#include "styles/palette.h"
|
#include "styles/palette.h"
|
||||||
|
|
||||||
#include <QtCore/QAbstractNativeEventFilter>
|
#include <QtCore/QAbstractNativeEventFilter>
|
||||||
|
|
@ -33,6 +34,56 @@ bool IsCompositionEnabled() {
|
||||||
return success && result;
|
return success && result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWND FindTaskbarWindow(LPRECT rcMon = nullptr) {
|
||||||
|
HWND hTaskbar = nullptr;
|
||||||
|
RECT rcTaskbar, rcMatch;
|
||||||
|
|
||||||
|
while ((hTaskbar = FindWindowEx(
|
||||||
|
nullptr,
|
||||||
|
hTaskbar,
|
||||||
|
L"Shell_TrayWnd",
|
||||||
|
nullptr)) != nullptr) {
|
||||||
|
if (!rcMon) {
|
||||||
|
break; // OK, return first found
|
||||||
|
}
|
||||||
|
if (GetWindowRect(hTaskbar, &rcTaskbar)
|
||||||
|
&& IntersectRect(&rcMatch, &rcTaskbar, rcMon)) {
|
||||||
|
break; // OK, taskbar match monitor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hTaskbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsTaskbarAutoHidden(LPRECT rcMon = nullptr, PUINT pEdge = nullptr) {
|
||||||
|
HWND hTaskbar = FindTaskbarWindow(rcMon);
|
||||||
|
if (!hTaskbar) {
|
||||||
|
if (pEdge) {
|
||||||
|
*pEdge = (UINT)-1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
APPBARDATA state = {sizeof(state), hTaskbar};
|
||||||
|
APPBARDATA pos = {sizeof(pos), hTaskbar};
|
||||||
|
|
||||||
|
LRESULT lState = SHAppBarMessage(ABM_GETSTATE, &state);
|
||||||
|
bool bAutoHidden = (lState & ABS_AUTOHIDE);
|
||||||
|
|
||||||
|
if (SHAppBarMessage(ABM_GETTASKBARPOS, &pos)) {
|
||||||
|
if (pEdge) {
|
||||||
|
*pEdge = pos.uEdge;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
base::Integration::Instance().logMessage("Failed to get taskbar pos");
|
||||||
|
if (pEdge) {
|
||||||
|
*pEdge = ABE_BOTTOM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bAutoHidden;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT WinApiSetWindowTheme(
|
HRESULT WinApiSetWindowTheme(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
LPCWSTR pszSubAppName,
|
LPCWSTR pszSubAppName,
|
||||||
|
|
@ -236,6 +287,15 @@ bool WindowHelper::handleNativeEvent(
|
||||||
mi.cbSize = sizeof(mi);
|
mi.cbSize = sizeof(mi);
|
||||||
if (GetMonitorInfo(hMonitor, &mi)) {
|
if (GetMonitorInfo(hMonitor, &mi)) {
|
||||||
*r = mi.rcWork;
|
*r = mi.rcWork;
|
||||||
|
UINT uEdge = (UINT)-1;
|
||||||
|
if (IsTaskbarAutoHidden(&mi.rcMonitor, &uEdge)) {
|
||||||
|
switch (uEdge) {
|
||||||
|
case ABE_LEFT: r->left += 1; break;
|
||||||
|
case ABE_RIGHT: r->right -= 1; break;
|
||||||
|
case ABE_TOP: r->top += 1; break;
|
||||||
|
case ABE_BOTTOM: r->bottom -= 1; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/basic_types.h"
|
#include "base/basic_types.h"
|
||||||
|
#include "base/algorithm.h"
|
||||||
|
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QVector>
|
#include <QtCore/QVector>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +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
|
|
||||||
//
|
|
||||||
#include "ui/ui_pch.h"
|
|
||||||
|
|
||||||
// Precompiled header helper.
|
|
||||||
Loading…
Add table
Reference in a new issue