Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: .qmake.conf src/client/configure.json Change-Id: I6afd4de5bcca36bebb7bfb479f8237a12e18dd5b
This commit is contained in:
commit
b21eacfa57
@ -149,7 +149,7 @@
|
|||||||
"#endif"
|
"#endif"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"use": "egl"
|
"use": "egl drm"
|
||||||
},
|
},
|
||||||
"vulkan-server-buffer": {
|
"vulkan-server-buffer": {
|
||||||
"label": "Vulkan Buffer Sharing",
|
"label": "Vulkan Buffer Sharing",
|
||||||
|
@ -88,7 +88,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p)
|
|||||||
// or the server didn't send an enter event first.
|
// or the server didn't send an enter event first.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mRepeatTimer.setInterval(mRepeatRate);
|
mRepeatTimer.setInterval(1000 / mRepeatRate);
|
||||||
handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, mRepeatKey.modifiers,
|
handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, mRepeatKey.modifiers,
|
||||||
mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers,
|
mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers,
|
||||||
mRepeatKey.text, true);
|
mRepeatKey.text, true);
|
||||||
@ -143,6 +143,12 @@ QWaylandWindow *QWaylandInputDevice::Keyboard::focusWindow() const
|
|||||||
QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat)
|
QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat)
|
||||||
: mParent(seat)
|
: mParent(seat)
|
||||||
{
|
{
|
||||||
|
#if QT_CONFIG(cursor)
|
||||||
|
mCursor.frameTimer.setSingleShot(true);
|
||||||
|
mCursor.frameTimer.callOnTimeout([&]() {
|
||||||
|
cursorTimerCallback();
|
||||||
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandInputDevice::Pointer::~Pointer()
|
QWaylandInputDevice::Pointer::~Pointer()
|
||||||
@ -224,7 +230,7 @@ public:
|
|||||||
if (animated) {
|
if (animated) {
|
||||||
m_frameCallback.reset(new WlCallback(frame(), [this](uint32_t time){
|
m_frameCallback.reset(new WlCallback(frame(), [this](uint32_t time){
|
||||||
Q_UNUSED(time);
|
Q_UNUSED(time);
|
||||||
m_pointer->updateCursor();
|
m_pointer->cursorFrameCallback();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
commit();
|
commit();
|
||||||
@ -328,7 +334,8 @@ void QWaylandInputDevice::Pointer::updateCursor()
|
|||||||
uint time = seat()->mCursor.animationTimer.elapsed();
|
uint time = seat()->mCursor.animationTimer.elapsed();
|
||||||
|
|
||||||
if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) {
|
if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) {
|
||||||
int frame = wl_cursor_frame(waylandCursor, time);
|
uint duration = 0;
|
||||||
|
int frame = wl_cursor_frame_and_duration(waylandCursor, time, &duration);
|
||||||
::wl_cursor_image *image = waylandCursor->images[frame];
|
::wl_cursor_image *image = waylandCursor->images[frame];
|
||||||
|
|
||||||
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
|
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
|
||||||
@ -339,7 +346,12 @@ void QWaylandInputDevice::Pointer::updateCursor()
|
|||||||
int bufferScale = mCursor.themeBufferScale;
|
int bufferScale = mCursor.themeBufferScale;
|
||||||
QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale;
|
QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale;
|
||||||
QSize size = QSize(image->width, image->height) / bufferScale;
|
QSize size = QSize(image->width, image->height) / bufferScale;
|
||||||
bool animated = waylandCursor->image_count > 1 && image->delay > 0;
|
bool animated = duration > 0;
|
||||||
|
if (animated) {
|
||||||
|
mCursor.gotFrameCallback = false;
|
||||||
|
mCursor.gotTimerCallback = false;
|
||||||
|
mCursor.frameTimer.start(duration);
|
||||||
|
}
|
||||||
getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated);
|
getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -354,6 +366,22 @@ CursorSurface *QWaylandInputDevice::Pointer::getOrCreateCursorSurface()
|
|||||||
return mCursor.surface.get();
|
return mCursor.surface.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWaylandInputDevice::Pointer::cursorTimerCallback()
|
||||||
|
{
|
||||||
|
mCursor.gotTimerCallback = true;
|
||||||
|
if (mCursor.gotFrameCallback) {
|
||||||
|
updateCursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWaylandInputDevice::Pointer::cursorFrameCallback()
|
||||||
|
{
|
||||||
|
mCursor.gotFrameCallback = true;
|
||||||
|
if (mCursor.gotTimerCallback) {
|
||||||
|
updateCursor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // QT_CONFIG(cursor)
|
#endif // QT_CONFIG(cursor)
|
||||||
|
|
||||||
QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p)
|
QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p)
|
||||||
|
@ -286,6 +286,8 @@ public:
|
|||||||
int idealCursorScale() const;
|
int idealCursorScale() const;
|
||||||
void updateCursorTheme();
|
void updateCursorTheme();
|
||||||
void updateCursor();
|
void updateCursor();
|
||||||
|
void cursorTimerCallback();
|
||||||
|
void cursorFrameCallback();
|
||||||
CursorSurface *getOrCreateCursorSurface();
|
CursorSurface *getOrCreateCursorSurface();
|
||||||
#endif
|
#endif
|
||||||
QWaylandInputDevice *seat() const { return mParent; }
|
QWaylandInputDevice *seat() const { return mParent; }
|
||||||
@ -325,6 +327,9 @@ public:
|
|||||||
QWaylandCursorTheme *theme = nullptr;
|
QWaylandCursorTheme *theme = nullptr;
|
||||||
int themeBufferScale = 0;
|
int themeBufferScale = 0;
|
||||||
QScopedPointer<CursorSurface> surface;
|
QScopedPointer<CursorSurface> surface;
|
||||||
|
QTimer frameTimer;
|
||||||
|
bool gotFrameCallback = false;
|
||||||
|
bool gotTimerCallback = false;
|
||||||
} mCursor;
|
} mCursor;
|
||||||
#endif
|
#endif
|
||||||
QPointF mSurfacePos;
|
QPointF mSurfacePos;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user