[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kscreen/sebas/osd] kded: Fix for both, X11 and wayland
From:       Sebastian_Kügler <sebas () kde ! org>
Date:       2016-12-02 11:10:28
Message-ID: E1cCljY-0006KE-Fd () code ! kde ! org
[Download RAW message or body]

Git commit 4740441f1fdfc1ea540f2028871357ffad2d5439 by Sebastian Kügler.
Committed on 02/12/2016 at 01:39.
Pushed by sebas into branch 'sebas/osd'.

Fix for both, X11 and wayland

We can only animate the opacity on X11, as QtWayland's platformwindow
doesn't support this. Avoids warnings.

M  +3    -3    kded/osd.cpp
M  +14   -4    kded/qml/Osd.qml

https://commits.kde.org/kscreen/4740441f1fdfc1ea540f2028871357ffad2d5439

diff --git a/kded/osd.cpp b/kded/osd.cpp
index c1b207b..051c515 100644
--- a/kded/osd.cpp
+++ b/kded/osd.cpp
@@ -104,9 +104,9 @@ void Osd::showOsd()
 
     auto *rootObject = m_osdObject->rootObject();
 
-    // if our OSD understands animating the opacity, do it;
-    // otherwise just show it to not break existing lnf packages
-    if (rootObject->property("animateOpacity").isValid()) {
+    // only animate on X11, wayland plugin doesn't support this and
+    // pukes loads of warnings into our logs
+    if (qGuiApp->platformName() == QStringLiteral("xcb")) {
         rootObject->setProperty("animateOpacity", false);
         rootObject->setProperty("opacity", 1);
         rootObject->setProperty("visible", true);
diff --git a/kded/qml/Osd.qml b/kded/qml/Osd.qml
index 69f35d2..65db294 100644
--- a/kded/qml/Osd.qml
+++ b/kded/qml/Osd.qml
@@ -31,13 +31,23 @@ PlasmaCore.Dialog {
 
     // Icon name to display
     property string icon
-
+    property string outputName
+    property string modeName
     property bool animateOpacity: false
-
     property string itemSource
 
-    property string outputName
-    property string modeName
+    Behavior on opacity {
+        SequentialAnimation {
+            // prevent press and hold from flickering
+            PauseAnimation { duration: root.timeout * 0.8 }
+
+            NumberAnimation {
+                duration: root.timeout * 0.2
+                easing.type: Easing.InQuad
+            }
+        }
+        enabled: root.animateOpacity
+    }
 
     mainItem: Loader {
         source: itemSource

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic