Exporting decorations buttons as images

Zolotukhin Mikhail zomial at protonmail.com
Sat Apr 25 09:33:26 BST 2020


Hello,

I am interested in providing support for custom window decorations for GTK applications with Client Sided Decorations. Currently I have an idea in mind, that may or may not work depending on multiple circumstances. One of the things I need to implement that idea is to tell KWin to draw window decorations with different states (hover, clicked, normal) to images (.png and .svg). If I understand correctly, to do that I need to call [paint](https://api.kde.org/kdecoration/html/classKDecoration2_1_1DecorationButton.html#ab57e4b79de9bf233a8cd5b7812c19c75) method from KDecoration library with a custom QPainter. However, to call it, I need to create a KDecoration2::DecorationButton instance first. Unfortunately, I do not fully understand how to do so from an arbitrary place.

As I could see Window Decorations KCM and [Latte Dock Buttons applet](https://github.com/psifidotos/applet-window-buttons) uses some kind of complicated bridge to draw decorations in QML. I am not really sure if I need exactly that to just draw decorations to images, so I tried to build a custom minimal solution here:
https://phabricator.kde.org/D28623
Unfortunately it does not work and the program just crashes with seg fault.

So, I want to ask the experts for help with that part: how can I correctly ask KWin to draw decorations buttons to images?

Best regards,
Mikhail Zolotukhin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwin/attachments/20200425/5f40f293/attachment.html>


More information about the kwin mailing list