These are chat archives for AvaloniaUI/Avalonia

16th
May 2016
Darnell Williams
@Seeker1437
May 16 2016 00:29
Is anyone one here that believes they have a strong grasp of ReactiveUI?
I need help understanding itr better
I have a prospective employer who says they will train me in ReactiveUI but I want to get some of my own knowledge in just in case I don't get the job xD
And ofc if you are willing to wor with me for a little bit to help me strengthen my understanding
The tutorials don't make too much sense to be because they often are for varying versions of RxUI
Jeremy Koritzinsky
@jkoritzinsky
May 16 2016 01:33
I'm going to take a stab at fixing the hit testing.
Darnell Williams
@Seeker1437
May 16 2016 01:33
:D
Jeremy Koritzinsky
@jkoritzinsky
May 16 2016 04:18
@grokys I'm trying to work on hit-testing/fixing adorners to work with transforms (can re-apply the adorner work onto the hit-testing work) and I'm having issues getting the transforms to work correctly when there are multiple transforms. Specifically, I'm having issues getting the transform offsets with respect to the parent elements correct.
Steven Kirk
@grokys
May 16 2016 05:25
not an issue i know about: is it possible to write a render test that demonstrates the issue?
Fei
@flyingxu
May 16 2016 07:03
Hi Guys, recently I saw some error messages in the application output of MonoDevelop:
Cairo.Path is leaking, programmer is missing a call to Dispose
Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces
I don't see the message in Avalonia's source code but I find some clue in github, https://github.com/mono/gtk-sharp/blob/994790432d124f009fa7dc1903f5d67c07ae553d/cairo/CairoDebug.cs#L65
Fei
@flyingxu
May 16 2016 07:15
then I set MONO_CAIRO_DEBUG_DISPOSE in the environment variables and I got the following message:
Cairo.Path is leaking, programmer is missing a call to Dispose
Allocated from:
  at System.Environment.get_StackTrace () [0x00000] in <filename unknown>:0 
  at Cairo.CairoDebug.OnAllocated (IntPtr obj) [0x00000] in <filename unknown>:0 
  at Cairo.Path..ctor (IntPtr handle) [0x00000] in <filename unknown>:0 
  at Cairo.Context.CopyPath () [0x00000] in <filename unknown>:0 
  at Avalonia.Cairo.Media.StreamGeometryContextImpl.EndFigure (Boolean isClosed) [0x00025] in avalonia/src/Gtk/Avalonia.Cairo/Media/StreamGeometryContextImpl.cs:86 
  at Avalonia.Media.EllipseGeometry..ctor (Rect rect) [0x001b8] in avalonia/src/Avalonia.SceneGraph/Media/EllipseGeometry.cs:46 
  at Avalonia.Controls.Shapes.Ellipse.CreateDefiningGeometry () [0x00025] in avalonia/src/Avalonia.Controls/Shapes/Ellipse.cs:18 
  at Avalonia.Controls.Shapes.Shape.get_DefiningGeometry () [0x0000f] in avalonia/src/Avalonia.Controls/Shapes/Shape.cs:45 
  at Avalonia.Controls.Shapes.Shape.get_RenderedGeometry () [0x0000e] in avalonia/src/Avalonia.Controls/Shapes/Shape.cs:64 
  at Avalonia.Controls.Shapes.Shape.Render (Avalonia.Media.DrawingContext context) [0x00002] in avalonia/src/Avalonia.Controls/Shapes/Shape.cs:109 
  at Avalonia.Rendering.RendererMixin.Render (Avalonia.Media.DrawingContext context, IVisual visual, Rect clipRect) [0x0013c] in avalonia/src/Avalonia.SceneGraph/Rendering/RendererMixin.cs:123 
  at Avalonia.Rendering.RendererMixin.Render (Avalonia.Media.DrawingContext context, IVisual visual, Rect clipRect) [0x001aa] in avalonia/src/Avalonia.SceneGraph/Rendering/RendererMixin.cs:134 
  at Avalonia.Rendering.RendererMixin.Render (Avalonia.Media.DrawingContext context, IVisual visual) [0x00009] in avalonia/src/Avalonia.SceneGraph/Rendering/RendererMixin.cs:81 
  at Avalonia.Rendering.RendererMixin.Render (IRenderTarget renderTarget, IVisual visual) [0x0000b] in avalonia/src/Avalonia.SceneGraph/Rendering/RendererMixin.cs:47 
  at Avalonia.Controls.Platform.DefaultTopLevelRenderer+<Attach>c__AnonStorey0.<>m__1 (Rect rect) [0x0000d] in avalonia/src/Avalonia.Controls/Platform/ITopLevelRenderer.cs:41 
  at Avalonia.Gtk.WindowImpl.OnExposeEvent (Gdk.EventExpose evnt) [0x00012] in avalonia/src/Gtk/Avalonia.Gtk/WindowImpl.cs:362 
  at Gtk.Widget.exposeevent_cb (IntPtr widget, IntPtr evnt) [0x00000] in <filename unknown>:0 
  at Gtk.Application.gtk_main_iteration () [0x00000] in <filename unknown>:0 
  at Gtk.Application.RunIteration () [0x00000] in <filename unknown>:0 
  at Avalonia.Gtk.GtkPlatform.RunLoop (CancellationToken cancellationToken) [0x00006] in avalonia/src/Gtk/Avalonia.Gtk/GtkPlatform.cs:74 
  at Avalonia.Threading.Dispatcher.MainLoop (CancellationToken cancellationToken) [0x00023] in avalonia/src/Avalonia.Base/Threading/Dispatcher.cs:55 
  at Avalonia.Application.Run (ICloseable closable) [0x00047] in avalonia/src/Avalonia.Controls/Application.cs:145
Steven Kirk
@grokys
May 16 2016 07:19
yeah i've seen those too. if i remember correctly it's not actually a problem
just we have long-living objects which you don't usually do with cairo
Fei
@flyingxu
May 16 2016 07:19
OK, nice to hear that
Steven Kirk
@grokys
May 16 2016 07:19
though i could be wrong - i wasn't involved much in the cario backend
Fei
@flyingxu
May 16 2016 07:21
Thanks
Steven Kirk
@grokys
May 16 2016 08:26
btw @danwalmsley i haven't forgotten about your bug. it's the same one that i was investigating before i went away, but it's a bit hard to track down
i hope i'll find it this evening though, assuming no interruptions
danwalmsley
@danwalmsley
May 16 2016 08:28
@grokys thanks mate, I saw you got more done on virtualization, did you come up with a solution for that?
Steven Kirk
@grokys
May 16 2016 08:29
yeah, i'm starting small, and i think it's going pretty well
i'm hoping to find a relatively simple elegant solution
and it's looking like that's definitely possible
Jeremy Koritzinsky
@jkoritzinsky
May 16 2016 18:44
@grokys The problem is getting adorners to overlay correctly over elements with transforms (and clipping once I get transforms working). I'm just having some trouble with getting the algebra to work quite right.
danwalmsley
@danwalmsley
May 16 2016 18:48
I guess its not as simple as applying same transform to the adorner?
hey can any of you guys offer me some advice on a multi-threaded issue I have...
I have a process that I am trying to communicate with via stdin and stdout
I fire up the process and start a thread that reads and writes from the stdio
now in Avalon studio the user can issue commands, that may come from any thread
Jeremy Koritzinsky
@jkoritzinsky
May 16 2016 18:52
For only a transform on the element adorned it is. Other than that it isn't.
danwalmsley
@danwalmsley
May 16 2016 18:52
but they need to be synchcronised to the single thread communicating
I have implemented this via a semaphore to control access to transmit function
but I'm getting dead locks all over the place... in my wpf version id done it without semaphore, just using a Dispatcher and running all the commands on the same thread
it worked perfectly.... can anyone suggest anything better?
danwalmsley
@danwalmsley
May 16 2016 21:00
@grokys are you there?
I'm trying to figure out how to use your dispatcher class
Steven Kirk
@grokys
May 16 2016 21:01
Yeah I'm here... Reinstalling windows fit the second time today :(
danwalmsley
@danwalmsley
May 16 2016 21:01
oh no!
basically I'm sure its simple
iv done this:
Task.Factory.StartNew(() =>
            {
                transmitDispatcher = SingleThreadDispatcher.StartNew(new CancellationToken());

                transmitDispatcher.MainLoop(new CancellationToken());
            });
and I'm posting stuff to the dispatcher to run on that task
like this:
 await transmitDispatcher.InvokeTaskAsync(() =>
            {});
but the Actions I'm posting are not getting executed
have I missed a step?
Steven Kirk
@grokys
May 16 2016 21:03
You're creating your own instance of the despatcher class?
danwalmsley
@danwalmsley
May 16 2016 21:03
yeh, kind of using it like a job queue
processing queue
I know its crazy!
Steven Kirk
@grokys
May 16 2016 21:03
Hmm not sure that's supported
Not really a use case I've thought about
danwalmsley
@danwalmsley
May 16 2016 21:03
the wpf dispatcher I used in that way
Steven Kirk
@grokys
May 16 2016 21:04
Yeah that was probably designed for it ;)
danwalmsley
@danwalmsley
May 16 2016 21:04
I was looking at the code and it seems that MainLoop should just run through the stuff posted to it
and execute on the thread the dispatcher was created
Steven Kirk
@grokys
May 16 2016 21:04
Possibly
danwalmsley
@danwalmsley
May 16 2016 21:05
can I ask you expert advice...
Steven Kirk
@grokys
May 16 2016 21:05
But what's pushing messages to the main loop?
danwalmsley
@danwalmsley
May 16 2016 21:05
I guess nothing
would it need a message telling it to start processing?
What is the difference between a processing queue and a dispatcher?
Steven Kirk
@grokys
May 16 2016 21:07
the dispatcher is tied to the windows message loop
danwalmsley
@danwalmsley
May 16 2016 21:08
hmmm ok
maybe I only need the job queue part to do what I'm doing
Steven Kirk
@grokys
May 16 2016 21:08
it's pretty much just an abstraction of that
you should be able to find loads of message queues
danwalmsley
@danwalmsley
May 16 2016 21:10
your job runner class looks exactly like what I need
its marked internal though :(
Steven Kirk
@grokys
May 16 2016 21:11
what exactly are you trying to do? just a producer consumer queue pushing messages from a thread to the UI thread?
danwalmsley
@danwalmsley
May 16 2016 21:12
effectively that
I'm trying to push messages from multiple threads to a single threaad
multi producer, single consumer
Steven Kirk
@grokys
May 16 2016 21:12
is the single thread the UI thread?
danwalmsley
@danwalmsley
May 16 2016 21:12
its for my debugging in Avalon Studio
its not the ui thread
its a thread that is the only one that can talk to GDB
Steven Kirk
@grokys
May 16 2016 21:13
just from googling, i found this: https://msdn.microsoft.com/en-us/library/dd997371(v=vs.110).aspx would that work?
danwalmsley
@danwalmsley
May 16 2016 21:16
cheers
yes that looks like what I need
could you use that instead of your job runner class?
in avalonia?
or does it do other stuff too?
Steven Kirk
@grokys
May 16 2016 21:18
not sure - i didn't write that stuff
well i wrote an early version but i didn't really know what i was doing
danwalmsley
@danwalmsley
May 16 2016 21:18
ah ok
hmm yeh the BlockingQueue doesn't exactly do what I need
await transmitRunner.InvokeTaskAsync(() =>
            {
                SetCommand(command);

                if (DebugMode)
                {
                    console.WriteLine("[Sending] " + command.Encode());
                }

                input.WriteLine(command.Encode());
                input.Flush();

                result = WaitForResponse(-1);

                ClearCommand();
            });
I wouldn't be able to await it
The invokeTaskAsync part of the dispatcher makes it perfect for my use
Steven Kirk
@grokys
May 16 2016 21:20
@kekekeks write the Dispatcher i think - he may be able to tell you if it can be adapted to work for your use case
danwalmsley
@danwalmsley
May 16 2016 21:21
ok cheers
hows your windows installation going?
just installing updates and then gotta install VS
danwalmsley
@danwalmsley
May 16 2016 21:23
mines await on Enqueue
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:23
guys
LoadFromXaml() is missing on latest nuget from nightly?
danwalmsley
@danwalmsley
May 16 2016 21:28
@grokys actually I think I can use blockingqueue as long as I return a Task and await that
cheer pal
Steven Kirk
@grokys
May 16 2016 21:30
@galvesribeiro yeah, that was removed - you should load from Xaml like this now:
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:31
ok
but what about the app startup?
    app.UsePIUI()
           .UseFrameBufferWindow("/dev/fb", width, height, (width * height * 16) >> 3, 90)
           .WithSkia()
           .UseAssetAssembly(asm).LoadFromXaml();
        app.Run();
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:31
just remove it?
Steven Kirk
@grokys
May 16 2016 21:32
we had to change that stuff because it broke the designer
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:32
humm
mine still broken hehehe
anyway, just remove it from my appbuilder and I'm fine?
Steven Kirk
@grokys
May 16 2016 21:33
basically, change your UseFrameBufferWindow extension method to look like this: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Windows/Avalonia.Win32/Win32Platform.cs#L24
the designer is still broken, but these changes should allow it to work soon
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:35
This message was deleted
public static TApp UseFrameBufferWindow<TApp>(this TApp app, string fbDeviceName, int width, int height, int fbSize, int rotateDegrees = 0) where TApp : AppBuilder
        {

            app.WindowingSubsystem = ()=> new PIUIWindowingPlatformImpl(new FrameBufferWindow(fbDeviceName, width, height, fbSize, rotateDegrees));

            SkiaPlatform.Initialize();

            return app;
        }
better
Steven Kirk
@grokys
May 16 2016 21:37
yeah - not sure you want SkiaPlatform.Initialize(); in there - isn't that what WithSkia does?
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:37
yeah... probably old code
Steven Kirk
@grokys
May 16 2016 21:38
basically, AppBuilder ensures that everything gets called in the correct order
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:38
actually I'm not using your skia binding
cause it does not support the framebuffer
Steven Kirk
@grokys
May 16 2016 21:39
ah ok. well just make sure you pass an init function to AppBuilder and let that call it rather than calling stuff yourself
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:39
public static class PIUIAPpllicationExtensions
    {
        public static AppT UsePIUI<AppT>(this AppT app) where AppT : AppBuilder
        {
            PIUIPlatform.Initialize();
            return app;
        }

        public static AppT UseAssetAssembly<AppT>(this AppT app, Assembly assembly) where AppT : AppBuilder
        {
            // Asset loading searches our own assembly?
            app.UseAssetAssembly(assembly);
            return app;
        }

        public static TApp UseFrameBufferWindow<TApp>(this TApp app, string fbDeviceName, int width, int height, int fbSize, int rotateDegrees = 0) where TApp : AppBuilder
        {
            app.WindowingSubsystem = ()=> new PIUIWindowingPlatformImpl(new FrameBufferWindow(fbDeviceName, width, height, fbSize, rotateDegrees));

            return app;
        }

        public static TApp WithSkia<TApp>(this TApp app) where TApp : AppBuilder
        {
            SkiaPlatform.Initialize();
            return app;
        }
    }
this is basically what we have now
Steven Kirk
@grokys
May 16 2016 21:40
change <TApp> to be non-generic AppBuilder
        public static AppBuilder WithSkia(this AppBuilder builder)
        {
            builder.RenderingPlatform = SkiaPlatform.Initialize;
            return builder;
        }
RenderingSubsystem not RenderingPlatform
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:42
RenderingPlatform isnt here
ah ok
btw, in case anyone missed http://dot.net
RC2 is out
Steven Kirk
@grokys
May 16 2016 21:44
is this actually going to be a Release Candidate?
or another beta?
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:45
I hope it is now a true RC with the go-live license
Steven Kirk
@grokys
May 16 2016 21:45
i don't know why MS insist on misusing versioning EVERY TIME
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:45
yeah
ok...
with this new version now I'm receiving segfaults...

Mono: Assembly Loader loaded assembly from location: '/data/opt/mono/4.5/System.Threading.Tasks.dll'.
Mono: Config attempting to parse: '/data/opt/mono/4.5/System.Threading.Tasks.dll.config'.
Mono: Config attempting to parse: '/data/opt/mono/etc/mono/assemblies/System.Threading.Tasks/System.Threading.Tasks.config'.
Mono: Assembly Ref addref Avalonia.Base[0xeee8b0] -> System.Threading.Tasks[0xf98338]: 2
Mono: Assembly Ref addref System.Threading.Tasks[0xf98338] -> mscorlib[0xb345c8]: 24
Segmentation fault
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:54
internal class PIUIPlatform
    {
        public static void Initialize()
        {
            AvaloniaLocator.CurrentMutable
                      .Bind<IPlatformSettings>().ToConstant(new PIUIPlatformSettings())
                          .Bind<IPclPlatformWrapper>().ToSingleton<PclPlatformWrapper>()
                          .Bind<IPlatformThreadingInterface>().ToConstant(new PIUIPlatformThreading());

            Application.RegisterPlatformCallback(() => { });
        }
    }
is this still valid on the current versions?
Steven Kirk
@grokys
May 16 2016 21:56
yeah should be - a sefault would suggest it's unmanaged code that's failing
possibly because things are getting initialized in a different order?
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 21:58
maybe
making mono confused
I think we should start fresh with this platform implementation
there are too much changes
Steven Kirk
@grokys
May 16 2016 22:02
tbh there haven't been many changes to avalonia other than the name change and appbuilder
Gutemberg Ribeiro
@galvesribeiro
May 16 2016 22:03
than idk what can possible be happening