Notification of quit event

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
jwong
Level 2
Level 2
Posts: 27
Joined: Thu Feb 17, 2011 4:58 pm

Notification of quit event

Post by jwong »

I could not find any documentation on this subject, so any help would be appreciated.

Is there any from within my Windows application to be notified of when my application is about to closed when X11 is shutdown? More specifically when I run my app via wine on OSX, the common way to shutdown the app is via command key + Q. This quits X11 as well as my app. I would however like the opportunity save the users current session. As of right now my app quits and all work done is lost.
User avatar
DanKegel
Moderator
Moderator
Posts: 1164
Joined: Wed May 14, 2008 11:44 am

Post by DanKegel »

That's a good question.

I don't know how Linux notifies apps of impending system shutdowns.
It might be the SeatRemoved signal from ConsoleKit these days.
Anybody know?
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Post by doh123 »

You cannot really set up CMD+Q to just quit the program in Wine, because of how it has to run in X11 and X11 runs on top of OSX.... unless you want to customize your own X11 source code and build your own version... its possible, but not with normal X11 or XQuartz.

Make sure you have X11 set to prompt when you hit CMD+Q and it'll come up with a warning... it won't save your stuff, but it'll prevent it from closing down without confirmation.

Other than that.. don't hit CMD+Q....
ischou
Level 4
Level 4
Posts: 109
Joined: Sun Nov 28, 2010 7:22 pm

Post by ischou »

Both Apple's X11 and XQuartz will prompt you with a "Are you sure you want to quit now?" message if there are active clients open (actually, I don't completely remember about X11, but I'm sure XQuartz does this) unless you intentionally disabled this function using a terminal command such as:

Code: Select all

defaults write org.x.x11 no_quit_alert true
If there are no clients open (ie, no connections to the X server) Cmd-Q will quit immediately. If clients are open, and the default behavior is intact, you should get a warning. So if you get a warning message, don't click "Ok" because something will get ungraciously killed.
jwong
Level 2
Level 2
Posts: 27
Joined: Thu Feb 17, 2011 4:58 pm

Post by jwong »

Thanks for the info. I didnt have X11 set to prompt when you hit CMD+Q originally. Now I do. While it is not ideal, it is much better.
Locked