implement xdg-decoration for native Wayland frameless

Replace XWayland fallback with proper xdg-decoration protocol
negotiation. On Wayland: binds zxdg_decoration_manager_v1 from
the compositor registry, requests CLIENT_SIDE mode on the toplevel
surface — KWin respects this and drops server-side decorations.
Falls back to gdk_window_set_decorations(0) + set_decorated(FALSE)
on X11. GDK_BACKEND=x11 removed from Makefile.

Also fixes mouse-jumping glitch: startDrag and startResize now
pass screen coordinates from Flutter's globalPosition through the
method channel to gtk_window_begin_move/resize_drag.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 09:21:19 +02:00
co-authored by Claude Opus 4.6
parent 8475e2e33a
commit a6b11a4cd8
9 changed files with 588 additions and 79 deletions
+1 -1
View File
@@ -221,7 +221,7 @@ class _HatBar extends StatelessWidget {
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
return GestureDetector(
onPanStart: (_) => kernel.window.startDrag(),
onPanStart: (d) => kernel.window.startDrag(d.globalPosition),
child: Container(
height: hatHeight,
decoration: BoxDecoration(
+12 -5
View File
@@ -17,19 +17,26 @@ class WindowControls extends ChangeNotifier {
notifyListeners();
}
Future<void> startResize(ResizeEdge edge) async {
Future<void> startResize(ResizeEdge edge, Offset screenPosition) async {
try {
await _channel.invokeMethod('startResize', edge.index);
await _channel.invokeMethod('startResize', {
'edge': edge.index,
'x': screenPosition.dx.round(),
'y': screenPosition.dy.round(),
});
} on MissingPluginException {
// no-op
}
}
Future<void> startDrag() async {
Future<void> startDrag(Offset screenPosition) async {
try {
await _channel.invokeMethod('startDrag');
await _channel.invokeMethod('startDrag', {
'x': screenPosition.dx.round(),
'y': screenPosition.dy.round(),
});
} on MissingPluginException {
// Web or unsupported platform — no-op.
// no-op
}
}
+1 -1
View File
@@ -33,7 +33,7 @@ class ColumnHat extends StatelessWidget {
Widget build(BuildContext context) {
final tokens = ClideTheme.of(context).surface;
return GestureDetector(
onPanStart: (_) => windowControls.startDrag(),
onPanStart: (d) => windowControls.startDrag(d.globalPosition),
child: Container(
height: hatHeight,
color: tokens.panelHeader,
+1 -1
View File
@@ -45,7 +45,7 @@ class ClideResizeBorder extends StatelessWidget {
return MouseRegion(
cursor: cursor,
child: GestureDetector(
onPanStart: (_) => windowControls.startResize(edge),
onPanStart: (d) => windowControls.startResize(edge, d.globalPosition),
child: const ColoredBox(color: Color(0x00000000)),
),
);