eclipse-platform / eclipse.platform.swt

Eclipse SWT
https://www.eclipse.org/swt/
Eclipse Public License 2.0
101 stars 123 forks source link

[win32][fix] apply dpi change to menus attribute for Decorations in windows #1283

Closed akoch-yatta closed 5 days ago

akoch-yatta commented 2 weeks ago

Note: issue can only occur in windows with flag swt.autoScale.updateOnRuntime set to true

This commit applies dpi changes to all menus in this menus attribute in Decorations as well in windows, so pop-up menus are no longer opened on the wrong location.

Requires

How to reproduce

  1. Have two monitors with different zoom settings
  2. Start IDE
  3. Move Java Editors on both of the monitors
  4. Right-click on multiple positions in the editor on the non-primary monitor -> in some places they are opened at the mouse location in some places not
github-actions[bot] commented 2 weeks ago

Test Results

   470 files  ±0     470 suites  ±0   9m 1s :stopwatch: -8s  4 135 tests ±0   4 127 :white_check_mark: ±0   8 :zzz: ±0  0 :x: ±0  16 336 runs  ±0  16 244 :white_check_mark: ±0  92 :zzz: ±0  0 :x: ±0 

Results for commit 06e55770. ± Comparison against base commit f40502d5.

:recycle: This comment has been updated with latest results.

akoch-yatta commented 1 week ago

The code looks OK, just a minor question about the null-check.

I tested this and the menu looks like this when most of the shell is on the 200% monitor but I right-click on the side of the 100% monitor:

image

Is this expected? Can it be fixed?

In most cases it will always look as expected now. The only exception is, when you have two monitor with different zoom and stretch one Shell over both monitors. When the menus will always be scaled according to the zoom the Shell is assigned to from Windows.