Skip to content

[Win32] Shell-TaskItem: overlay text remains after the shell is closed (Windows 11) #603

@tmssngr

Description

@tmssngr

Describe the bug
Windows 11 shows always the task items for its windows combined into one. If one shell of your multi-shell SWT application has an overlay text, it will be shown. So fine so good. But when closing the shell with the overlay text, it remains displayed.

To Reproduce
Please run the following snippet on Windows 11.

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;

public class TaskbarTest {

	public static void main(String[] args) {
		final Display display = new Display();

		createShell("Without taskitem", display);

		final Shell shell = createShell("With taskitem", display);
		final TaskItem item = display.getSystemTaskBar().getItem(shell);
		item.setOverlayText("abc");

		while (!display.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	private static Shell createShell(String text, Display display) {
		final Shell shell = new Shell(display);
		shell.setText(text);
		shell.addListener(SWT.Close, event -> {
			final Shell[] shells = display.getShells();
			if (shells.length == 1) {
				display.dispose();
			}
		});
		shell.setSize(400, 300);
		shell.open();
		return shell;
	}
}

You will see 2 shells, one with task item overlay, one without. Closing the one with overlay causes the task item still to show the item.

Expected behavior
The overlay should be hidden if the shell causing it has been closed/disposed.

Screenshots
screenshot

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Windows 11

Workaround (or) Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions