RFR: 8236651: Simplify and update glass gtk backend

Thiago Milczarek Sayao tsayao at openjdk.java.net
Mon Feb 3 17:26:49 UTC 2020

On Wed, 29 Jan 2020 12:16:49 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:

>> To anyone willing to test this, here is a binary test-release for linux:
>> https://github.com/tsayao/jfx/releases/tag/test-glass-gtk
> 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;
    * Focus Grab: Use gtk_grab_add and gtk window group functions instead of custom code;
    * 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
    * 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.


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

More information about the openjfx-dev mailing list