Merge pull request #6094 from dignow/fix/open_individual_window_offset
open individual window, add offset
This commit is contained in:
commit
2544a7e4ea
@ -1673,8 +1673,10 @@ Future<Offset?> _adjustRestoreMainWindowOffset(
|
|||||||
|
|
||||||
/// Restore window position and size on start
|
/// Restore window position and size on start
|
||||||
/// Note that windowId must be provided if it's subwindow
|
/// Note that windowId must be provided if it's subwindow
|
||||||
|
//
|
||||||
|
// display is used to set the offset of the window in individual display mode.
|
||||||
Future<bool> restoreWindowPosition(WindowType type,
|
Future<bool> restoreWindowPosition(WindowType type,
|
||||||
{int? windowId, String? peerId}) async {
|
{int? windowId, String? peerId, int? display}) async {
|
||||||
if (bind
|
if (bind
|
||||||
.mainGetEnv(key: "DISABLE_RUSTDESK_RESTORE_WINDOW_POSITION")
|
.mainGetEnv(key: "DISABLE_RUSTDESK_RESTORE_WINDOW_POSITION")
|
||||||
.isNotEmpty) {
|
.isNotEmpty) {
|
||||||
@ -1710,14 +1712,22 @@ Future<bool> restoreWindowPosition(WindowType type,
|
|||||||
debugPrint("no window position saved, ignoring position restoration");
|
debugPrint("no window position saved, ignoring position restoration");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (type == WindowType.RemoteDesktop &&
|
if (type == WindowType.RemoteDesktop) {
|
||||||
!isRemotePeerPos &&
|
if (!isRemotePeerPos && windowId != null) {
|
||||||
windowId != null) {
|
|
||||||
if (lpos.offsetWidth != null) {
|
if (lpos.offsetWidth != null) {
|
||||||
lpos.offsetWidth = lpos.offsetWidth! + windowId * 20;
|
lpos.offsetWidth = lpos.offsetWidth! + windowId * kNewWindowOffset;
|
||||||
}
|
}
|
||||||
if (lpos.offsetHeight != null) {
|
if (lpos.offsetHeight != null) {
|
||||||
lpos.offsetHeight = lpos.offsetHeight! + windowId * 20;
|
lpos.offsetHeight = lpos.offsetHeight! + windowId * kNewWindowOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (display != null) {
|
||||||
|
if (lpos.offsetWidth != null) {
|
||||||
|
lpos.offsetWidth = lpos.offsetWidth! + display * kNewWindowOffset;
|
||||||
|
}
|
||||||
|
if (lpos.offsetHeight != null) {
|
||||||
|
lpos.offsetHeight = lpos.offsetHeight! + display * kNewWindowOffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +66,10 @@ const int kWindowMainId = 0;
|
|||||||
const String kPointerEventKindTouch = "touch";
|
const String kPointerEventKindTouch = "touch";
|
||||||
const String kPointerEventKindMouse = "mouse";
|
const String kPointerEventKindMouse = "mouse";
|
||||||
|
|
||||||
const String kKeyShowDisplaysAsIndividualWindows = 'displays_as_individual_windows';
|
const String kKeyShowDisplaysAsIndividualWindows =
|
||||||
const String kKeyUseAllMyDisplaysForTheRemoteSession = 'use_all_my_displays_for_the_remote_session';
|
'displays_as_individual_windows';
|
||||||
|
const String kKeyUseAllMyDisplaysForTheRemoteSession =
|
||||||
|
'use_all_my_displays_for_the_remote_session';
|
||||||
const String kKeyShowMonitorsToolbar = 'show_monitors_toolbar';
|
const String kKeyShowMonitorsToolbar = 'show_monitors_toolbar';
|
||||||
|
|
||||||
// the executable name of the portable version
|
// the executable name of the portable version
|
||||||
@ -87,6 +89,14 @@ const int kDesktopMaxDisplaySize = 3840;
|
|||||||
const double kDesktopFileTransferRowHeight = 30.0;
|
const double kDesktopFileTransferRowHeight = 30.0;
|
||||||
const double kDesktopFileTransferHeaderHeight = 25.0;
|
const double kDesktopFileTransferHeaderHeight = 25.0;
|
||||||
|
|
||||||
|
double kNewWindowOffset = Platform.isWindows
|
||||||
|
? 56.0
|
||||||
|
: Platform.isLinux
|
||||||
|
? 50.0
|
||||||
|
: Platform.isMacOS
|
||||||
|
? 30.0
|
||||||
|
: 50.0;
|
||||||
|
|
||||||
EdgeInsets get kDragToResizeAreaPadding =>
|
EdgeInsets get kDragToResizeAreaPadding =>
|
||||||
!kUseCompatibleUiMode && Platform.isLinux
|
!kUseCompatibleUiMode && Platform.isLinux
|
||||||
? stateGlobal.fullscreen.isTrue || stateGlobal.isMaximized.value
|
? stateGlobal.fullscreen.isTrue || stateGlobal.isMaximized.value
|
||||||
|
@ -48,7 +48,8 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
|
|
||||||
late ToolbarState _toolbarState;
|
late ToolbarState _toolbarState;
|
||||||
String? peerId;
|
String? peerId;
|
||||||
bool isScreenRectSet = false;
|
bool _isScreenRectSet = false;
|
||||||
|
int? _display;
|
||||||
|
|
||||||
var connectionMap = RxList<Widget>.empty(growable: true);
|
var connectionMap = RxList<Widget>.empty(growable: true);
|
||||||
|
|
||||||
@ -61,7 +62,8 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
final display = params['display'];
|
final display = params['display'];
|
||||||
final displays = params['displays'];
|
final displays = params['displays'];
|
||||||
final screenRect = parseParamScreenRect(params);
|
final screenRect = parseParamScreenRect(params);
|
||||||
isScreenRectSet = screenRect != null;
|
_isScreenRectSet = screenRect != null;
|
||||||
|
_display = display as int?;
|
||||||
tryMoveToScreenAndSetFullscreen(screenRect);
|
tryMoveToScreenAndSetFullscreen(screenRect);
|
||||||
if (peerId != null) {
|
if (peerId != null) {
|
||||||
ConnectionTypeState.init(peerId!);
|
ConnectionTypeState.init(peerId!);
|
||||||
@ -202,7 +204,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
_update_remote_count();
|
_update_remote_count();
|
||||||
return returnValue;
|
return returnValue;
|
||||||
});
|
});
|
||||||
if (!isScreenRectSet) {
|
if (!_isScreenRectSet) {
|
||||||
Future.delayed(Duration.zero, () {
|
Future.delayed(Duration.zero, () {
|
||||||
restoreWindowPosition(
|
restoreWindowPosition(
|
||||||
WindowType.RemoteDesktop,
|
WindowType.RemoteDesktop,
|
||||||
@ -210,6 +212,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
|||||||
peerId: tabController.state.value.tabs.isEmpty
|
peerId: tabController.state.value.tabs.isEmpty
|
||||||
? null
|
? null
|
||||||
: tabController.state.value.tabs[0].key,
|
: tabController.state.value.tabs[0].key,
|
||||||
|
display: _display,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -200,8 +200,13 @@ void runMultiWindow(
|
|||||||
case kAppTypeDesktopRemote:
|
case kAppTypeDesktopRemote:
|
||||||
// If screen rect is set, the window will be moved to the target screen and then set fullscreen.
|
// If screen rect is set, the window will be moved to the target screen and then set fullscreen.
|
||||||
if (argument['screen_rect'] == null) {
|
if (argument['screen_rect'] == null) {
|
||||||
await restoreWindowPosition(WindowType.RemoteDesktop,
|
// display can be used to control the offset of the window.
|
||||||
windowId: kWindowId!, peerId: argument['id'] as String?);
|
await restoreWindowPosition(
|
||||||
|
WindowType.RemoteDesktop,
|
||||||
|
windowId: kWindowId!,
|
||||||
|
peerId: argument['id'] as String?,
|
||||||
|
display: argument['display'] as int?,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kAppTypeDesktopFileTransfer:
|
case kAppTypeDesktopFileTransfer:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user