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

Command+Q on Snippet99 #1484

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elsazac
Copy link
Member

@elsazac elsazac commented Sep 23, 2024

Fixes: #1205

Snippet99 requires modification as Command+Q is not implemented on that. 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 behaviour. The snippet has been updated to implement Command+Q functionality and to add an SWT dispose listener to the display object.

Copy link
Contributor

github-actions bot commented Sep 23, 2024

Test Results

   483 files  ±0     483 suites  ±0   8m 11s ⏱️ +13s
 4 135 tests ±0   4 125 ✅ ±0   7 💤 ±0  3 ❌ ±0 
16 333 runs  ±0  16 240 ✅ ±0  90 💤 ±0  3 ❌ ±0 

For more details on these failures, see this check.

Results for commit 4ad37b7. ± Comparison against base commit 6907169.

♻️ This comment has been updated with latest results.

@Phillipus
Copy link
Contributor

Phillipus commented Oct 4, 2024

But this doesn't demonstrate what is being asked in #1205

As said in this comment:

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.

So in this PR pressing Command+Q will open the dialog but choosing "No" has no effect. i.e event.doit = false has no effect on the dispose event.

@elsazac
Copy link
Member Author

elsazac commented Oct 24, 2024

But this doesn't demonstrate what is being asked in #1205

So in this PR pressing Command+Q will open the dialog but choosing "No" has no effect. i.e event.doit = false has no effect on the dispose event.

I just noticed that while the snippet shows the message box, it doesn't prevent the app from quitting when Command+Q is pressed. Since in macOS, Command+Q is handled at the OS level, even though the SWT.Dispose event listener can trigger the message box, it doesn't have control over stopping the closing of the shell process triggered by the system. So, the application closes right after the message box appears, regardless of the any other choice.

I tried implementing the keydown event for Command and Q, but this doesn't work either because macOS takes over this key combination before it reaches the SWT application.

Does anyone have any other suggestions on how to handle this situation effectively?

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shell close event listener not called on Command+Q on Mac
2 participants