Paste P506

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Dec 13 2019, 7:47 PM.
diff --git a/autotests/client/test_plasmashell.cpp b/autotests/client/test_plasmashell.cpp
index 7c6082d..e14d953 100644
--- a/autotests/client/test_plasmashell.cpp
+++ b/autotests/client/test_plasmashell.cpp
@@ -438,6 +438,7 @@ void TestPlasmaShell::testPanelTakesFocus()
{
// this test verifies that whether a panel wants to take focus is passed through correctly
QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated);
+
QVERIFY(plasmaSurfaceCreatedSpy.isValid());
QScopedPointer<Surface> s(m_compositor->createSurface());
QScopedPointer<PlasmaShellSurface> ps(m_plasmaShell->createSurface(s.data()));
@@ -445,16 +446,22 @@ void TestPlasmaShell::testPanelTakesFocus()
QVERIFY(plasmaSurfaceCreatedSpy.wait());
QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1);
auto sps = plasmaSurfaceCreatedSpy.first().first().value<PlasmaShellSurfaceInterface*>();
+ QSignalSpy plasmaSurfaceTakesFocusSpy(sps, &PlasmaShellSurfaceInterface::panelTakesFocusChanged);
+
QVERIFY(sps);
QCOMPARE(sps->role(), PlasmaShellSurfaceInterface::Role::Panel);
QCOMPARE(sps->panelTakesFocus(), false);
ps->setPanelTakesFocus(true);
m_connection->flush();
- QTRY_COMPARE(sps->panelTakesFocus(), true);
+ QVERIFY(plasmaSurfaceTakesFocusSpy.wait());
+ QCOMPARE(plasmaSurfaceTakesFocusSpy.count(), 1);
+ QCOMPARE(sps->panelTakesFocus(), true);
ps->setPanelTakesFocus(false);
m_connection->flush();
- QTRY_COMPARE(sps->panelTakesFocus(), false);
+ QVERIFY(plasmaSurfaceTakesFocusSpy.wait());
+ QCOMPARE(plasmaSurfaceTakesFocusSpy.count(), 2);
+ QCOMPARE(sps->panelTakesFocus(), false);
}
void TestPlasmaShell::testDisconnect()
diff --git a/src/server/plasmashell_interface.cpp b/src/server/plasmashell_interface.cpp
index 2a020bd..50a983e 100644
--- a/src/server/plasmashell_interface.cpp
+++ b/src/server/plasmashell_interface.cpp
@@ -318,6 +318,7 @@ void PlasmaShellSurfaceInterface::Private::panelTakesFocusCallback(wl_client *cl
auto s = cast<Private>(resource);
Q_ASSERT(client == *s->client);
s->panelTakesFocus = takesFocus;
+ emit s->q_func()->panelTakesFocusChanged();
}
void PlasmaShellSurfaceInterface::Private::setPanelBehavior(org_kde_plasma_surface_panel_behavior behavior)
diff --git a/src/server/plasmashell_interface.h b/src/server/plasmashell_interface.h
index 7e00611..2cb47dd 100644
--- a/src/server/plasmashell_interface.h
+++ b/src/server/plasmashell_interface.h
@@ -234,6 +234,10 @@ Q_SIGNALS:
**/
void panelAutoHideShowRequested();
+ /*
+ */
+ void panelTakesFocusChanged();
+
private:
friend class PlasmaShellInterface;
explicit PlasmaShellSurfaceInterface(PlasmaShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource);
davidedmundson edited the content of this paste. (Show Details)Dec 13 2019, 7:47 PM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.