Skip to content

Conversation

ShahzaibIbrahim
Copy link
Contributor

@ShahzaibIbrahim ShahzaibIbrahim commented Oct 6, 2025

Few Widgets do not adhere to AUTO_SCALE_DISABLED field when set to true in Widget#setData. The proposed changes are as follow:

  • In Widget when setting DATA_AUTOSCALE_DISABLED to true we also update the nativeZoom value to 100 since it is a public field and we cannot rely on everyone calling the getter for it where we previously had a logic to return 100 in case of autoScale disablement.
  • Tracker class in some cases was using same logic as getZoom() but missing one additional detail which is present in getZoom(), that is to check if autoScale is disabled then use 100%
  • In Control class when we set the bounds then we use to check for autoScale disablement but not when setting the size or location, so that's fixed too.

Detailed Analysis

These are the widgets or widget utils that should be affected when auto scale is disabled.

org.eclipse.swt.dnd.DragSource.drag(Event)
org.eclipse.swt.dnd.DropTarget.convertPixelToPoint(int, int)
org.eclipse.swt.dnd.TableDragSourceEffect.getDragSourceImage(DragSourceEvent)
org.eclipse.swt.dnd.TableDropTargetEffect.dragOver(DropTargetEvent)
org.eclipse.swt.dnd.TreeDragSourceEffect.getDragSourceImage(DragSourceEvent)
org.eclipse.swt.dnd.TreeDropTargetEffect.dragOver(DropTargetEvent)

org.eclipse.swt.widgets.Button.Button(Composite, int)
org.eclipse.swt.widgets.Button.getCheckboxTextOffset(long)
org.eclipse.swt.widgets.Button.wmDrawChild(long, long)

org.eclipse.swt.widgets.Composite.wmNCPaint(long, long, long)

org.eclipse.swt.widgets.Control.getData(String)
org.eclipse.swt.widgets.Control.setParent(Composite)
org.eclipse.swt.widgets.Control.WM_DPICHANGED(long, long)

org.eclipse.swt.widgets.ExpandBar.computeSizeInPixels(int, int, boolean)
org.eclipse.swt.widgets.ExpandBar.drawThemeBackground(long, long, RECT)
org.eclipse.swt.widgets.ExpandBar.drawWidget(GC, RECT)

org.eclipse.swt.widgets.Menu.fixMenus(Decorations)

org.eclipse.swt.widgets.MenuItem.fixMenus(Decorations)
org.eclipse.swt.widgets.MenuItem.getMenuItemIconBitmapHandle(Image)
org.eclipse.swt.widgets.MenuItem.getMenuItemIconSelectedBitmapHandle()

org.eclipse.swt.widgets.TabFolder.drawThemeBackground(long, long, RECT)

org.eclipse.swt.widgets.Table.setCheckboxImageList(int, int, boolean)
org.eclipse.swt.widgets.Table.wmNotifyHeader(NMHDR, long, long)

org.eclipse.swt.widgets.TaskBar.createShellLink(MenuItem)

org.eclipse.swt.widgets.Text.WM_DRAWITEM(long, long)

org.eclipse.swt.widgets.Tree.calculateAndApplyIndentSize()
org.eclipse.swt.widgets.Tree.setCheckboxImageList()
org.eclipse.swt.widgets.Tree.wmNotifyHeader(NMHDR, long, long)

When should auto scale disabling function?

Whenever widget#nativeZoom or widget#getNativeZoom is called from any of the widget, the native zoom must be 100%.

Copy link
Contributor

github-actions bot commented Oct 6, 2025

Test Results

  118 files  ±0    118 suites  ±0   13m 59s ⏱️ + 1m 14s
4 583 tests ±0  4 565 ✅ ±0  18 💤 ±0  0 ❌ ±0 
  330 runs  ±0    326 ✅ ±0   4 💤 ±0  0 ❌ ±0 

Results for commit 1f7b045. ± Comparison against base commit 1460543.

♻️ This comment has been updated with latest results.

@ShahzaibIbrahim ShahzaibIbrahim marked this pull request as draft October 7, 2025 08:41
@ShahzaibIbrahim ShahzaibIbrahim force-pushed the master-446 branch 2 times, most recently from 10fe424 to 29ded18 Compare October 7, 2025 13:17
@ShahzaibIbrahim ShahzaibIbrahim marked this pull request as ready for review October 7, 2025 13:31
The nativeZoom of some widgets currently always has the original native
zoom value, even if autoscaling is disabled for that widget such that
they behave as if their native zoom is effectively 100. With this change
the behavior of those widgets will be fixed as per autoscale disabled
value.
Copy link
Member

@fedejeanne fedejeanne left a comment

Choose a reason for hiding this comment

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

How does one test this?

Shouldn't line 186 (in the constructor) also be adapted?

	this.nativeZoom = parent != null ? parent.nativeZoom : DPIUtil.getNativeDeviceZoom();


void handleDPIChange(Event event, float scalingFactor) {
this.nativeZoom = event.detail;
this.nativeZoom = this.autoScaleDisabled ? 100 : event.detail;;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
this.nativeZoom = this.autoScaleDisabled ? 100 : event.detail;;
this.nativeZoom = this.autoScaleDisabled ? 100 : event.detail;

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.

Replace nativeZoom of widgets with disabled autoscaling with 100

3 participants