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

后端 未结 1 1363
余生分开走
余生分开走 2021-01-22 07:02

I\'ve got a little graphical program that uses ConfigureNotify events to detect window resizing and to redraw the application. However, the resize events seem to come in somewh

相关标签:
1条回答
  • 2021-01-22 07:25

    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.

    0 讨论(0)
提交回复
热议问题