fix: linux, custom client, incoming, window size (#7995)
* fix: linux, custom client, incoming, window size Signed-off-by: fufesou <shuanglongchen@yeah.net> * comments Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
a595d83232
commit
73662ed7d9
@ -3257,3 +3257,5 @@ Widget buildVirtualWindowFrame(BuildContext context, Widget child) {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get windowEdgeSize => isLinux && bind.isIncomingOnly() ? 0.0 : kWindowEdgeSize;
|
||||||
|
@ -262,7 +262,7 @@ class _ConnectionPageState extends State<ConnectionPage>
|
|||||||
void onWindowLeaveFullScreen() {
|
void onWindowLeaveFullScreen() {
|
||||||
// Restore edge border to default edge size.
|
// Restore edge border to default edge size.
|
||||||
stateGlobal.resizeEdgeSize.value =
|
stateGlobal.resizeEdgeSize.value =
|
||||||
stateGlobal.isMaximized.isTrue ? kMaximizeEdgeSize : kWindowEdgeSize;
|
stateGlobal.isMaximized.isTrue ? kMaximizeEdgeSize : windowEdgeSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -144,7 +144,12 @@ void runMainApp(bool startService) async {
|
|||||||
}
|
}
|
||||||
windowManager.setOpacity(1);
|
windowManager.setOpacity(1);
|
||||||
windowManager.setTitle(getWindowName());
|
windowManager.setTitle(getWindowName());
|
||||||
windowManager.setResizable(!bind.isIncomingOnly());
|
// `windowManager.setResizable(false)` will reset the window size to the default size on Linux.
|
||||||
|
// https://stackoverflow.com/questions/8193613/gtk-window-resize-disable-without-going-back-to-default
|
||||||
|
if (!isLinux) {
|
||||||
|
windowManager.setResizable(!bind.isIncomingOnly());
|
||||||
|
}
|
||||||
|
// For Linux, we set the edge size to 0 to disable resize. See `get windowEdgeSize` in common.dart.
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class StateGlobal {
|
|||||||
bool _isMinimized = false;
|
bool _isMinimized = false;
|
||||||
final RxBool isMaximized = false.obs;
|
final RxBool isMaximized = false.obs;
|
||||||
final RxBool _showTabBar = true.obs;
|
final RxBool _showTabBar = true.obs;
|
||||||
final RxDouble _resizeEdgeSize = RxDouble(kWindowEdgeSize);
|
final RxDouble _resizeEdgeSize = RxDouble(windowEdgeSize);
|
||||||
final RxDouble _windowBorderWidth = RxDouble(kWindowBorderWidth);
|
final RxDouble _windowBorderWidth = RxDouble(kWindowBorderWidth);
|
||||||
final RxBool showRemoteToolBar = false.obs;
|
final RxBool showRemoteToolBar = false.obs;
|
||||||
final svcStatus = SvcStatus.notReady.obs;
|
final svcStatus = SvcStatus.notReady.obs;
|
||||||
@ -57,7 +57,7 @@ class StateGlobal {
|
|||||||
if (isMaximized.value != v) {
|
if (isMaximized.value != v) {
|
||||||
isMaximized.value = v;
|
isMaximized.value = v;
|
||||||
_resizeEdgeSize.value =
|
_resizeEdgeSize.value =
|
||||||
isMaximized.isTrue ? kMaximizeEdgeSize : kWindowEdgeSize;
|
isMaximized.isTrue ? kMaximizeEdgeSize : windowEdgeSize;
|
||||||
}
|
}
|
||||||
if (!isMacOS) {
|
if (!isMacOS) {
|
||||||
_windowBorderWidth.value = v ? 0 : kWindowBorderWidth;
|
_windowBorderWidth.value = v ? 0 : kWindowBorderWidth;
|
||||||
@ -75,7 +75,7 @@ class StateGlobal {
|
|||||||
? kFullScreenEdgeSize
|
? kFullScreenEdgeSize
|
||||||
: isMaximized.isTrue
|
: isMaximized.isTrue
|
||||||
? kMaximizeEdgeSize
|
? kMaximizeEdgeSize
|
||||||
: kWindowEdgeSize;
|
: windowEdgeSize;
|
||||||
print(
|
print(
|
||||||
"fullscreen: $fullscreen, resizeEdgeSize: ${_resizeEdgeSize.value}");
|
"fullscreen: $fullscreen, resizeEdgeSize: ${_resizeEdgeSize.value}");
|
||||||
_windowBorderWidth.value = fullscreen.isTrue ? 0 : kWindowBorderWidth;
|
_windowBorderWidth.value = fullscreen.isTrue ? 0 : kWindowBorderWidth;
|
||||||
@ -113,4 +113,5 @@ class StateGlobal {
|
|||||||
static final StateGlobal instance = StateGlobal._();
|
static final StateGlobal instance = StateGlobal._();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This final variable is initialized when the first time it is accessed.
|
||||||
final stateGlobal = StateGlobal.instance;
|
final stateGlobal = StateGlobal.instance;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user