Kodi Community Forum
Issues with Custom RTL Layout support in FixedList (Not Text Alignment) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Issues with Custom RTL Layout support in FixedList (Not Text Alignment) (/showthread.php?tid=379247)



Issues with Custom RTL Layout support in FixedList (Not Text Alignment) - Visually - 2024-10-24

Hi all,

I've been working on adding support for RTL (Right-to-Left) layout to Kodi's UI, specifically for a `FixedList` view where the entire layout is mirrored, and items are displayed from right to left (HORIZONTAL_RTL), not just RTL text alignment which is already supported. I've successfully managed to reverse the item order, but I'm encountering several issues that I need help with.

You can see the changes I made as well as pictures here in the link
https://github.com/DevGeniusCode/xbmc-RTL/compare/Omega...DevGeniusCode:xbmc-RTL:Omega-RTL?diff=split&w=

### Issue 1: Mouse Focus Misalignment  
When selecting an item with the mouse, the selection doesn't correspond to the item I'm hovering over. Instead, it seems to select the item that would be in that position if it were still in the original (HORIZONTAL) layout. In other words, the mouse is still behaving as if the list were left-to-right, while visually, it's now right-to-left.

### Issue 2: List Scrolling Behavior with Keyboard/Remote  
In the original (HORIZONTAL) mode, when I move right (with the keyboard or remote), the entire list scrolls to the left to keep the focused item visible, and the leftmost item disappears off the screen.  
Now that the list is reversed (right to left), the items scroll in the opposite direction (i.e., to the right when moving left), which is expected. However, the problem is that the leftmost item continues to disappear instead of the rightmost item, which should now disappear when scrolling leftwards.

### Issue 3: Focused Item Visibility  
In the original (HORIZONTAL) mode, the item in focus is always visible on the screen. But in the new right-to-left layout, the focused item sometimes goes off the screen. It seems like this is related to the second issue, as if the rightmost item (which should be in focus) is positioned beyond the visible boundaries of the list. This feels like a boundary or layout issue where the list block isn't adjusting correctly to the RTL layout.

Could someone please provide some guidance on how to address these issues? Specifically:
- How can I fix the mouse focus behavior so it aligns correctly with the new RTL item layout?
- How can I adjust the scrolling behavior so that the rightmost item disappears when moving leftwards (instead of the leftmost)?
- What could be causing the focused item to move off the screen in the RTL layout?

Any insights or pointers would be greatly appreciated!

Thanks in advance for your help.


RE: Issues with Custom RTL Layout support in FixedList (Not Text Alignment) - scott967 - 2024-10-25

No guidance, but I've thought about how to properly provide an RTL UI based on an existing skin, but couldn't see any way except essentially re-writing every window.  Not surprised if list-style containers are broken.  From what you've seen are panels better?  The change from posx/posy to left/top was intended to make positioning more robust, but there's no way to just declare positions origin from right edge, not left.

scott s.
.


RE: Issues with Custom RTL Layout support in FixedList (Not Text Alignment) - Visually - 2024-10-25

Thank you, Scott.

Yes, I am indeed working on adding RTL support directly within Kodi's core engine, not just through skin modifications. I’ve managed to implement RTL functionality for `Panel` containers by making changes to the file `xbmc/guilib/GUIPanelContainer.cpp`, which inherits from `xbmc/guilib/GUIBaseContainer.cpp`, the file responsible for the base structure of all containers.

The main issue I'm facing right now is with the `FixedList` container (`xbmc/guilib/GUIFixedListContainer.cpp`). This particular container is presenting the challenges I described earlier, especially with maintaining correct focus and scrolling behaviors in RTL mode.

I’d appreciate any insights you might have and invite you to review the list of changes I’ve made so far, which you can find in the link here on GitHub.

Thanks again for your guidance!


RE: Issues with Custom RTL Layout support in FixedList (Not Text Alignment) - Visually - 2024-10-26

I’m pleased to share that I’ve successfully resolved both the list scrolling behavior and the focused item visibility! However, I'm still facing the first issue.

Remaining Issue: Mouse Focus Misalignment
When selecting an item with the mouse, the selection doesn't correspond to the item I'm hovering over. It seems to select the item that would be in that position if it were still in the original (HORIZONTAL) layout.

I would greatly appreciate any guidance on how to address this remaining issue:

How can I fix the mouse focus behavior so it aligns correctly with the new RTL item layout?
Thanks in advance for your help!