vlc | branch: master | Prince Gupta <guptaprince8...@gmail.com> | Mon Feb 22 
23:12:11 2021 +0530| [d67fffcba9012c1c5c68f9079e5d873b7295f8da] | committer: 
Pierre Lamot

qml: fix focus in local menu group

Signed-off-by: Pierre Lamot <pie...@videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d67fffcba9012c1c5c68f9079e5d873b7295f8da
---

 modules/gui/qt/maininterface/qml/BannerSources.qml | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/maininterface/qml/BannerSources.qml 
b/modules/gui/qt/maininterface/qml/BannerSources.qml
index 6ac68049ff..92594f7271 100644
--- a/modules/gui/qt/maininterface/qml/BannerSources.qml
+++ b/modules/gui/qt/maininterface/qml/BannerSources.qml
@@ -176,12 +176,25 @@ Widgets.NavigableFocusScope {
                 }
             }
 
-            Item {
+            Widgets.NavigableFocusScope {
                 id: localToolbar
 
                 width: parent.width
                 height: VLCStyle.localToolbar_height
 
+                onActiveFocusChanged: {
+                    if (activeFocus) {
+                        // sometimes when view changes, one of the "focusable" 
object will become disabled
+                        // but because of focus chainning, FocusScope still 
tries to force active focus on the object
+                        // but that will fail, manually assign focus in such 
cases
+                        var focusable = [localContextGroup, localMenuGroup, 
playlistGroup]
+                        if (!focusable.some(function (obj) { return 
obj.activeFocus; })) {
+                            // no object has focus
+                            
localToolbar.nextItemInFocusChain(true).forceActiveFocus()
+                        }
+                    }
+                }
+
                 Rectangle {
                     id: localToolbarBg
                     color: VLCStyle.colors.bg
@@ -309,6 +322,7 @@ Widgets.NavigableFocusScope {
 
                         focus: !!item && item.focus && item.visible
                         visible: !!item
+                        enabled: status === Loader.Ready
                         y: (VLCStyle.localToolbar_height - item.height) / 2
                         width: !!item
                                ? clamp(localMenuView.availableWidth

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to