Merge branch 'Plasma/5.7'
commit
1a779ccd88
|
@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KWayland/Client/shell.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Server/seat_interface.h>
|
||||
//screenlocker
|
||||
#include <KScreenLocker/KsldApp>
|
||||
|
||||
|
@ -211,6 +212,15 @@ void PlasmaWindowTest::testCreateDestroyX11PlasmaWindow()
|
|||
QCOMPARE(client->window(), w);
|
||||
QVERIFY(client->isDecorated());
|
||||
QVERIFY(client->isActive());
|
||||
// verify that it gets the keyboard focus
|
||||
QVERIFY(!client->surface());
|
||||
// we don't have a surface yet, so focused keyboard surface if set is not ours
|
||||
QVERIFY(!waylandServer()->seat()->focusedKeyboardSurface());
|
||||
QSignalSpy surfaceChangedSpy(client, &Toplevel::surfaceChanged);
|
||||
QVERIFY(surfaceChangedSpy.isValid());
|
||||
QVERIFY(surfaceChangedSpy.wait());
|
||||
QVERIFY(client->surface());
|
||||
QCOMPARE(waylandServer()->seat()->focusedKeyboardSurface(), client->surface());
|
||||
|
||||
// now that should also give it to us on client side
|
||||
QVERIFY(plasmaWindowCreatedSpy.wait());
|
||||
|
|
|
@ -374,7 +374,17 @@ void KeyboardInputRedirection::init()
|
|||
|
||||
connect(workspace(), &QObject::destroyed, this, [this] { m_inited = false; });
|
||||
connect(waylandServer(), &QObject::destroyed, this, [this] { m_inited = false; });
|
||||
connect(workspace(), &Workspace::clientActivated, this, &KeyboardInputRedirection::update);
|
||||
connect(workspace(), &Workspace::clientActivated, this,
|
||||
[this] {
|
||||
disconnect(m_activeClientSurfaceChangedConnection);
|
||||
if (auto c = workspace()->activeClient()) {
|
||||
m_activeClientSurfaceChangedConnection = connect(c, &Toplevel::surfaceChanged, this, &KeyboardInputRedirection::update);
|
||||
} else {
|
||||
m_activeClientSurfaceChangedConnection = QMetaObject::Connection();
|
||||
}
|
||||
update();
|
||||
}
|
||||
);
|
||||
if (waylandServer()->hasScreenLockerIntegration()) {
|
||||
connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, &KeyboardInputRedirection::update);
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ private:
|
|||
bool m_inited = false;
|
||||
QScopedPointer<Xkb> m_xkb;
|
||||
QHash<quint32, QTimer*> m_repeatTimers;
|
||||
QMetaObject::Connection m_activeClientSurfaceChangedConnection;
|
||||
};
|
||||
|
||||
inline
|
||||
|
|
11
platform.cpp
11
platform.cpp
|
@ -85,8 +85,10 @@ void Platform::setSoftWareCursor(bool set)
|
|||
m_softWareCursor = set;
|
||||
if (m_softWareCursor) {
|
||||
connect(Cursor::self(), &Cursor::posChanged, this, &Platform::triggerCursorRepaint);
|
||||
connect(this, &Platform::cursorChanged, this, &Platform::triggerCursorRepaint);
|
||||
} else {
|
||||
disconnect(Cursor::self(), &Cursor::posChanged, this, &Platform::triggerCursorRepaint);
|
||||
disconnect(this, &Platform::cursorChanged, this, &Platform::triggerCursorRepaint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,17 +97,14 @@ void Platform::triggerCursorRepaint()
|
|||
if (!Compositor::self()) {
|
||||
return;
|
||||
}
|
||||
const QPoint &hotSpot = softwareCursorHotspot();
|
||||
const QSize &size = softwareCursor().size();
|
||||
Compositor::self()->addRepaint(m_cursor.lastRenderedPosition.x() - hotSpot.x(),
|
||||
m_cursor.lastRenderedPosition.y() - hotSpot.y(),
|
||||
size.width(), size.height());
|
||||
Compositor::self()->addRepaint(m_cursor.lastRenderedGeometry);
|
||||
Compositor::self()->addRepaint(QRect(Cursor::pos() - softwareCursorHotspot(), softwareCursor().size()));
|
||||
}
|
||||
|
||||
void Platform::markCursorAsRendered()
|
||||
{
|
||||
if (m_softWareCursor) {
|
||||
m_cursor.lastRenderedPosition = Cursor::pos();
|
||||
m_cursor.lastRenderedGeometry = QRect(Cursor::pos() - softwareCursorHotspot(), softwareCursor().size());
|
||||
}
|
||||
if (input()->pointer()) {
|
||||
input()->pointer()->markCursorAsRendered();
|
||||
|
|
|
@ -222,7 +222,7 @@ private:
|
|||
void triggerCursorRepaint();
|
||||
bool m_softWareCursor = false;
|
||||
struct {
|
||||
QPoint lastRenderedPosition;
|
||||
QRect lastRenderedGeometry;
|
||||
} m_cursor;
|
||||
bool m_handlesOutputs = false;
|
||||
bool m_ready = false;
|
||||
|
|
|
@ -478,6 +478,7 @@ void Toplevel::setSurface(KWayland::Server::SurfaceInterface *surface)
|
|||
m_surface = nullptr;
|
||||
}
|
||||
);
|
||||
emit surfaceChanged();
|
||||
}
|
||||
|
||||
void Toplevel::addDamage(const QRegion &damage)
|
||||
|
|
|
@ -450,6 +450,11 @@ Q_SIGNALS:
|
|||
**/
|
||||
void hasAlphaChanged();
|
||||
|
||||
/**
|
||||
* Emitted whenever the Surface for this Toplevel changes.
|
||||
**/
|
||||
void surfaceChanged();
|
||||
|
||||
protected Q_SLOTS:
|
||||
/**
|
||||
* Checks whether the screen number for this Toplevel changed and updates if needed.
|
||||
|
|
Loading…
Reference in New Issue