Exporting decorations buttons as images
Zolotukhin Mikhail <[email protected]>
| Newsgroups | gmane.comp.kde.devel.kwin |
|---|---|
| Message-ID | <AyXpJxNGeR1VI81iDQqWmX0vmuyC8blKnJ05Vo92jM3UHZsZxeSEHX5Mi7VqHv3zOlZISL7_dd3c9adj7jVFlTgIsxHQS002Ex33WpWF4Jg=@protonmail.com> |
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