RFR: 8280994: [XWayland] Drag and Drop does not work in java -> wayland app direction [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Mon Jun 5 06:53:22 UTC 2023


On Fri, 2 Jun 2023 13:53:46 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java line 448:
>> 
>>> 446:         }
>>> 447: 
>>> 448:         if (isXWaylandDndAwareWindow(window)) {
>> 
>> https://github.com/openjdk/jdk/blob/ec4493f5273746fdbc2a9c9451c15050d04730d2/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java#L441-L444
>> 
>> Is it not required to do `win != 0 && isXWaylandDndAwareWindow()`  since we are returning value from here too?
>
> Not sure what is the purpose of `win != 0 && isXWaylandDndAwareWindow()`, it'll change the behavior for the  X11 session(isXWaylandDndAwareWindow is always false in this case).
> 
> `findClientWindow` is a recursive function, and the `isXWaylandDndAwareWindow` check is already performed within the call from line 442.

Yes, since it's a recursive function, I was just trying to understand if `isXWaylandDndAwareWindow `is called at right place
I tried a simple recursive program similar to `findClientWindow `which gives StackOverflowError so I was thinking if `findClientWindow  `can also give SOF and whether we should call `isXWaylandDndAwareWindow ` at l446 or l439


public class Recursion {
    public static void main(String[] args) {
        long value = 22;
        System.out.println(test(value));
    }

    private static long test(long value) {
        long arr[] = {1L,2L,3L};
        for (long i : arr) {
            long val = test(i);
            if (val != 0) {
                System.out.println("val " + val);
                return val;
            }
        }
        if (getValue(value) == 22) {
            return value;
        }
        return 0;
    }
    private static long getValue(long value) {
        return value;
    }
}

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14266#discussion_r1217601483



More information about the client-libs-dev mailing list