nadment opened a new pull request, #9632:
URL: https://github.com/apache/hop/pull/9632

   Fixes #9317.
   
   On Windows the Git menu of the status bar opened a full menu height above 
its button, while the Project and Environment menus opened in place. The cause 
is the height estimate in `PopupMenuPlacement.heightOf()`, not the Git plugin: 
the three menus share the same placement code. The details and the measurements 
are in the issue.
   
   ### What changes
   
   - **Rows are measured one by one.** A row without an image keeps the text 
row height. A row with an image is `max(text row, image + padding)`. Before, 
the tallest image found was applied to every row.
   - **Pending images are counted.** `heightOf()` now calls 
`GuiMenuWidgets.getImage(item)`, so the images of the actions, which were only 
loaded on `SWT.Show`, are on the items when the height is computed. The menu is 
about to open, so nothing is loaded that would not have been loaded a moment 
later.
   - **Windows metrics are corrected.** A row of a themed popup is `SM_CYMENU` 
+ 2 points (22 px at 100%, where the metric says 20), a separator is 9 points 
(was `max(6, row / 3)`), and a row with an image is the image height + 6 points.
   
   ### How it was checked
   
   With a small SWT program that opens menus above a simulated 28 px status bar 
and reads the real item rectangles with `GetMenuItemRect`, on Windows 11 at 
100% zoom. With 16, 18, 20 and 24 px icons and 3 to 40 branch rows, the last 
item now always ends 5 px above the top of the button. Before, a menu with 15 
branches was flipped by Windows and left a 443 px gap.
   
   Not checked:
   
   - Hop GUI itself was not started with this change; the three real menus 
still have to be looked at.
   - Other zoom levels on Windows (125%, 150%, 200%). The constants are in 
points and are assumed to scale linearly with the zoom.
   - `PopupMenuPlacementTest` does not cover `heightOf()`, and `mvn clean 
install apache-rat:check` was not run. `spotless:check` passes on the `ui` 
module.
   
   ### Help wanted: Linux and macOS
   
   This change also alters the estimate on the other platforms, and I could 
only test on Windows:
   
   - the action images are now loaded before the height is computed, so rows 
that were counted as text rows are now counted as image rows;
   - a row with an image is `image + 2`, but only for that row, where the 
tallest image used to be applied to all rows;
   - the separator height is derived from the text row instead of the image row.
   
   Could someone on **Linux (GTK)** and **macOS** open the Project, Environment 
and Git menus from the status bar, with a repository that has a dozen branches 
or more, and confirm that each menu still sits on its button? A check in **Hop 
Web** would be welcome too, since the same code places these menus there.
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   - [ ] Run `mvn clean install apache-rat:check` to make sure basic checks 
pass. A more thorough check will be performed on your pull request 
automatically.
   - [x] If you have a group of commits related to the same change, please 
squash your commits into one and force push your branch using `git rebase -i`.
   - [x] Mention the appropriate issue in your description (for example: 
`addresses #123`), if applicable.
   
   To make clear that you license your contribution under the [Apache License 
Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
   - [ ] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   - [ ] In any other case, please file an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to