简体   繁体   中英

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 = SubstructureNotifyMask | StructureNotifyMask;

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

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

return 0;
}

从内存中,您可以使用XChangeWindowAttributes从根窗口侦听事件,然后根据您的“新窗口出现”的定义,对XMapEvent(或XCreateWindowEvent或whateverEvent)执行操作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM