Merge pull request #10609 from electron/win32_toast_update
Fix for narrowing conversion warnings, minor style change
This commit is contained in:
commit
91e11f8e6f
1 changed files with 10 additions and 11 deletions
|
@ -642,8 +642,7 @@ void DesktopNotificationController::Toast::CancelDismiss() {
|
||||||
|
|
||||||
void DesktopNotificationController::Toast::ScheduleDismissal() {
|
void DesktopNotificationController::Toast::ScheduleDismissal() {
|
||||||
ULONG duration;
|
ULONG duration;
|
||||||
auto result = SystemParametersInfo(SPI_GETMESSAGEDURATION, 0, &duration, 0);
|
if (!SystemParametersInfo(SPI_GETMESSAGEDURATION, 0, &duration, 0)) {
|
||||||
if (result == FALSE) {
|
|
||||||
duration = 5;
|
duration = 5;
|
||||||
}
|
}
|
||||||
SetTimer(hwnd_, TimerID_AutoDismiss, duration * 1000, nullptr);
|
SetTimer(hwnd_, TimerID_AutoDismiss, duration * 1000, nullptr);
|
||||||
|
@ -784,9 +783,9 @@ float DesktopNotificationController::Toast::AnimateEaseIn() {
|
||||||
if (!ease_in_active_)
|
if (!ease_in_active_)
|
||||||
return ease_in_pos_;
|
return ease_in_pos_;
|
||||||
|
|
||||||
constexpr float duration = 500.0f;
|
constexpr DWORD duration = 500;
|
||||||
float elapsed = GetTickCount() - ease_in_start_;
|
auto elapsed = GetTickCount() - ease_in_start_;
|
||||||
float time = std::min(duration, elapsed) / duration;
|
float time = std::min(duration, elapsed) / static_cast<float>(duration);
|
||||||
|
|
||||||
// decelerating exponential ease
|
// decelerating exponential ease
|
||||||
const float a = -8.0f;
|
const float a = -8.0f;
|
||||||
|
@ -799,9 +798,9 @@ float DesktopNotificationController::Toast::AnimateEaseOut() {
|
||||||
if (!ease_out_active_)
|
if (!ease_out_active_)
|
||||||
return ease_out_pos_;
|
return ease_out_pos_;
|
||||||
|
|
||||||
constexpr float duration = 120.0f;
|
constexpr DWORD duration = 120;
|
||||||
float elapsed = GetTickCount() - ease_out_start_;
|
auto elapsed = GetTickCount() - ease_out_start_;
|
||||||
float time = std::min(duration, elapsed) / duration;
|
float time = std::min(duration, elapsed) / static_cast<float>(duration);
|
||||||
|
|
||||||
// accelerating circle ease
|
// accelerating circle ease
|
||||||
auto pos = 1.0f - std::sqrt(1 - time * time);
|
auto pos = 1.0f - std::sqrt(1 - time * time);
|
||||||
|
@ -813,9 +812,9 @@ float DesktopNotificationController::Toast::AnimateStackCollapse() {
|
||||||
if (!IsStackCollapseActive())
|
if (!IsStackCollapseActive())
|
||||||
return stack_collapse_pos_;
|
return stack_collapse_pos_;
|
||||||
|
|
||||||
constexpr float duration = 500.0f;
|
constexpr DWORD duration = 500;
|
||||||
float elapsed = GetTickCount() - stack_collapse_start_;
|
auto elapsed = GetTickCount() - stack_collapse_start_;
|
||||||
float time = std::min(duration, elapsed) / duration;
|
float time = std::min(duration, elapsed) / static_cast<float>(duration);
|
||||||
|
|
||||||
// decelerating exponential ease
|
// decelerating exponential ease
|
||||||
const float a = -8.0f;
|
const float a = -8.0f;
|
||||||
|
|
Loading…
Reference in a new issue