This PR fixes a Warning I always get when JavaFX and Swing are both mixed 
together in an application.
The error: `XSetErrorHandler() called with a GDK error trap pushed. Don't do 
that.`

The problem is that we call `gdk_error_trap_push`, which will result in this 
warning when there was already an `XSetErrorHandler` set previously, in this 
case Swing.

See also:
- https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/x11/gdkmain-x11.c#L313

Checking the Swing code, we just call `XSetErrorHandler` and not 
`gdk_error_trap_push`. See also:

- 
[XlibWrapper](https://github.com/openjdk/jdk/blob/master/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c#L1328)
- 
[gtk3_interface](https://github.com/openjdk/jdk/blob/master/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c#L679)

`gdk_error_trap_push` will call `XSetErrorHandler`, so we might as well do that 
directly.
I checked the code in `gdk_error_trap_push` I do not see any problems with this 
new approach.

cc @tsayao, a review is appreciated.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - 8156779: GTK3: warning when running SwingNode applications

Changes: https://git.openjdk.org/jfx/pull/2296/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2296&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8156779
  Stats: 8 lines in 1 file changed: 6 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jfx/pull/2296.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2296/head:pull/2296

PR: https://git.openjdk.org/jfx/pull/2296

Reply via email to