Skip to content

Commit 2b1a0f2

Browse files
Scale Tree.DRAG_IMAGE_SIZE by zoom level instead of using fixed pixels
The Tree.DRAG_IMAGE_SIZE constant specifies the width of the drag image when a tree item is dragged. Previously, this value was fixed in pixels, which caused the drag image to appear too small on high-DPI monitors. This change redefines DRAG_IMAGE_SIZE in points and converts it to pixels based on the current zoom level, ensuring consistent drag image sizing across different display scales.
1 parent 93a484e commit 2b1a0f2

File tree

1 file changed

+2
-2
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6072,7 +6072,7 @@ long windowProc (long hwnd, int msg, long wParam, long lParam) {
60726072
OS.GetClientRect(handle, clientRect);
60736073
RECT rect = items [0].getBounds (0, true, true, false);
60746074
if ((style & SWT.FULL_SELECTION) != 0) {
6075-
int width = DRAG_IMAGE_SIZE;
6075+
int width = Win32DPIUtils.pointToPixel(DRAG_IMAGE_SIZE, getZoom());
60766076
rect.left = Math.max (clientRect.left, mousePos.x - width / 2);
60776077
if (clientRect.right > rect.left + width) {
60786078
rect.right = rect.left + width;
@@ -6086,7 +6086,7 @@ long windowProc (long hwnd, int msg, long wParam, long lParam) {
60866086
}
60876087
long hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
60886088
for (int i = 1; i < count; i++) {
6089-
if (rect.bottom - rect.top > DRAG_IMAGE_SIZE) break;
6089+
if (rect.bottom - rect.top > Win32DPIUtils.pointToPixel(DRAG_IMAGE_SIZE, getZoom())) break;
60906090
if (rect.bottom > clientRect.bottom) break;
60916091
RECT itemRect = items[i].getBounds (0, true, true, false);
60926092
if ((style & SWT.FULL_SELECTION) != 0) {

0 commit comments

Comments
 (0)