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

8260528: Clean glass-gtk sizing and positioning code #915

Closed
wants to merge 78 commits into from

Conversation

tsayao
Copy link
Collaborator

@tsayao tsayao commented Oct 13, 2022

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;

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8260528: Clean glass-gtk sizing and positioning code

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/915/head:pull/915
$ git checkout pull/915

Update a local copy of the PR:
$ git checkout pull/915
$ git pull https://git.openjdk.org/jfx.git pull/915/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 915

View PR using the GUI difftool:
$ git pr show -t 915

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/915.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 13, 2022

👋 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. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 13, 2022

⚠️ @tsayao This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@tsayao tsayao changed the title WIP: 8260528: Clean glass-gtk sizing and positioning code 8260528: Clean glass-gtk sizing and positioning code Oct 16, 2022
@openjdk openjdk bot added the rfr Ready for review label Oct 16, 2022
@mlbridge
Copy link

mlbridge bot commented Oct 16, 2022

Webrevs

@tsayao tsayao force-pushed the clean_glass_gtk branch 2 times, most recently from 9fb69ec to bfdb4ad Compare October 17, 2022 00:11
@tsayao
Copy link
Collaborator Author

tsayao commented Feb 19, 2023

It's now ready for a re-review. Black header is gone, iconify tests pass.

@kevinrushforth
Copy link
Member

I can confirm that the black header area is fixed on 20.04. I'll do some final testing and code review soon.

@kevinrushforth
Copy link
Member

I ran a full set of headful tests on both Ubuntu 20.04 and 22.04. The only remaining problem I see is a new failure on one test on both platforms:

$ gradle --info -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests CheckWindowOrderTest

CheckWindowOrderTest > topWindowShouldBeTheLast FAILED
    java.lang.AssertionError: Last Window Should be Focused
        at org.junit.Assert.fail(Assert.java:89)
        at org.junit.Assert.assertTrue(Assert.java:42)
        at test.robot.javafx.stage.CheckWindowOrderTest.topWindowShouldBeTheLast(CheckWindowOrderTest.java:57)

That test passes without the patch from this PR.

@tsayao
Copy link
Collaborator Author

tsayao commented Feb 26, 2023

It's working now, but I found out that calling gtk_window_move() after show() changes the "focus on map" order. It's called then frame extents are received to adjust position by gravity. It might be a bug in gtk.

With the current solution it is working, but it does send extra notifyFocusevents, as before (I refer to the code in master branch).

@kevinrushforth
Copy link
Member

I can confirm that this fixes the window order test without introducing new test failures. It looks ready for final testing and review.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have finished my testing. All looks good, with one problem seen on Ubuntu 16.04 that warrants a P4 follow-up bug (which we may or may not care to fix).

The following test fails consistently on Ubuntu 16.04 with this patch:

DeiconifiedWithChildTest > testDeiconifiedPosition FAILED
    java.lang.AssertionError: Child window was moved expected:<343.0> but was:<333.0>
        at org.junit.Assert.fail(Assert.java:89)
        at org.junit.Assert.failNotEquals(Assert.java:835)
        at org.junit.Assert.assertEquals(Assert.java:555)
        at test.javafx.stage.DeiconifiedWithChildTest.testDeiconifiedPosition(DeiconifiedWithChildTest.java:99)

I also reviewed the code changes, and they look good (although I did leave one question for you to consider).

Display *display = GDK_DISPLAY_XDISPLAY(gdk_window_get_display(gdk_window));
Atom rfeAtom = XInternAtom(display, "_NET_REQUEST_FRAME_EXTENTS", True);
static Atom rfeAtom = XInternAtom(display, "_NET_REQUEST_FRAME_EXTENTS", False);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If display could be different for two Windows, then making this static would not be the right thing to do. I don't think it can, so this is probably OK.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Atoms are per server, so I also think it's ok.

@kevinrushforth
Copy link
Member

@johanvos Can you re-review this when you have time?

Copy link
Collaborator

@johanvos johanvos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the diffs, and re-did my tests. All working as expected on Ubuntu 22.04.

@openjdk
Copy link

openjdk bot commented Apr 7, 2023

@tsayao This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8260528: Clean glass-gtk sizing and positioning code

Reviewed-by: jvos, kcr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 5 new commits pushed to the master branch:

  • 2b2a7f1: 8304441: [macos] Crash when putting invalid unicode char on clipboard
  • b6e5737: 8283063: Optimize Observable{List/Set/Map}Wrapper.retainAll/removeAll
  • 810bd90: 8286089: Intermittent WebKit build failure on macOS in JavaScriptCore
  • a264435: 8282359: Intermittent WebKit build failure on Windows: C1090: PDB API call failed, error code 23
  • 4c0e0bd: 8305248: TableView not rendered correctly after column is made visible if fixed cell size is set

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label Apr 7, 2023
@tsayao
Copy link
Collaborator Author

tsayao commented Apr 7, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Apr 7, 2023

Going to push as commit 0c03a41.
Since your change was applied there have been 5 commits pushed to the master branch:

  • 2b2a7f1: 8304441: [macos] Crash when putting invalid unicode char on clipboard
  • b6e5737: 8283063: Optimize Observable{List/Set/Map}Wrapper.retainAll/removeAll
  • 810bd90: 8286089: Intermittent WebKit build failure on macOS in JavaScriptCore
  • a264435: 8282359: Intermittent WebKit build failure on Windows: C1090: PDB API call failed, error code 23
  • 4c0e0bd: 8305248: TableView not rendered correctly after column is made visible if fixed cell size is set

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 7, 2023
@openjdk openjdk bot closed this Apr 7, 2023
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Apr 7, 2023
@openjdk
Copy link

openjdk bot commented Apr 7, 2023

@tsayao Pushed as commit 0c03a41.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
4 participants