Re: What to do when WM destroy command is used?



Damon Chaplin <damon helixcode com> writes:

> I just got a bug report about Glade crashing after the Window Manager's
> 'Destroy' command was used to destroy a window.
> 
> Can GTK+ apps recover from a window being destroyed by the WM?

Well, there are two forms of "Destroy".

The proper way is that the window manager calls XKillClient. There is
no way at all for a client to recover from this, because you can't
recover from an X IO error.

The force-destroy in Enlightenment and Sawfish works another way - it
justs calls XDestroyWindow (!) on the window. This is more handleable,
and if an app ignores X errors, it sees it as a bit like a "Delete"
request, except that the window is gone...  But it doesn't make it
better, it just makes it less predictable.

I think Enlightenment uses "Annihilate" or "Nuke" or something
a bit more dangerous sounding than simply "Destroy".

> Is there a recommended way to do this?
> 
> If not, maybe we should encourage WMs to not show the "Destroy" command,
> or make it an advanced option.

Window managers probably should have some sort of force-kill command,
since it is useful, upon rare occasion. But it should work something
like:

 - Send a delete message to the window, and at the same time a
   _NET_WM_PING message if the application advertises support
   for that.

 - If after some timeout (maybe 10 seconds), the window is still
   there, put up a dialog:

    PING supported and no ping received:

     "The application is not responding to messages. This may
      mean it is busy or communication with it has been lost.
      Attempt to force the application to quit?"

    PING supported and received:

     "The application does not allow closing this window."
      
    No PING supported:

     "The application is busy or does not allow closing this window.
      Attempt to force the application to quit?"

    (Need some considerable rewording about the dangers of forced   
    quits - LOST DATA!. But gives some idea of what a window manager
    can do.)

 - If the user chooses to kill the application, kill the application
   via some combination of XKillClient(), and, if the client is
   local kill().

Under no circumstances should a window manager XDestroyWindow() a
clients window. There is no guarantee at all what a client will do
when one of its windows is destroyed by an outside agency - it
might seg fault, it might remain running with no windows visible,
etc...

Regards,
                                        Owen 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]