mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 01:19:28 +01:00
JBR-9642 Wayland: Call wl_data_offer.finish()
This patch adds a call to wl_data_offer.finish() upon a successful completion of a drag-and-drop operation, as well as more synchronized annotations in WLDataOffer, to match the existing ones. Calling finish() doesn't seem to be required by most compositors when performing drag-and-drop, at least within the same window. Other toolkits, such as Qt, only call it when dealing with cross-application drag-and-drop. In the interest of maximal compatibility, this patch implements calling finish() always when a drag-and-drop operation succeeds.
This commit is contained in:
@@ -68,7 +68,7 @@ public class WLDataOffer {
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] receiveData(String mime) throws IOException {
|
||||
public synchronized byte[] receiveData(String mime) throws IOException {
|
||||
int fd;
|
||||
|
||||
if (nativePtr == 0) {
|
||||
@@ -86,7 +86,7 @@ public class WLDataOffer {
|
||||
}
|
||||
}
|
||||
|
||||
public void accept(long serial, String mime) {
|
||||
public synchronized void accept(long serial, String mime) {
|
||||
if (nativePtr == 0) {
|
||||
throw new IllegalStateException("nativePtr is 0");
|
||||
}
|
||||
@@ -94,15 +94,17 @@ public class WLDataOffer {
|
||||
acceptImpl(nativePtr, serial, mime);
|
||||
}
|
||||
|
||||
public void finishDnD() {
|
||||
public synchronized void finishDnD() {
|
||||
if (nativePtr == 0) {
|
||||
throw new IllegalStateException("nativePtr is 0");
|
||||
}
|
||||
|
||||
finishDnDImpl(nativePtr);
|
||||
if (selectedAction != 0) {
|
||||
finishDnDImpl(nativePtr);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDnDActions(int actions, int preferredAction) {
|
||||
public synchronized void setDnDActions(int actions, int preferredAction) {
|
||||
if (nativePtr == 0) {
|
||||
throw new IllegalStateException("nativePtr is 0");
|
||||
}
|
||||
|
||||
@@ -106,7 +106,10 @@ public class WLDropTargetContextPeer extends SunDropTargetContextPeer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doDropDone(boolean success, int dropAction, boolean isLocal) {
|
||||
protected synchronized void doDropDone(boolean success, int dropAction, boolean isLocal) {
|
||||
if (success && currentOffer != null) {
|
||||
currentOffer.finishDnD();
|
||||
}
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user