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;
|
||||
}
|
||||
|
||||
// \a size is without margins
|
||||
static QRegion marginsRegion(const QSize &size, const QMargins &margins)
|
||||
{
|
||||
QRegion r;
|
||||
@ -123,7 +124,7 @@ const QImage &QWaylandAbstractDecoration::contentImage()
|
||||
d->m_decorationContentImage.fill(Qt::transparent);
|
||||
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)
|
||||
waylandWindow()->damage(r);
|
||||
|
||||
|
@ -417,6 +417,15 @@ void QWaylandInputContext::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)
|
||||
{
|
||||
qCDebug(qLcQpaInputMethods) << Q_FUNC_INFO << queries;
|
||||
@ -424,15 +433,15 @@ void QWaylandInputContext::update(Qt::InputMethodQueries queries)
|
||||
if (!QGuiApplication::focusObject() || !textInput())
|
||||
return;
|
||||
|
||||
if (mCurrentWindow && mCurrentWindow->handle() && !inputMethodAccepted()) {
|
||||
struct ::wl_surface *surface = static_cast<QWaylandWindow *>(mCurrentWindow->handle())->object();
|
||||
textInput()->disable(surface);
|
||||
auto *currentSurface = surfaceForWindow(mCurrentWindow);
|
||||
|
||||
if (currentSurface && !inputMethodAccepted()) {
|
||||
textInput()->disable(currentSurface);
|
||||
mCurrentWindow.clear();
|
||||
} else if (!mCurrentWindow && inputMethodAccepted()) {
|
||||
} else if (!currentSurface && inputMethodAccepted()) {
|
||||
QWindow *window = QGuiApplication::focusWindow();
|
||||
if (window && window->handle()) {
|
||||
struct ::wl_surface *surface = static_cast<QWaylandWindow *>(window->handle())->object();
|
||||
textInput()->enable(surface);
|
||||
if (auto *focusSurface = surfaceForWindow(window)) {
|
||||
textInput()->enable(focusSurface);
|
||||
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)
|
||||
{
|
||||
QWaylandWindow *window = mFocus;
|
||||
|
||||
if (!window) {
|
||||
// We destroyed the pointer focus surface, but the server
|
||||
// didn't get the message yet.
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -535,6 +534,12 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
|
||||
uint32_t button, uint32_t state)
|
||||
{
|
||||
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;
|
||||
|
||||
// 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)
|
||||
{
|
||||
QWaylandWindow *window = mFocus;
|
||||
QPoint pixelDelta;
|
||||
QPoint angleDelta;
|
||||
|
||||
if (!window) {
|
||||
// We destroyed the pointer focus surface, but the server
|
||||
// didn't get the message yet.
|
||||
// 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;
|
||||
}
|
||||
|
||||
QPoint pixelDelta;
|
||||
QPoint angleDelta;
|
||||
|
||||
//normalize value and inverse axis
|
||||
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)
|
||||
{
|
||||
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;
|
||||
bool isDown = state != WL_KEYBOARD_KEY_STATE_RELEASED;
|
||||
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
|
||||
mParent->mSerial = serial;
|
||||
|
||||
if (!window) {
|
||||
// We destroyed the keyboard focus surface, but the server
|
||||
// didn't get the message yet.
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDown)
|
||||
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()
|
||||
{
|
||||
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);
|
||||
sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode,
|
||||
#if QT_CONFIG(xkbcommon)
|
||||
|
@ -384,7 +384,7 @@ QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const
|
||||
void QWaylandWindow::setVisible(bool visible)
|
||||
{
|
||||
if (visible) {
|
||||
if (window()->type() == Qt::Popup)
|
||||
if (window()->type() & (Qt::Popup | Qt::ToolTip))
|
||||
activePopups << this;
|
||||
initWindow();
|
||||
mDisplay->flushRequests();
|
||||
|
Loading…
x
Reference in New Issue
Block a user