This is an automated email from the git hooks/post-receive script.
guix_mirror_bot pushed a commit to branch master
in repository guix.
The following commit(s) were added to refs/heads/master by this push:
new 0ddd1390e63 gnu: jbr: Update to 25.0.4.1b635.79.
0ddd1390e63 is described below
commit 0ddd1390e63e7d4cffa701e75d89449dac016d64
Author: Danny Milosavljevic <[email protected]>
AuthorDate: Wed Oct 28 00:02:40 2026 +0100
gnu: jbr: Update to 25.0.4.1b635.79.
* gnu/packages/java.scm (jbr25): Update to 25.0.4.1b635.79.
* gnu/packages/patches/jbr-25-wayland-drag-icon.patch: Modify.
* gnu/packages/patches/jbr-25-wayland-intra-jvm-dnd.patch: Modify.
Change-Id: Ia66b8567efa9eff29e7e6d2161f4450fa9b3d639
Merges: #12260
---
gnu/packages/java.scm | 4 +-
.../patches/jbr-25-wayland-drag-icon.patch | 340 ++++++++-------------
.../patches/jbr-25-wayland-intra-jvm-dnd.patch | 132 +++-----
3 files changed, 160 insertions(+), 316 deletions(-)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 677e9a961b9..a1652184f1c 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2030,7 +2030,7 @@ OpenJDK.")
(package
(inherit openjdk25)
(name "jbr")
- (version "25.0.2b329.72")
+ (version "25.0.4.1b635.79")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -2039,7 +2039,7 @@ OpenJDK.")
(file-name (string-append name "-" version "-checkout"))
(sha256
(base32
- "1m7pbz2ypx4h7n6iqss8bgymg9hqn14lnis4a2w87mgy51p370ib"))
+ "0zi5gqil5a61dn1bh0jxa4dkjxwd2fkb561vqr3lwgrmzpcawxzx"))
(patches
(search-patches "jbr-25-wayland-drag-icon.patch"
"jbr-25-wayland-intra-jvm-dnd.patch"))))
diff --git a/gnu/packages/patches/jbr-25-wayland-drag-icon.patch
b/gnu/packages/patches/jbr-25-wayland-drag-icon.patch
index 62090e90b85..8a83ceb1654 100644
--- a/gnu/packages/patches/jbr-25-wayland-drag-icon.patch
+++ b/gnu/packages/patches/jbr-25-wayland-drag-icon.patch
@@ -1,19 +1,13 @@
From 0602a477881f7d4047edd2ffe2b6f5157fda9bc9 Mon Sep 17 00:00:00 2001
-From: Danny Milosavljevic <[email protected]>
+From: Danny Milosavljevic <[email protected]>
Date: Tue, 31 Mar 2026 05:11:27 +0000
Subject: [PATCH 1/2] Wayland: fix drag icon updates during drag-and-drop
-Expose the actual cursor image and size to the Wayland peer, provide DnD
cursor desktop properties, and use the Wayland drag icon surface as the
drag-and-drop status channel. Preserve application-supplied drag images, update
cursor-derived fallback icons during action changes, pad drag icon buffers for
compositor scale requirements, and reuse the drag icon surface so later status
changes reach the compositor.
+Expose the actual cursor image and size to the Wayland peer, provide DnD
+cursor desktop properties, and use the Wayland drag icon surface as the
+status channel. Preserve application-supplied drag images and update
+cursor-derived fallback icons when the negotiated action changes.
---
- .../share/classes/sun/awt/CustomCursor.java | 21 ++-
- .../classes/sun/awt/wl/WLCursorManager.java | 30 +++++
- .../unix/classes/sun/awt/wl/WLDataSource.java | 32 +++--
- .../sun/awt/wl/WLDragSourceContextPeer.java | 122 ++++++++++++++++--
- .../unix/classes/sun/awt/wl/WLToolkit.java | 11 +-
- .../unix/native/libawt_wlawt/WLCursor.c | 14 ++
- .../unix/native/libawt_wlawt/WLDataDevice.c | 37 +++++-
- 7 files changed, 243 insertions(+), 24 deletions(-)
-
diff --git a/src/java.desktop/share/classes/sun/awt/CustomCursor.java
b/src/java.desktop/share/classes/sun/awt/CustomCursor.java
index 2b65c5dbe..aa7e5559d 100644
--- a/src/java.desktop/share/classes/sun/awt/CustomCursor.java
@@ -27,7 +21,7 @@ index 2b65c5dbe..aa7e5559d 100644
public CustomCursor(Image cursor, Point hotSpot, String name)
throws IndexOutOfBoundsException {
-@@ -80,6 +82,9 @@ public CustomCursor(Image cursor, Point hotSpot, String name)
+@@ -80,6 +82,9 @@
throw new IndexOutOfBoundsException("invalid hotSpot");
}
@@ -37,7 +31,7 @@ index 2b65c5dbe..aa7e5559d 100644
/* Extract ARGB array from image.
*
* A transparency mask can be created in native code by checking
-@@ -96,10 +101,24 @@ public CustomCursor(Image cursor, Point hotSpot, String
name)
+@@ -96,10 +101,24 @@
} catch (InterruptedException e) {
}
@@ -64,18 +58,18 @@ index 2b65c5dbe..aa7e5559d 100644
+ }
}
diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLCursorManager.java
b/src/java.desktop/unix/classes/sun/awt/wl/WLCursorManager.java
-index 75927e762..0b1ef8d57 100644
+index cbcebd4c7..59ebb6a57 100644
--- a/src/java.desktop/unix/classes/sun/awt/wl/WLCursorManager.java
+++ b/src/java.desktop/unix/classes/sun/awt/wl/WLCursorManager.java
-@@ -29,6 +29,7 @@
- import sun.awt.AWTAccessor;
+@@ -30,6 +30,7 @@
import sun.util.logging.PlatformLogger;
-+import java.awt.Dimension;
import java.awt.Cursor;
++import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
-@@ -139,7 +140,36 @@ private long createNativeCursor(int type, int scale) {
+ public class WLCursorManager {
+@@ -229,9 +230,38 @@
return 0;
}
@@ -106,79 +100,26 @@ index 75927e762..0b1ef8d57 100644
+ }
+ }
+
+ private static native boolean nativeIsCursorShapeSupported();
private static native void nativeSetCursor(long pData, int scale, long
pointerEnterSerial);
private static native long nativeGetPredefinedCursor(String name, int
scale);
private static native void nativeDestroyPredefinedCursor(long pData);
+ private static native void nativeSetCursorShape(int shape, long serial);
+ private static native int nativeGetCursorWidth(long pData);
+ private static native int nativeGetCursorHeight(long pData);
}
-diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java
b/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java
-index 260aab964..2ecc52619 100644
---- a/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java
-+++ b/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java
-@@ -103,22 +103,38 @@ public void setDnDIcon(Image image, int scale, int
offsetX, int offsetY) {
-
- int width = image.getWidth(null);
- int height = image.getHeight(null);
-- int[] pixels = new int[width * height];
-+ int paddedWidth = width;
-+ int paddedHeight = height;
-+ Image iconImage = image;
-+
-+ if (scale > 1) {
-+ paddedWidth = ((width + scale - 1) / scale) * scale;
-+ paddedHeight = ((height + scale - 1) / scale) * scale;
-+ if (paddedWidth != width || paddedHeight != height) {
-+ BufferedImage paddedImage = new BufferedImage(paddedWidth,
paddedHeight, BufferedImage.TYPE_INT_ARGB);
-+ Graphics2D g = paddedImage.createGraphics();
-+ g.drawImage(image, 0, 0, null);
-+ g.dispose();
-+ iconImage = paddedImage;
-+ }
-+ }
-+
-+ int[] pixels = new int[paddedWidth * paddedHeight];
-
-- if (image instanceof BufferedImage) {
-+ if (iconImage instanceof BufferedImage) {
- // NOTE: no need to ensure that the BufferedImage is
TYPE_INT_ARGB,
- // getRGB() does pixel format conversion automatically
-- ((BufferedImage) image).getRGB(0, 0, width, height, pixels, 0,
width);
-+ ((BufferedImage) iconImage).getRGB(0, 0, paddedWidth,
paddedHeight, pixels, 0, paddedWidth);
- } else {
-- BufferedImage bufferedImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
-+ BufferedImage bufferedImage = new BufferedImage(paddedWidth,
paddedHeight, BufferedImage.TYPE_INT_ARGB);
- Graphics2D g = bufferedImage.createGraphics();
-- g.drawImage(image, 0, 0, null);
-+ g.drawImage(iconImage, 0, 0, null);
- g.dispose();
-
-- bufferedImage.getRGB(0, 0, width, height, pixels, 0, width);
-+ bufferedImage.getRGB(0, 0, paddedWidth, paddedHeight, pixels, 0,
paddedWidth);
- }
-
-- setDnDIconImpl(nativePtr, scale, width, height, offsetX, offsetY,
pixels);
-+ setDnDIconImpl(nativePtr, scale, paddedWidth, paddedHeight, offsetX,
offsetY, pixels);
- }
-
- public void offerExtraMime(String mime) {
-@@ -152,4 +168,4 @@ protected void handleDnDDropPerformed() {}
- protected void handleDnDFinished() {}
-
- protected void handleDnDAction(int action) {}
--}
-\ No newline at end of file
-+}
diff --git
a/src/java.desktop/unix/classes/sun/awt/wl/WLDragSourceContextPeer.java
b/src/java.desktop/unix/classes/sun/awt/wl/WLDragSourceContextPeer.java
-index afd727d1a..46747ddca 100644
+index 1f9fe1417..0ebbffd77 100644
--- a/src/java.desktop/unix/classes/sun/awt/wl/WLDragSourceContextPeer.java
+++ b/src/java.desktop/unix/classes/sun/awt/wl/WLDragSourceContextPeer.java
-@@ -26,9 +26,13 @@
+@@ -26,11 +26,15 @@
package sun.awt.wl;
import sun.awt.AWTAccessor;
+import sun.awt.CustomCursor;
import sun.awt.dnd.SunDragSourceContextPeer;
+ import sun.awt.dnd.SunDropTargetContextPeer;
+ import sun.util.logging.PlatformLogger;
import java.awt.Cursor;
+import java.awt.Dimension;
@@ -187,74 +128,49 @@ index afd727d1a..46747ddca 100644
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DragGestureEvent;
-@@ -36,6 +40,8 @@
-
- public class WLDragSourceContextPeer extends SunDragSourceContextPeer {
- private final WLDataDevice dataDevice;
-+ private WLDragSource activeDragSource;
-+ private boolean activeDragSourceUsesCursorFallback;
+@@ -58,6 +62,11 @@
private class WLDragSource extends WLDataSource {
- private int action;
-@@ -47,7 +53,7 @@ private class WLDragSource extends WLDataSource {
+ int action;
++ // Unlike action, this starts at zero even when a default drop action
++ // is supplied, so the first accepted action generates an enter event.
++ int lastNotifiedAction;
++ final int iconScale;
++ boolean usesCursorFallback;
+ String mime;
+ boolean didSendFinishedEvent = false;
+ boolean didSucceed = false;
+@@ -67,9 +76,10 @@
+ // When we see a mouse released event, and isPending is true, we can
be sure that our start_drag request was rejected.
+ boolean isPending = true;
+
+- WLDragSource(Transferable data, int defaultAction) {
++ WLDragSource(Transferable data, int defaultAction, int iconScale) {
super(dataDevice, WLDataDevice.DATA_TRANSFER_PROTOCOL_WAYLAND,
data);
+ action = defaultAction;
++ this.iconScale = iconScale;
}
-- private void sendFinishedEvent() {
-+ private synchronized void sendFinishedEvent() {
- if (didSendFinishedEvent) {
- return;
- }
-@@ -67,7 +73,11 @@ protected synchronized void handleDnDAction(int action) {
- // except for maybe action(dnd_ask), but since we do not announce
support for dnd_ask,
- // we don't need to worry about it.
- if (!didSucceed) {
-+ int previousAction = this.action;
- this.action = action;
-+ if (previousAction != action) {
-+
WLDragSourceContextPeer.this.handleSourceActionChanged(previousAction, action);
-+ }
+ private void sendFinishedEvent() {
+@@ -110,8 +120,13 @@
+ // Spec says that after dnd_drop_performed(), no further
action() events will be sent,
+ // except for maybe action(dnd_ask), but since we do not
announce support for dnd_ask,
+ // we don't need to worry about it.
+- if (!didSucceed) {
++ if (!didSucceed && !didSendFinishedEvent && currentDragSource
== this) {
+ this.action = action;
++ int previousAction = lastNotifiedAction;
++ lastNotifiedAction = action;
++ if (previousAction != action) {
++ handleSourceActionChanged(previousAction, action);
++ }
+ }
}
}
-
-@@ -78,8 +88,8 @@ protected synchronized void handleDnDDropPerformed() {
-
- @Override
- protected synchronized void handleDnDFinished() {
-+ WLDragSourceContextPeer.this.finishDragSource(this);
- sendFinishedEvent();
-- destroy();
- }
-
- @Override
-@@ -88,9 +98,9 @@ protected synchronized void handleTargetAcceptsMime(String
mime) {
- }
-
- @Override
-- protected void handleCancelled() {
-+ protected synchronized void handleCancelled() {
-+ WLDragSourceContextPeer.this.finishDragSource(this);
- sendFinishedEvent();
-- super.handleCancelled();
+@@ -186,6 +201,23 @@
}
}
-@@ -119,6 +129,35 @@ private WLMainSurface getSurface() {
- return null;
- }
-
-+ private synchronized void activateDragSource(WLDragSource dragSource) {
-+ activeDragSource = dragSource;
-+ }
-+
-+ private synchronized void finishDragSource(WLDragSource dragSource) {
-+ if (activeDragSource == dragSource) {
-+ activeDragSource = null;
-+ activeDragSourceUsesCursorFallback = false;
-+ }
-+ dragSource.destroy();
-+ }
-+
+ private void handleSourceActionChanged(int previousWaylandAction, int
waylandAction) {
+ var inputState = WLToolkit.getInputState();
+ int x = inputState.getPointerX();
@@ -274,60 +190,46 @@ index afd727d1a..46747ddca 100644
+
@Override
protected void startDrag(Transferable trans, long[] formats, Map<Long,
DataFlavor> formatMap) {
- var mainSurface = getSurface();
-@@ -134,21 +173,88 @@ protected void startDrag(Transferable trans, long[]
formats, Map<Long, DataFlavo
-
- source.setDnDActions(waylandActions);
-
-+ int scale = mainSurface.getGraphicsDevice().getDisplayScale();
- var dragImage = getDragImage();
-+ Point dragImageOffset = null;
-+ boolean usesCursorFallback = false;
-+ if (dragImage == null) {
-+ dragImage = cursorToImage(getDragSourceContext().getCursor());
-+ if (dragImage != null) {
-+ dragImageOffset =
cursorToDragImageOffset(getDragSourceContext().getCursor(), scale);
-+ usesCursorFallback = true;
+ if (log.isLoggable(PlatformLogger.Level.FINE)) {
+@@ -216,15 +248,22 @@
+
+ // formats and formatMap are unused, because WLDataSource already
references the same DataTransferer singleton
+ // Configuring the dragImage for the source is done without holding a
lock, because it might call out to user code.
+- var source = new WLDragSource(trans, defaultAction);
++ var source = new WLDragSource(trans, defaultAction,
peer.getDisplayScale());
+ try {
+ source.setDnDActions(waylandActions);
+
+ var dragImage = getDragImage();
++ Point dragImageOffset = getDragImageOffset();
++ if (dragImage == null && dragSourceContext != null) {
++ Cursor cursor = dragSourceContext.getCursor();
++ dragImage = cursorToImage(cursor);
++ if (dragImage != null) {
++ dragImageOffset = cursorToDragImageOffset(cursor,
source.iconScale);
++ source.usesCursorFallback = true;
++ }
+ }
-+ } else {
-+ dragImageOffset = getDragImageOffset();
-+ }
- if (dragImage != null) {
-- var dragImageOffset = getDragImageOffset();
- source.setDnDIcon(dragImage,
-- mainSurface.getGraphicsDevice().getDisplayScale(),
-+ scale,
- dragImageOffset.x, dragImageOffset.y);
- }
-
- long eventSerial = WLToolkit.getInputState().pointerButtonSerial();
-
-- dataDevice.startDrag(source, mainSurface.getWlSurfacePtr(),
eventSerial);
-+ synchronized (this) {
-+ activateDragSource(source);
-+ activeDragSourceUsesCursorFallback = usesCursorFallback;
-+ }
-+ try {
-+ dataDevice.startDrag(source, mainSurface.getWlSurfacePtr(),
eventSerial);
-+ } catch (RuntimeException | Error e) {
-+ finishDragSource(source);
-+ throw e;
-+ }
- }
+ if (dragImage != null) {
+- var dragImageOffset = getDragImageOffset();
+- source.setDnDIcon(dragImage,
+- peer.getDisplayScale(),
++ source.setDnDIcon(dragImage, source.iconScale,
+ dragImageOffset.x, dragImageOffset.y);
+ }
+ } catch (Throwable e) {
+@@ -274,6 +313,48 @@
@Override
protected void setNativeCursor(long nativeCtxt, Cursor c, int cType) {
- // TODO: setting cursor here doesn't seem to be required on Wayland?
-+ // On Wayland, cursor changes during a drag are expressed by
-+ // updating the drag icon surface content.
-+ var mainSurface = getSurface();
-+ int scale = mainSurface != null ?
mainSurface.getGraphicsDevice().getDisplayScale() : 1;
-+
++ // SunDragSourceContextPeer.setCursor() already holds this monitor.
++ // Reuse the source's scale instead of looking up the component peer:
++ // taking the AWT lock here would invert startDrag()'s lock order.
+ synchronized (this) {
-+ if (activeDragSource == null) {
-+ return;
-+ }
-+ if (!activeDragSourceUsesCursorFallback) {
++ var source = currentDragSource;
++ if (source == null || !source.usesCursorFallback
++ || source.didSendFinishedEvent || source.didSucceed) {
+ return;
+ }
+
@@ -336,8 +238,8 @@ index afd727d1a..46747ddca 100644
+ return;
+ }
+
-+ Point dragImageOffset = cursorToDragImageOffset(c, scale);
-+ activeDragSource.setDnDIcon(image, scale, dragImageOffset.x,
dragImageOffset.y);
++ Point offset = cursorToDragImageOffset(c, source.iconScale);
++ source.setDnDIcon(image, source.iconScale, offset.x, offset.y);
+ }
+ }
+
@@ -361,18 +263,16 @@ index afd727d1a..46747ddca 100644
+ return new Point(0, 0);
+ }
+
-+ // This is only for the Wayland fallback path where no application
drag
-+ // image was supplied and we reuse DnD cursor artwork as the drag
icon.
-+ // Keep that fallback icon visible by placing it one cursor
width/height
-+ // away from the pointer hotspot, expressed in surface-local
coordinates.
++ // For cursor-derived fallback icons only, keep the artwork visible
++ // one cursor width/height away from the pointer, in surface
coordinates.
+ return new Point(cursorSize.width / scale, cursorSize.height / scale);
}
}
diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLToolkit.java
b/src/java.desktop/unix/classes/sun/awt/wl/WLToolkit.java
-index 058306539..e768cbfd8 100644
+index 47a3c3688..20222db0f 100644
--- a/src/java.desktop/unix/classes/sun/awt/wl/WLToolkit.java
+++ b/src/java.desktop/unix/classes/sun/awt/wl/WLToolkit.java
-@@ -983,9 +983,18 @@ public int getNumberOfButtons(){
+@@ -1016,9 +1016,18 @@
return MOUSE_BUTTONS_COUNT;
}
@@ -393,10 +293,10 @@ index 058306539..e768cbfd8 100644
}
return null;
diff --git a/src/java.desktop/unix/native/libawt_wlawt/WLCursor.c
b/src/java.desktop/unix/native/libawt_wlawt/WLCursor.c
-index f56f39d16..6d1a95460 100644
+index 8fe7319b1..1b0077737 100644
--- a/src/java.desktop/unix/native/libawt_wlawt/WLCursor.c
+++ b/src/java.desktop/unix/native/libawt_wlawt/WLCursor.c
-@@ -100,6 +100,20 @@ JNIEXPORT void JNICALL
Java_sun_awt_wl_WLCursorManager_nativeDestroyPredefinedCu
+@@ -117,6 +117,20 @@
free(cursor);
}
@@ -418,10 +318,10 @@ index f56f39d16..6d1a95460 100644
(JNIEnv *env, jclass cls, jintArray pixels, jint width, jint height, jint
xHotSpot, jint yHotSpot)
{
diff --git a/src/java.desktop/unix/native/libawt_wlawt/WLDataDevice.c
b/src/java.desktop/unix/native/libawt_wlawt/WLDataDevice.c
-index 5d0095dae..7e6311529 100644
+index 2ce3d274c..0da6e69bd 100644
--- a/src/java.desktop/unix/native/libawt_wlawt/WLDataDevice.c
+++ b/src/java.desktop/unix/native/libawt_wlawt/WLDataDevice.c
-@@ -86,6 +86,8 @@ struct DataSource
+@@ -96,6 +96,8 @@
struct wl_surface* dragIcon;
struct wl_buffer* dragIconBuffer;
@@ -430,19 +330,7 @@ index 5d0095dae..7e6311529 100644
struct DataSource* nextDel;
};
-@@ -673,7 +675,10 @@ zwp_primary_selection_source_handle_cancelled(void *user,
- static void
- wl_data_offer_handle_offer(void *user, struct wl_data_offer *wl_data_offer,
const char *mime)
- {
-- DataOffer_callOfferHandler((struct DataOffer *) user, mime);
-+ struct DataOffer *offer = user;
-+ assert(offer != NULL);
-+
-+ DataOffer_callOfferHandler(offer, mime);
- }
-
- static void
-@@ -1149,6 +1154,14 @@ JNIEXPORT void JNICALL
Java_sun_awt_wl_WLDataSource_setDnDIconImpl
+@@ -1382,6 +1384,14 @@
jint width, jint height, jint offsetX, jint offsetY, jintArray pixels)
{
struct DataSource *source = jlong_to_ptr(nativePtr);
@@ -457,18 +345,36 @@ index 5d0095dae..7e6311529 100644
size_t pixelCount = (size_t)((*env)->GetArrayLength(env, pixels));
size_t byteSize = pixelCount * 4U;
-@@ -1180,7 +1193,9 @@ JNIEXPORT void JNICALL
Java_sun_awt_wl_WLDataSource_setDnDIconImpl
- return;
+@@ -1407,29 +1417,31 @@
}
+ #endif
+- source->dragIconBuffer = wl_shm_pool_create_buffer(pool, 0, width,
height, width * 4, WL_SHM_FORMAT_ARGB8888);
++ struct wl_buffer *buffer = wl_shm_pool_create_buffer(pool, 0, width,
height, width * 4, WL_SHM_FORMAT_ARGB8888);
+ wl_shm_pool_destroy(pool);
+- if (!source->dragIconBuffer) {
+- return;
+- }
+-
- source->dragIcon = wl_compositor_create_surface(wl_compositor);
-+ if (!source->dragIcon) {
-+ source->dragIcon = wl_compositor_create_surface(wl_compositor);
++ if (!buffer) {
++ return;
+ }
++
if (!source->dragIcon) {
- wl_buffer_destroy(source->dragIconBuffer);
- source->dragIconBuffer = NULL;
-@@ -1191,12 +1206,12 @@ JNIEXPORT void JNICALL
Java_sun_awt_wl_WLDataSource_setDnDIconImpl
+- wl_buffer_destroy(source->dragIconBuffer);
+- source->dragIconBuffer = NULL;
+- return;
+- }
++ source->dragIcon = wl_compositor_create_surface(wl_compositor);
++ }
++ if (!source->dragIcon) {
++ wl_buffer_destroy(buffer);
++ return;
++ }
++ source->dragIconBuffer = buffer;
+
+ #if WL_SURFACE_OFFSET_SINCE_VERSION >= 5
int wl_compositor_version = wl_compositor_get_version(wl_compositor);
if (wl_compositor_version >= 5) {
wl_surface_attach(source->dragIcon, source->dragIconBuffer, 0, 0);
@@ -484,7 +390,7 @@ index 5d0095dae..7e6311529 100644
#endif
if (scale >= 1) {
-@@ -1205,7 +1220,17 @@ JNIEXPORT void JNICALL
Java_sun_awt_wl_WLDataSource_setDnDIconImpl
+@@ -1438,7 +1450,18 @@
wl_surface_damage_buffer(source->dragIcon, 0, 0, width, height);
@@ -496,6 +402,7 @@ index 5d0095dae..7e6311529 100644
+ source->dragIconOffsetX = offsetX;
+ source->dragIconOffsetY = offsetY;
+
++ // The first commit is done immediately after start_drag().
+ if (updating_existing_icon) {
+ wl_surface_commit(source->dragIcon);
+ wlFlushToServer(env);
@@ -505,4 +412,3 @@ index 5d0095dae..7e6311529 100644
JNIEXPORT void JNICALL
--
2.52.0
-
diff --git a/gnu/packages/patches/jbr-25-wayland-intra-jvm-dnd.patch
b/gnu/packages/patches/jbr-25-wayland-intra-jvm-dnd.patch
index 889014653d0..8dec1110057 100644
--- a/gnu/packages/patches/jbr-25-wayland-intra-jvm-dnd.patch
+++ b/gnu/packages/patches/jbr-25-wayland-intra-jvm-dnd.patch
@@ -1,62 +1,45 @@
From 6f12ff22c3a902db64ef2bc4f94cb2ad4b26f4ce Mon Sep 17 00:00:00 2001
From: Danny Milosavljevic <[email protected]>
Date: Tue, 31 Mar 2026 05:24:04 +0000
-Subject: [PATCH 2/2] Wayland: enable intra-JVM drag-and-drop transfers
+Subject: [PATCH 2/2] Wayland: advertise JVM-local drag-and-drop flavors
-Advertise JAVA_DATAFLAVOR natives for local drags, register the current
JVM-local Transferable before starting the drag, and let the drop target fall
back to the source actions when Wayland MIME negotiation stays at zero for a
local Java-object transfer.
+Advertise JAVA_DATAFLAVOR natives for local drags, including object flavors
+whose representation class is not serializable. DataTransferer filters
+those out of getFormatsForTransferableAsArray(), but intra-JVM transfers
+can pass the objects directly without serialization.
---
- .../sun/awt/wl/WLDragSourceContextPeer.java | 42 +++++++++++++++++--
- .../sun/awt/wl/WLDropTargetContextPeer.java | 11 ++++-
- 2 files changed, 48 insertions(+), 5 deletions(-)
-
+diff --git a/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java
b/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java
+index 0d4356c3b..517b35dbd 100644
+--- a/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java
++++ b/src/java.desktop/unix/classes/sun/awt/wl/WLDataSource.java
+@@ -160,6 +160,14 @@
+ setDnDIconImpl(nativePtr, scale, width, height, offsetX, offsetY,
pixels);
+ }
+
++ // Only call before publishing the source as a selection or starting a
drag.
++ void offerExtraMime(String mime) {
++ if (nativePtr == 0) {
++ throw new IllegalStateException("Native pointer is null");
++ }
++ offerMimeImpl(nativePtr, mime);
++ }
++
+ // externally synchronized, only call from one thread at a time (e.g. by
holding a lock)
+ // destroy all references to this object after this method returns
+ public void destroy() {
diff --git
a/src/java.desktop/unix/classes/sun/awt/wl/WLDragSourceContextPeer.java
b/src/java.desktop/unix/classes/sun/awt/wl/WLDragSourceContextPeer.java
-index 46747ddca..3490b9f2b 100644
+index 0ebbffd77..1053c1522 100644
--- a/src/java.desktop/unix/classes/sun/awt/wl/WLDragSourceContextPeer.java
+++ b/src/java.desktop/unix/classes/sun/awt/wl/WLDragSourceContextPeer.java
-@@ -28,6 +28,7 @@
- import sun.awt.AWTAccessor;
- import sun.awt.CustomCursor;
- import sun.awt.dnd.SunDragSourceContextPeer;
-+import sun.awt.dnd.SunDropTargetContextPeer;
-
- import java.awt.Cursor;
- import java.awt.Dimension;
-@@ -35,7 +36,9 @@
- import java.awt.Point;
- import java.awt.datatransfer.DataFlavor;
+@@ -39,6 +39,7 @@
import java.awt.datatransfer.Transferable;
-+import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
+ import java.awt.dnd.InvalidDnDOperationException;
+import java.util.HashSet;
import java.util.Map;
public class WLDragSourceContextPeer extends SunDragSourceContextPeer {
-@@ -59,7 +62,9 @@ private synchronized void sendFinishedEvent() {
- }
- didSendFinishedEvent = true;
-
-- final int javaAction = didSucceed ?
WLDataDevice.waylandActionsToJava(action) : 0;
-+ final int javaAction = didSucceed
-+ ? WLDataDevice.waylandActionsToJava(action)
-+ : DnDConstants.ACTION_NONE;
- final int x = WLToolkit.getInputState().getPointerX();
- final int y = WLToolkit.getInputState().getPointerY();
- WLDragSourceContextPeer.this.dragDropFinished(didSucceed,
javaAction, x, y);
-@@ -149,15 +154,41 @@ private void handleSourceActionChanged(int
previousWaylandAction, int waylandAct
- int javaAction = WLDataDevice.waylandActionsToJava(waylandAction);
- int previousJavaAction =
WLDataDevice.waylandActionsToJava(previousWaylandAction);
-
-- if (previousJavaAction == 0 && javaAction != 0) {
-+ if (previousJavaAction == DnDConstants.ACTION_NONE
-+ && javaAction != DnDConstants.ACTION_NONE) {
- postDragSourceDragEvent(javaAction, modifiers, x, y,
DISPATCH_ENTER);
-- } else if (previousJavaAction != 0 && javaAction == 0) {
-+ } else if (previousJavaAction != DnDConstants.ACTION_NONE
-+ && javaAction == DnDConstants.ACTION_NONE) {
- dragExit(x, y);
-- } else if (previousJavaAction != 0) {
-+ } else if (previousJavaAction != DnDConstants.ACTION_NONE) {
- postDragSourceDragEvent(javaAction, modifiers, x, y,
DISPATCH_CHANGED);
+@@ -218,6 +219,30 @@
}
}
@@ -86,59 +69,14 @@ index 46747ddca..3490b9f2b 100644
+
@Override
protected void startDrag(Transferable trans, long[] formats, Map<Long,
DataFlavor> formatMap) {
- var mainSurface = getSurface();
-@@ -167,6 +198,7 @@ protected void startDrag(Transferable trans, long[]
formats, Map<Long, DataFlavo
-
- // formats and formatMap are unused, because WLDataSource already
references the same DataTransferer singleton
- var source = new WLDragSource(trans);
-+ offerJavaFlavorMimes(source, trans);
-
- var actions = getDragSourceContext().getSourceActions();
- int waylandActions = WLDataDevice.javaActionsToWayland(actions);
-@@ -199,9 +231,11 @@ protected void startDrag(Transferable trans, long[]
formats, Map<Long, DataFlavo
- activeDragSourceUsesCursorFallback = usesCursorFallback;
- }
+ if (log.isLoggable(PlatformLogger.Level.FINE)) {
+@@ -250,6 +275,7 @@
+ // Configuring the dragImage for the source is done without holding a
lock, because it might call out to user code.
+ var source = new WLDragSource(trans, defaultAction,
peer.getDisplayScale());
try {
-+
SunDropTargetContextPeer.setCurrentJVMLocalSourceTransferable(trans);
- dataDevice.startDrag(source, mainSurface.getWlSurfacePtr(),
eventSerial);
- } catch (RuntimeException | Error e) {
- finishDragSource(source);
-+
SunDropTargetContextPeer.setCurrentJVMLocalSourceTransferable(null);
- throw e;
- }
- }
-diff --git
a/src/java.desktop/unix/classes/sun/awt/wl/WLDropTargetContextPeer.java
b/src/java.desktop/unix/classes/sun/awt/wl/WLDropTargetContextPeer.java
-index 76e47a133..757e20652 100644
---- a/src/java.desktop/unix/classes/sun/awt/wl/WLDropTargetContextPeer.java
-+++ b/src/java.desktop/unix/classes/sun/awt/wl/WLDropTargetContextPeer.java
-@@ -31,6 +31,7 @@
- import sun.awt.dnd.SunDropTargetEvent;
-
- import java.awt.Component;
-+import java.awt.dnd.DnDConstants;
- import java.awt.event.MouseEvent;
- import java.io.IOException;
++ offerJavaFlavorMimes(source, trans);
+ source.setDnDActions(waylandActions);
-@@ -67,10 +68,18 @@ private synchronized void postEvent(int event) {
- var x = peer.surfaceUnitsToJavaUnits((int) currentX);
- var y = peer.surfaceUnitsToJavaUnits((int) currentY);
- var actions =
WLDataDevice.waylandActionsToJava(currentOffer.getSourceActions());
-- int dropAction = 0;
-+ int dropAction = DnDConstants.ACTION_NONE;
-
- if (hasTarget() && event != MouseEvent.MOUSE_EXITED) {
-+ // For intra-JVM transfers, the Wayland-level action negotiation
-+ // may fail (no matching MIME types for Java object flavors).
-+ // Fall back to the source actions directly.
- dropAction =
WLDataDevice.waylandActionsToJava(currentOffer.getSelectedAction());
-+ if (dropAction == DnDConstants.ACTION_NONE
-+ && currentJVMLocalSourceTransferable != null) {
-+ dropAction =
SunDragSourceContextPeer.convertModifiersToDropAction(
-+ WLToolkit.getInputState().getModifiers(), actions);
-+ }
- }
-
- postDropTargetEvent(
+ var dragImage = getDragImage();
--
2.52.0
-