Skip to content

Commit

Permalink
Adapt GetSystemMetrics calls to be DPI dependent
Browse files Browse the repository at this point in the history
Writing GetSystemMetrics method in Widget class so that the child
controls can use it to get System Metrics to be DPI dependent

Contributes to:
eclipse-platform#62 &
eclipse-platform#127
  • Loading branch information
ShahzaibIbrahim committed May 6, 2024
1 parent 04f724a commit 0684300
Show file tree
Hide file tree
Showing 20 changed files with 86 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class Button extends Control {
static {
long hBitmap = OS.LoadBitmap (0, OS.OBM_CHECKBOXES);
if (hBitmap == 0) {
CHECK_WIDTH = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
CHECK_WIDTH = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
CHECK_HEIGHT = OS.GetSystemMetrics (OS.SM_CYVSCROLL);
} else {
BITMAP bitmap = new BITMAP ();
Expand Down Expand Up @@ -315,11 +315,11 @@ else if ((style & SWT.RIGHT) != 0) {
int width = 0, height = 0, border = getBorderWidthInPixels ();
if ((style & SWT.ARROW) != 0) {
if ((style & (SWT.UP | SWT.DOWN)) != 0) {
width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
height += OS.GetSystemMetrics (OS.SM_CYVSCROLL);
width += getSystemMetrics (OS.SM_CXVSCROLL);
height += getSystemMetrics (OS.SM_CYVSCROLL);
} else {
width += OS.GetSystemMetrics (OS.SM_CXHSCROLL);
height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
width += getSystemMetrics (OS.SM_CXHSCROLL);
height += getSystemMetrics (OS.SM_CYHSCROLL);
}
} else {
if ((style & SWT.COMMAND) != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ public void clearSelection () {
width += pcbi.itemLeft + (pcbi.buttonRight - pcbi.buttonLeft);
height = (pcbi.buttonBottom - pcbi.buttonTop) + pcbi.buttonTop * 2;
} else {
int border = OS.GetSystemMetrics (OS.SM_CXEDGE);
width += OS.GetSystemMetrics (OS.SM_CXVSCROLL) + border * 2;
int border = getSystemMetrics (OS.SM_CXEDGE);
width += getSystemMetrics (OS.SM_CXVSCROLL) + border * 2;
int textHeight = (int)OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, -1, 0);
if ((style & SWT.DROP_DOWN) != 0) {
height = textHeight + 6;
Expand All @@ -665,7 +665,7 @@ public void clearSelection () {
}
}
if ((style & SWT.SIMPLE) != 0 && (style & SWT.H_SCROLL) != 0) {
height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
height += getSystemMetrics (OS.SM_CYHSCROLL);
}
return new Point (width, height);
}
Expand Down Expand Up @@ -2188,7 +2188,7 @@ void setScrollWidth (int scrollWidth) {
OS.SendMessage (handle, OS.CB_SETDROPPEDWIDTH, 0, 0);
OS.SendMessage (handle, OS.CB_SETHORIZONTALEXTENT, scrollWidth, 0);
} else {
scrollWidth += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
scrollWidth += getSystemMetrics (OS.SM_CYHSCROLL);
OS.SendMessage (handle, OS.CB_SETDROPPEDWIDTH, scrollWidth, 0);
OS.SendMessage (handle, OS.CB_SETHORIZONTALEXTENT, 0, 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ LRESULT wmNCPaint (long hwnd, long wParam, long lParam) {
rect.right -= rect.left;
rect.bottom -= rect.top;
rect.left = rect.top = 0;
int border = OS.GetSystemMetrics (OS.SM_CXEDGE);
int border = getSystemMetrics (OS.SM_CXEDGE);
OS.ExcludeClipRect (hDC, border, border, rect.right - border, rect.bottom - border);
OS.DrawThemeBackground (display.hEditTheme (), hDC, OS.EP_EDITTEXT, OS.ETS_NORMAL, rect, null);
OS.ReleaseDC (hwnd, hDC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ void createHandle () {
}

void checkGesture () {
int value = OS.GetSystemMetrics (OS.SM_DIGITIZER);
int value =getSystemMetrics (OS.SM_DIGITIZER);
if ((value & (OS.NID_READY | OS.NID_MULTI_INPUT)) != 0) {
/*
* Feature in Windows 7: All gestures are enabled by default except GID_ROTATE.
Expand Down Expand Up @@ -1159,8 +1159,8 @@ public int getBorderWidth () {
int getBorderWidthInPixels () {
long borderHandle = borderHandle ();
int bits1 = OS.GetWindowLong (borderHandle, OS.GWL_EXSTYLE);
if ((bits1 & OS.WS_EX_CLIENTEDGE) != 0) return OS.GetSystemMetrics (OS.SM_CXEDGE);
if ((bits1 & OS.WS_EX_STATICEDGE) != 0) return OS.GetSystemMetrics (OS.SM_CXBORDER);
if ((bits1 & OS.WS_EX_CLIENTEDGE) != 0) return getSystemMetrics (OS.SM_CXEDGE);
if ((bits1 & OS.WS_EX_STATICEDGE) != 0) return getSystemMetrics (OS.SM_CXBORDER);
int bits2 = OS.GetWindowLong (borderHandle, OS.GWL_STYLE);

if ((bits2 & OS.WS_BORDER) != 0) {
Expand All @@ -1170,9 +1170,9 @@ int getBorderWidthInPixels () {
* saves screen space, but could break some layouts.
*/
if (isUseWsBorder ())
return OS.GetSystemMetrics (OS.SM_CXEDGE);
return getSystemMetrics (OS.SM_CXEDGE);

return OS.GetSystemMetrics (OS.SM_CXBORDER);
return getSystemMetrics (OS.SM_CXBORDER);
}

return 0;
Expand Down Expand Up @@ -2281,10 +2281,10 @@ void printWidget (long hwnd, long hdc, GC gc) {
hwndInsertAfter = OS.HWND_TOP;
}
if (fixPrintWindow) {
int x = OS.GetSystemMetrics (OS.SM_XVIRTUALSCREEN);
int y = OS.GetSystemMetrics (OS.SM_YVIRTUALSCREEN);
int width = OS.GetSystemMetrics (OS.SM_CXVIRTUALSCREEN);
int height = OS.GetSystemMetrics (OS.SM_CYVIRTUALSCREEN);
int x =getSystemMetrics (OS.SM_XVIRTUALSCREEN);
int y =getSystemMetrics (OS.SM_YVIRTUALSCREEN);
int width =getSystemMetrics (OS.SM_CXVIRTUALSCREEN);
int height =getSystemMetrics (OS.SM_CYVIRTUALSCREEN);
int flags = OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE | OS.SWP_DRAWFRAME;
if ((bits1 & OS.WS_VISIBLE) != 0) {
OS.DefWindowProc (hwnd, OS.WM_SETREDRAW, 0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ protected void checkSubclass () {
width = size.cx;
height = size.cy;
// TODO: Can maybe use DTM_GETDATETIMEPICKERINFO for this
int upDownHeight = OS.GetSystemMetrics (OS.SM_CYVSCROLL) + 7;
int upDownHeight = getSystemMetrics (OS.SM_CYVSCROLL) + 7;
height = Math.max (height, upDownHeight);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ Control computeTabRoot () {
OS.AdjustWindowRectEx (rect, bits1, hasMenu, bits2);

/* Get the size of the scroll bars */
if (horizontalBar != null) rect.bottom += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
if (verticalBar != null) rect.right += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
if (horizontalBar != null) rect.bottom += getSystemMetrics (OS.SM_CYHSCROLL);
if (verticalBar != null) rect.right += getSystemMetrics (OS.SM_CXVSCROLL);

/* Compute the height of the menu bar */
if (hasMenu) {
Expand All @@ -326,7 +326,7 @@ Control computeTabRoot () {
OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect);
while ((testRect.bottom - testRect.top) < height) {
if (testRect.bottom - testRect.top == 0) break;
rect.top -= OS.GetSystemMetrics (OS.SM_CYMENU) - OS.GetSystemMetrics (OS.SM_CYBORDER);
rect.top -= getSystemMetrics (OS.SM_CYMENU) - getSystemMetrics (OS.SM_CYBORDER);
OS.SetRect (testRect, 0, 0, rect.right - rect.left, rect.bottom - rect.top);
OS.SendMessage (handle, OS.WM_NCCALCSIZE, 0, testRect);
}
Expand Down Expand Up @@ -466,8 +466,8 @@ void fixDecorations (Decorations newDecorations, Control control, Menu [] menus)
* the window restored. There is no fix for this problem at
* this time.
*/
if (horizontalBar != null) width -= OS.GetSystemMetrics (OS.SM_CYHSCROLL);
if (verticalBar != null) height -= OS.GetSystemMetrics (OS.SM_CXVSCROLL);
if (horizontalBar != null) width -= getSystemMetrics (OS.SM_CYHSCROLL);
if (verticalBar != null) height -= getSystemMetrics (OS.SM_CXVSCROLL);
RECT rect = new RECT ();
int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
int bits2 = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
Expand Down Expand Up @@ -902,11 +902,11 @@ void setImages (Image image, Image [] images) {
datas [i] = images [i].getImageData (getZoom());
}
images = bestImages;
sort (images, datas, OS.GetSystemMetrics (OS.SM_CXSMICON), OS.GetSystemMetrics (OS.SM_CYSMICON), depth);
sort (images, datas, getSystemMetrics (OS.SM_CXSMICON), getSystemMetrics (OS.SM_CYSMICON), depth);
}
smallIcon = images [0];
if (images.length > 1) {
sort (images, datas, OS.GetSystemMetrics (OS.SM_CXICON), OS.GetSystemMetrics (OS.SM_CYICON), depth);
sort (images, datas, getSystemMetrics (OS.SM_CXICON), getSystemMetrics (OS.SM_CYICON), depth);
}
largeIcon = images [0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static int checkStyle (int style) {
checkWidget ();
int width = 0, height = 0, border = getBorderWidthInPixels ();
if ((style & SWT.SEPARATOR) != 0) {
int lineWidth = OS.GetSystemMetrics (OS.SM_CXBORDER);
int lineWidth = getSystemMetrics (OS.SM_CXBORDER);
if ((style & SWT.HORIZONTAL) != 0) {
width = DEFAULT_WIDTH; height = lineWidth * 2;
} else {
Expand Down Expand Up @@ -535,7 +535,7 @@ void wmDrawChildSeparator(DRAWITEMSTRUCT struct) {
if ((style & SWT.SHADOW_NONE) != 0) return;

RECT rect = new RECT ();
int lineWidth = OS.GetSystemMetrics (OS.SM_CXBORDER);
int lineWidth = getSystemMetrics (OS.SM_CXBORDER);
int flags = (style & SWT.SHADOW_IN) != 0 ? OS.EDGE_SUNKEN : OS.EDGE_ETCHED;
if ((style & SWT.HORIZONTAL) != 0) {
int bottom = struct.top + Math.max (lineWidth * 2, (struct.bottom - struct.top) / 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ static int checkStyle (int style) {
width += border * 2 + INSET;
height += border * 2;
if ((style & SWT.V_SCROLL) != 0) {
width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
width += getSystemMetrics (OS.SM_CXVSCROLL);
}
if ((style & SWT.H_SCROLL) != 0) {
height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
height += getSystemMetrics (OS.SM_CYHSCROLL);
}
return new Point (width, height);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ LRESULT wmTimer (long wParam, long lParam) {
if (!success) return null;
if (OS.PtInRect (rect, pt)) {
// Mouse cursor is within the bounds of menu item
selectedMenuItem.showTooltip (pt.x, pt.y + OS.GetSystemMetrics(OS.SM_CYCURSOR) / 2 + 5);
selectedMenuItem.showTooltip (pt.x, pt.y + getSystemMetrics(OS.SM_CYCURSOR) / 2 + 5);
} else {
/*
* Mouse cursor is outside the bounds of the menu item:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ static int checkStyle (int style) {
int border = getBorderWidthInPixels ();
int width = border * 2, height = border * 2;
if ((style & SWT.HORIZONTAL) != 0) {
width += OS.GetSystemMetrics (OS.SM_CXHSCROLL) * 10;
height += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
width += getSystemMetrics (OS.SM_CXHSCROLL) * 10;
height += getSystemMetrics (OS.SM_CYHSCROLL);
} else {
width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
height += OS.GetSystemMetrics (OS.SM_CYVSCROLL) * 10;
width += getSystemMetrics (OS.SM_CXVSCROLL);
height += getSystemMetrics (OS.SM_CYVSCROLL) * 10;
}
if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ static int checkStyle (int style) {
RECT rect = new RECT ();
OS.SendMessage (handle, OS.TBM_GETTHUMBRECT, 0, rect);
if ((style & SWT.HORIZONTAL) != 0) {
width += OS.GetSystemMetrics (OS.SM_CXHSCROLL) * 10;
int scrollY = OS.GetSystemMetrics (OS.SM_CYHSCROLL);
width += getSystemMetrics (OS.SM_CXHSCROLL) * 10;
int scrollY = getSystemMetrics (OS.SM_CYHSCROLL);
height += (rect.top * 2) + scrollY + (scrollY / 3);
} else {
int scrollX = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
int scrollX = getSystemMetrics (OS.SM_CXVSCROLL);
width += (rect.left * 2) + scrollX + (scrollX / 3);
height += OS.GetSystemMetrics (OS.SM_CYVSCROLL) * 10;
height += getSystemMetrics (OS.SM_CYVSCROLL) * 10;
}
if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ Rectangle getBounds () {
if ((style & SWT.HORIZONTAL) != 0) {
y = rect.bottom - rect.top;
width = rect.right - rect.left;
height = OS.GetSystemMetrics (OS.SM_CYHSCROLL);
height = getSystemMetrics (OS.SM_CYHSCROLL);
} else {
x = rect.right - rect.left;
width = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
width = getSystemMetrics (OS.SM_CXVSCROLL);
height = rect.bottom - rect.top;
}
return new Rectangle (x, y, width, height);
Expand Down Expand Up @@ -365,9 +365,9 @@ Point getSizeInPixels () {
int width, height;
if ((style & SWT.HORIZONTAL) != 0) {
width = rect.right - rect.left;
height = OS.GetSystemMetrics (OS.SM_CYHSCROLL);
height = getSystemMetrics (OS.SM_CYHSCROLL);
} else {
width = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
width = getSystemMetrics (OS.SM_CXVSCROLL);
height = rect.bottom - rect.top;
}
return new Point (width, height);
Expand Down Expand Up @@ -468,7 +468,7 @@ Rectangle getThumbTrackBoundsInPixels () {
int x = 0, y = 0, width, height;
if ((style & SWT.HORIZONTAL) != 0) {
OS.GetScrollBarInfo(parent.handle, OS.OBJID_HSCROLL, info);
int size = OS.GetSystemMetrics (OS.SM_CYHSCROLL);
int size = getSystemMetrics (OS.SM_CYHSCROLL);
y = info.rcScrollBar.top;
width = info.rcScrollBar.right - info.rcScrollBar.left;
height = size;
Expand All @@ -481,7 +481,7 @@ Rectangle getThumbTrackBoundsInPixels () {
}
} else {
OS.GetScrollBarInfo(parent.handle, OS.OBJID_VSCROLL, info);
int size = OS.GetSystemMetrics (OS.SM_CYVSCROLL);
int size = getSystemMetrics (OS.SM_CYVSCROLL);
x = info.rcScrollBar.left;
width = size;
height = info.rcScrollBar.bottom - info.rcScrollBar.top;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) {
int bits1 = OS.GetWindowLong (scrolledHandle, OS.GWL_STYLE);
int bits2 = OS.GetWindowLong (scrolledHandle, OS.GWL_EXSTYLE);
OS.AdjustWindowRectEx (rect, bits1, false, bits2);
if (horizontalBar != null) rect.bottom += OS.GetSystemMetrics (OS.SM_CYHSCROLL);
if (verticalBar != null) rect.right += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
if (horizontalBar != null) rect.bottom += getSystemMetrics (OS.SM_CYHSCROLL);
if (verticalBar != null) rect.right += getSystemMetrics (OS.SM_CXVSCROLL);
int nWidth = rect.right - rect.left, nHeight = rect.bottom - rect.top;
return new Rectangle (rect.left, rect.top, nWidth, nHeight);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,12 +1068,12 @@ Point getMaximumSizeInPixels () {
int width = Math.min (Integer.MAX_VALUE, maxWidth);
int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX;
if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) {
width = Math.min (width, OS.GetSystemMetrics (OS.SM_CXMAXTRACK));
width = Math.min (width, getSystemMetrics (OS.SM_CXMAXTRACK));
}
int height = Math.min (Integer.MAX_VALUE, maxHeight);
if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) {
if ((style & SWT.RESIZE) != 0) {
height = Math.min (height, OS.GetSystemMetrics (OS.SM_CYMAXTRACK));
height = Math.min (height, getSystemMetrics (OS.SM_CYMAXTRACK));
} else {
RECT rect = new RECT ();
int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
Expand Down Expand Up @@ -1109,12 +1109,12 @@ Point getMinimumSizeInPixels () {
int width = Math.max (0, minWidth);
int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX;
if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) {
width = Math.max (width, OS.GetSystemMetrics (OS.SM_CXMINTRACK));
width = Math.max (width, getSystemMetrics (OS.SM_CXMINTRACK));
}
int height = Math.max (0, minHeight);
if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) {
if ((style & SWT.RESIZE) != 0) {
height = Math.max (height, OS.GetSystemMetrics (OS.SM_CYMINTRACK));
height = Math.max (height, getSystemMetrics (OS.SM_CYMINTRACK));
} else {
RECT rect = new RECT ();
int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
Expand Down Expand Up @@ -1779,9 +1779,9 @@ void setMaximumSizeInPixels (int width, int height) {
int widthLimit = 0, heightLimit = 0;
int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX;
if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) {
widthLimit = OS.GetSystemMetrics (OS.SM_CXMAXTRACK);
widthLimit = getSystemMetrics (OS.SM_CXMAXTRACK);
if ((style & SWT.RESIZE) != 0) {
heightLimit = OS.GetSystemMetrics (OS.SM_CYMAXTRACK);
heightLimit = getSystemMetrics (OS.SM_CYMAXTRACK);
} else {
RECT rect = new RECT ();
int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
Expand Down Expand Up @@ -1824,9 +1824,9 @@ void setMinimumSizeInPixels (int width, int height) {
int widthLimit = 0, heightLimit = 0;
int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX;
if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) {
widthLimit = OS.GetSystemMetrics (OS.SM_CXMINTRACK);
widthLimit = getSystemMetrics (OS.SM_CXMINTRACK);
if ((style & SWT.RESIZE) != 0) {
heightLimit = OS.GetSystemMetrics (OS.SM_CYMINTRACK);
heightLimit = getSystemMetrics (OS.SM_CYMINTRACK);
} else {
RECT rect = new RECT ();
int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
Expand Down Expand Up @@ -2631,12 +2631,12 @@ LRESULT WM_WINDOWPOSCHANGING (long wParam, long lParam) {
lpwp.cx = Math.max (lpwp.cx, minWidth);
int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX;
if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) {
lpwp.cx = Math.max (lpwp.cx, OS.GetSystemMetrics (OS.SM_CXMINTRACK));
lpwp.cx = Math.max (lpwp.cx, getSystemMetrics (OS.SM_CXMINTRACK));
}
lpwp.cy = Math.max (lpwp.cy, minHeight);
if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) {
if ((style & SWT.RESIZE) != 0) {
lpwp.cy = Math.max (lpwp.cy, OS.GetSystemMetrics (OS.SM_CYMINTRACK));
lpwp.cy = Math.max (lpwp.cy, getSystemMetrics (OS.SM_CYMINTRACK));
} else {
RECT rect = new RECT ();
int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void addVerifyListener (VerifyListener listener) {
height = hHint;
else {
int borderAdjustment = (style & SWT.BORDER) != 0 ? -1 : 3;
int upDownHeight = OS.GetSystemMetrics (OS.SM_CYVSCROLL);
int upDownHeight = getSystemMetrics (OS.SM_CYVSCROLL);
height = Math.max(height, upDownHeight + borderAdjustment);
}

Expand Down Expand Up @@ -339,7 +339,7 @@ void addVerifyListener (VerifyListener listener) {
width += 2;
height += 2;
}
width += OS.GetSystemMetrics (OS.SM_CXVSCROLL);
width += getSystemMetrics (OS.SM_CXVSCROLL);
return new Rectangle (x, y, width, height);
}

Expand Down Expand Up @@ -1216,7 +1216,7 @@ LRESULT WM_SIZE (long wParam, long lParam) {
LRESULT result = super.WM_SIZE (wParam, lParam);
if (isDisposed ()) return result;
int width = OS.LOWORD (lParam), height = OS.HIWORD (lParam);
int upDownWidth = OS.GetSystemMetrics (OS.SM_CXVSCROLL) - 1;
int upDownWidth = getSystemMetrics (OS.SM_CXVSCROLL) - 1;
int textWidth = width - upDownWidth;

/*
Expand All @@ -1226,7 +1226,7 @@ LRESULT WM_SIZE (long wParam, long lParam) {
*/
int borderAdjustment = 0;
if (((style & SWT.BORDER) != 0) && !display.useWsBorderText) {
borderAdjustment = OS.GetSystemMetrics (OS.SM_CYEDGE) - OS.GetSystemMetrics (OS.SM_CYBORDER);
borderAdjustment = getSystemMetrics (OS.SM_CYEDGE) - getSystemMetrics (OS.SM_CYBORDER);
/* There is an unexplained 1px additional offset in Windows */
borderAdjustment++;
}
Expand Down
Loading

0 comments on commit 0684300

Please sign in to comment.