Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump DBus stack take 2 #15685

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Avalonia.FreeDesktop/Avalonia.FreeDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Tmds.DBus.Protocol" Version="0.16.0" />
<PackageReference Include="Tmds.DBus.SourceGenerator" Version="0.0.15" PrivateAssets="all" />
<PackageReference Include="Tmds.DBus.Protocol" Version="0.19.0" />
<PackageReference Include="Tmds.DBus.SourceGenerator" Version="0.0.18" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.FreeDesktop/DBusIme/Fcitx/FcitxICWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public async Task<bool> ProcessKeyEventAsync(uint keyVal, uint keyCode, uint sta

public ValueTask<IDisposable> WatchForwardKeyAsync(Action<Exception?, (uint keyval, uint state, int type)> handler) =>
_old?.WatchForwardKeyAsync(handler)
?? _modern?.WatchForwardKeyAsync((e, ev) => handler.Invoke(e, (ev.keyval, ev.state, ev.type ? 1 : 0)))
?? _modern?.WatchForwardKeyAsync((e, ev) => handler.Invoke(e, (ev.Keyval, ev.State, ev.Type ? 1 : 0)))
?? new ValueTask<IDisposable>(Disposable.Empty);

public ValueTask<IDisposable> WatchUpdateFormattedPreeditAsync(
Action<Exception?, ((string?, int)[]? str, int cursorpos)> handler) =>
_old?.WatchUpdateFormattedPreeditAsync(handler!)
?? _modern?.WatchUpdateFormattedPreeditAsync(handler!)
?? new ValueTask<IDisposable>(Disposable.Empty);

public Task SetCapacityAsync(uint flags) =>
_old?.SetCapacityAsync(flags) ?? _modern?.SetCapabilityAsync(flags) ?? Task.CompletedTask;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override async Task<bool> Connect(string name)
var resp = await method.CreateICv3Async(GetAppName(),
Process.GetCurrentProcess().Id);

var proxy = new OrgFcitxFcitxInputContext(Connection, name, $"/inputcontext_{resp.icid}");
var proxy = new OrgFcitxFcitxInputContext(Connection, name, $"/inputcontext_{resp.Icid}");
_context = new FcitxICWrapper(proxy);
}
else
Expand Down
21 changes: 10 additions & 11 deletions src/Avalonia.FreeDesktop/DBusIme/IBus/IBusX11TextInputMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,16 @@ private void OnShowPreedit(Exception? obj)
Client.SetPreeditText(_preeditText, _preeditText == null ? null : _preeditCursor);
}

private void OnUpdatePreedit(Exception? arg1, (DBusVariantItem text, uint cursor_pos, bool visible) preeditComponents)
private void OnUpdatePreedit(Exception? arg1, (VariantValue Text, uint CursorPos, bool Visible) preeditComponents)
{
if (preeditComponents.text is { Value: DBusStructItem { Count: >= 3 } structItem } &&
structItem[2] is DBusStringItem stringItem)
if (preeditComponents.Text is { Type: VariantValueType.Struct, Count: >= 3 } structItem && structItem.GetItem(2) is { Type: VariantValueType.String} stringItem)
{
_preeditText = stringItem.Value;
_preeditText = stringItem.GetString();
_preeditCursor = _preeditText != null
? Utf16Utils.CharacterOffsetToStringOffset(_preeditText,
(int)Math.Min(preeditComponents.cursor_pos, int.MaxValue), false)
(int)Math.Min(preeditComponents.CursorPos, int.MaxValue), false)
: 0;

_preeditShown = true;
}
else
Expand Down Expand Up @@ -102,13 +101,13 @@ private void OnForwardKey(Exception? e, (uint keyval, uint keycode, uint state)
});
}

private void OnCommitText(Exception? e, DBusVariantItem variantItem)
private void OnCommitText(Exception? e, VariantValue variantItem)
{
if (_insideReset > 0)
if (_insideReset > 0)
{
// For some reason iBus can trigger a CommitText while being reset.
// Thankfully the signal is sent _during_ Reset call processing,
// so it arrives on-the-wire before Reset call result, so we can
// so it arrives on-the-wire before Reset call result, so we can
// check if we have any pending Reset calls and ignore the signal here
return;
}
Expand All @@ -118,8 +117,8 @@ private void OnCommitText(Exception? e, DBusVariantItem variantItem)
return;
}

if (variantItem.Value is DBusStructItem { Count: >= 3 } structItem && structItem[2] is DBusStringItem stringItem)
FireCommit(stringItem.Value);
if (variantItem.Count >= 3 && variantItem.GetItem(2) is { Type: VariantValueType.String } stringItem)
FireCommit(stringItem.GetString());
}

protected override Task DisconnectAsync() => _service?.DestroyAsync() ?? Task.CompletedTask;
Expand Down
Loading
Loading