Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewauclair committed Aug 17, 2024
1 parent 314500c commit fad4ca9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions docking-api/src/ModernDocking/floating/FloatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ private void dragStarted(Point dragOrigin) {
if (currentRoot.isEmpty()) {
originalWindow.setVisible(false);
}

Floating.startDrag(dragSource);
}

public void removeListeners() {
Expand Down Expand Up @@ -196,6 +198,7 @@ public void dragDropEnd(DragSourceDropEvent event) {
originalWindow.dispose();
}

Floating.endDrag(dragSource);
Floating.setFloating(false);
}

Expand Down
9 changes: 5 additions & 4 deletions docking-api/src/ModernDocking/floating/FloatUtilsFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public FloatUtilsFrame(DockingAPI docking, Window referenceDockingWindow, Intern
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
BufferCapabilities bufferCapabilities = gc.getBufferCapabilities();

if (bufferCapabilities.isMultiBufferAvailable()) {
if (bufferCapabilities.isMultiBufferAvailable())
{
add(renderPanel);
renderPanel.setOpaque(false);
}
Expand All @@ -112,7 +113,7 @@ public void activate(FloatListener floatListener, JFrame floatingFrame, DragSour
this.floatListener = floatListener;
this.floatingFrame = floatingFrame;
this.dragSource = dragSource;
dragSource.addDragSourceMotionListener(this);
// dragSource.addDragSourceMotionListener(this);

mouseMoved(mousePosOnScreen);

Expand All @@ -138,7 +139,7 @@ public void deactivate() {
setVisible(false);

if (dragSource != null) {
dragSource.removeDragSourceMotionListener(this);
// dragSource.removeDragSourceMotionListener(this);
}
floatListener = null;
floatingFrame = null;
Expand Down Expand Up @@ -324,7 +325,7 @@ public DockingRegion getDockableRegion(Dockable targetDockable, Dockable floatin
}

private void setSizeAndLocation() {
int padding = (int) (DockingHandle.HANDLE_ICON_SIZE * 1.75);
int padding = getExtendedState() == Frame.MAXIMIZED_BOTH ? 0 : (int) (DockingHandle.HANDLE_ICON_SIZE * 1.75);

Point location = new Point(referenceDockingWindow.getLocationOnScreen());
Dimension size = new Dimension(referenceDockingWindow.getSize());
Expand Down
13 changes: 13 additions & 0 deletions docking-api/src/ModernDocking/floating/Floating.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal

import javax.swing.*;
import java.awt.*;
import java.awt.dnd.DragSource;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -58,4 +59,16 @@ static void setFloating(boolean floating) {
static void setFloatingTabbedPane(boolean floating) {
isFloatingTabbedPane = floating;
}

public static void startDrag(DragSource dragSource) {
for (FloatUtilsFrame frame : utilFrames.values()) {
dragSource.addDragSourceMotionListener(frame);
}
}

public static void endDrag(DragSource dragSource) {
for (FloatUtilsFrame frame : utilFrames.values()) {
dragSource.removeDragSourceMotionListener(frame);
}
}
}

0 comments on commit fad4ca9

Please sign in to comment.