Repository navigation
Description
With window_manager 0.7.0, setting minimumSize on a hidden-title-bar window makes maximize/unmaximize restore the wrong size under KDE Wayland. This reproduces in a freshly generated Flutter Linux application with no other plugins and no runner modifications.
Environment :
- Flutter 3.50.0 stable, framework ab2912035e, engine 371f77202a
- Dart 3.14.0
- window_manager 0.7.0
- nativeapi / nativeapi_flutter / cnativeapi 0.6.0
- Fedora 45, KDE Plasma / KWin 6.8.2, GTK 3.24.52, Breeze
- Wayland session, GDK_BACKEND=wayland, 125% display scaling
Reproduction :
- flutter create --empty --platforms=linux --project-name wm_minimum_repro wm_minimum_repro
- cd wm_minimum_repro
- flutter pub add window_manager:0.7.0
- Replace lib/main.dart with the code below. Leave linux/runner/my_application.cc unchanged.
- flutter build linux --debug
- GDK_BACKEND=wayland build/linux/x64/debug/bundle/wm_minimum_repro
- Run the same binary with the minimum-size assignment disabled:
GDK_BACKEND=wayland WM_SKIP_MINIMUM=1 build/linux/x64/debug/bundle/wm_minimum_repro
Expected :
Both runs restore the initial 800 x 600 size after every maximize/unmaximize cycle.
Actual, with minimumSize = Size(800, 600)
minimum=true initial=Size(800.0, 600.0)
cycle=1 maximized=Size(1536.0, 795.0)
cycle=1 restored=Size(1536.0, 864.0)
cycle=2 maximized=Size(1536.0, 795.0)
cycle=2 restored=Size(1536.0, 864.0)
cycle=3 maximized=Size(1536.0, 795.0)
cycle=3 restored=Size(1536.0, 864.0)
Control, omitting only the minimumSize assignment
minimum=false initial=Size(800.0, 600.0)
cycle=1 maximized=Size(1536.0, 795.0)
cycle=1 restored=Size(800.0, 600.0)
cycle=2 maximized=Size(1536.0, 795.0)
cycle=2 restored=Size(800.0, 600.0)
cycle=3 maximized=Size(1536.0, 795.0)
cycle=3 restored=Size(800.0, 600.0)
The one-second delays allow mapping and deferred shadow setup to complete. The initial size is explicitly reapplied after mapping. Both runs exit normally.
Regression comparison with window_manager 0.5.2
The same freshly generated runner, SDK, desktop session, requested dimensions, one-second delays and three maximize/unmaximize cycles were also tested using 0.5.2's corresponding API:
- windowManager.ensureInitialized()
- windowManager.setTitleBarStyle(TitleBarStyle.hidden)
- windowManager.setMinimumSize(const Size(800, 600))
- windowManager.setSize / getSize / maximize / unmaximize
With the minimum set, 0.5.2 restores Size(800.0, 600.0) after all three cycles. Version 0.7.0 restores Size(1536.0, 864.0). Omitting the minimum makes both versions restore 800 x 600. This establishes a geometry regression, rather than merely an existing minimum-size limitation. The separate implicit-view cleanup warning logged by 0.5.2 at shutdown is not the issue reported here.
Possible cause :
Window::Impl::RefreshGeometryHints adds the GDK-surface/frame difference to the minimum-size hints. With GTK's client-side decorations on Wayland, the custom shadow/gutter may be counted again. The observed height increase is 264 logical pixels (twice the 132-pixel gutter on this host).
Application workaround :
In our application, omitting window.minimumSize on Linux and setting gtk_widget_set_size_request(GTK_WIDGET(view), 800, 600) on the primary FlView preserves the content minimum and correct restoration. This workaround is not applied in the standalone reproduction above. Repeated maximize/restore and an attempted resize below the minimum pass in the application on both Wayland and XWayland.
Minimal lib/main.dart :
import 'dart:io';
import 'package:flutter/widgets.dart';
import 'package:window_manager/window_manager.dart';
/// Reproduces hidden-window minimum-size restoration in a stock Linux runner.
///
/// Copy this file to a fresh Flutter project's `lib/main.dart` and add
/// `window_manager: 0.7.0`. Run with `GDK_BACKEND=wayland`; repeat with
/// `WM_SKIP_MINIMUM=1` to compare the same window without minimum-size hints.
/// Do not use Focale's runner, which contains a content-minimum workaround.
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
final Window window = WindowManager.instance.getCurrent() ?? (throw StateError('No primary window'));
final bool applyMinimum = Platform.environment['WM_SKIP_MINIMUM'] != '1';
window.titleBarStyle = .hidden;
if (applyMinimum) {
window.minimumSize = const Size(800, 600).toNative();
}
window.setSize(const Size(800, 600).toNative(), false);
window.title = 'window_manager minimum size reproduction';
runApp(
const Directionality(
textDirection: .ltr,
child: ColoredBox(
color: Color(0xFF244865),
child: Center(
child: Text('800 × 600 content', style: TextStyle(color: Color(0xFFFFFFFF), fontSize: 24)),
),
),
),
);
window.show();
await Future<void>.delayed(const Duration(seconds: 1));
window.setSize(const Size(800, 600).toNative(), false);
await Future<void>.delayed(const Duration(seconds: 1));
stdout.writeln('minimum=$applyMinimum initial=${window.size.toSize()}');
for (int cycle = 1; cycle <= 3; cycle++) {
window.maximize();
await Future<void>.delayed(const Duration(seconds: 1));
stdout.writeln('cycle=$cycle maximized=${window.size.toSize()}');
window.unmaximize();
await Future<void>.delayed(const Duration(seconds: 1));
stdout.writeln('cycle=$cycle restored=${window.size.toSize()}');
}
window.close();
}
Activity
Skyost commentedon Nov 14, 2026
Just saw that I posted this in
nativeapiinstead ofmultiview_desktop, sorry ! Feel free to move the issue to the other repo.lijy91 commentedon Nov 14, 2026
Fixed on
mainin 56e7632f, using nativeapi-core commit18d2a41.The minimum-size hint could retain the old shadow gutter during maximize/restore and interfere with GDK's saved restore size. GTK windows with content now derive their minimum through the content widget's size request, so GTK accounts for the current decorations during layout. The host's existing size request is preserved and restored when the minimum is cleared.
We reproduced the native regression on GTK 3.24.52 / KWin 6.8.1: with the minimum enabled, all three restores produced 1280×864 instead of 800×600. After the fix:
Verification details and commands. Fedora 45 / KWin 6.8.2 were not independently tested. This fix belongs in nativeapi, so there is no need to move the issue.
The fix is on
main; a package release containing it has not been published yet.Bump screen_retriever to e1635ba (merge PRs #33-#35, #37-#39)