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

Kevin Rushforth kcr at openjdk.org
Fri Feb 10 00:02:58 UTC 2023


On Mon, 23 Jan 2023 03:51:33 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 four additional commits since the last revision:
> 
>  - Fix JDK-8089923
>  - Fix JDK-8089923
>  - Fix JDK-8089923
>  - Fix deiconify regression

I did some more testing with the latest version, which includes the debug print statements. It runs fine on Ubuntu 16.04 with the just the minor previously reported failures.

On Ubuntu 20.04 I still see the race condition where most of the time the content is offset and the black band appears right below the window decoration. I managed to try it on a physical machine and get the same result, so it isn't due to running in VirtualBox. Here is the debug output:


$ java DragFailure2
set gravity: 0.500000, 0.333333
set_bounds -> x = 745, y = 231, w = 500, h = 300, cw = -1, ch = -1
notify window size -> w = 500, h = 300
notify view size -> cw = 500, ch = 300
set_bounds -> x = -1, y = -1, w = 500, h = 300, cw = 500, ch = 263
notify window size -> w = 500, h = 300
notify view size -> cw = 500, ch = 263
notify window size -> w = 500, h = 300
notify view size -> cw = 500, ch = 263


Clicking anywhere causes it to refresh.

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

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


More information about the openjfx-dev mailing list