9#include <config-kwin.h> 
   15#include <QPropertyAnimation> 
   16#include <QQmlComponent> 
   19#include <QQuickWindow> 
   20#include <QStandardPaths> 
   23#include <KConfigGroup> 
   48    if (event->type() != QEvent::MouseMove) {
 
 
   57    , m_timer(new QTimer(this))
 
   59    m_timer->setSingleShot(
true);
 
   67            m_containsPointer = 
false;
 
 
   74    if (QQuickWindow *w = qobject_cast<QQuickWindow *>(m_mainItem.get())) {
 
 
  134    return m_timer->interval();
 
 
  139    if (m_timer->interval() == 
timeout) {
 
 
  146void OnScreenNotification::show()
 
  150    ensureQmlComponent();
 
  152    if (m_timer->interval() != 0) {
 
  157void OnScreenNotification::ensureQmlContext()
 
  159    Q_ASSERT(m_qmlEngine);
 
  163    m_qmlContext = std::make_unique<QQmlContext>(m_qmlEngine);
 
  164    m_qmlContext->setContextProperty(QStringLiteral(
"osd"), 
this);
 
  167void OnScreenNotification::ensureQmlComponent()
 
  170    Q_ASSERT(m_qmlEngine);
 
  171    if (m_qmlComponent) {
 
  174    m_qmlComponent = std::make_unique<QQmlComponent>(m_qmlEngine);
 
  175    const QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
 
  176                                                    m_config->group(QStringLiteral(
"OnScreenNotification")).readEntry(
"QmlPath", QStringLiteral(
"kwin/onscreennotification/plasma/main.qml")));
 
  177    if (fileName.isEmpty()) {
 
  180    m_qmlComponent->loadUrl(QUrl::fromLocalFile(fileName));
 
  181    if (!m_qmlComponent->isError()) {
 
  182        m_mainItem.reset(m_qmlComponent->create(m_qmlContext.get()));
 
  184        m_qmlComponent.reset();
 
  188void OnScreenNotification::createInputSpy()
 
  191    if (
auto w = qobject_cast<QQuickWindow *>(m_mainItem.get())) {
 
  192        m_spy = std::make_unique<OnScreenNotificationInputEventSpy>(
this);
 
  195            m_animation = 
new QPropertyAnimation(w, 
"opacity", 
this);
 
  196            m_animation->setStartValue(1.0);
 
  197            m_animation->setEndValue(0.0);
 
  198            m_animation->setDuration(250);
 
  199            m_animation->setEasingCurve(QEasingCurve::InOutCubic);
 
  206    if (QQuickWindow *w = qobject_cast<QQuickWindow *>(m_mainItem.get())) {
 
  207        return w->geometry();
 
 
  214    if (m_containsPointer == contains) {
 
  217    m_containsPointer = contains;
 
  221    m_animation->setDirection(m_containsPointer ? QAbstractAnimation::Forward : QAbstractAnimation::Backward);
 
  222    m_animation->start();
 
 
  227    if (QQuickWindow *w = qobject_cast<QQuickWindow *>(m_mainItem.get())) {
 
  228        w->setProperty(
"KWIN_SKIP_CLOSE_ANIMATION", skip);
 
 
  234#include "moc_onscreennotification.cpp" 
void setConfig(KSharedConfigPtr config)
void setContainsPointer(bool contains)
void setSkipCloseAnimation(bool skip)
void setEngine(QQmlEngine *engine)
void setIconName(const QString &iconName)
OnScreenNotification(QObject *parent=nullptr)
void setVisible(bool m_visible)
~OnScreenNotification() override
void setTimeout(int timeout)
void setMessage(const QString &message)
InputRedirection * input()