211 ConnectionThread *connection = ConnectionThread::fromApplication(
this);
212 Registry *registry =
new Registry(connection);
213 registry->create(connection);
215 connect(registry, &Registry::interfacesAnnounced,
this,
217 const auto interface = registry->interface(Registry::Interface::PlasmaShell);
218 if (interface.name == 0) {
221 m_shell = registry->createPlasmaShell(interface.name, interface.version);
225 connection->roundtrip();
275 if (watched !=
window() || !m_shell) {
278 if (event->type() == QEvent::PlatformSurface) {
279 QPlatformSurfaceEvent *pe =
static_cast<QPlatformSurfaceEvent *
>(event);
280 if (pe->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) {
283 delete m_shellSurface;
284 m_shellSurface =
nullptr;
287 if (event->type() == QEvent::Move) {
288 if (m_shellSurface) {
289 m_shellSurface->setPosition(
window()->position());
297 QApplication app(argc, argv);
298 QApplication::setApplicationDisplayName(QStringLiteral(
"Screen Edge Show Test App"));
300 std::unique_ptr<QWidget> widget(
new QWidget(
nullptr, Qt::FramelessWindowHint));
301 if (KWindowSystem::isPlatformX11()) {
302 app.setProperty(
"x11Connection", QVariant::fromValue<void *>(QX11Info::connection()));
304 }
else if (KWindowSystem::isPlatformWayland()) {
312 QPushButton *hideWindowButton =
new QPushButton(QStringLiteral(
"Hide"), widget.get());
316 QPushButton *hideAndRestoreButton =
new QPushButton(QStringLiteral(
"Hide and Restore after 10 sec"), widget.get());
319 QToolButton *edgeButton =
new QToolButton(widget.get());
321 QCheckBox *raiseCheckBox =
new QCheckBox(
"Raise:", widget.get());
324 edgeButton->setText(QStringLiteral(
"Edge"));
325 edgeButton->setPopupMode(QToolButton::MenuButtonPopup);
326 QMenu *edgeButtonMenu =
new QMenu(edgeButton);
331 edgeButtonMenu->addSeparator();
333 edgeButton->setMenu(edgeButtonMenu);
335 QHBoxLayout *layout =
new QHBoxLayout(widget.get());
336 layout->addWidget(hideWindowButton);
337 layout->addWidget(hideAndRestoreButton);
338 layout->addWidget(edgeButton);
339 widget->setLayout(layout);
341 const QRect geo = QGuiApplication::primaryScreen()->geometry();
342 widget->setGeometry(geo.x(), geo.y() + geo.height() - 100, geo.width(), 100);