KWin enters the world of QtQuick 2

Since my last blog post there has been lots of progress on the KWin on 5 effort. First of all a big thank you to everybody who has picked up some of the tasks on the trello board. Thanks to that the compile output is starting to look better and better – the number of deprecated warnings is starting to go down and by that also some areas are closer to be working again.

Talking of working again: the important changes are merged into Qt with the result that KWin from framework-scratch branch starts again. One should still be careful and not replace the KWin 4 – the most important steps are outlined in the wiki.

Lately my work focused on porting from QtQuick 1 to QtQuick 2. This is a change which needs to happen as all our user interfaces are using Plasma Components which do not exist for QtQuick 1 anymore in the frameworks 5 world. Of course we also want to make use of the new goodies of QtQuick 2 🙂

This required not only to adjust our QML files, but also to change the C++ side from QtDeclarative to QtQuick. I was a little bit afraid of these changes as our window thumbnail rendering used quite some hacks around the underlying QGraphicsScene to make it work. My fear was that this won’t be possible with QtQuick 2 anymore.

To my surprise I was even able to remove a large part of our hacks because QtQuick 2 exposes information which we need and which isn’t exposed in the old world. Other parts are still hacky and I fear that we even have some regressions concerning clipping.

Our QtScript and QML bindings shared a lot of code as both are based on QScriptEngine. With QtQuick 2 it’s no longer based on the QScriptEngine and by that our implementations start to diverge. As far as my testing showed we can no longer inject properties on the JavaScript global object in the QtQuick bindings which means that our API slightly breaks and cannot be identical to the QtScript API any more.

While this is of course a disadvantage it also brings advantages as I am forced to implement proper QML replacements. For example interaction with a screen edge can now be done in a nice QML syntax:

ScreenEdgeItem {
    edge: ScreenEdgeItem.LeftEdge
    onActivated: doSomething()
}

Right now all usages of QtQuick in KWin core and KWin effects have been ported to QtQuick 2. Still remaining is Aurorae – this needs some more work as the window decoration API needs adjustments anyway given that right now rendering of decorations in non-compositing is broken.

10 Replies to “KWin enters the world of QtQuick 2”

  1. Fantastic! This work really is progressing fairly quickly. I’m glad to hear it wasn’t quite as frightening as you’d anticipated. Good luck with this continual process- I really appreciate your dedication.

  2. Hello there, I want to say thanks for your amazing work! Been using KDE 4.11 for a few hours under my Gentoo box and all KWin performance feels so smooth. Thanks!

    I was looking forward to this bug (https://bugs.kde.org/show_bug.cgi?id=296069). I don’t know if I got it wrong (if I did please excuse me, I don’t speak english too much), but I understood the core of the “Desktop Grid” effect would be rewritten in QML so we would be able to navegate through previews of virtual desktops. I have assigned the “Meta + Tab” shortcut for launching “Desktop grid”, but when I press “Meta + Tab” again the effect closes, while I was expecting that if I did it again it would select the next virtual desktop (much like a “window switch” effect).

    Am I wrong understanding this, is this another effect or do I need to activate something… Thanks!

    1. yeah that’s something completely different. There is a walk through desktops shortcut available and for that the previews are used.

      1. Hmmm. So I went to try that in systemsettings -> Shortcuts and gestures (I guess that is the name of it in english) -> Global hotkeys -> KWin. I found two shortcut options: “Cycle through desktops” and “Cycle through desktops (reverse order)”. Just a popup appears with a list of available virtual desktops with no previews, just like the old window switching…

  3. Excellent work. KWin each day is much better.

    I wanted to take this opportunity to ask three questions, if I may:

    1 – I created several Aurorae themes, but always use the buttons Close, Minimize, Maximize, and Help.

    The name of the files. Svg are obvious: close.svgz, maximize.svgz, minimize.svgz, help.svgz. My question is: What is the name of the other files for the other buttons?

    2 – The Maximize button does the same function as Resize?

    3 – This is not more of a question, but a personal suggestion. KWin would be very nice if you had the option buttons are placed at the same height of the tabs in applications like Firefox, Dolphin, as do the buttons on the Mac, for example:

    http://blog.desdelinux.net/wp-content/uploads/2013/08/Mac_Buttons.png

    Thanks for your time.

  4. Martin with Qt now being more open can’t you work with them to have the stuff you need in Qt rather than using different hacks. From my experience in SW hacks are very bad even if they seem to work for the moment.
    Most of them will just come to bite you in the … rear later on.

Comments are closed.