fix: macos tab drag (#8242)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-06-02 10:56:29 +08:00 committed by GitHub
parent 32346c23e0
commit 32ef5f47f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 1 deletions

View File

@ -396,6 +396,16 @@ class DesktopTab extends StatelessWidget {
}
: null,
onPanStart: (_) => startDragging(isMainWindow),
onPanCancel: () {
if (isMacOS) {
setMovable(isMainWindow, false);
}
},
onPanEnd: (_) {
if (isMacOS) {
setMovable(isMainWindow, false);
}
},
child: Row(
children: [
Offstage(
@ -786,6 +796,14 @@ void startDragging(bool isMainWindow) {
}
}
void setMovable(bool isMainWindow, bool movable) {
if (isMainWindow) {
windowManager.setMovable(movable);
} else {
WindowController.fromWindowId(kWindowId!).setMovable(movable);
}
}
/// return true -> window will be maximize
/// return false -> window will be unmaximize
Future<bool> toggleMaximize(bool isMainWindow) async {

View File

@ -95,6 +95,7 @@ Future<void> main(List<String> args) async {
desktopType = DesktopType.main;
await windowManager.ensureInitialized();
windowManager.setPreventClose(true);
windowManager.setMovable(false);
runMainApp(true);
}
}
@ -167,6 +168,7 @@ void runMultiWindow(
final title = getWindowName();
// set prevent close to true, we handle close event manually
WindowController.fromWindowId(kWindowId!).setPreventClose(true);
WindowController.fromWindowId(kWindowId!).setMovable(false);
late Widget widget;
switch (appType) {
case kAppTypeDesktopRemote:

View File

@ -335,7 +335,7 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: bfbed668445edaea0626fb7d6b8b2aab3a444b17
resolved-ref: 3535741662c5b7529e182227a277a8551aed3398
url: "https://github.com/rustdesk-org/rustdesk_desktop_multi_window"
source: git
version: "0.1.0"