How do I gracefully exit an X11 event loop?

前端 未结 2 1937
逝去的感伤
逝去的感伤 2020-12-12 18:47

Almost every tutorial I find tells me to do this for my event loop:

XEvent event;

while (true)
{
    XNextEvent(display, &event);

    switch (event.typ         


        
2条回答
  •  一个人的身影
    2020-12-12 19:31

    There are no such things as "exit button" or "application" or "close event" in X11. This is by design.

    Window decorations, exit buttons and many the other things we depend upon are not built into X11. They are implemented on top of the core X11 instead. The name of the particular set of conventions responsible for wmDeleteMessage is ICCCM, look it up.

    Xlib only deals with the core X11 protocol. No built-in close event there.

    There are toolkits that make dealing with ICCCM and all other things that are not built into X11 easier (GTK, wxWindows, Qt, ...) You probably want to use one of those.

提交回复
热议问题