Is there a way to change ConfigureNotify event frequency in X11?

与世无争的帅哥 提交于 2019-12-02 02:19:57

No, it is not possible to configure the event rate; they just come in as the X server sees fit. However, part of the jerkiness may be precisely because you are updating the window immediately after an resize event (I hope you don't do it inside the event handler...) The reason is that you immediately keep the X server busy with your painting, giving it little time to send events back.

My standard solution for this kind of behaviour is: while resizing, use a timer to repaint at regular intervals (say, every 200 ms or so). Use the width and height as it is at the start of the paint routine (remember that you can receive resize events while painting!). If there has not been a change in width/height since the last timer event, stop the timer.

I suggest using the Xt toolkit to implement timers and other callbacks; it's a lot easier to use than bare Xlib calls.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!