Skip to content

Commit c012752

Browse files
committed
[Win32] Avoid faulty setting of image list at OS on Tree.setOrientation
The Windows Tree implementation only registers an image list at the OS control in case an image is set in the first column of an item of the tree. For images in the other columns, they are added to an SWT image list but since the images are embedded by SWT, no image list is registered at the OS. The implementation of Tree.updateOrientation() does not consider that for the OS control no image list may have been set even if the SWT control manages an image list. As a consequence, calling Tree.setOrientation() on a Tree whose items do not have any image in the first column leads to all those items receiving a white space where an image might be placed as an empty image list is registered at the OS. This change adapts the Tree.updateOrientation() implementation to only refresh the OS image list for the control in case one was already set before. In addition to calling Tree.setOrientation() this also affects DPI changes when moving the containing shell to a monitor with a different zoom where the same happens because of a call to Tree.updateOrientation(). Contributes to #3075
1 parent 3e1cc4f commit c012752

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5805,8 +5805,12 @@ void updateOrientation () {
58055805
}
58065806
}
58075807
}
5808-
long hImageList = imageList.getHandle(getAutoscalingZoom());
5809-
OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, hImageList);
5808+
// Image list is only set at OS when the first column contains images,
5809+
// thus check if an image list is set at the OS to refresh and otherwise skip it
5810+
if (OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0) != 0) {
5811+
long hImageList = imageList.getHandle(getAutoscalingZoom());
5812+
OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, hImageList);
5813+
}
58105814
}
58115815
if (hwndHeader != 0) {
58125816
if (headerImageList != null) {

0 commit comments

Comments
 (0)