Skip to content

[Proof of Concept/WIP] Tmds to Avalonia.DBus migration#20799

Draft
jmacato wants to merge 12 commits intomasterfrom
fixes/avdbus-impl2
Draft

[Proof of Concept/WIP] Tmds to Avalonia.DBus migration#20799
jmacato wants to merge 12 commits intomasterfrom
fixes/avdbus-impl2

Conversation

@jmacato
Copy link
Member

@jmacato jmacato commented Mar 3, 2026

Switching our dbus backend for Avalonia.FreeDesktop from Tmds to Avalonia.DBus.

Proof of concept for now to see if this is a viable migration path.

jmacato added 8 commits March 3, 2026 20:50
Create DBusXml/Types.xml defining named structs (MenuLayout,
MenuItemProperties, MenuEvent, IconPixmap, ToolTip, InputContextArg,
FormattedPreeditSegment) and register it as an AdditionalFiles entry
in the csproj so the source generator uses readable type names.
Add xmlns:av namespace, av:ImportTypes, and av:TypeDefinition annotations
so the source generator produces named struct types instead of tuples:
- com.canonical.dbusmenu.xml: MenuLayout, MenuItemProperties, MenuEvent
- org.kde.StatusNotifierItem.xml: IconPixmap, ToolTip
- org.fcitx.Fcitx.InputMethod1.xml: InputContextArg
- org.fcitx.Fcitx.InputContext.xml: FormattedPreeditSegment
- org.fcitx.Fcitx.InputContext1.xml: FormattedPreeditSegment
Replace auto-generated DbusStruct_* names with meaningful type names
from the av:TypeDefinition annotations added to the DBus XML files:
- DbusStruct_Riaesvavz -> MenuLayout
- DbusStruct_Riaesvz -> MenuItemProperties
- DbusStruct_Risvuz -> MenuEvent
- DbusStruct_Riiayz -> IconPixmap
- DbusStruct_Rsariiayzssz -> ToolTip
- DbusStruct_Rssz -> InputContextArg
- DbusStruct_Rsiz -> FormattedPreeditSegment

Also update property accessors (.Item1/.Item2 -> named properties)
in DBusMenuExporter.cs and FcitxX11TextInputMethod.cs.
Replace Tmds.DBus.Protocol/SourceGenerator with Avalonia.DBus across
all FreeDesktop platform code: DBusHelper, system dialogs, platform
settings, and IME implementations (IBus, Fcitx).

Key changes:
- Connection → DBusConnection
- VariantValue → DBusVariant
- ObjectPath → DBusObjectPath
- Callback signatures simplified (removed Exception? first param)
- Struct/Array helpers → DBusStruct/List<T>
@jmacato jmacato requested review from MrJul and kekekeks March 3, 2026 16:40
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0062895-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@jmacato
Copy link
Member Author

jmacato commented Mar 3, 2026

Leaving this PR for future review/hold as trayicons/menus/dialogs seems to work

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0062907-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants