Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public abstract class Control extends Widget implements Drawable {
/** Cache for currently processed DPI change event to be able to cancel it if a new one is triggered */
Event currentDpiChangeEvent;

private static final String DATA_SHELL_ZOOM = "SHELL_ZOOM";
/**
* Prevents uninitialized instances from being created outside the package.
*/
Expand Down Expand Up @@ -1260,6 +1261,15 @@ public Cursor getCursor () {
return cursor;
}

@Override
public Object getData(String key) {
if (DATA_SHELL_ZOOM.equals(key)) {
Shell shell = getShell();
return shell == null ? null : shell.nativeZoom;
}
return super.getData(key);
}

/**
* Returns <code>true</code> if the receiver is detecting
* drag gestures, and <code>false</code> otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public abstract class Widget {
static final int AUTO_TEXT_DIRECTION = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;

private static final String DATA_AUTOSCALE_DISABLED = "AUTOSCALE_DISABLED";
private static final String DATA_NATIVE_ZOOM = "NATIVE_ZOOM";

/* Initialize the Common Controls DLL */
static {
Expand Down Expand Up @@ -189,7 +188,6 @@ public Widget (Widget parent, int style) {
display = parent.display;
reskinWidget ();
notifyCreationTracker();
this.setData(DATA_NATIVE_ZOOM, this.nativeZoom);
registerDPIChangeListener();
}

Expand Down Expand Up @@ -2727,9 +2725,7 @@ int getZoom() {
}

void handleDPIChange(Event event, float scalingFactor) {
int newZoom = event.detail;
this.nativeZoom = newZoom;
this.setData(DATA_NATIVE_ZOOM, newZoom);
this.nativeZoom = event.detail;
}

int getSystemMetrics(int nIndex) {
Expand Down
Loading