From 7a482fd22aab61e3aabd7e25e2ffb986955ccf74 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Mon, 2 Oct 2023 21:22:40 +0530 Subject: [PATCH] fix wayland screen prompt on display menu Signed-off-by: Sahil Yeole --- flutter/lib/desktop/widgets/remote_toolbar.dart | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index 8f668f7ad..e7d81dfec 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -1053,10 +1053,12 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { FfiModel get ffiModel => widget.ffi.ffiModel; Display get display => ffiModel.display; List get resolutions => pi.resolutions; + bool get isWayland => bind.mainCurrentIsWayland(); @override void initState() { super.initState(); + _getLocalResolutionWayland(); } @override @@ -1065,7 +1067,6 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { final visible = ffiModel.keyboard && (isVirtualDisplay || resolutions.length > 1); if (!visible) return Offstage(); - _getLocalResolution(); final showOriginalBtn = display.isOriginalResolutionSet && !display.isOriginalResolution; final showFitLocalBtn = !_isRemoteResolutionFitLocal(); @@ -1101,6 +1102,20 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> { ); } + Future _getLocalResolutionWayland() async { + if (!isWayland) return _getLocalResolution(); + final window = await window_size.getWindowInfo(); + final screen = window.screen; + if (screen != null) { + setState(() { + _localResolution = Resolution( + screen.frame.width.toInt(), + screen.frame.height.toInt(), + ); + }); + } + } + _getLocalResolution() { _localResolution = null; final String currentDisplay = bind.mainGetCurrentDisplay();