Merge pull request #5887 from sahilyeole/fix/wayland_screen_share_prompt

Fix wayland screen prompt on display menu
This commit is contained in:
RustDesk 2023-10-03 13:13:52 +08:00 committed by GitHub
commit 94830cffca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1053,10 +1053,12 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
FfiModel get ffiModel => widget.ffi.ffiModel;
Display get display => ffiModel.display;
List<Resolution> 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<void> _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();