[FFmpeg-devel] [PATCH] lavd/xv: handle delete window message

Lukasz Marek lukasz.m.luki2 at gmail.com
Wed May 28 12:12:14 CEST 2014


On 28 May 2014 09:31, Nicolas George <george at nsup.org> wrote:

> Good idea, thanks.
>
> L'octidi 8 prairial, an CCXXII, Lukasz Marek a écrit :
> > User may close X11 window by close button on tray.
> > FFmpeg leaves in graceless way.
>
> Bogus window manager, it should not be destroying a window if it can not
> delete it, unless the user really request it.
>
> > This commit detects it and return IO error.
>
> Seems reasonable. EPIPE could make sense too.
>

Yes. Seems more accurate.

>
> > +
> > +    /* Check messages. Window might get closed. */
> > +    if (!xv->window_id) {
> > +        XEvent event;
> > +        if (XCheckTypedEvent(xv->display, ClientMessage, &event)) {
> > +            if (event.xclient.data.l[0] == xv->wm_delete_message) {
> > +                av_log(xv, AV_LOG_DEBUG, "Window close event.\n");
> > +                return AVERROR(EIO);
> > +            }
> > +        }
> > +    }
> > +
>
> I must say I do not like XCheckTypedEvent() much: what happens to the other
> events? They stay and clobber the queue. I suggest to loop over XPending
> and
> XNextEvent. That would also make life easier to someone who wants to
> implement other kind of events.


What's the reason for this change you suggest?
To answer: all ClientMessage events are removed from queue and handled here
(in fact only delete window is handled, other (if any) are omitted)
Other events stays in queue.


More information about the ffmpeg-devel mailing list