[Approved] Modified focus handling (1 Viewer)

Brownard

Development Group
  • Team MediaPortal
  • March 21, 2007
    1,946
    1,298
    United Kingdom United Kingdom
    Country flag
    • Thread starter
    • Moderator
    • #1
    Hi

    I've always felt like there was something not quite right with the focus handling in MP2, particularly how it chooses the purely closest element when there is another element that is more in line with the movement direction although further away. I've modified the handling slightly so that it takes this into account and it feels more intuitive to me (e.g pressing left on an item list takes you straight to the side menu rather than the navigation tree)

    There is one issue with my implementation (although I'd prefer to call it a bug with MP2 :)), when the side menu in Titanium is displayed the ActualBounds property of the menu elements doesn't take into account the menu's new location so it's difficult to re-enter focus on the menu after you've left it. Is this by design?

    What do you think?
     

    Attachments

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,390
    6,966
    Germany Germany
    Country flag
    Thanks for this patch! I will check the code later.

    Did you already test all focus movement test screens inside GUI-Test plugin? They have some special cases for transformations of controls.
     

    Brownard

    Development Group
  • Team MediaPortal
  • March 21, 2007
    1,946
    1,298
    United Kingdom United Kingdom
    Country flag
    • Thread starter
    • Moderator
    • #3
    Did you already test all focus movement test screens inside GUI-Test plugin? They have some special cases for transformations of controls.
    I hadn't, but I just did and looks like my patch could do with a bit of tweaking ;). I think it's definitely an improvement when using 'Focus movement test 1' in that pressing up/down on the middle column keeps focus within the column rather than jumping to the left.

    It falls down a bit on test 2 as it skips rows when moving up/down because I'm calculating alignment based on the centre of the controls - I will see if I can improve this.
     

    Brownard

    Development Group
  • Team MediaPortal
  • March 21, 2007
    1,946
    1,298
    United Kingdom United Kingdom
    Country flag
    • Thread starter
    • Moderator
    • #4
    I've updated the first post with a new patch and bin which now works well with the GUI Tests.

    Incidentally Focus movement test 1 highlights the issue I was mentioning earlier with translated controls, shouldn't the focus prediction be using the translated position rather than the original position?
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,390
    6,966
    Germany Germany
    Country flag
    shouldn't the focus prediction be using the translated position rather than the original position?
    IIRC we (Albert and me) tested to include RenderTransform into consideration. But this leads to some strange side effects. Also WPF doesn't do this, so we decide to roll changes back. But LayoutTransform is considered though.
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,390
    6,966
    Germany Germany
    Country flag
    I just have applied your patch and I think the results are good (y)!

    I will keep the changes in my local test builds and test them in deep. Thanks a lot! Let me know if there are more things to improve :)
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,390
    6,966
    Germany Germany
    Country flag
    I tested your changes a while. Unfortunately I found some situations where your version does not work well. See following screens (default skin) as example. Focus is inside content area and I hit "down" once. I expect to stay in list, but focus jumps to main menu.
    01_Expected.png
    02_Actual.png

    Another example is the SlimTv home screen: if you are on channel list and move "Up", focus moves to left side.

    Can you check those examples? At least the first should be good reproducable. For a public testbuild I'd revert the changes so long, I hope you understand this.
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,390
    6,966
    Germany Germany
    Country flag
    Sorry, I had another change in code which introduces this behaviour. It was not your change.

    At least it shows how sensible this part is. I'm now looking for another solution of my problem.
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,390
    6,966
    Germany Germany
    Country flag
    Maybe you can help with my issue?
    I have tried to draw the layout: the main ScrollViewer (1) contains 3 nested ScrollViewers.
    ScrollViewerFocus.png

    Now I focus an item of (3) and hit "Down".
    Screen (top element) gets "Down" key and tries every child control to handle this key.
    (1) skips, because of "Check focus in scope" (https://github.com/MediaPortal/Medi...ne/Controls/Visuals/ScrollViewer.cs#L507-L512)

    (2) is skipped (CheckFocusInScope false)
    (3) has the focus in scope, but can't handle "Down" (end of list)

    Now we have a problem: the parent ScrollViewer (1) is already done with handling this key, so it doesn't scroll down.

    In my test I removed the CheckFocusInScope which caused trouble as I described above.

    Any ideas how to handle this? Bubble key up again to let parent try to handle it?
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    framug 1.25.0 Modify native Irtrans buttons Remotes 10
    L [solved] Modifying programmed recording after setting it General 0
    M Collection was modified; enumeration operation may not execute General Support 0
    M Need advice on writing plugin that modifies EPG database TV-Server 2
    F MCE Remote has no focus General 6
    M [further infos missing] Stuttery UI behaviour when in focus, super fast outside focus. Submit: Bug Reports 14
    cbr954rr Mp loose focus after switching tv off General 1
    N [Finished] Focus problems - I think I've found the bug MediaPortal 2 30
    HTPCSourcer [Rejected] Mouse movements and focus: Windows standards MediaPortal 2 3
    stirlinghart [duplicate] Mp not focused on after resuming from sleep 2.2 Archive 7
    stirlinghart FOCUS not on MP after resuming from sleep General 11
    B [MP2-744] WMC home content focus improvements Archive 55
    C Can the XmlTv Plugin handle 600+ channels? General 3
    N [Approved] [MP2-198-200] Playlist handling patches Submit: Code Patches 4
    gpnash Ceton eth6 now handling 6 tuners Installation, configuration support 7
    C How well can MediaPortal handle 10,000+ recordings? MediaPortal 1 Talk 3
    Alberto83 [Finished] [MP2-752] Improve recording handling MediaPortal 2 34
    E [Pending] Handling Multifile Cue Submit: code patches (MediaPortal/TV-Server/etc.) 56
    H MP 2.2 - Rework thumbnail handling Archive 43
    Top Bottom