C�pia Daniel Secrieru <[EMAIL PROTECTED]>:

  Hi,

>     Does anyone knows anything about something similar to Windows
> WM_CLOSE
> message in Xlib?
>     That is a message that is emitted when a client wants to close a
> window,
> before destroying it (so DestroyNotify doesn't do the trick). A close
> message doesn't necesarily mean that a destroy message/event will be
> emmited, that meaning that the client had decided not to destroy the
> window
> after all.
>     I have a hunch that such a message/event might have something to do
> with
> the WM, but I couldn't find anything in the docs. Could someone please
> help
> me? Thanks...

  In a xlib only based program, you should do something like:


    Atom wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", False);

    XSetWMProtocols(display, top_window, &wm_delete_window, 1);

  Then, in the event loop, I thnik it is something like:

    switch (event->type) {
    ...
        case ClientMessage:
            if (event->xclient.message_type == wm_delete_window) {
                /* cleanup, confirm save files, etc */
            }
            break;
    ...
    }

  Note that ClientMessage may also be used to pass data between windows,
but I think there is no largely used standard for it. You can use the data
field of the XClientMessageEvent structure to comunicate using the windows
as a kind of descriptor, and create you own message passing system using
plain X events (limited to 20 bytes each packet).

> Dany Secrieru,
> LFC - The X-Platform
> http://www.lfc2.net/
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> _______________________________________________
> Xpert mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/xpert
> 

Paulo
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to