Opened 10 years ago

Last modified 10 years ago

#10826 new bug

"Close all" from another workspace does not show user unload hook message

Reported by: Kev Owned by: jackburton
Priority: normal Milestone: R1
Component: Applications/Terminal Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: x86

Description

hrev47209

  1. open a Terminal window
  2. type 'ftp' and hit Enter
  3. switch workspaces
  4. click the Terminal entry in Deskbar, and click Close All
  5. nothing appears to happen (i.e. Terminal continues to run) because it's waiting on the other workspace with a user message (because ftp is still running)

Should it:

  1. switch the current workspace over to where Terminal is popping up a message
  2. somehow pop the message up in the current workspace, even if that's different from where Terminal is running
  3. migrate the Terminal window to the current workspace
  4. stay how it is

I think A is probably out, because if you open two Terminal windows in separate workspaces, they both pop up a message.

Change History (7)

comment:1 by diver, 10 years ago

Component: Applications/DeskbarApplications/Terminal
Owner: changed from axeld to jackburton

Looks like a problem with Terminal itself.

comment:2 by bonefish, 10 years ago

A problem is that Terminal is multi-launch, i.e. the windows actually belong to different applications. Otherwise I'd say, simply display the same message on all workspaces with a Terminal window, listing all the still running processes (maybe grouped by window).

I assume Deskbar just iterates through the applications and sends each a quit message, which makes coordination between the Terminal applications somewhat problematic.

I wonder, if we should just make Terminal single-launch. For all practical purposes -- save pressing Command-Q -- it behaves that way anyway.

comment:3 by Kev, 10 years ago

bonefish, I'm not sure that's the trouble--it already *does* display the same message on all workspaces with a Terminal window (albeit without listing other running processes.) The user-perspective glitch comes if you're trying to close all Terminal windows using Deskbar on a workspace that does not have a Terminal window on it--you don't see any of the messages that it makes, until you switch to those workspaces. I don't think there needs to be any co-ordination between Terminal apps, though, if we used solutions B or C--aside from attempting to make a one-click confirmation for all running Terminals--because the user would then see all of the Terminal messages and could decide on whether to close each window in turn, and each Terminal only need deal with itself and not even know about the others' existence.

diver, now that you mention it, it may be nicer for the user to implement at the application level than at Deskbar level. Aside from making some new API that every app needs to respond to Deskbar's quit command with a flag indicating whether user confirmation is needed, which seems not worth it, it would not be great to bring the running app to the fore (or switch workspaces) no matter what. Windows does this and it's quite annoying, especially if you're closing apps because a system has slowed down, to have each app insist on showing itself before you can close it down using its taskbar button. On the other hand, I bet this issue applies to any app that has a user quit confirmation. Maybe the Deskbar could issue quit commands, then check a few seconds later, and if the app is still running, drag it to the current workspace and offer to the user to kill its process. If the user then sees its confirmation dialog and responds by confirming the quit, Deskbar's own confirmation dialog should detect this and close itself down. If the user responds by cancelling the quit, I guess there's no way for Deskbar to know whether they cancelled or are just taking longer to decide, so then the user would have to cancel Deskbar's confirmation as well.

comment:4 by pulkomandy, 10 years ago

The API already supports this:

  • The application QuitRequested method is called. This is where we pop the alert up.
  • The method return a boolean to indicate that the app can be closed or not (cancelling the quit request, or allowing it to continue)

It is currently up to the app to make sure the user gets to see the alert. This is tricky with the current multi-launch terminal because it goes this way:

  • DeskBar sends the quit request to all terminal apps
  • All window pop the QuitRequested message at the same time
  • They all try to switch to their own workspace
  • Only one of them wins

With a single launch terminal it would work better:

  • Deskbar sends the quit request to the unique terminal app
  • The app iterates over all the windows and call their QuitRequested hook (this is the default implementation of BApplication::QuitRequested)
  • So the windows get to show their alert one after another, not all at the same time, they can safely grab the user attention by switching workspaces
  • If a window has no running app, it can be quit without popping the alert or switching worksapces
  • If the user cancels the shutdown at one window, the process stops there, there is no alert for remaining windows.

in reply to:  4 ; comment:5 by Kev, 10 years ago

Replying to pulkomandy:

The API already supports this:

  • The application QuitRequested method is called. This is where we pop the alert up.
  • The method return a boolean to indicate that the app can be closed or not (cancelling the quit request, or allowing it to continue)

Interesting! That's good.

It is currently up to the app to make sure the user gets to see the alert. This is tricky with the current multi-launch terminal because it goes this way:

  • DeskBar sends the quit request to all terminal apps
  • All window pop the QuitRequested message at the same time
  • They all try to switch to their own workspace
  • Only one of them wins

So it was right to make it a Terminal thing after all. Now, this is where my report is maybe actually about two bugs: there is still something not working right if you only have one single Terminal window open, and try to "Close All" from another workspace. It doesn't change workspaces. By extension the multi-Terminal-workspace situation is also not working right--none of them win, because the workspace doesn't switch to any of them.

With a single launch terminal it would work better:

  • Deskbar sends the quit request to the unique terminal app
  • The app iterates over all the windows and call their QuitRequested hook (this is the default implementation of BApplication::QuitRequested)
  • So the windows get to show their alert one after another, not all at the same time, they can safely grab the user attention by switching workspaces
  • If a window has no running app, it can be quit without popping the alert or switching worksapces
  • If the user cancels the shutdown at one window, the process stops there, there is no alert for remaining windows.

If you have a single launch, though, and some program in a Terminal crashes (say like in #10504 ), does it take all your Terminal windows with it?

in reply to:  5 comment:6 by pulkomandy, 10 years ago

Replying to Kev:

  • They all try to switch to their own workspace

By extension the multi-Terminal-workspace situation is also not working right--none of them win, because the workspace doesn't switch to any of them.

Yes, in either case we still need to make terminal alert to switch workspaces.

If you have a single launch, though, and some program in a Terminal crashes (say like in #10504 ), does it take all your Terminal windows with it?

If bash crashes, only the affected tab will be closed (and the window with it if it was the only tab there). If Terminal itself crashes, all windows will be closed, but we should make sure Terminal doesn't crash.

comment:7 by axeld, 10 years ago

Of course it would work better with a single launch Terminal, but that doesn't solve the underlying problem; any other app could be in the same situation as Terminal. It would be nice to find a solution that works for that kind of apps.

Also, it looks like you mix "Close All" from Deskbar, and a shutdown. AFAIK the shutdown process does not send out the quit message simultaneously for that very reason.

Note: See TracTickets for help on using tickets.