RFR: 8260528: Clean glass-gtk sizing and positioning code [v33]

Kevin Rushforth kcr at openjdk.org
Fri Dec 16 19:24:03 UTC 2022


On Sun, 11 Dec 2022 22:34:04 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:

>> This cleans size and positioning code, reducing special cases, code complexity and size.
>> 
>> Changes:
>> 
>> - cached extents: 28, 1, 1, 1 are old defaults - modern gnome uses different sizes. It does not assume any size because it varies - it does cache because it's unlikely to vary on the same system - but if it does occur, it will only waste a resize event.
>> - window geometry, min/max size are centralized in `update_window_constraints`;
>> - Frame extents (the window decoration size used for "total window size"):
>>     - frame extents are received in `process_property_notify`;
>>     - removed quirks in java code;
>>     - When received, call `set_bounds` again to adjust the size (to account decorations later received);
>> - Removed `activate_window` because it's the same as focusing the window. `gtk_window_present` will deiconify and focus it.
>> - `ensure_window_size` was a quirk - removed;
>> - `requested_bounds` removed - not used anymore;
>> - `window_configure` incorporated in `set_bounds` with `gtk_window_move` and `gtk_window_resize`;
>> - `process_net_wm_property` is a work-around for Unity only (added a check if Unity - but it can probably be removed at some point)
>> - `restack` split in `to_front()` and `to_back()` to conform to managed code;
>> - Set `gtk_window_set_focus_on_map` to FALSE because if TRUE the Window Manager changes the window ordering in the "focus stealing" mechanism - this makes possible to remove the quirk on `request_focus()`;
>> - Note:  `geometry_get_*` and `geometry_set_*` moved location but unchanged.
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove unused method

I did a fair bit of testing yesterday and today. I ran automated tests on 3 different versions of Linux: Ubuntu 16.04 (physical), Ubuntu 20.04, and Ubuntu 22.04. I ran sanity tests on two others: Oracle Linux 7.7, Oracle Linux 8.5.

Other than Ubuntu 16.04 (see below), most of my testing looks good. I did spot one new regression that needs to be looked at. I think it is related to the initial size or position reported to an app in a way that affects layout. While testing to see whether [JDK-8292922](https://bugs.openjdk.org/browse/JDK-8292922) might be fixed by this PR (it isn't, but that can be looked at separately), I ran the "DragFailure2" test program attached to that bug report. When initially drawn the top component of the border pane is about 30 pixels lower than it should be (roughly the size of the window decoration), leaving a black horizontal band between there and the actual top of the content portion of the Stage. On Ubuntu 22.04, it usually fixes itself right away (possibly due to an event that causes a redraw), so all you see is a brief flash. On Ubuntu 20.04 it does not fix itself until you interact with it in a way that will cause the window to be refreshed (e.g., temporarily moving some other w
 indow on top). See the attached screen shot.

![BadLayout](https://user-images.githubusercontent.com/34689748/208171448-1e24782d-0cb7-4218-b38c-75303ed32954.png)

Unrelated to the above, on Ubuntu 16.04, which is very old and out of support, there are three significant problems:

1. As discussed in an [earlier comment](https://github.com/openjdk/jfx/pull/915#issuecomment-1343182944), the newly created windows do not get focus and are not brought in front of the terminal that started the application. The workaround is to set the Focus Prevention Level to OFF in compiz config settings tool.
2. A Stage that is set to full screen before being initially shown will not restore to the correct size when exiting full screen (to reproduce, run the HelloFullscreen app and press the ESC, or run the `RestoreSceneSizeTest` system test).
3. Live resize no longer happens when resizing a Window; resizing is also very slow

I don't think any of these three Ubuntu 16.04 problems should block this PR from going in. A release note might be in order for the first problem, especially since it will provide a good place to document the workaround. I note that even though Ubuntu 16.04 is _very_ out of date, there might be other less common distros that still include Compiz.

I also reviewed the code and didn't see anything of concern.

As noted above, [JDK-8292922](https://bugs.openjdk.org/browse/JDK-8292922) is still reproducible even with this patch applied, so will need to be handled as a follow-up bug, either by using the approach I prototyped in PR #905 or some other approach. We can discuss it once this PR is integrated.

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

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


More information about the openjfx-dev mailing list