Skip to content

Commit 819c1c3

Browse files
Scale Table.DRAG_IMAGE_SIZE by zoom level instead of using fixed pixels
The Table.DRAG_IMAGE_SIZE constant specifies the width of the drag image when a table 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 d5dc661 commit 819c1c3

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/Table.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,7 +5746,7 @@ long windowProc (long hwnd, int msg, long wParam, long lParam) {
57465746
TableItem item = _getItem (selection);
57475747
RECT rect = item.getBounds (selection, 0, true, true, true);
57485748
if ((style & SWT.FULL_SELECTION) != 0) {
5749-
int width = DRAG_IMAGE_SIZE;
5749+
int width = Win32DPIUtils.pointToPixel(DRAG_IMAGE_SIZE, getZoom());
57505750
rect.left = Math.max (clientRect.left, mousePos.x - width / 2);
57515751
if (clientRect.right > rect.left + width) {
57525752
rect.right = rect.left + width;
@@ -5757,7 +5757,7 @@ long windowProc (long hwnd, int msg, long wParam, long lParam) {
57575757
}
57585758
long hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
57595759
while ((selection = (int)OS.SendMessage (handle, OS.LVM_GETNEXTITEM, selection, OS.LVNI_SELECTED)) != -1) {
5760-
if (rect.bottom - rect.top > DRAG_IMAGE_SIZE) break;
5760+
if (rect.bottom - rect.top > Win32DPIUtils.pointToPixel(DRAG_IMAGE_SIZE, getZoom())) break;
57615761
if (rect.bottom > clientRect.bottom) break;
57625762
RECT itemRect = item.getBounds (selection, 0, true, true, true);
57635763
long rectRgn = OS.CreateRectRgn (rect.left, itemRect.top, rect.right, itemRect.bottom);

0 commit comments

Comments
 (0)