Ensure MacClipboardListener differentiates between images properly

MYC-Refactor
Hammy 3 years ago
parent 82d23458be
commit 7db4422e64

@ -12,6 +12,7 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import me.goudham.domain.MyClipboardContent; import me.goudham.domain.MyClipboardContent;
import me.goudham.domain.OldClipboardContent; import me.goudham.domain.OldClipboardContent;
import me.goudham.domain.OldImage;
import me.goudham.domain.TransferableFileList; import me.goudham.domain.TransferableFileList;
import me.goudham.domain.TransferableImage; import me.goudham.domain.TransferableImage;
@ -53,7 +54,6 @@ class MacClipboardListener extends ClipboardListener implements Runnable {
} }
myClipboardContents[0].setOldContent(newStringContent); myClipboardContents[0].setOldContent(newStringContent);
myClipboardContents[0].setOldDimensionContent(newStringContent);
} }
} }
@ -68,16 +68,16 @@ class MacClipboardListener extends ClipboardListener implements Runnable {
BufferedImage bufferedImageContent = getImageContent(newClipboardContents); BufferedImage bufferedImageContent = getImageContent(newClipboardContents);
if (bufferedImageContent == null) return; if (bufferedImageContent == null) return;
Dimension newDimensionContent = new Dimension(bufferedImageContent.getWidth(), bufferedImageContent.getHeight()); Dimension newDimensionContent = new Dimension(bufferedImageContent.getWidth(), bufferedImageContent.getHeight());
OldImage newImageContent = new OldImage(bufferedImageContent, newDimensionContent);
if (isImageMonitored()) { if (isImageMonitored()) {
if (!newDimensionContent.equals(myClipboardContents[0].getOldDimensionContent())) { if (!newImageContent.equals(myClipboardContents[0].getOldContent())) {
OldClipboardContent oldClipboardContent = ClipboardUtils.getOldClipboardContent(myClipboardContents[0].getOldContent()); OldClipboardContent oldClipboardContent = ClipboardUtils.getOldClipboardContent(myClipboardContents[0].getOldContent());
getEventManager().notifyImageEvent(oldClipboardContent, bufferedImageContent); getEventManager().notifyImageEvent(oldClipboardContent, bufferedImageContent);
} }
} }
myClipboardContents[0].setOldContent(bufferedImageContent); myClipboardContents[0].setOldContent(newImageContent);
myClipboardContents[0].setOldDimensionContent(newDimensionContent);
} }
} }
@ -101,7 +101,6 @@ class MacClipboardListener extends ClipboardListener implements Runnable {
} }
myClipboardContents[0].setOldContent(fileListContent); myClipboardContents[0].setOldContent(fileListContent);
myClipboardContents[0].setOldContent(fileListContent);
} }
} }

Loading…
Cancel
Save