Commit 410c414b authored by Sebastian Kügler's avatar Sebastian Kügler
Browse files

Add Registry::interfacesAnnounced signal

Emitted when the Wayland display is done flushing the initial interface
callbacks, announcing wl_display properties. This can be used to compress
events. Note that this signal is emitted only after announcing interfaces,
such as outputs, but not after receiving callbacks of interface properties,
such as the output's geometry, modes, etc..

This signal is emitted from the wl_display_sync callback.

REVIEW:120471
parent ecec8003
......@@ -21,6 +21,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QtTest/QtTest>
// KWin
#include "../../src/client/connection_thread.h"
#include "../../src/client/event_queue.h"
#include "../../src/client/registry.h"
#include "../../src/server/compositor_interface.h"
#include "../../src/server/display.h"
......@@ -45,6 +46,8 @@ private Q_SLOTS:
void testBindOutput();
void testBindShm();
void testBindSeat();
void testGlobalSync();
void testGlobalSyncThreaded();
void testRemoval();
void testDestroy();
......@@ -274,5 +277,57 @@ void TestWaylandRegistry::testDestroy()
registry.destroy();
}
void TestWaylandRegistry::testGlobalSync()
{
using namespace KWayland::Client;
ConnectionThread connection;
connection.setSocketName(s_socketName);
QSignalSpy connectedSpy(&connection, SIGNAL(connected()));
connection.initConnection();
QVERIFY(connectedSpy.wait());
Registry registry;
QSignalSpy syncSpy(&registry, SIGNAL(interfacesAnnounced()));
// Most simple case: don't even use the ConnectionThread,
// just its display.
registry.create(connection.display());
registry.setup();
QVERIFY(syncSpy.wait());
QCOMPARE(syncSpy.count(), 1);
registry.destroy();
}
void TestWaylandRegistry::testGlobalSyncThreaded()
{
// More complex case, use a ConnectionThread, in a different Thread,
// and our own EventQueue
using namespace KWayland::Client;
ConnectionThread connection;
connection.setSocketName(s_socketName);
QThread thread;
connection.moveToThread(&thread);
thread.start();
QSignalSpy connectedSpy(&connection, SIGNAL(connected()));
connection.initConnection();
QVERIFY(connectedSpy.wait());
EventQueue queue;
queue.setup(&connection);
Registry registry;
QSignalSpy syncSpy(&registry, SIGNAL(interfacesAnnounced()));
registry.setEventQueue(&queue);
registry.create(&connection);
registry.setup();
QVERIFY(syncSpy.wait());
QCOMPARE(syncSpy.count(), 1);
registry.destroy();
thread.quit();
thread.wait();
}
QTEST_GUILESS_MAIN(TestWaylandRegistry)
#include "test_wayland_registry.moc"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment