Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8236651: Simplify and update glass gtk backend #77

Open
wants to merge 15 commits into
base: master
from

Conversation

@tsayao
Copy link

tsayao commented Jan 6, 2020

Summary

  • Simplify and update the Gtk glass backend, making Linux a first-class OpenJFX platform.

Goals

  • Make Linux a first-class OpenJFX platform (see Motivation);
  • Simplify the code and reduce it's size;
  • Update to gtk3 (it was originally a port from gtk2);
  • Remove unused code (such as applets and web start);
  • Prepare the ground for a possible future Wayland support.

Testing

./gradlew -PEXTRA_TEST_ARGS='-Djavafx.gtk.experimental=true' -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Download

$ git fetch https://git.openjdk.java.net/jfx pull/77/head:pull/77
$ git checkout pull/77

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 6, 2020

👋 Welcome back tsayao! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request (refresh this page to view it).

@openjdk openjdk bot added the rfr label Jan 6, 2020
@mlbridge
Copy link

mlbridge bot commented Jan 6, 2020

Webrevs

@kevinrushforth
Copy link
Member

kevinrushforth commented Jan 6, 2020

Please, mark it as WIP.

You can do this by editing the title and adding WIP: as a prefix.

@kevinrushforth kevinrushforth changed the title 8236651: Simplify and update glass gtk backend WIP: 8236651: Simplify and update glass gtk backend Jan 6, 2020
@openjdk openjdk bot removed the rfr label Jan 6, 2020
@kevinrushforth
Copy link
Member

kevinrushforth commented Jan 6, 2020

This sort of enhancement needs to be discussed on the openjfx-dev mailing list first. While the WIP PR might be used to illustrate what you have in mind to propose, it is premature to actually review the implementation without first discussing whether and it makes sense to do it, what the high-level goals are, etc.

@tsayao
Copy link
Author

tsayao commented Jan 6, 2020

I understand. Will do that when the code works 100%. I have submitted the PR to avoid duplicated efforts and let people test it (if anyone is willing).

@mlbridge
Copy link

mlbridge bot commented Jan 13, 2020

Mailing list message from Thiago Milczarek Sayao on openjfx-dev:

Hello users of this list.

While fixing some bugs on glass-gtk backend I had some noticed some quite complex logic to mimic windows behavior on linux - for example, on linux window decorations are a job do the window manager - which may vary. So window sizes does not account decorations.

Also, the gtk2 -> gtk3 migration could use some improvement because gtk3 does a lot of "deprecations" - even inside the gtk3 release cycle.

There was a lot of code regarding applets and web start, which are discontinued.

So this PR simplifies te code (specially sizing a positioning of windows), updates to gtk3 recent changes (while being compatible with older releases) and removes web start / applet code.

It also eliminates some restrictions on DND. It will work with all text formats and all image formats that both gtk and javafx supports.

It's working very well. So if anyone is willing to test, or take a look.

I need to do more testing on:

* Mouse grabs to mimic windows behavior;
* Native _setBackground call

Any pointers on uses cases for this is appreciated.

Cheers.

________________________________
De: openjfx-dev <openjfx-dev-bounces at openjdk.java.net> em nome de Thiago Milczarek Sayao <tsayao at openjdk.java.net>
Enviado: s?bado, 11 de janeiro de 2020 22:00
Para: openjfx-dev at openjdk.java.net <openjfx-dev at openjdk.java.net>
Assunto: Re: [Rev 08] RFR: WIP: 8236651: Simplify and update glass gtk backend

This proposed change does the following:

- Ports DND target to use GTK reducing code size and adding extra text / image formats (such as .gif);
- Use gtk signals instead of gdk events (also to reduce code size);
- Simplifies geometry (sizing/positioning) with a more straightforward code (less special cases) ;
- Replaces (pointer and focus) grabbing with a gtk approach;
- Reworked frame extents (the wm extension to get decoration sizes) to reduce size and complexity;
- Simplified cursor changing;
- Reduced the use of gtk/gdk deprecated functions;

In general it reduces code size and complexity and hands more work to gtk.

Important notice: As I could not test the code for handling web start and web applets because browsers do not support it anymore and java has removed "javaws", I took the liberty to remove the code. Will restore if necessary.

![image](https://user-images.githubusercontent.com/30704286/71791073-58779d00-3012-11ea-89e5-07588f7a41cc.png)

The pull request has been updated with 1 additional commit.

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

Added commits:
- 9850bb7: Fix dialog with owner sizing

Changes:
- all: https://git.openjdk.java.net/jfx/pull/77/files
- new: https://git.openjdk.java.net/jfx/pull/77/files/209b7ac7..9850bb7

Webrevs:
- full: https://webrevs.openjdk.java.net/jfx/77/webrev.08
- incr: https://webrevs.openjdk.java.net/jfx/77/webrev.07-08

Stats: 7 lines in 1 file changed: 0 ins; 3 del; 4 mod
Patch: https://git.openjdk.java.net/jfx/pull/77.diff
Fetch: git fetch https://git.openjdk.java.net/jfx pull/77/head:pull/77

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

Merge master
@tsayao tsayao force-pushed the tsayao:jdk_8236651 branch from 0e07116 to 694641f Jan 23, 2020
@tsayao tsayao changed the title WIP: 8236651: Simplify and update glass gtk backend 8236651: Simplify and update glass gtk backend Jan 29, 2020
@openjdk openjdk bot added the rfr label Jan 29, 2020
@tsayao tsayao requested a review from kevinrushforth Jan 31, 2020
@tsayao
Copy link
Author

tsayao commented Feb 3, 2020

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.
@openjdk openjdk bot added outdated and removed outdated labels Feb 3, 2020
@kevinrushforth
Copy link
Member

kevinrushforth commented Feb 13, 2020

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.

@kevinrushforth
Copy link
Member

kevinrushforth commented Feb 13, 2020

/reviewers 3

@openjdk
Copy link

openjdk bot commented Feb 13, 2020

@kevinrushforth
The number of required reviews for this PR is now set to 3 (with at least 1 of role reviewers).

Merge from jfx
@tsayao tsayao force-pushed the tsayao:jdk_8236651 branch 2 times, most recently from cddf3ad to f7a84fd Feb 16, 2020
Merge
@tsayao
Copy link
Author

tsayao commented Mar 3, 2020

I have been testing this for several days on ubuntu 18.04 and it's working good. It pass system tests, runs Ensemble 8 and Scenebuilder.

Will have to do some tests on 16.04.

merge from jfx
@openjdk openjdk bot removed the rfr label Mar 19, 2020
@tsayao
Copy link
Author

tsayao commented Mar 24, 2020

Ubuntu 20.04 Test Results

Updated April 2nd.

image

Merge upstream
@tsayao tsayao force-pushed the tsayao:jdk_8236651 branch from 381e8d1 to 192114e Apr 1, 2020
@openjdk openjdk bot added the rfr label Apr 1, 2020
@tsayao
Copy link
Author

tsayao commented Apr 1, 2020

Test on 16.04 (without Webkit - it does not build on 16.04 anymore)

Updated April 2nd.

image

Note: DatePickerTest works when run alone.

@tsayao tsayao force-pushed the tsayao:jdk_8236651 branch from 144f346 to f52f63b Apr 3, 2020
@tsayao
Copy link
Author

tsayao commented Apr 3, 2020

I will keep testing it, but I think it's looking good.

@kevinrushforth
Copy link
Member

kevinrushforth commented Apr 3, 2020

I see a lot of work going into this.

In order for this to progress beyond the prototype or concept phase, we will need to have a discussion on the openjfx-dev mailing list in a separate email thread that is not directly tied to the PR -- meaning not a reply to the RFR thread and not a comment in the PR.

@tsayao When you are ready, please send a short email (not a reply to any existing message) to openjfx-dev@openjdk.java.net with the following:

  1. A short summary of the proposed enhancement
  2. The goals of the proposed enhancement
  3. A description of the proposed changes (basically, the bullet items from the description of this PR)
  4. A pointer to this PR for reference

I want to focus the openjfx-dev discussion on getting general agreement on the overall approach rather than on the details of the code changes. This is a big change, so getting feedback on the overall goals and approach is important; review comments in the PR aren't the best way to have that discussion.

We aren't following the formal JEP process for JavaFX features, but the JEP template in JEP 2 is a good format to follow for large or high-impact features to make sure that the motivation, goals, and tradeoffs are documented.

Finally, I note that this will eventually need a CSR, but that can be done once there is agreement on the approach, and when this is farther along in the review process.

@kevinrushforth
Copy link
Member

kevinrushforth commented Apr 3, 2020

/csr

@openjdk
Copy link

openjdk bot commented Apr 3, 2020

@kevinrushforth has indicated that a compatibility and specification (CSR) request is needed for this pull request.
@tsayao please create a CSR request and add link to it in JDK-8236651. This pull request cannot be integrated until the CSR request is approved.

@openjdk openjdk bot added the csr label Apr 3, 2020
@tsayao
Copy link
Author

tsayao commented Apr 3, 2020

@kevinrushforth Ok, will do as the instructions. Thanks.

Cleaning

Cleaning + change year to 2020

Fix crash

Fix crash

Fix crash

Revert idea files

Fix flickering and sizing issues

Pass more tests

Small fixes

Use gtk_window_set_default_size for before-map sizing which is the appropriate function

Better alternative calculation for no _NET_FRAME_EXTENTS WM extension

Fix dialog with owner sizing

Maybe fix background

Big cleanup

Allow undecorated windows to be maximized.

Mouse pointer grab

Work on mouse grab

8233747: JVM crash in com.sun.webkit.dom.DocumentImpl.createAttribute

Reviewed-by: kcr, ghb

8234474: [macos 10.15] Crash in file dialog in sandbox mode

Reviewed-by: arapte, prr

8236648: javadoc warning on Text::tabSizeProperty method

Reviewed-by: kcr

8233798: Ctrl-L character mistakenly removed from gstreamer.md

Reviewed-by: almatvee

8232589: Remove CoreAudio Utility Classes

Reviewed-by: kcr, jvos

8236448: Remove unused and repair broken Android/Dalvik code

Reviewed-by: kcr

8236808: javafx_iio can not be used in static environment

Reviewed-by: kcr

8236733: Change JavaFX release version to 15

Reviewed-by: arapte

8232128: Better formatting for numbers

Reviewed-by: rhalade, ghb

8232214: Improved internal validations

Reviewed-by: ghb, rhalade

8237078: [macOS] Media build broken on XCode 11

Reviewed-by: kcr, almatvee

JDK-8236651 Simplify and update glass gtk backend

Cleaning

Cleaning + change year to 2020

Fix crash

Fix crash

Fix crash

Revert idea files

Fix flickering and sizing issues

Pass more tests

Small fixes

Use gtk_window_set_default_size for before-map sizing which is the appropriate function

Better alternative calculation for no _NET_FRAME_EXTENTS WM extension

Fix dialog with owner sizing

Maybe fix background

Big cleanup

Allow undecorated windows to be maximized.

Mouse pointer grab

Work on mouse grab

Fix Initial Size

Revert "Fix Initial Size"

This reverts commit 0c982d6

Better fix for initial size

8157224: isNPOTSupported check is too strict

Reviewed-by: kcr

8233942: Update to 609.1 version of WebKit

Co-authored-by: Guru HB <guru.hb@oracle.com>
Co-authored-by: Arun Joseph <arun.aj.joseph@oracle.com>
Co-authored-by: Kevin Rushforth <kevin.rushforth@oracle.com>
Reviewed-by: kcr, jvos, ajoseph

8236753: Animations do not play backwards after being stopped

Reviewed-by: kcr, arapte

8237823: Mark TextTest.testTabSize as unstable

Reviewed-by: prr

8236912: NullPointerException when clicking in WebView with Button 4 or Button 5

Reviewed-by: ghb, kcr

8232824: Removing TabPane with strong referenced content causes memory leak from weak one

Reviewed-by: kcr, aghaisas

8237372: NullPointerException in TabPaneSkin.stopDrag

Reviewed-by: arapte

8237003: Remove hardcoded WebAnimationsCSSIntegrationEnabled flag in DumpRenderTree

Reviewed-by: kcr

8238249: GetPrimitiveArrayCritical passed with hardcoded FALSE value

Reviewed-by: kcr

8088198: Exception thrown from snapshot if dimensions are larger than max texture size

Reviewed-by: arapte, kcr

8237833: Check glyph size before adding to glyph texture cache

Reviewed-by: kcr

8237782: Only read advances up to the minimum of the numHorMetrics or the available font data.

Reviewed-by: kcr

8237770: Error creating fragment phong shader on iOS

Reviewed-by: kcr

8237944: webview native cl "-m32" unknown option for windows 32-bit build

Reviewed-by: kcr

8231513: JavaFX cause Keystroke Receiving prompt on MacOS 10.15 (Catalina)

Reviewed-by: prr, jvos

8237975: Non-embedded Animations do not play backwards after being paused

Reviewed-by: kcr, arapte

8237503: Update copyright header for files modified in 2020

Reviewed-by: arapte

Revert back focus mechanism

Fix seat_grab param

Fix POPUP window positioning

Fix bug on extents calculation

Ajustments

Fix pointer grab bug

Remove unused var

8237469: Inherited styles don't update when node is moved

Reviewed-by: dgrieve, aghaisas, kcr

8238526: Cherry pick GTK WebKit 2.26.3 changes

Reviewed-by: kcr, jvos

8237453: [TabPane] Incorrect arrow key traversal through tabs after reordering

Reviewed-by: kcr, aghaisas

8236839: System menubar removed when other menubars are created or modified

Reviewed-by: kcr, aghaisas

8227619: Potential memory leak in javafx.scene.control.ListView

Reviewed-by: kcr, aghaisas

Adjust comment

Adjust comment

Fix compile error on implicit function declaration on updated g++

fix compilation on ubuntu 16.04

calculate less if _NET_FRAME_EXTENTS is available

Fixes for WM that do not support frame extents

Mouse grab fixes on Ubuntu 20.04 Gtk+3.20+

Better comment

Fix Tab

Prefer content size over window size.

Fixes for ubuntu 16.04 (which delays frame extents)

Just comment fixing

More fixes for 16.04 (i mean gtk+ version that ships on 16.04, plus the different window manager - Unity).

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Fix unfullscreen bug on older gtk+

Only work-around Unity bug if Unity is the Window Manager (Ubuntu 16.04).

Separate the new gtk glass impl

Make gtk3 compile without deprecations

Make gtk3 compile without deprecations

Make gtk3 compile without deprecations
@tsayao tsayao force-pushed the tsayao:jdk_8236651 branch from 91d9846 to 8973d38 Apr 5, 2020
tsayao and others added 9 commits Apr 5, 2020
Thiago M Sayao
Merge from upstream
Thiago M Sayao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.