Hello, everyone! I'm a newbie in xlib, I need to close the window while won't close the program, [1] is my test code, here's the result in [2], XDestroyWindow passed, but the window haven't close, Haven't I get the key to code it?
[1] #include <X11/Xlib.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sched.h> int main(void) { Display *display; Window window; XEvent event; char *msg = "Hello, World!"; int s; /* open connection with the server */ display = XOpenDisplay(NULL); if (display == NULL) { fprintf(stderr, "Cannot open display\n"); exit(1); } s = DefaultScreen(display); /* create window */ window = XCreateSimpleWindow(display, RootWindow(display, s), 10, 10, 200, 200, 1, BlackPixel(display, s), WhitePixel(display, s)); /* select kind of events we are interested in */ XSelectInput(display, window, ExposureMask | KeyPressMask); /* map (show) the window */ XMapWindow(display, window); /* event loop */ for (;;) { XNextEvent(display, &event); printf("get next event\n"); XDestroyWindow(display, window); printf("window destroyed\n"); while(1) { sched_yield(); } return 0; } [2] https://i.stack.imgur.com/3ydc7.png -- Best Wishes, Pencc
_______________________________________________ xorg@lists.x.org: X.Org support Archives: http://lists.freedesktop.org/archives/xorg Info: https://lists.x.org/mailman/listinfo/xorg Your subscription address: %(user_address)s