Skip to content

Commit fe1d828

Browse files
arunjose696HeikoKlare
authored andcommitted
update computeSizeInPixels signature to accept zoom
This change prepares the codebase for upcoming work in #2748.
1 parent 6c9ed53 commit fe1d828

File tree

21 files changed

+25
-43
lines changed

21 files changed

+25
-43
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,8 @@ else if ((style & SWT.RIGHT) != 0) {
323323
}
324324

325325
@Override
326-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
326+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
327327
checkWidget ();
328-
int zoom = getZoom();
329328
Point hintInPixels = Win32DPIUtils.pointToPixelAsSufficientlyLargeSize(hintInPoints, zoom);
330329
int width = 0, height = 0, border = getBorderWidthInPixels ();
331330
if ((style & SWT.ARROW) != 0) {

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,8 @@ public void clearSelection () {
593593
}
594594

595595
@Override
596-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
596+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
597597
checkWidget ();
598-
int zoom = getZoom();
599598
Point hintInPixels = Win32DPIUtils.pointToPixelAsSufficientlyLargeSize(hintInPoints, zoom);
600599
int width = 0, height = 0;
601600
if (hintInPoints.x == SWT.DEFAULT) {

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ protected void checkSubclass () {
207207
}
208208

209209
@Override
210-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
210+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
211211
display.runSkin ();
212212
Point sizeInPoints;
213213
if (layout != null) {

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,13 +621,12 @@ public Point computeSize (int wHint, int hHint, boolean changed){
621621
int zoom = getZoom();
622622
//We should never return a size that is to small, RoundingMode.UP ensures we at worst case report
623623
//a size that is a bit too large by half a point
624-
return Win32DPIUtils.pixelToPointAsSufficientlyLargeSize(computeSizeInPixels(new Point(wHint, hHint), changed), zoom);
624+
return Win32DPIUtils.pixelToPointAsSufficientlyLargeSize(computeSizeInPixels(new Point(wHint, hHint), zoom, changed), zoom);
625625
}
626626

627-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
627+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
628628
int width = DEFAULT_WIDTH;
629629
int height = DEFAULT_HEIGHT;
630-
int zoom = getZoom();
631630
Point hintInPixels = Win32DPIUtils.pointToPixelAsSufficientlyLargeSize(hintInPoints, zoom);
632631
if (hintInPoints.x != SWT.DEFAULT) width = hintInPixels.x;
633632
if (hintInPoints.y != SWT.DEFAULT) height = hintInPixels.y;

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ protected void checkSubclass () {
141141
}
142142

143143
@Override
144-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
145-
int zoom = getZoom();
144+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
146145
Point hintInPixels = Win32DPIUtils.pointToPixelAsSufficientlyLargeSize(hintInPoints, zoom);
147146
int width = 0, height = 0;
148147
int border = getBorderWidthInPixels ();
@@ -1228,7 +1227,7 @@ void handleDPIChange(Event event, float scalingFactor) {
12281227
item.setControl(control);
12291228
}
12301229

1231-
Point preferredControlSize = item.getControl().computeSizeInPixels(new Point(SWT.DEFAULT, SWT.DEFAULT), true);
1230+
Point preferredControlSize = item.getControl().computeSizeInPixels(new Point(SWT.DEFAULT, SWT.DEFAULT), getZoom(), true);
12321231
int controlWidth = preferredControlSize.x;
12331232
int controlHeight = preferredControlSize.y;
12341233
if (((style & SWT.VERTICAL) != 0)) {

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ protected void checkSubclass () {
219219
}
220220

221221
@Override
222-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
222+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
223223
checkWidget ();
224-
int zoom = getZoom();
225224
Point hintInPixels = Win32DPIUtils.pointToPixelAsSufficientlyLargeSize(hintInPoints, zoom);
226225
int width = 0, height = 0;
227226
if (hintInPoints.x == SWT.DEFAULT || hintInPoints.y == SWT.DEFAULT) {

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ static int checkStyle (int style) {
127127
}
128128

129129
@Override
130-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
131-
int zoom = getZoom();
130+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
132131
Point hintInPixels = Win32DPIUtils.pointToPixelAsSufficientlyLargeSize(hintInPoints, zoom);
133132
int height = 0, width = 0;
134133
if (hintInPoints.x == SWT.DEFAULT || hintInPoints.y == SWT.DEFAULT) {

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ protected void checkSubclass () {
139139
}
140140

141141
@Override
142-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
142+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
143143
checkWidget ();
144-
Point size = super.computeSizeInPixels (hintInPoints, changed);
144+
Point size = super.computeSizeInPixels (hintInPoints, zoom, changed);
145145
int length = text.length ();
146146
if (length != 0) {
147147
String string = fixText (false);

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ static int checkStyle (int style) {
131131
}
132132

133133
@Override
134-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
134+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
135135
checkWidget ();
136-
int zoom = getZoom();
137136
Point hintInPixels = Win32DPIUtils.pointToPixelAsSufficientlyLargeSize(hintInPoints, zoom);
138137
int width = 0, height = 0, border = getBorderWidthInPixels ();
139138
if ((style & SWT.SEPARATOR) != 0) {

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ long callWindowProc (long hwnd, int msg, long wParam, long lParam) {
159159
}
160160

161161
@Override
162-
Point computeSizeInPixels (Point hintInPoints, boolean changed) {
162+
Point computeSizeInPixels (Point hintInPoints, int zoom, boolean changed) {
163163
checkWidget ();
164-
int zoom = getZoom();
165164
Point hintInPixels = Win32DPIUtils.pointToPixelAsSufficientlyLargeSize(hintInPoints, zoom);
166165
int width, height;
167166
/*

0 commit comments

Comments
 (0)