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
This commit is contained in:
Sebastian Kügler 2014-10-14 13:29:13 +02:00
parent ecec800357
commit 410c414bad

View file

@ -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"