XCB: Fix clipboard breaking when timer wraps after 50 days
xcb_timestamp_t is a 32-bit unsigned value in miliseconds, so it wraps after 49.7 days. When it happens, QXcbConnection::m_time stops updating and copy & paste in an application would not work until the application is restarted. This patch detects the timer wrap and allows m_time to wrap too. The fix was verified in KDE desktop with applications running for 51 days. Fixes: QTBUG-65145 Change-Id: I328c4179c1b1f71914adda6f9a0ca3991a7e808e Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This commit is contained in:
parent
85250da09d
commit
036fe49580
@ -187,10 +187,10 @@ public:
|
||||
void addPeekFunc(PeekFunc f);
|
||||
|
||||
inline xcb_timestamp_t time() const { return m_time; }
|
||||
inline void setTime(xcb_timestamp_t t) { if (t > m_time) m_time = t; }
|
||||
inline void setTime(xcb_timestamp_t t) { if (timeGreaterThan(t, m_time)) m_time = t; }
|
||||
|
||||
inline xcb_timestamp_t netWmUserTime() const { return m_netWmUserTime; }
|
||||
inline void setNetWmUserTime(xcb_timestamp_t t) { if (t > m_netWmUserTime) m_netWmUserTime = t; }
|
||||
inline void setNetWmUserTime(xcb_timestamp_t t) { if (timeGreaterThan(t, m_netWmUserTime)) m_netWmUserTime = t; }
|
||||
|
||||
xcb_timestamp_t getTimestamp();
|
||||
xcb_window_t getSelectionOwner(xcb_atom_t atom) const;
|
||||
@ -264,6 +264,8 @@ private:
|
||||
void destroyScreen(QXcbScreen *screen);
|
||||
void initializeScreens();
|
||||
bool compressEvent(xcb_generic_event_t *event) const;
|
||||
inline bool timeGreaterThan(xcb_timestamp_t a, xcb_timestamp_t b) const
|
||||
{ return static_cast<int32_t>(a - b) > 0 || b == XCB_CURRENT_TIME; }
|
||||
|
||||
#if QT_CONFIG(xcb_xinput)
|
||||
void xi2SetupDevice(void *info, bool removeExisting = true);
|
||||
|
Loading…
Reference in New Issue
Block a user