These are chat archives for AvaloniaUI/Avalonia

16th
Mar 2016
Steven Kirk
@grokys
Mar 16 2016 00:04
@QuantumDeveloper yeah i saw that CI failed
seems all the grid tests are failing
Darnell Williams
@Seeker1437
Mar 16 2016 00:30
hmmm
Is therea way to return something like
Binding.DoNothing
Darnell Williams
@Seeker1437
Mar 16 2016 01:54
Perspex uses GTK# on other platofmrs if it's not windows right?
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 06:51
@grokys could you just build it yourself? Because in my project there is no issues and all grid tests are green. also your project building and working correctly. I dont understand why CI is failed
Darnell Williams
@Seeker1437
Mar 16 2016 07:02
Bluidl was fine, tests failed though
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 07:11
as I understand grid is not related with those tests
Darnell Williams
@Seeker1437
Mar 16 2016 07:29
ah yeah they are specifically the grid tests though
this means that even if grid built successfully it might not be functioning properly
      Stack Trace:
        tests\Perspex.Controls.UnitTests\GridTests.cs(413,0): at Perspex.Controls.UnitTests.GridTests.ChildlessMargin_RowDefinition_Height_autoSize_constSize_multiRow()
    Perspex.Controls.UnitTests.GridTests.ChildlessMargin_RowDefinition_Height_constSize_singleRow [FAIL]
      Assert.Equal() Failure
      Expected: 10, 100
      Actual:   100, 100
      Stack Trace:
        tests\Perspex.Controls.UnitTests\GridTests.cs(33
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 07:37
its megastrange
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 07:43
Did something in layout was changed? Because in my framework those tests passing without errors.
Darnell Williams
@Seeker1437
Mar 16 2016 07:45
@QuantumDeveloper try mergine master in your repo.
git pull Perspex master
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 09:06
ok, seems I found what was wrong)
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 09:16
in WPF Grid if no definition was defined, be default it use not star row/column, but Auto and in my implementation was stars)
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 09:51
@grokys can you help me with one question?
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 11:41
is it normal that content control has nos visual children when I explicitly set control to content property?
Steven Kirk
@grokys
Mar 16 2016 12:00
hi @QuantumDeveloper, no that is not normal
ContentControl is a TemplatedControl and so its visual child should be the root of its template
danwalmsley
@danwalmsley
Mar 16 2016 12:14
@grokys does Perspex have a way to work out if a control is within the bounds of the screen
this is for me to fix context menu
Steven Kirk
@grokys
Mar 16 2016 12:14
not yet, no - we don't have a screen api
danwalmsley
@danwalmsley
Mar 16 2016 12:14
when it opens it can overlap the edge of the screen at the moment
Steven Kirk
@grokys
Mar 16 2016 12:14
yeah, i know :/
danwalmsley
@danwalmsley
Mar 16 2016 12:14
or a compromise would be I guess not overlapping its parent control?
Steven Kirk
@grokys
Mar 16 2016 12:15
we really need a screen api
danwalmsley
@danwalmsley
Mar 16 2016 12:15
ok
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 12:16
@grokys then this is a bug, which prevent Grid to be checked in
danwalmsley
@danwalmsley
Mar 16 2016 12:16
do you think there is a lot involved in that?
Steven Kirk
@grokys
Mar 16 2016 12:16
@QuantumDeveloper are you sure you have a template applied, and that ApplyTemplate has been called?
@danwalmsley probably not, no
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 12:16
because during test ContentControl itself has correct size, but border inside control has zero size
@grokys I didnt know that I need to set Template to ContentControl explicitly
in WPF I dont need to do that
Steven Kirk
@grokys
Mar 16 2016 12:19
you don't need to set it explicitly if you've got a rooted tree and a theme
(which will be the case in an application)
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 12:19
ok, lets see it in context of the grid test
var r = new Border(); ContentControl mc = new ContentControl { Content = r };
What I need to do here to make border work correctly?
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 12:22
thanks
and another one question
regarding TrackChanges
how to make it work?
I see that it fires only once, and not react on Definitions changes
and this also break Grid in some parts
Steven Kirk
@grokys
Mar 16 2016 12:24
have you tried debugging it to see if the PropertyChanged handers are added?
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 12:29
no, because I am not sure that I understand how all that reactive stuff working)
Steven Kirk
@grokys
Mar 16 2016 12:31
ok, but that doesn't even use any reactive stuff - it's just property changed handlers
but if you show me the code that's failing i can hopefully take a look sometime today
i'm busy with work
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 12:39
@grokys Ok, now all tests are green)
Darnell Williams
@Seeker1437
Mar 16 2016 14:37
@grokys the screen API I was curious about it
Where would you put something like that (which library(ies))
Darnell Williams
@Seeker1437
Mar 16 2016 14:45
Also what is our physical unit size? (same as wpf?)
Steven Kirk
@grokys
Mar 16 2016 15:28
well it would have a platform specific part and a platform independent part
not sure where we'd put it - Perspex.Application would make most sense but that's higher level than Perspex.Controls which is where it'd need to be used, so it couldn't be put there
Jeremy Koritzinsky
@jkoritzinsky
Mar 16 2016 15:30
@grokys That's the same issue I had choosing a location for IApplicationLifecycle.
Steven Kirk
@grokys
Mar 16 2016 15:31
yeah, maybe the separation of controls/application doesn't make much sense...
Jeremy Koritzinsky
@jkoritzinsky
Mar 16 2016 15:34
My thought is either to merge Perspex.Controls and Perspex.Application or move the stuff that Perspex.Application depends on in Perspex.Controls to somewhere else and invert the relationship.
Steven Kirk
@grokys
Mar 16 2016 15:35
yeah, perhaps just merging would be the best solution - there's practically nothing in Perspex.Application
only worry is the Perspex.Controls is becoming where everything gets put
Jeremy Koritzinsky
@jkoritzinsky
Mar 16 2016 15:38
That's why I was thinking of the inverse relationship (making Perspex.Application define and implement the used services and Perspex.Controls depend on it). That way we can keep the separation and still have everything work as expected.
Steven Kirk
@grokys
Mar 16 2016 15:39
hmmm yeah
Jeremy Koritzinsky
@jkoritzinsky
Mar 16 2016 15:40
I can take a look at that over the weekend and try to send in a PR. I'm on spring break next week so I'll have time to work on it.
Steven Kirk
@grokys
Mar 16 2016 15:40
thing is, Perspex.Application currently registers all the services so it needs access to everything below it
ok!
even if it's just merging them
Jeremy Koritzinsky
@jkoritzinsky
Mar 16 2016 15:41
I'll try a few different directions and see what I can get to work.
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 15:44
@grokys good news. I found some more issues, which were causing tests to fail. So, now I have (I hope) exactly measuring/arrange system as in original WPG Grid
Steven Kirk
@grokys
Mar 16 2016 15:44
cool! we need to test with AvalonStudio and Core2D next then
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 15:45
during runtime it also seems that everything works correctly, except your test app, where you pass max window size
I will make additional improvements and commit today evening
BTW, what about GridSplitter?
Steven Kirk
@grokys
Mar 16 2016 15:47
i've been busy with work so haven't given it much of a look yet
but the WPF/non-WPF toggle is confusing
as it doesn't even give an idea of what it does
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 15:51
during working on GridSplitter I found out that WPF GridSplitter has some rules for resizing different definition types. And If you will change one of them (how to resize 2 nonstar definitions), you will receive different results, so in some cases you can get rid of some WPF GridSplitter specific issues
something like that
so, WPF scheme will give you exact WPF GridSplitter resizing if you need it
if you want, I can remove it
Steven Kirk
@grokys
Mar 16 2016 15:58
i'm not sure exactly what it does, so i can't really say if it should be removed or not, but it would at least need decent documentation if it's to be kept
how likely do you think that it's necessary? considering that porting to Perspex would require many changes anyway
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 16:02
I dont know also, should it be kept or removed, so I think it must be tested by someone, who using GridSplitter and they will told us. By default WPF scheme set, so resizing must be exactly as in WPF.
with its advantages and disadvantages
Steven Kirk
@grokys
Mar 16 2016 16:05
ok, if you could at least precisely explain what the option does (preferably in documentation comments in the source) then we can ask e.g. @wieslawsoltes and @danwalmsley if it's necessary as they're the main two users for Perspex at the moment
However I'm tempted to say we should just use the most sensible mode even if it's not the same as wpf
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 16:24
ok
Steven Kirk
@grokys
Mar 16 2016 16:29
apologies about the delay in checkout out your PRs - I've got something complex i'm working on for my day job that I want to get finished
Darnell Williams
@Seeker1437
Mar 16 2016 18:17
Steven Kirk
@grokys
Mar 16 2016 18:33
there isn't currently an event for losing mouse capture
i can't see a reason you'd need it tbh
Amer Koleci
@amerkoleci
Mar 16 2016 20:19
Guys, just submitted pull request for update to SharpDX 3.0.2 and cleaned up some unused references
Merge please if you can
Steven Kirk
@grokys
Mar 16 2016 20:34
ok, what does 3.0.2 bring?
danwalmsley
@danwalmsley
Mar 16 2016 21:23
iv been having weird memory leak problems and occasional crashes in sharp dx, perhaps @amerkoleci might have fixed thaat
is the new Grid stuff ready to test on AvalonStudio?
danwalmsley
@danwalmsley
Mar 16 2016 21:33
@QuantumDeveloper
image.png
when I run AvalonStudio against your grid branch
danwalmsley
@danwalmsley
Mar 16 2016 21:42
@QuantumDeveloper this exection was caused by some controls returning availableSize.Width or availableSize.Height in first call to measure override (infinity)
I manually hard coded these values to 4096... but I'm getting weird results...
image.png
it should have looked like this:
Ivan Kochurkin
@KvanTTT
Mar 16 2016 21:46

Sometimes on mouse middle button scroll the following error occured: Arithmetic operation resulted in an overflow.
With such StackTrace:

   at System.IntPtr.op_Explicit(IntPtr value)
   at Perspex.Win32.WindowImpl.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Perspex.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Perspex.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken)
   at Perspex.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Perspex.Application.Run(ICloseable closable)
   at DotsGame.GUI.App.Main(String[] args)
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Does anybody know what it related to and how to fix it?

danwalmsley
@danwalmsley
Mar 16 2016 21:47
@QuantumDeveloper if you want I can help you setup and build AvalonStudio so you can debug what the issues are with your new grid..
from what I could see the performance did seem better
much less CPU usage when re-rendering
Steven Kirk
@grokys
Mar 16 2016 21:51
@KvanTTT strange - seems it's encountering an overflow in the win32 message handler. do you have any sort of strange mouse or something?
also is it repeatable?
danwalmsley
@danwalmsley
Mar 16 2016 21:53
@QuantumDeveloper also Window resize didn't seem to be working, the window could be resized, but it just occluded the window contents, it didn't resize the controls inside the window
its close though, hopefully its a few minor things to fix :D
Ivan Kochurkin
@KvanTTT
Mar 16 2016 21:56
@grokys yes, scroll a bit strange: it's generate to many events on one scroll (this is unconvinent in some cases). But anyway this exception should not be generated. Now I'am trying to repeat this behavior with debug in Perspex.
Not always occures
danwalmsley
@danwalmsley
Mar 16 2016 21:58
@KvanTTT which part of Perspex code generates the scrolling? Iv been wanting to adust it for ages, 1 mouse scroll is like half a page on my text editor
Steven Kirk
@grokys
Mar 16 2016 22:03
@danwalmsley that's because virtual scrolling doesn't know anything about the scrollwheel yet
danwalmsley
@danwalmsley
Mar 16 2016 22:03
can you point me out to where id need to look to implement it?
Steven Kirk
@grokys
Mar 16 2016 22:03
so it thinks it's scrolling in pixels instead of lines
danwalmsley
@danwalmsley
Mar 16 2016 22:04
ah I see, so it needs some kind of scale factor?
Steven Kirk
@grokys
Mar 16 2016 22:04
well IScrollInfo has separate methods for scrolling with keyboard or mouse wheel
we'd need something like that, though not the 10s of methods that WPF has - something that takes enums to describe what's happened i think
danwalmsley
@danwalmsley
Mar 16 2016 22:08
surely we could just report 2 properties, smallscrollsize and bigscrollsize
or scrollsize and pagescrollsize?
Steven Kirk
@grokys
Mar 16 2016 22:09
hmm, yeah that might work too
danwalmsley
@danwalmsley
Mar 16 2016 22:10
at least for my purposes, but there are probably unknown use cases that may need something more complex?
Steven Kirk
@grokys
Mar 16 2016 22:10
really not sure...
danwalmsley
@danwalmsley
Mar 16 2016 22:11
fancy a PR for the ScrollSize and PageScrollSize properties? if it works?
Steven Kirk
@grokys
Mar 16 2016 22:11
sure!
danwalmsley
@danwalmsley
Mar 16 2016 22:12
i'll have a look... do you know where the code Perspex calls to scroll ? i.e. the point I need to check if it implements IScrollInfo or not
and if see ready the ScrollSize property and scroll by that
otherwise continue to scroll by pixels
Steven Kirk
@grokys
Mar 16 2016 22:13
i think it's all in ScrollContentPresenter
danwalmsley
@danwalmsley
Mar 16 2016 22:21
protected override void OnPointerWheelChanged(PointerWheelEventArgs e)
        {
            if (Extent.Height > Viewport.Height)
            {
                var scrollable = Child as IScrollable;

                if (scrollable != null)
                {

                }
                else
                {
                    var y = Offset.Y + (-e.Delta.Y * 50);
                    y = Math.Max(y, 0);
                    y = Math.Min(y, Extent.Height - Viewport.Height);
                    Offset = new Vector(Offset.X, y);
                    e.Handled = true;
                }
            }
        }
-e.Delta.Y * 50
what is the 50?
does that mean its 50 pixels * number of scrolls?
danwalmsley
@danwalmsley
Mar 16 2016 22:29
@grokys it works!!! PR coming soon as
Steven Kirk
@grokys
Mar 16 2016 22:31
yeah, i think 50 was the value used by wpf or something
danwalmsley
@danwalmsley
Mar 16 2016 22:31
have a quick look at #474
I used the type size, since I guess you can scroll horizontally somehow too?
this PR only implements it for vertical scrolling
via mouse wheel
PRs are mounting up, soon you will be just managing PRs ;)
Steven Kirk
@grokys
Mar 16 2016 22:40
yeah, i need to get on the PRs, sorry these last few days have been a bit hectic and need some evenings away from programming...
danwalmsley
@danwalmsley
Mar 16 2016 22:40
benchmark tests failed on my PR
does that run any unit tests?
Steven Kirk
@grokys
Mar 16 2016 22:41
no
danwalmsley
@danwalmsley
Mar 16 2016 22:41
238  Perspex.Benchmarks -> C:\projects\perspex\tests\Perspex.Benchmarks\bin\Release\Perspex.Benchmarks.exe
 239Command exited with code 1
 240Unregistering Xamarin license...
how do you get a build to retry?
Steven Kirk
@grokys
Mar 16 2016 22:42
'ScrollContentPresenterTests_IScrollable.TestScrollable' does not implement interface member 'IScrollable.ScrollSize'
is the error
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 22:46
@danwalmsley I am now working on some fixes and hope they will help. When I commit them to my branch I will let you know so that you could do at least sanity tests
danwalmsley
@danwalmsley
Mar 16 2016 22:46
ok cheers i'll be happy to help
do you know why the first time MeasureOverride is called
it says size available is infinity?
Darnell Williams
@Seeker1437
Mar 16 2016 22:47
@grokys I get it too, I have a mouse that can turn the stepping on and off (aka the wheel can spin freely at high speed or click like youd be used to)
In the measure step, if WPF sends you infinity, you are supposed to tell it how big you want to be.
danwalmsley
@danwalmsley
Mar 16 2016 22:49
ah ok
so if I just send infinity back then that as bug in my code
ok
if you just want to use the full size of the container you are in, would you return bounds.height?
Steven Kirk
@grokys
Mar 16 2016 22:51
bounds.height won't be set at that point
what you return depends on the control
if it's your text editor, you should return the size of the text
danwalmsley
@danwalmsley
Mar 16 2016 22:52
for example my text editor
when it has no text in it
Steven Kirk
@grokys
Mar 16 2016 22:52
then you should return 0
danwalmsley
@danwalmsley
Mar 16 2016 22:52
its size is just to fill the screen
Steven Kirk
@grokys
Mar 16 2016 22:52
read a WPF guide on this stuff, it will explain better than I can
there's loads of info out there
danwalmsley
@danwalmsley
Mar 16 2016 22:53
ok :D
@grokys fancy a quick merge of #474 now it passes?
Steven Kirk
@grokys
Mar 16 2016 22:55
sorry, i'm not at my computer right now, i'm at my girlfriend's
so i can't try it
danwalmsley
@danwalmsley
Mar 16 2016 22:55
ok no problem :D
Steven Kirk
@grokys
Mar 16 2016 22:56
looks good though
danwalmsley
@danwalmsley
Mar 16 2016 22:56
seems to be a pretty obvious and simple solution
I cant understand why wpf is so complicated
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 22:57
because was developed by hindoo
and they love to write a lot of code
Steven Kirk
@grokys
Mar 16 2016 22:58
i'm not sure if that's a race reference or not, but if so i'd prefer it to be kept out of the perspex room
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 23:03
@grokys :+1:
Steven Kirk
@grokys
Mar 16 2016 23:04
but anyway, yeah, the complexity in wpf is a little baffling at times
but you have to remember that a lot of it was written when C# was very new
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 23:04
yeah
I found that Grid was written at 2004
but anyway, they could rewrite it later, but didnt do that
danwalmsley
@danwalmsley
Mar 16 2016 23:06
does the new UWP use alot of WPF stuff perhaps they re-wrote it for that?
its all xaml and surely based off WPF?
Steven Kirk
@grokys
Mar 16 2016 23:06
no idea... the code isn't open
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 23:07
I suspect that UWp is based on D2D and WPF was based on old managed DX9
Steven Kirk
@grokys
Mar 16 2016 23:07
i think uwp evolved from silverlight
Denis Zaporozhets
@QuantumDeveloper
Mar 16 2016 23:07
and I think that they rewrite a lot of controls, maybe even all
Steven Kirk
@grokys
Mar 16 2016 23:09
probably yeah