RFR: 8236651: Simplify and update glass gtk backend

Kevin Rushforth kcr at openjdk.java.net
Thu Feb 13 23:58:52 UTC 2020


On Mon, 3 Feb 2020 17:26:32 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:

>> It's ready for an initial look.
>> 
>> If anyone has issues with Linux, I will fix it.
> 
> **Code Changes**
> 
> * glass_window.cpp / glass_window.h
>     * Removed WindowContextPlug and WindowContextChild (that were used for applets / web start) and moved everything to
> one class named WindowContext (since inheritance was no required anymore)
>     * Changed set_enabled() to use gtk_widget_set_sensitive instead of custom code;
>     * Moved to gtk signals instead of gdk events (to use gtk_widget_set_sensitive and gtk_grab_add);
>     * Frame Extents: Removed the code to request extents and gtk already does it by default;
>     * Size calculation: Reworked size calculation code. In general, X windows are content size instead of whole window size (considering extents - frame decorations). OpenJfx uses "whole window size" as  window sizes, so it requires a "hack" to recalculate sizes when set_bounds() is called with window sizes instead of content sizes. The rework was to simplify code paths and make it more straightforward.
>     * Other Size calculation changes:
>         * Use gtk_window_set_default_size() for initial size which is the appropriate function; 
>         * Gravity is now ignored as it is on Windows glass impl;
>         * Avoid sending same sizes to Java;
>         * Introduced calculate_adjustments() which is a fallback when frame extents is not present (it's optional  to window managers to implement it);
>     * Geometry: Min / Max sizes - reworked it to simplify / Concentrated geometry changes on
>       apply_geometry().
>     * Mouse grab: Reworked it to use to correct functions according to gtk+ version;
>     * Draw: Reworked it to use the correct calls accord to gtk+ version changes;
>     * Fixed JDK-8237491;
>     * Moved background code to paint() as gtk3 uses styles to set the background and other functions were deprecated;
>     * Reorganized function order on glass_window.cpp to match glass_window.h
> 
> 
> * GlassCursor.cpp
>     * Gtk+3 uses a name-like-css approach - so it was properly ported to gtk3 way;
>     * Reworked Gtk+2 to use a function instead of manual calls to find the cursor;
> 
> * GtkWindow.java
>     * Moved the extents special case to native glass;
> 
> * GlassApplication.cpp
>     * Removed Gdk events where possible (it's now on glass_window as signals);
>     * Removed applet/web start code;
> 
> * GlassView.cpp
>     * Changes to reflect frame extents rework on glass_window
> 
> * GlassWindow.cpp
>     * WindowContextTop -> WindowContext
>     * Removed applet / web start code;
>     * Removed frame extents (which is not called anymore due to GtkWindow.java change);
> 
> * glass_general.cpp
>     * Removed functions that became unused;
>     * Added is_grab_disabled() that is used on glass_window
> 
> * glass_window_ime.cpp
>     * WindowContextTop -> WindowContext;
>     
> * glass_dnd.cpp / glass_dnd.h
>     * Ported to Gtk signals;
>     * Use all possible image formats (supported by GdkPixbuf / OpenJfx) - .gif is now possible (for ex.);
>     * Allow COMPOUND_TEXT;
>     * Do not request content while dragging;
>     * Reduce overall code size.

This is going to need further discussion on the mailing list as indicated above, so it is still premature to review it (i.e., it should still be considered effectively a "WIP" until that discussion happens). Additionally, this is a significant and risky change, so I'd like additional eyes on it when we do get to the point of reviewing it.

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

PR: https://git.openjdk.java.net/jfx/pull/77


More information about the openjfx-dev mailing list