Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell close event listener not called on Command+Q on Mac #1205

Open
mwhapples opened this issue May 1, 2024 · 2 comments · May be fixed by #1484
Open

Shell close event listener not called on Command+Q on Mac #1205

mwhapples opened this issue May 1, 2024 · 2 comments · May be fixed by #1484
Labels
macOS happens on macOS

Comments

@mwhapples
Copy link

On MacOSX when I press Command+Q for quit in an SWT application the shell closes without calling the close event listener. My Mac is a bit outdated, but I have been assured by work colleagues the issue still shows with newer Macs.

Steps to reproduce:

  1. Launch Eclipse SWT Snippet99
  2. Press Command+Q

Expected: The message box asking whether to close should appear.
Actual: The shell just closes.

SWT version tested: 3.125.0 (from maven central)

This bug seems to be specific to pressing the Command+Q keyboard shortcut, pressing the close button on screen works as expected.

@tmssngr
Copy link
Contributor

tmssngr commented May 3, 2024

IIRC, you need to add a SWT.Dispose listener to the display to get a notification for Cmd+Q on MacOS.

@mwhapples
Copy link
Author

If I understand it correctly a dispose listener on the Display object will be called after the shell is closed, so attempting to cancel the dispose event will not prevent the shell being closed. Thus it does not seem to be a solution if a confirmation to quit dialog is wanted like in Snippet99 and the prompt is to appear when using Command+Q keyboard shortcut. If I have misunderstood and it does actually work as I would have hoped, then may be Snippet99 needs updating to include this as well.

@jukzi jukzi added the macOS happens on macOS label May 13, 2024
elsazac added a commit to elsazac/eclipse.platform.swt that referenced this issue Sep 23, 2024
Snippet99 requires modification as Command+Q is not implemented.
Currently, the snippet demonstrates a message box pop-up when attempting
to close the dialog window, but pressing Command+Q closes the window
without triggering this behavior. The snippet has been updated to
implement Command+Q functionality and to add an SWT dispose listener to
the display object.
@elsazac elsazac linked a pull request Sep 23, 2024 that will close this issue
elsazac added a commit to elsazac/eclipse.platform.swt that referenced this issue Oct 4, 2024
Snippet99 requires modification as Command+Q is not implemented.
Currently, the snippet demonstrates a message box pop-up when attempting
to close the dialog window, but pressing Command+Q closes the window
without triggering this behavior. The snippet has been updated to
implement Command+Q functionality and to add an SWT dispose listener to
the display object.
elsazac added a commit to elsazac/eclipse.platform.swt that referenced this issue Oct 24, 2024
Snippet99 requires modification as Command+Q is not implemented.
Currently, the snippet demonstrates a message box pop-up when attempting
to close the dialog window, but pressing Command+Q closes the window
without triggering this behavior. The snippet has been updated to
implement Command+Q functionality and to add an SWT dispose listener to
the display object.
elsazac added a commit to elsazac/eclipse.platform.swt that referenced this issue Oct 24, 2024
Snippet99 requires modification as Command+Q is not implemented.
Currently, the snippet demonstrates a message box pop-up when attempting
to close the dialog window, but pressing Command+Q closes the window
without triggering this behavior. The snippet has been updated to
implement Command+Q functionality and to add an SWT dispose listener to
the display object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS happens on macOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants