Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: src/client/qwaylandinputdevice.cpp Change-Id: I4f985d6e47b4199a940ff1cd40e65165c28e49b2
This commit is contained in:
commit
0552060620
@ -100,6 +100,7 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window)
|
|||||||
d->m_wayland_window = window;
|
d->m_wayland_window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// \a size is without margins
|
||||||
static QRegion marginsRegion(const QSize &size, const QMargins &margins)
|
static QRegion marginsRegion(const QSize &size, const QMargins &margins)
|
||||||
{
|
{
|
||||||
QRegion r;
|
QRegion r;
|
||||||
@ -123,7 +124,7 @@ const QImage &QWaylandAbstractDecoration::contentImage()
|
|||||||
d->m_decorationContentImage.fill(Qt::transparent);
|
d->m_decorationContentImage.fill(Qt::transparent);
|
||||||
this->paint(&d->m_decorationContentImage);
|
this->paint(&d->m_decorationContentImage);
|
||||||
|
|
||||||
QRegion damage = marginsRegion(window()->frameGeometry().size(), window()->frameMargins());
|
QRegion damage = marginsRegion(window()->geometry().size(), window()->frameMargins());
|
||||||
for (QRect r : damage)
|
for (QRect r : damage)
|
||||||
waylandWindow()->damage(r);
|
waylandWindow()->damage(r);
|
||||||
|
|
||||||
|
@ -417,6 +417,15 @@ void QWaylandInputContext::commit()
|
|||||||
textInput()->commit();
|
textInput()->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ::wl_surface *surfaceForWindow(QWindow *window)
|
||||||
|
{
|
||||||
|
if (!window || !window->handle())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto *waylandWindow = static_cast<QWaylandWindow *>(window->handle());
|
||||||
|
return waylandWindow->wl_surface::object();
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandInputContext::update(Qt::InputMethodQueries queries)
|
void QWaylandInputContext::update(Qt::InputMethodQueries queries)
|
||||||
{
|
{
|
||||||
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries;
|
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries;
|
||||||
@ -424,15 +433,15 @@ void QWaylandInputContext::update(Qt::InputMethodQueries queries)
|
|||||||
if (!QGuiApplication::focusObject() || !textInput())
|
if (!QGuiApplication::focusObject() || !textInput())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mCurrentWindow && mCurrentWindow->handle() && !inputMethodAccepted()) {
|
auto *currentSurface = surfaceForWindow(mCurrentWindow);
|
||||||
struct ::wl_surface *surface = static_cast<QWaylandWindow *>(mCurrentWindow->handle())->object();
|
|
||||||
textInput()->disable(surface);
|
if (currentSurface && !inputMethodAccepted()) {
|
||||||
|
textInput()->disable(currentSurface);
|
||||||
mCurrentWindow.clear();
|
mCurrentWindow.clear();
|
||||||
} else if (!mCurrentWindow && inputMethodAccepted()) {
|
} else if (!currentSurface && inputMethodAccepted()) {
|
||||||
QWindow *window = QGuiApplication::focusWindow();
|
QWindow *window = QGuiApplication::focusWindow();
|
||||||
if (window && window->handle()) {
|
if (auto *focusSurface = surfaceForWindow(window)) {
|
||||||
struct ::wl_surface *surface = static_cast<QWaylandWindow *>(window->handle())->object();
|
textInput()->enable(focusSurface);
|
||||||
textInput()->enable(surface);
|
|
||||||
mCurrentWindow = window;
|
mCurrentWindow = window;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -501,10 +501,9 @@ public:
|
|||||||
void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)
|
void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)
|
||||||
{
|
{
|
||||||
QWaylandWindow *window = mFocus;
|
QWaylandWindow *window = mFocus;
|
||||||
|
|
||||||
if (!window) {
|
if (!window) {
|
||||||
// We destroyed the pointer focus surface, but the server
|
// We destroyed the pointer focus surface, but the server didn't get the message yet...
|
||||||
// didn't get the message yet.
|
// or the server didn't send an enter event first. In either case, ignore the event.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,6 +534,12 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
|
|||||||
uint32_t button, uint32_t state)
|
uint32_t button, uint32_t state)
|
||||||
{
|
{
|
||||||
QWaylandWindow *window = mFocus;
|
QWaylandWindow *window = mFocus;
|
||||||
|
if (!window) {
|
||||||
|
// We destroyed the pointer focus surface, but the server didn't get the message yet...
|
||||||
|
// or the server didn't send an enter event first. In either case, ignore the event.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Qt::MouseButton qt_button;
|
Qt::MouseButton qt_button;
|
||||||
|
|
||||||
// translate from kernel (input.h) 'button' to corresponding Qt:MouseButton.
|
// translate from kernel (input.h) 'button' to corresponding Qt:MouseButton.
|
||||||
@ -601,15 +606,15 @@ public:
|
|||||||
void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value)
|
void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value)
|
||||||
{
|
{
|
||||||
QWaylandWindow *window = mFocus;
|
QWaylandWindow *window = mFocus;
|
||||||
QPoint pixelDelta;
|
|
||||||
QPoint angleDelta;
|
|
||||||
|
|
||||||
if (!window) {
|
if (!window) {
|
||||||
// We destroyed the pointer focus surface, but the server
|
// We destroyed the pointer focus surface, but the server didn't get the message yet...
|
||||||
// didn't get the message yet.
|
// or the server didn't send an enter event first. In either case, ignore the event.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPoint pixelDelta;
|
||||||
|
QPoint angleDelta;
|
||||||
|
|
||||||
//normalize value and inverse axis
|
//normalize value and inverse axis
|
||||||
int valueDelta = wl_fixed_to_int(value) * -12;
|
int valueDelta = wl_fixed_to_int(value) * -12;
|
||||||
|
|
||||||
@ -714,6 +719,12 @@ static void sendKey(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Q
|
|||||||
void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
|
void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
|
||||||
{
|
{
|
||||||
QWaylandWindow *window = mFocus;
|
QWaylandWindow *window = mFocus;
|
||||||
|
if (!window) {
|
||||||
|
// We destroyed the keyboard focus surface, but the server didn't get the message yet...
|
||||||
|
// or the server didn't send an enter event first. In either case, ignore the event.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t code = key + 8;
|
uint32_t code = key + 8;
|
||||||
bool isDown = state != WL_KEYBOARD_KEY_STATE_RELEASED;
|
bool isDown = state != WL_KEYBOARD_KEY_STATE_RELEASED;
|
||||||
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
|
QEvent::Type type = isDown ? QEvent::KeyPress : QEvent::KeyRelease;
|
||||||
@ -721,12 +732,6 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
|
|||||||
int qtkey = key + 8; // qt-compositor substracts 8 for some reason
|
int qtkey = key + 8; // qt-compositor substracts 8 for some reason
|
||||||
mParent->mSerial = serial;
|
mParent->mSerial = serial;
|
||||||
|
|
||||||
if (!window) {
|
|
||||||
// We destroyed the keyboard focus surface, but the server
|
|
||||||
// didn't get the message yet.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDown)
|
if (isDown)
|
||||||
mParent->mQDisplay->setLastInputDevice(mParent, serial, window);
|
mParent->mQDisplay->setLastInputDevice(mParent, serial, window);
|
||||||
|
|
||||||
@ -793,6 +798,12 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
|
|||||||
|
|
||||||
void QWaylandInputDevice::Keyboard::repeatKey()
|
void QWaylandInputDevice::Keyboard::repeatKey()
|
||||||
{
|
{
|
||||||
|
if (!mFocus) {
|
||||||
|
// We destroyed the keyboard focus surface, but the server didn't get the message yet...
|
||||||
|
// or the server didn't send an enter event first.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mRepeatTimer.setInterval(mRepeatRate);
|
mRepeatTimer.setInterval(mRepeatRate);
|
||||||
sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode,
|
sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode,
|
||||||
#if QT_CONFIG(xkbcommon)
|
#if QT_CONFIG(xkbcommon)
|
||||||
|
@ -384,7 +384,7 @@ QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const
|
|||||||
void QWaylandWindow::setVisible(bool visible)
|
void QWaylandWindow::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (window()->type() == Qt::Popup)
|
if (window()->type() & (Qt::Popup | Qt::ToolTip))
|
||||||
activePopups << this;
|
activePopups << this;
|
||||||
initWindow();
|
initWindow();
|
||||||
mDisplay->flushRequests();
|
mDisplay->flushRequests();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user