Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.8, 6.4.2
-
None
Description
Subclassing QOpenGLWidget and overriding mouseMoveEvent, looks like I get an average of ~1.8ms between events. Now if I call update inside mouseMoveEvent, the average time between mouse motion events becomes equal to the monitor vsync, ~16.6ms. As I understand it, many events are lost or not passed to the QOpenGLWidget.
I attached a test code to demonstrate what I mean.
Now, my vague understanding is that calling update triggers paintGL and swap buffers, and since vsync is enabled, the GUI thread is being put to sleep until the vsync, and during that period, the mouse events are lost? I can reduce the problem by using a timer to call update at a maximum of 60Hz, but that's basically duplicating work that is already being done inside Qt.
EDIT: In Linux, if I enable debugging, and without update called from mouseMoveEvent, I get many mouse move events in the same sequence:
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1721
qt.qpa.input.events: XI2 mouse motion 365,190, time 135969488, source MouseEventNotSynthesized
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1721
qt.qpa.input.events: XI2 mouse motion 367,190, time 135969489, source MouseEventNotSynthesized
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1721
qt.qpa.input.events: XI2 mouse motion 369,190, time 135969490, source MouseEventNotSynthesized
...
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1721
qt.qpa.input.events: XI2 mouse motion 437,169, time 135970097, source MouseEventNotSynthesized
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1721
qt.qpa.input.events: XI2 mouse motion 436,169, time 135970121, source MouseEventNotSynthesized
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1721
qt.qpa.input.events: XI2 mouse motion 436,169, time 135970148, source MouseEventNotSynthesized
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1721
qt.qpa.input.events: XI2 mouse motion 435,169, time 135970159, source MouseEventNotSynthesized
while with update from mouseMoveEvent:
qt.qpa.backingstore: Composing and flushing QRegion(null) of QWidgetWindow(0x55789516aa70, name="QMainWindowClassWindow") at offset QPoint(0,0) with 3 texture(s) in QPlatformTextureList(0x5578951bda80)
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1657
qt.qpa.input.events: XI2 mouse motion 335,293, time 135969219, source MouseEventNotSynthesized
16ms
qt.qpa.backingstore: Composing and flushing QRegion(null) of QWidgetWindow(0x55789516aa70, name="QMainWindowClassWindow") at offset QPoint(0,0) with 3 texture(s) in QPlatformTextureList(0x5578951bda80)
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1661
qt.qpa.input.events: XI2 mouse motion 393,309, time 135969237, source MouseEventNotSynthesized
16ms
qt.qpa.backingstore: Composing and flushing QRegion(null) of QWidgetWindow(0x55789516aa70, name="QMainWindowClassWindow") at offset QPoint(0,0) with 3 texture(s) in QPlatformTextureList(0x5578951bda80)
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1665
qt.qpa.input.events: XI2 mouse motion 457,307, time 135969253, source MouseEventNotSynthesized
16ms
qt.qpa.backingstore: Composing and flushing QRegion(null) of QWidgetWindow(0x55789516aa70, name="QMainWindowClassWindow") at offset QPoint(0,0) with 3 texture(s) in QPlatformTextureList(0x5578951bda80)
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1669
qt.qpa.input.events: XI2 mouse motion 521,287, time 135969269, source MouseEventNotSynthesized
16ms
qt.qpa.backingstore: Composing and flushing QRegion(null) of QWidgetWindow(0x55789516aa70, name="QMainWindowClassWindow") at offset QPoint(0,0) with 3 texture(s) in QPlatformTextureList(0x5578951bda80)
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1673
qt.qpa.input.events: XI2 mouse motion 560,255, time 135969286, source MouseEventNotSynthesized
16ms
qt.qpa.backingstore: Composing and flushing QRegion(null) of QWidgetWindow(0x55789516aa70, name="QMainWindowClassWindow") at offset QPoint(0,0) with 3 texture(s) in QPlatformTextureList(0x5578951bda80)
qt.qpa.events: Event | XInput Event(XCB_INPUT_MOTION) | sequence: 1677
qt.qpa.input.events: XI2 mouse motion 569,232, time 135969304, source MouseEventNotSynthesized