Skip to content

Commit 652d5d9

Browse files
committed
flutter_browser_tabs_example: a tab pressed in the title bar band drags the tab
The tab strip sits under the macOS title bar (content under the title bar), and AppKit moves the window for any press in that 28 pt band before Flutter sees it, so grabbing a tab by its upper half dragged the whole window instead of the tab. The strip moves the window itself through its drag session (SetPosition), so the window is made not movable by the system, as core already does for TitleBarStyle.hidden. Checked on macOS: a tab grabbed in the band reorders and the window stays; the empty strip still moves the window; a tab pulled down still tears off.
1 parent c63a165 commit 652d5d9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎examples/flutter_browser_tabs_example/lib/src/tabs_controller.dart‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ class TabsController extends ChangeNotifier {
131131
// is a title bar the content has taken in; elsewhere the strip carries its own
132132
// close button and the title bar goes away with its buttons.
133133
if (native != null) {
134-
if (!native.setContentUnderTitleBar(true)) {
134+
if (native.setContentUnderTitleBar(true)) {
135+
// macOS still moves the window for any press in the title bar band
136+
// (the top 28 pt), tabs included, before Flutter sees it. The strip
137+
// moves the window itself, so take that away from the system; with
138+
// TitleBarStyle.hidden core already does.
139+
native.isMovable = false;
140+
} else {
135141
native.titleBarStyle = na.TitleBarStyle.hidden;
136142
}
137143
// Either way the frame is kept, so the content just grew into the title

0 commit comments

Comments
 (0)