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

avalonia revamp review #1

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

avalonia revamp review #1

wants to merge 12 commits into from

Conversation

gonX
Copy link
Owner

@gonX gonX commented Nov 20, 2023

This PR exists to easier facilitate review and to hopefully catch any eventual missing changes not correctly ported from master

Copy link
Owner Author

@gonX gonX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • eng/linux/package.sh untouched - still compiles UX.Gtk

Things I noticed:

  • Missing console app?
  • Missing config migration? We should at the very least support migrating from 0.6.3.0 before we make a release with this (i.e. 0.7 release?)
  • Adding localization support looks easy, very nice!

Intentionally not reviewed:

  • Benchmarks
  • Tests

The original PR (OpenTabletDriver#2772) mentions missing filters and tools. I don't think these are necessary to merge as we're not breaking much there (it is master after all), but is obviously needed before a release.

If nothing else, having this merged onto a branch on the main repo would be a really good idea.

Comment on lines +286 to +287
var name = (await _driverDaemon.GetTabletConfiguration(id)).Name;
var state = await _driverDaemon.GetTabletState(id);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it reduce the overhead if these attributes were included in the initial call? Maybe expand the functionality of GetTablets() or add a new function to include these?

{
public class Settings
{
public static readonly Version CurrentRevision = Version.Parse("0.7.0.0");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change "0.7.0.0" from magic number to a project reference

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended to not follow current OTD's version. May instead use integers to be more explicit about that intention. This version number will only be bumped when settings format actually changed, or when migration is needed.

Another way is to move the declaration via MSBuild-generated assembly attributes, something like

    <AssemblyAttribute Include="OpenTabletDriver.Attributes.SettingsFormatAttribute">
        <_Parameter1>0.7.0.0</_Parameter1>
    </AssemblyAttribute>

or

Directory.Build.targets

<Project>
  <Target Name="AddOpenTabletDriverSettingsFormat" BeforeTargets="BeforeCompile">
    <!-- Handle OpenTabletDriverSettingsFormat -->
    <ItemGroup Condition="'@(OpenTabletDriverSettingsFormat->Count())' &gt; 0">
      <AssemblyAttribute Include="OpenTabletDriver.Attributes.SettingsFormatAttribute">
        <_Parameter1>%(OpenTabletDriverSettingsFormat.Identity)</_Parameter1>
      </AssemblyAttribute>
    </ItemGroup>
  </Target>
</Project>

Directory.Build.props

  <ItemGroup>
    <OpenTabletDriverSettingsFormat>0.7.0.0</OpenTabletDriverSettingsFormat>
  </ItemGroup>

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, a monotonic number definitely makes more sense.

OpenTabletDriver.Daemon.Library/Extensions.cs Outdated Show resolved Hide resolved
Copy link
Owner Author

@gonX gonX Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should probably be extracted into the single image that we need from it, since I assume we don't need all the images in this file (file tells me it has 7 icons)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not really using this logo anymore. It's just there when the project was initialized and not removed till now.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be squashed in so we don't have the icon in the history at all. It's almost 200KB that would be added to every fresh fetch on the main repo

if (OperatingSystem.IsWindows())
return services.AddWindowsServices();
// else if (OperatingSystem.IsLinux())
// return services.AddLinuxServices();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just commenting: we can probably set up autostart on linux with the help of shell commands or systemd integration


shortcut.Save(GetShortcutPath());
return true;
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add else if (autoStart && AutoStart) case to check if the already created shortcut matches current path?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add shortcut target check to AutoStart instead, so launching from a different path will lead to AutoStart being false for that binary.

Width="Auto"
SharedSizeGroup="Input_LabelColumn" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="6*" />
Copy link
Owner Author

@gonX gonX Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does 6* do?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It takes up 6 times more space than other columns with *. Is used to scale slider.

{
// clear the navigation list to workaround an avalonia layout bug
// unfortunately due to this we can't animate the Daemon item into
// popping up
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link issue number to avalonia bug

Copy link
Owner Author

@gonX gonX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(continued review, Green button too attractive!)

Skipped all removed OTD.UX/Controls and OTD.UX/ViewModels files since its easier to manually test for regressions in those.

return;

e.Handled = true;
// is there a need to implement forward?
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this comment relates to back/forward buttons on side mouse, I would prefer forward being an option if Avalonia supports it

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the navigation-related code is homebrew. The forward is a bit harder to get right due to viewmodel invalidations. We can write an issue for this for now, but this feature is not going to be part of initial merge.

{
}

protected override bool EnableTray { get; } = IsVariableSet("OTD_TRAY_ICON");
Copy link
Owner Author

@gonX gonX Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if tray still exists in avalonia (should be default on btw) no tray, add to missing features

Copy link
Owner Author

@gonX gonX Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check that this (area converter) still exists
missing area converter, add to missing features

Comment on lines -15 to -17
Developers = new[] { "InfinityGhost" };
Designers = new[] { "InfinityGhost" };
Documenters = new[] { "InfinityGhost" };
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reimplement these in Build.props for an about tab or about dialog? The actual content can be updated later

OpenTabletDriver/InputDeviceEndpoint.cs Show resolved Hide resolved
@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

Needs InfinityGhost/HIDSharpCore#23 on Linux

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

Bindings editor should probably open as another type of window - currently it gets tiled with my other windows. "About" page in old UI does what I describe.

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

Transparency is flipped, at least on Linux (Sway) - it goes white/grey with mouse in frame and "normal" without the mouse. Disabling transparency fixes this.

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

Aux buttons do not work on my PTH-851

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

Odd crash while right clicking stuff:

Unhandled exception. System.InvalidOperationException: The control already has a visual parent.
   at Avalonia.Visual.ValidateVisualChild(Visual c)
   at Avalonia.Collections.AvaloniaList`1.InsertRange(Int32 index, IEnumerable`1 items)
   at Avalonia.Controls.Panel.ChildrenChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Avalonia.Collections.AvaloniaList`1.NotifyAdd(T item, Int32 index)
   at Avalonia.Controls.Presenters.PanelContainerGenerator.InsertContainer(ItemsControl itemsControl, Controls children, Object item, Int32 index)
   at Avalonia.Controls.Presenters.PanelContainerGenerator.<OnItemsChanged>g__Add|5_0(Int32 index, IEnumerable items, <>c__DisplayClass5_0&)
   at Avalonia.Controls.Presenters.PanelContainerGenerator.OnItemsChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Avalonia.Controls.Presenters.ItemsPresenter.CreateSimplePanelGenerator()
   at Avalonia.Controls.Presenters.ItemsPresenter.ApplyTemplate()
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.Presenters.ScrollContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Controls.DockPanel.MeasureOverride(Size constraint)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
   at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
   at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding)
   at Avalonia.Controls.Primitives.VisualLayerManager.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutHelper.MeasureChild(Layoutable control, Size availableSize, Thickness padding)
   at Avalonia.Controls.LayoutTransformControl.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
   at Avalonia.Controls.Primitives.PopupRoot.MeasureOverride(Size availableSize)
   at Avalonia.Layout.Layoutable.Measure(Size availableSize)
   at Avalonia.Layout.LayoutManager.Measure(Layoutable control)
   at Avalonia.Layout.LayoutManager.ExecuteInitialLayoutPass()
   at Avalonia.Controls.WindowBase.Show()
   at Avalonia.Controls.Primitives.Popup.Open()
   at Avalonia.Controls.Primitives.Popup.IsOpenChanged(AvaloniaPropertyChangedEventArgs`1 e)
   at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value)
   at Avalonia.PropertyStore.EffectiveValue`1.SetAndRaiseCore(ValueStore owner, StyledProperty`1 property, T value, BindingPriority priority, Boolean isOverriddenCurrentValue, Boolean isCoercedDefaultValue)
   at Avalonia.PropertyStore.ValueStore.SetLocalValue[T](StyledProperty`1 property, T value)
   at Avalonia.PropertyStore.ValueStore.SetValue[T](StyledProperty`1 property, T value, BindingPriority priority)
   at Avalonia.AvaloniaObject.SetValue[T](StyledProperty`1 property, T value, BindingPriority priority)
   at Avalonia.Controls.Primitives.Popup.set_IsOpen(Boolean value)
   at Avalonia.Controls.ContextMenu.Open(Control control, Control placementTarget, Boolean requestedByPointer)
   at Avalonia.Controls.ContextMenu.ControlContextRequested(Object sender, ContextRequestedEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
   at Avalonia.Controls.Control.OnPointerReleased(PointerReleasedEventArgs e)
   at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value)
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
   at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers, IInputElement hitTest)
   at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e)
   at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e)
   at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e)
   at Avalonia.X11.X11Window.DispatchInput(RawInputEventArgs args)
   at Avalonia.RawEventGrouper.Dispatch(RawInputEventArgs ev)
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
   at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode)
   at OpenTabletDriver.UI.Program.RunAvaloniaApp(String[] args) in /home/gonx/git/opentabletdriver/OpenTabletDriver.UI/Program.cs:line 25
   at OpenTabletDriver.UI.Program.Main(String[] args) in /home/gonx/git/opentabletdriver/OpenTabletDriver.UI/Program.cs:line 14
Aborted (core dumped)

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

setting a binding for an incorrect mode (e.g. artist mode binding in absolute mode), applying, and then switching to the correct mode and applying that does not make the bindings work, but changing any bindings (even unrelated ones) and applying following that does fix it

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

clicking reset (in the save/discard/reset menu in the bottom-right) is too aggressive, it should have a confirmation box or "hold down to 'fill' the button to reset" or similar misclick mitigation

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

changing output modes does not enable apply/save/discard buttons

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

switching output mode changing settings on the new output mode results in discard not behaving correctly, basically:

  • Switch output mode
  • Set settings (e.g. width/sensitivity) for new output mode
  • Press discard
  • Go back to same output mode as on first step
  • Observe your settings are still kept

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

disconnecting a client (e.g. closing 1 of multiple UI processes) causes other clients to also disconnect which may cause issues when Console app is fixed

@gonX
Copy link
Owner Author

gonX commented Nov 21, 2023

"full area" tablet area shortcut does not center

@gonX
Copy link
Owner Author

gonX commented Nov 23, 2023

needs X9VoiD#8 to be able to run ./build.sh on Linux

@gonX
Copy link
Owner Author

gonX commented Nov 23, 2023

meta: open issue for adding "forward button" support in GUI (resolves a convo in this thread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants