简体   繁体   中英

How to watch any window movements with xlib?

How do I track move event for all the windows? Like if user moves window "Pluma" my daemon would receive window name and new coordinates.

if(XCheckMaskEvent(display, -1, &event))
    {
        if(event.type == ConfigureNotify)
        {
            moved += event.xmotion.x + event.xmotion.y;
            //qDebug << moved;
        }
    }

I tried tracking it like this, but it does not work...

You need t select SubstructureNotify mask on the root window first:

XSelectInput(display, XDefaultRootWindow(display), SubstructureNotifyMask );

This way you are telling X server "I'm interested in root window childrens move/resize/delete/create events"

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