开发者

X11 Programming: Get notified if new window appeared?

programming in C with the X11 library, is there a way to get notified if a new window has appeared? I found XSetAfterFunction but its intended for debugging purposes only ...

Thanks for your help!

Heinrich

@edit:

This code solves my problem

int main() {    
Display* display = XOpenDisplay(":2");

XSetWindowAttributes attributes;
attributes.event_mask = SubstructureNoti开发者_如何学JAVAfyMask | StructureNotifyMask;

XChangeWindowAttributes(display, 0x100, CWEventMask, &attributes);

while (true) {
    XEvent event;
    XNextEvent(display, &event);
    std::cout << "Event occured" << std::endl;
}

return 0;
}


From memory, you can use XChangeWindowAttributes to listen to events from the root window, then act on XMapEvent (or XCreateWindowEvent or whateverEvent depending on your definition of "a new window has appeared").

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜