This is a continuation to 
[JDK-8236651](https://bugs.openjdk.org/browse/JDK-8236651) and it aims to 
stabilize the linux glass gtk backend.


Overall, it has been made more robust within its scope, particularly in terms 
of sizing, positioning, and state management.

List of changes:
1. It embraces the asynchronous nature of X11 by reporting geometry changes 
only upon receiving a configure event, rather than immediately as before. This 
is because it merely requests changes from the window manager, which may or may 
not honor them. However, it still reports changes immediately in certain 
special cases, such as when the window has not yet been realized (i.e., when 
the window has not actually been created yet). One scenario where this behavior 
is evident is when we request the window to move to position (0, 0), but the 
window manager instead places it in the top-right corner where panels converge.
2. FullScreen now keeps track of geometry changes and apply them on restore as 
documented on Stage.java. No geometry changes affects the FullScreen state;
3. States (fullscreen, maximized and iconify) are now reported back to Java 
when it actually happens rather than immediately (except when not realized);
4. When a window is maximized, it will ignore geometry changes and restore to 
the geometry it had prior to being maximized. After some testing, I believe 
this is the best behavior for platform compatibility;
5. Unifies the WindowContext class: previously, there were three separate 
classes—two of which (for applets and Java Web Start) were removed, leaving 
only one. However, the supporting infrastructure was still there partially. 
[Unify WindowContext in glass-gtk](https://bugs.openjdk.org/browse/JDK-8305768)
6. `setAlpha` and `setBackground` were removed because they no longer function 
correctly due to the lack of shared rendering. It's not possible to paint a 
background using GTK and then render custom content on top of it, unless the 
rendering is done by Gtk (it is not). It is possible to keep the background by 
painting with cairo, and make it work with software rendering, but that's a 
very remote scenario;
7. Tests were added and re-enabled to ensure everything works correctly. The 
stage tests now cover various StageStyle configurations, as I found that 
`DECORATED` stages often behave differently from `UNDECORATED` or `UTILITY` 
stages;
8. Added Logs for debugging. Enable it with ` -PCONF=DebugNative`;
9. It no longer keeps track of geometry internally, as GTK already manages this 
- except in special cases, such as when the window has not yet been realized. 
Previously, it used BoundsType to distinguish between "Window Bounds" and 
"Content Bounds." Now, it consistently uses "Content Bounds" and converts them 
to "Window Bounds" by adding extents (decoration sizes) when necessary;
10. Old work-arounds dating back to Ubuntu 16.04 with Compiz were removed. 

A simple manual test is also provided but I would prefer to move it's 
functionality to monkey tester:
`java @build/run.args tests/manual/stage/TestStage.java `


List of fixed issues:

1. [[Linux] Stage.setMaximized() before show() does not 
persist](https://bugs.openjdk.org/browse/JDK-8316425)
2. [[Linux] Intermittent test failure in 
IconifyTest.canIconifyDecoratedStage](https://bugs.openjdk.org/browse/JDK-8316891)
3. [[Linux] Initial window position is not centered on Ubuntu 24.04 / 
Xorg](https://bugs.openjdk.org/browse/JDK-8337400)
4. [[Linux] Initial window position is not centered on Ubuntu 24.04 / 
Xorg](https://bugs.openjdk.org/browse/JDK-8337400)
11. [[Linux] Some of the SizeToSceneTest fail in Ubuntu 
24.04](https://bugs.openjdk.org/browse/JDK-8353612)
12. [[Linux] View size glitch when resizing past max window 
size](https://bugs.openjdk.org/browse/JDK-8355073)

The Xorg-related bugs were not issues within JavaFX itself, so they were 
addressed through workarounds - such as delaying the initial state and 
re-checking the geometry when the window is first mapped.

**IMPORTANT**: While this is open for review, please allow me some time to 
further polish and test it before final approval. Feedback is 
welcome—especially regarding any need to disable the new tests on specific 
platforms, as some of them might fail.

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

Commit messages:
 - [Linux] Simplify and update glass gtk backend: window sizing, positioning, 
and state management issues

Changes: https://git.openjdk.org/jfx/pull/1789/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1789&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8354943
  Stats: 3139 lines in 23 files changed: 2101 ins; 606 del; 432 mod
  Patch: https://git.openjdk.org/jfx/pull/1789.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1789/head:pull/1789

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

Reply via email to