summaryrefslogtreecommitdiff
path: root/src/client/qwaylandinputdevice_p.h
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2019-12-13 22:15:32 +0100
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2019-12-17 12:02:23 +0100
commitce15889614f87b5986f997beffd2826471adfe51 (patch)
tree206f0693a83633558c3f02b440559ef00eb6f512 /src/client/qwaylandinputdevice_p.h
parent80ed5501cf5dcc4b6ef2a1a126d9d564c1c73851 (diff)
downloadqtwayland-ce15889614f87b5986f997beffd2826471adfe51.tar.gz
Drive cursor animation with a timer
Using only wl_surface_frame callbacks to update the cursor does so much more often than needed. In addition, at least GNOME and Weston fire the callback for the cursor surface immediately, which ends up updating the cursor at over 3000 Hz here. Use wl_cursor_frame_and_duration to drive a single shot timer. This function is also guaranteed to return 0 for single frame cursors, so we can avoid starting the timer at all. We wait for both the surface frame callback and the timer to fire before updating the cursor for the next frame of animation. This reduces our update rate to the frame rate of the cursor or the rate requested by the compositor, whichever is lower. Change-Id: I10277460ebe9b547ebaf7f73424b9ef17614107f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/client/qwaylandinputdevice_p.h')
-rw-r--r--src/client/qwaylandinputdevice_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h
index 60d6f2c1..a567c57b 100644
--- a/src/client/qwaylandinputdevice_p.h
+++ b/src/client/qwaylandinputdevice_p.h
@@ -286,6 +286,8 @@ public:
int idealCursorScale() const;
void updateCursorTheme();
void updateCursor();
+ void cursorTimerCallback();
+ void cursorFrameCallback();
CursorSurface *getOrCreateCursorSurface();
#endif
QWaylandInputDevice *seat() const { return mParent; }
@@ -325,6 +327,9 @@ public:
QWaylandCursorTheme *theme = nullptr;
int themeBufferScale = 0;
QScopedPointer<CursorSurface> surface;
+ QTimer frameTimer;
+ bool gotFrameCallback = false;
+ bool gotTimerCallback = false;
} mCursor;
#endif
QPointF mSurfacePos;