Skip to content

Conversation

@InfinityGhost
Copy link
Member

@InfinityGhost InfinityGhost commented Jul 20, 2022

Notes

  • Completely rewrote the OpenTabletDriver Daemon and UI projects from scratch using Dependency Injection.
  • Merged the OpenTabletDriver.Plugin library into the core OpenTabletDriver library.

Issues

@InfinityGhost InfinityGhost added enhancement New feature or request windows/wpf Affects the Windows platform linux/gtk Affects the Linux platform macos Affects the MacOS platform gui Affects driver GUI daemon Affects the driver itself plugins Plugin or Plugin API related console Affects the OpenTabletDriver console utility breaking Introduces a breaking change core OpenTabletDriver core library labels Jul 20, 2022
@InfinityGhost InfinityGhost added this to the v0.7.x milestone Jul 20, 2022
@InfinityGhost InfinityGhost added the priority:high High priority issue/pull request label Jul 20, 2022
@InfinityGhost InfinityGhost force-pushed the di branch 2 times, most recently from 72c5543 to 9b5f26d Compare July 26, 2022 03:03
@gonX
Copy link
Member

gonX commented Aug 9, 2022

Linux lg2m and tested working well enough that a prerelease is viable. Still needs testing on other platforms.

Btw, you can add "Fixes #1988" now

@InfinityGhost InfinityGhost marked this pull request as ready for review August 19, 2022 22:25
@InfinityGhost InfinityGhost merged commit edd8b01 into OpenTabletDriver:master Aug 21, 2022
@InfinityGhost InfinityGhost deleted the di branch August 21, 2022 21:55
Copy link
Contributor

@AkiSakurai AkiSakurai left a comment

Choose a reason for hiding this comment

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

Some minor issues collected, it is cumbersome to recreate separated issues, I just leave the comments here.

await Driver.Instance.ResetSettings();
App.Current.Settings = await Driver.Instance.GetSettings();
if (await _rpc.Instance!.GetUpdateInfo() is UpdateInfo updateInfo)
_app.ShowWindow<UpdateForm>(updateInfo);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unhandled exception. MonoMac.Foundation.ObjCException: NSInternalInconsistencyException: NSWindow drag regions should only be invalidated on the Main Thread!
   at MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_CGRect_UInt64_UInt64_bool(IntPtr receiver, IntPtr selector, CGRect arg1, UInt64 arg2, UInt64 arg3, Boolean arg4)
   at MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper_CGRect_UInt64_UInt64_bool(IntPtr receiver, IntPtr selector, CGRect arg1, UInt64 arg2, UInt64 arg3, Boolean arg4)
   at MonoMac.AppKit.NSWindow..ctor(CGRect contentRect, NSWindowStyle aStyle, NSBackingStore bufferingType, Boolean deferCreation)
   at Eto.Mac.Forms.EtoWindow..ctor(CGRect rect, NSWindowStyle style, NSBackingStore store, Boolean flag)
   at Eto.Mac.Forms.FormHandler.CreateControl()
   at Eto.WidgetHandler`2.get_Control()
   at Eto.Mac.Forms.MacWindow`3.ConfigureWindow()
   at Eto.Mac.Forms.FormHandler`1.Initialize()
   at Eto.WidgetHandler`1.Eto.Widget.IHandler.Initialize()
   at Eto.Widget.Initialize()
   at Eto.Forms.Window..ctor()
   at Eto.Forms.Form..ctor()
   at OpenTabletDriver.UX.Components.DesktopForm..ctor()
   at OpenTabletDriver.UX.Windows.UpdateForm..ctor(IDriverDaemon daemon, App app, UpdateInfo update)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at OpenTabletDriver.Desktop.DependencyInjectionExtensions.CreateInstance(IServiceProvider serviceProvider, Type type, Object[] additionalDependencies)
   at OpenTabletDriver.Desktop.DependencyInjectionExtensions.CreateInstance[T](IServiceProvider serviceProvider, Object[] additionalDependencies)
   at OpenTabletDriver.Desktop.DependencyInjectionExtensions.GetOrCreateInstance[T](IServiceProvider serviceProvider, Object[] additionalDependencies)
   at OpenTabletDriver.UX.App.ShowWindow[TWindow](Object[] deps)
   at OpenTabletDriver.UX.MainForm.OnConnected()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result)
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result)
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync(JsonRpcRequest request, Type expectedResultType, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Threading.Tasks.TaskCompletionSource`1.SetResult(TResult result)
   at StreamJsonRpc.JsonRpc.<>c__DisplayClass143_0.<InvokeCoreAsync>b__0(JsonRpcMessage response)
   at StreamJsonRpc.JsonRpc.HandleRpcAsync(JsonRpcMessage rpc)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at Microsoft.VisualStudio.Threading.AwaitExtensions.TaskSchedulerAwaiter.<>c.<UnsafeOnCompleted>b__6_0(Object state)
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   
   

if (MessageBox.Show("Reset settings to default?", "Reset to defaults", MessageBoxButtons.OKCancel, MessageBoxType.Question) == DialogResult.Ok)
await ResetSettings();
}
Content = _placeholder;
Copy link
Contributor

Choose a reason for hiding this comment

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

System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
   at System.Windows.Threading.Dispatcher.VerifyAccess()
   at Eto.Wpf.Forms.TableLayoutHandler.InitializeSizes()
   at Eto.Wpf.Forms.TableLayoutHandler.SetupGrid()
   at Eto.Wpf.Forms.TableLayoutHandler.OnLoad(EventArgs e)
   at Eto.Forms.Control.OnLoad(EventArgs e)
   at Eto.Forms.TableLayout.OnLoad(EventArgs e)
   at Eto.Forms.Control.TriggerLoad(EventArgs e)
   at Eto.Forms.Container.OnLoad(EventArgs e)
   at Eto.Forms.TableLayout.OnLoad(EventArgs e)
   at Eto.Forms.Control.TriggerLoad(EventArgs e)
   at Eto.Forms.Container.OnLoad(EventArgs e)
   at Eto.Forms.StackLayout.OnLoad(EventArgs e)
   at Eto.Forms.Control.TriggerLoad(EventArgs e)
   at Eto.Forms.Container.OnLoad(EventArgs e)
   at Eto.Forms.Control.TriggerLoad(EventArgs e)
   at Eto.Forms.Container.SetParent(Control child, Action assign, Control previousChild)
   at Eto.Forms.Panel.set_Content(Control value)
   at OpenTabletDriver.UX.MainForm.OnDisconnected() in 

private async Task InstallUpdate()
{
Enabled = false;
var executable = Process.GetCurrentProcess().ProcessName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Process name is truncated on macos.
dotnet/runtime#52860


LogMessage IList<LogMessage>.this[int index]
{
get => (_filteredMessages as IList<LogMessage>)![index];
Copy link
Contributor

Choose a reason for hiding this comment

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

Eto (>=2.6.0) added caching for non indexable IEnumerable lookup but forgot to invalidate the cache when IEnumerable is updated. Which brokes the log viewer and causes random segfault.
picoe/Eto#2029

Queue<T> does not implement IList<T>.
Beside, this function is not called by Eto.
Eto calls IList<object>.[] or IList.[] internally, but IList<T> can't be cast to IList<object>.

As a workaround, you can avoid the caching by implement IList or just use FilterCollection so the index function can be picked up by eto.

};

IAreaConverter? converter = null;

Copy link
Contributor

Choose a reason for hiding this comment

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

Dialog is too small.
Screenshot 2022-08-20 at 9 23 52 AM

Process.Start("chmod", $"+x {subPath}/OpenTabletDriver.UX.MacOS");
Process.Start("chmod", $"+x {subPath}/OpenTabletDriver.Daemon");
Move(subPath, BinaryDirectory);
Copy link
Contributor

Choose a reason for hiding this comment

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

DownloadDirectory is moved to BinaryDirectory by function Install in superclass before this function is called.

var splitter = new Splitter
{
Panel1MinimumSize = 250,
Panel1 = _configsList = new ListBox<TabletConfiguration>(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Configuration editor is not scrollable now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Weird that the macOS implementation doesn't have a scrollable built into that

Copy link
Contributor

Choose a reason for hiding this comment

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

Also happens on linux
Screenshot from 2022-08-22 20-07-24

@gonX gonX added the backport-not-needed Feature is already implemented or is not relevant for 0.6.x branch label Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-not-needed Feature is already implemented or is not relevant for 0.6.x branch breaking Introduces a breaking change console Affects the OpenTabletDriver console utility core OpenTabletDriver core library daemon Affects the driver itself enhancement New feature or request gui Affects driver GUI linux/gtk Affects the Linux platform macos Affects the MacOS platform plugins Plugin or Plugin API related priority:high High priority issue/pull request windows/wpf Affects the Windows platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore input outside area does not function

3 participants