Skip to content

Commit 6376e25

Browse files
committed
[Win32] Update shell icons on DPI change asynchronously
When changing the zoom of the current monitor, the taskbar icon for an SWT application is not updated properly but is replaced with a generic executable icon and will only be replaced with the actual application after quite some time/interaction (if at all). This seems to be caused by some caching effects of the Windows explorer. This change defers the refresh of the icons to be executed after all DPI change processing has been handled. This results in reliable updates of the application icon once the DPI change processing has finished.
1 parent 9a2a885 commit 6376e25

File tree

1 file changed

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

1 file changed

+16
-9
lines changed

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,15 +1708,6 @@ LRESULT WM_WINDOWPOSCHANGING (long wParam, long lParam) {
17081708
@Override
17091709
void handleDPIChange(Event event, float scalingFactor) {
17101710
super.handleDPIChange(event, scalingFactor);
1711-
Image image = getImage();
1712-
if (image != null) {
1713-
setImage(image);
1714-
}
1715-
1716-
Image[] images = getImages();
1717-
if (images != null && images.length > 0) {
1718-
setImages(images);
1719-
}
17201711

17211712
Menu menuBar = getMenuBar();
17221713
if (menuBar != null) {
@@ -1730,5 +1721,21 @@ void handleDPIChange(Event event, float scalingFactor) {
17301721
}
17311722
}
17321723
}
1724+
1725+
display.asyncExec(() -> {
1726+
if (isDisposed()) {
1727+
return;
1728+
}
1729+
1730+
Image image = getImage();
1731+
if (image != null) {
1732+
setImage(image);
1733+
}
1734+
1735+
Image[] images = getImages();
1736+
if (images != null && images.length > 0) {
1737+
setImages(images);
1738+
}
1739+
});
17331740
}
17341741
}

0 commit comments

Comments
 (0)