Fix overlay drop ordering and qualify native docking test setup
Hit-test expanded overlays before the docked content they cover. Share tab detachment and group-settings capture across lifecycle paths. Native fixtures establish their initial OS focus with one client click. Geometry setup waits for the requested client width before creating the split, avoiding a ratio constrained by the previous native size. Transfer assertions remain unchanged. Verified 329 fx tests and 34 example tests with all five native test options enabled.
This commit is contained in:
@@ -287,6 +287,12 @@ final class DockDragController {
|
||||
|
||||
private Proposal proposal(DockableId id, double screenX, double screenY) {
|
||||
List<GroupSurface> groups = surfaces.get();
|
||||
for (GroupSurface group : groups) {
|
||||
if (group.tabs() instanceof DockGroupPane tabs && tabs.isOverlay() && !tabs.isCollapsed()) {
|
||||
Proposal overlay = visibleProposal(id, group, screenX, screenY);
|
||||
if (overlay != null) return overlay;
|
||||
}
|
||||
}
|
||||
for (GroupSurface group : groups) {
|
||||
if (hidden(group) && (group.edge() != null || group.tabs().isManaged())) {
|
||||
Proposal empty = emptyProposal(group, screenX, screenY);
|
||||
@@ -294,24 +300,8 @@ final class DockDragController {
|
||||
}
|
||||
}
|
||||
for (GroupSurface group : groups) {
|
||||
if (hidden(group)) continue;
|
||||
Bounds bounds = group.tabs().localToScreen(group.tabs().getBoundsInLocal());
|
||||
if (bounds == null || !bounds.contains(screenX, screenY)) continue;
|
||||
Node strip = headerStrip(group.tabs());
|
||||
Bounds stripBounds = strip == null ? null : strip.localToScreen(strip.getBoundsInLocal());
|
||||
if (stripBounds != null && stripBounds.contains(screenX, screenY)) {
|
||||
Proposal insertion = insertion(group, screenX, screenY);
|
||||
if (insertion != null) return insertion;
|
||||
}
|
||||
Bounds content = contentBounds(bounds, stripBounds, group.tabs().getSide());
|
||||
Side edge = edgeAt(content, screenX, screenY);
|
||||
if (edge != null) {
|
||||
DockTarget target = DockTarget.split(group.id(), edge);
|
||||
MoveCheck split = manager.checkMove(id, target);
|
||||
if (split instanceof MoveCheck.Allowed) return new Proposal(target, half(content, edge));
|
||||
if (split instanceof MoveCheck.NoChange) return new Proposal(target, bounds);
|
||||
}
|
||||
return new Proposal(DockTarget.group(group.id()), bounds);
|
||||
Proposal visible = visibleProposal(id, group, screenX, screenY);
|
||||
if (visible != null) return visible;
|
||||
}
|
||||
for (GroupSurface group : groups) {
|
||||
if (hidden(group) && group.edge() == null && !group.tabs().isManaged()) {
|
||||
@@ -322,6 +312,27 @@ final class DockDragController {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Proposal visibleProposal(DockableId id, GroupSurface group, double screenX, double screenY) {
|
||||
if (hidden(group)) return null;
|
||||
Bounds bounds = group.tabs().localToScreen(group.tabs().getBoundsInLocal());
|
||||
if (bounds == null || !bounds.contains(screenX, screenY)) return null;
|
||||
Node strip = headerStrip(group.tabs());
|
||||
Bounds stripBounds = strip == null ? null : strip.localToScreen(strip.getBoundsInLocal());
|
||||
if (stripBounds != null && stripBounds.contains(screenX, screenY)) {
|
||||
Proposal insertion = insertion(group, screenX, screenY);
|
||||
if (insertion != null) return insertion;
|
||||
}
|
||||
Bounds content = contentBounds(bounds, stripBounds, group.tabs().getSide());
|
||||
Side edge = edgeAt(content, screenX, screenY);
|
||||
if (edge != null) {
|
||||
DockTarget target = DockTarget.split(group.id(), edge);
|
||||
MoveCheck split = manager.checkMove(id, target);
|
||||
if (split instanceof MoveCheck.Allowed) return new Proposal(target, half(content, edge));
|
||||
if (split instanceof MoveCheck.NoChange) return new Proposal(target, bounds);
|
||||
}
|
||||
return new Proposal(DockTarget.group(group.id()), bounds);
|
||||
}
|
||||
|
||||
private static boolean hidden(GroupSurface group) {
|
||||
return !group.tabs().isVisible() || !group.tabs().isManaged();
|
||||
}
|
||||
|
||||
@@ -386,6 +386,15 @@ public final class DockingManager {
|
||||
if (kind == CloseScope.Kind.MAIN_WINDOW && mainWindowCloseMode == MainWindowCloseMode.AUTOMATIC) stage.hide();
|
||||
}
|
||||
|
||||
private void detachTab(Group group, Tab tab) {
|
||||
dragFor(group).uninstallTab(tab);
|
||||
DockTabPresentation.unbind(tab);
|
||||
tab.textProperty().unbind();
|
||||
tab.graphicProperty().unbind();
|
||||
tab.setGraphic(null);
|
||||
tab.setContent(null);
|
||||
}
|
||||
|
||||
private void removeDockables(List<DockableId> ids) {
|
||||
Dockable previousActive = active.get();
|
||||
Group previousGroup = previousActive == null ? null : containing(previousActive.getId());
|
||||
@@ -395,12 +404,7 @@ public final class DockingManager {
|
||||
Group group = containing(id);
|
||||
if (group == null) continue;
|
||||
Tab tab = group.tabs.getTabs().get(tabIndex(group, id));
|
||||
dragFor(group).uninstallTab(tab);
|
||||
DockTabPresentation.unbind(tab);
|
||||
tab.textProperty().unbind();
|
||||
tab.graphicProperty().unbind();
|
||||
tab.setGraphic(null);
|
||||
tab.setContent(null);
|
||||
detachTab(group, tab);
|
||||
group.tabs.getTabs().remove(tab);
|
||||
dockables.remove(id);
|
||||
previousFocus.remove(id);
|
||||
@@ -963,12 +967,7 @@ public final class DockingManager {
|
||||
try {
|
||||
for (Group old : groups.values()) {
|
||||
for (Tab tab : List.copyOf(old.tabs.getTabs())) {
|
||||
dragFor(old).uninstallTab(tab);
|
||||
DockTabPresentation.unbind(tab);
|
||||
tab.textProperty().unbind();
|
||||
tab.graphicProperty().unbind();
|
||||
tab.setGraphic(null);
|
||||
tab.setContent(null);
|
||||
detachTab(old, tab);
|
||||
}
|
||||
old.tabs.getTabs().clear();
|
||||
}
|
||||
@@ -1103,18 +1102,8 @@ public final class DockingManager {
|
||||
}
|
||||
|
||||
private Group createDetachedGroup(DockGroupId id, DockGroupDefinition definition) {
|
||||
DockGroupDefinition captured = new DockGroupDefinition(definition.getDestinationId());
|
||||
captured.setTabSide(definition.getTabSide());
|
||||
captured.setMode(definition.getMode());
|
||||
captured.setPreferredWidth(definition.getPreferredWidth());
|
||||
captured.setPreferredHeight(definition.getPreferredHeight());
|
||||
captured.setMinimumWidth(definition.getMinimumWidth());
|
||||
captured.setMinimumHeight(definition.getMinimumHeight());
|
||||
captured.setSplitDirections(definition.getSplitDirections());
|
||||
captured.setPersistent(definition.isPersistent());
|
||||
captured.setCollapsible(definition.isCollapsible());
|
||||
captured.setVisibleWhenEmpty(definition.isVisibleWhenEmpty());
|
||||
captured.setReleaseSpaceWhenEmpty(definition.isReleaseSpaceWhenEmpty());
|
||||
DockGroupDefinition captured = LayoutSnapshot.GroupSettings.capture(definition)
|
||||
.definition(new DockAreaId(definition.getDestinationId()));
|
||||
TabPane tabs = new DockGroupPane(captured);
|
||||
tabs.setSide(captured.getTabSide());
|
||||
((DockGroupPane) tabs).setCollapsed(captured.getMode() == DockGroupMode.OVERLAY);
|
||||
|
||||
Reference in New Issue
Block a user