Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Формат: для каждой версии блок заголовка `## [MAJOR.MINOR.PATCH]`.
GitHub Actions при создании релиза ищет блок с номером версии из `pubspec.yaml` (только `X.Y.Z`, без `+build`) и подставляет его текст в описание релиза.

## [1.4.1] - 2026-04-17

### Windows

- **Исправлено автоматическое скрытие окна трея**: окно теперь автоматически скрывается при клике вне его (на рабочий стол, другие окна, панель задач). Добавлена обработка Windows сообщений `WM_ACTIVATE` и `WM_KILLFOCUS`.
- **Исправлено позиционирование окна**: используется нативный метод `alignBottomRight` с `GetMonitorInfo` вместо ручного расчета координат через `trayManager.getBounds()`. Окно теперь корректно позиционируется в правом нижнем углу рабочей области.

## [1.4.0] - 2026-04-14

### Windows
Expand Down
15 changes: 2 additions & 13 deletions lib/core/platform/windows_tray_shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import 'package:vkpn/core/platform/vkpn_windows_window.dart';
const Size _kFlyoutSize = Size(420, 680);

/// Зазор между нижним краем окна и таскбаром / треем (логические px).
/// Основной путь позиции — через [trayManager.getBounds], не через C++ [alignBottomRight].
const double _kGapAboveTaskbar = 45;
/// Используется в alignBottomRight для позиционирования окна.
const double _kGapAboveTaskbar = 8;

/// Трей + окно без кнопки на панели задач (аналог OneDrive).
/// Окно управляется нативно ([vkpn/window]), без `window_manager` / `screen_retriever`.
Expand Down Expand Up @@ -54,17 +54,6 @@ final class VkpnWindowsChrome with TrayListener {
}

Future<void> _positionFlyout() async {
final Rect? tray = await trayManager.getBounds();
// Логические координаты как у tray_manager; нативный слой переводит в пиксели.
if (tray != null) {
final double x = tray.center.dx - _kFlyoutSize.width / 2;
double y = tray.top - _kFlyoutSize.height - _kGapAboveTaskbar;
if (y < 0) {
y = tray.bottom + _kGapAboveTaskbar;
}
await VkpnWindowsWindow.setPosition(x, y);
return;
}
await VkpnWindowsWindow.alignBottomRight(marginFromBottom: _kGapAboveTaskbar);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.4.0+1
version: 1.4.1+1

environment:
sdk: ^3.11.1
Expand Down
17 changes: 17 additions & 0 deletions windows/runner/flutter_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,23 @@ FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
ShowWindow(hwnd, SW_HIDE);
return 0;
}

// Автоматическое скрытие окна при клике вне его (поведение как у системного трея).
if (message == WM_ACTIVATE) {
if (LOWORD(wparam) == WA_INACTIVE) {
ShowWindow(hwnd, SW_HIDE);
return 0;
}
}

// Дополнительная защита - скрытие при потере фокуса.
if (message == WM_KILLFOCUS) {
if (IsWindowVisible(hwnd)) {
ShowWindow(hwnd, SW_HIDE);
}
return 0;
}

// Give Flutter, including plugins, an opportunity to handle window messages.
if (flutter_controller_) {
std::optional<LRESULT> result =
Expand Down