Skip to content

Commit c1d6b91

Browse files
authored
[linux] remove the margins of the window frame (#318)
To avoid first displaying a window as Server-side Decoration and then changing it to Client-side Decoration. Use 'gtk_widget_realize' instead of 'gtk_widget_show' in the example.
1 parent 3267799 commit c1d6b91

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

example/linux/my_application.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static void my_application_activate(GApplication* application) {
4949
}
5050

5151
gtk_window_set_default_size(window, 1280, 720);
52-
gtk_widget_show(GTK_WIDGET(window));
52+
gtk_widget_realize(GTK_WIDGET(window));
5353

5454
g_autoptr(FlDartProject) project = fl_dart_project_new();
5555
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);

lib/src/widgets/virtual_window_frame.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import 'package:window_manager/src/window_manager.dart';
1010
final _kIsLinux = !kIsWeb && Platform.isLinux;
1111
final _kIsWindows = !kIsWeb && Platform.isWindows;
1212

13-
double get kVirtualWindowFrameMargin => (_kIsLinux) ? 20.0 : 0;
14-
1513
class VirtualWindowFrame extends StatefulWidget {
1614
const VirtualWindowFrame({
1715
Key? key,
@@ -45,9 +43,6 @@ class _VirtualWindowFrameState extends State<VirtualWindowFrame>
4543

4644
Widget _buildVirtualWindowFrame(BuildContext context) {
4745
return Container(
48-
margin: (_isMaximized || _isFullScreen)
49-
? EdgeInsets.zero
50-
: EdgeInsets.all(kVirtualWindowFrameMargin),
5146
decoration: BoxDecoration(
5247
color: Colors.transparent,
5348
border: Border.all(
@@ -79,9 +74,6 @@ class _VirtualWindowFrameState extends State<VirtualWindowFrame>
7974
Widget build(BuildContext context) {
8075
if (_kIsLinux) {
8176
return DragToResizeArea(
82-
resizeEdgeMargin: (_isMaximized || _isFullScreen)
83-
? EdgeInsets.zero
84-
: EdgeInsets.all(kVirtualWindowFrameMargin * 0.6),
8577
enableResizeEdges: (_isMaximized || _isFullScreen) ? [] : null,
8678
child: _buildVirtualWindowFrame(context),
8779
);

0 commit comments

Comments
 (0)