Skip to content

Conversation

@ujpv
Copy link
Collaborator

@ujpv ujpv commented Feb 10, 2025

No description provided.

@ujpv
Copy link
Collaborator Author

ujpv commented Feb 10, 2025

@ujpv ujpv requested a review from YaaZ February 10, 2025 19:54
@ujpv ujpv force-pushed the kharitonov/shared_textures_rebase branch from f40d316 to 6dc24d6 Compare February 17, 2025 08:37
@ujpv ujpv force-pushed the kharitonov/shared_textures_rebase branch 8 times, most recently from 9f997c9 to eb58b2d Compare August 1, 2025 12:41
@ujpv ujpv force-pushed the kharitonov/shared_textures_rebase branch from a4f70d6 to cff0f0e Compare October 15, 2025 10:45
@ujpv ujpv force-pushed the kharitonov/shared_textures_rebase branch 4 times, most recently from eacb1fe to c09273b Compare December 1, 2025 17:25
dmitrii-drobotov and others added 27 commits December 3, 2025 01:02
* Add null checks for variables that can have null values to prevent hard crash
* Add missing CHECK_EXCEPTION after JNI call
* Add missing DeleteLocalRef for axComponent

(cherry picked from commit 96fcd9e)
This patch implements a workaround for a bug that exists on KWin 6.5. For
some reason, KWin sends a wl_data_source.action(0) event immediately
after wl_data_source.dnd_drop_finished(). This makes the drag source
think that the DnD operation failed, even though it succeeded.
The workaround it to ignore the wl_data_source.action() events
after a successful wl_data_source.dnd_drop_finished()

In addition to this, this patch also fixes some inconsistency with
translating between AWT and Wayland DnD operation masks. This doesn't
have any visible effect though, since the mask values happen to be the
same.
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.
Use -Dsun.awt.wl.WindowDecorationStyle=server to activate
KWin does not accept the serial number from a "keyboard enter" event in
a window activation request, while a recent input event serial is OK.
Gnome, however, requires the "keyboard enter" event serial.
Shortly said, we don't need to handle recursive invocations of the `java.io` to nio adapters, while this recursion leads to problems.

# Problem 

Since we're not allowed to modify public API of Java classes, an unreliable workaround `IoOverNio.PARENT_FOR_FILE_CHANNEL_IMPL` had been introduced. This trick lets us pass some object into a called function without adding a new function argument.

The trick backfired at the following code:

```java
// at java.base/java.io.IoOverNioFileSystem.initializeStreamUsingNio (simplified code)
IoOverNio.PARENT_FOR_FILE_CHANNEL_IMPL.set(owner);
return initializeStreamsUsingNio0(owner, nioFs, file, nioPath, optionsForChannel, channelCleanable);


// at java.base/java.io.IoOverNioFileSystem.initializeStreamsUsingNio0
channel = nioFs.provider().newFileChannel(nioPath, optionsForChannel);
```

The intention of setting `PARENT_FOR_FILE_CHANNEL_IMPL` is to path `owner` inside a constructor of `sun.nio.ch.FileChannelImpl` which may be called by `newFileChannel(nioPath, optionsForChannel)`.

The implementation of `newFileChannel` in IntelliJ triggered class loading. The classloader of IntelliJ triggered the call `java.nio.file.Files.readAllBytes`. The latter code also invoked the constructor of `FileChannelImpl`, and the constructor got from the thread-local variable the value for the field `parent`. That value was supposed to be passed to a different invocation of the constructor.

The observable result of this bug was a `NullPointerExceptions` from `java.io.FileOutputStream.close`. Hypothetically, this bug could also lead to closing file descriptors earlier as expected in other unpredictable places.

# Rejected approaches

* The cleanest solution could be passing specific function arguments through function arguments. 
  
  However, we may neither create a new public function in the module `java.base`, nor add an argument to an existing one. Thus, we have to keep dealing with thread-local variables.
* To hold several values in the thread-local variable. 

  In this case, the constructor of `FileChannelImpl` should somehow choose the right value from the list. The only possible way for filtering values is by the provided path. It doesn't look like a performant and reliable solution.
 
# Chosen solution
 
This commit disables recursive invocations of `java.io` from `java.nio` adapters.
  
The chosen solution is tied to specifics of IntelliJ. The reason for introducing java.io over java.nio adapter was to be able to access files from remote machines without rewriting old code. It is not expected that an implementation of `java.nio.file.spi.FileSystemProvider` accesses the file system using `java.io`. The only imaginable way to get a `java.io` call from `java.nio` is class loading. In case of IntelliJ, it's assumed that the class loader never accesses classes and jars from a remote machine.
Updates the CI build scripts to look for wayland protocols in
/opt/wayland-protocols
…n Linux in the 2025.2.5 version

JBR-9714: Horizontal scroll stopped working after 2025.2.5 update
JBR-9715: Horizontal touchpad scroll stopped working after 2025.2.5 update

- Disabling the part of JDK-8351907 that disables all mouse extra buttons for XWayland GNOME of version >= 47.
- Adding a manual test for mouse back and forth buttons.

(cherry picked from commit caf64ee)
(cherry picked from commit 6efade4)
…tMethodZwpTextInputV3 logger is enabled

Resetting the text iterator of each InputMethodEvent after it gets logged.

(cherry picked from commit 3355214)
This patch implements support for the xdg_toplevel_icon_v1 protocol.
The image choosing logic is just to pick the largest square image for
now. The image scale factor is also not set, since it's unclear if it's
needed and how it interacts with multi-monitor setups.

NOTE: this patch introduces a dependency on wayland-protocols 1.37+.
Use getRootPane()
.putClientProperty("wlawt.popup_position_unconstrained", Boolean.TRUE)
to enable unconstrained popup positioning.
@ujpv ujpv force-pushed the kharitonov/shared_textures_rebase branch from 9b43b01 to 0f7f79e Compare December 3, 2025 17:44
@ujpv ujpv force-pushed the kharitonov/shared_textures_rebase branch from 0f7f79e to 82af9cd Compare December 3, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.