Ignore:
Timestamp:
Apr 17, 2006, 10:09:42 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Implemented CACA_EVENT_QUIT. Unused yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_x11.c

    r780 r799  
    5353    int font_offset;
    5454    Cursor pointer;
     55    Atom wm_protocols;
     56    Atom wm_delete_window;
    5557#if defined(HAVE_X11_XKBLIB_H)
    5658    Bool autorepeat;
     
    148150                      CWBackingStore | CWBackPixel | CWEventMask,
    149151                      &x11_winattr);
     152
     153    kk->drv.p->wm_protocols =
     154        XInternAtom(kk->drv.p->dpy, "WM_PROTOCOLS", True);
     155    kk->drv.p->wm_delete_window =
     156        XInternAtom(kk->drv.p->dpy, "WM_DELETE_WINDOW", True);
     157
     158    if(p_win->wm_protocols != None && p_win->wm_delete_window != None)
     159        XSetWMProtocols(kk->drv.p->dpy, kk->drv.p->window,
     160                        &kk->drv.p->wm_delete_window, 1);
    150161
    151162    XStoreName(kk->drv.p->dpy, kk->drv.p->window, "caca for X");
     
    509520    }
    510521
     522    while(XCheckTypedEvent(kk->drv.p->dpy, ClientMessage, &xevent))
     523    {
     524        if(xevent.xclient.message_type != kk->drv.p->wm_protocols)
     525            continue;
     526
     527        if((Atom)xevent.xclient.data.l[0] == kk->drv.p->wm_delete_window)
     528        {
     529            ev->type = CACA_EVENT_QUIT;
     530            return 1;
     531        }
     532    }
     533
    511534    ev->type = CACA_EVENT_NONE;
    512535    return 0;
Note: See TracChangeset for help on using the changeset viewer.