Skip to content

Conversation

amartya4256
Copy link
Contributor

With this PR, all the widgets scale themselves asynchronously independent of the order saving the wait time over their children to scale.
Earlier, the widgets would scale synchronously on a DPI_CHANGED event from the OS, i.e., the shell receives the callback from the OS and calls and waits for its children to execute their handleDPIChange (Over all the superclasses of course) and every widget on handleDPIChange method being triggered, would call handDPIChange for their children widgets or associated widgets and wait for them to finish and them execute he remaining scaling statements and pass the control to their parents. This whole flow would keep the thread busy for a significant amount of time making the UI freeze for sometime.

With this approach, the Shell receives the callback from the OS and executes its handleDPIChange (Over all the superclasses of course) and sends a notification asynchronously, i.e., queues the notifyListeners to be executed for its children when the thread is free. Once the first queued notifyListeners runs, it would invoke the handleDPIChange for that particular widget, which would then schedule DPI scaling calls for its children and associated widgets and move on with its handleDPIChange execution. This would definitely change the hierarchical order in which the widgets scale themselves. Considering that the parents need to resize them on the basis of the size of the children, there needs to be a recalibration of the bounds for the widgets once all the widgets have scaled themselves. Hence, we keep a note of when all the widgets have completed their scaling, the last widget to scale itself triggers a Resize event, leading every widget to recalibrate their bounds. This leads to a better UI freeze free scaling where all the widgets inside the shell are still operable/clickable amidst the scaling.

Only the last commit is relevant to this PR.
Depends on #2483

This commit improves thes design implementation for widgets in win32 by
moving away from DPIZoomChangeRegistry to an event-driven design using
ZoomChanged event and inheritance.

contributes to
eclipse-platform#62 and
eclipse-platform#128
With this commit, all the widgets scale themselves asynchronously
independent of the order saving the wait time over their children to
scale.
@amartya4256 amartya4256 linked an issue Sep 17, 2025 that may be closed by this pull request
Copy link
Contributor

Test Results

  110 files   -   8    110 suites   - 8   8m 29s ⏱️ - 3m 29s
4 181 tests  - 250  4 153 ✅  - 261  14 💤  - 3  0 ❌ ±0  14 🔥 +14 
  242 runs   -  56    227 ✅  -  67   1 💤  - 3  0 ❌ ±0  14 🔥 +14 

For more details on these errors, see this check.

Results for commit 1e8e9a5. ± Comparison against base commit c588cde.

This pull request removes 250 tests.
AllWin32Tests ImageWin32Tests ‑ testDisposeDrawnImageBeforeRequestingTargetForOtherZoom
AllWin32Tests ImageWin32Tests ‑ testDrawImageAtDifferentZooms(boolean)[1] true
AllWin32Tests ImageWin32Tests ‑ testDrawImageAtDifferentZooms(boolean)[2] false
AllWin32Tests ImageWin32Tests ‑ testImageDataForDifferentFractionalZoomsShouldBeDifferent
AllWin32Tests ImageWin32Tests ‑ testImageShouldHaveDimesionAsPerZoomLevel
AllWin32Tests ImageWin32Tests ‑ testRetrieveImageDataAtDifferentZooms(boolean)[1] true
AllWin32Tests ImageWin32Tests ‑ testRetrieveImageDataAtDifferentZooms(boolean)[2] false
AllWin32Tests ImageWin32Tests ‑ test_getImageData_fromCopiedImage
AllWin32Tests ImageWin32Tests ‑ test_getImageData_fromImageForImageDataFromImage
AllWin32Tests TestTreeColumn ‑ test_ColumnOrder
…
This pull request skips 3 tests.
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser ‑ test_Constructor_multipleInstantiationsInDifferentThreads[browser flags: 0]
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_graphics_Image ‑ test_imageDataIsCached
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Button ‑ test_traverseCheckButton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make DPI change asynchronous
1 participant