aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Blake <oak99sky@yahoo.co.uk>2020-07-15 12:33:50 +0100
committerGitHub <noreply@github.com>2020-07-15 12:33:50 +0100
commitff4b2c0f7900da1e94db96343f65bbd0d480f6e2 (patch)
tree60b24ad9c75321e23f039b10553e0aabee64e235
parent808f1292aa46065ae3bd0ca52e3bc5747e2c81f0 (diff)
parentcb8b7f9b4fa0437ad184b5170f065333e44c5b51 (diff)
Merge pull request #18073 from dagwieers/fixactivate
Fix ActivateWindow if 'return' is defined (Leia backport)
-rw-r--r--xbmc/interfaces/builtins/GUIBuiltins.cpp12
-rw-r--r--xbmc/windows/GUIMediaWindow.cpp16
2 files changed, 20 insertions, 8 deletions
diff --git a/xbmc/interfaces/builtins/GUIBuiltins.cpp b/xbmc/interfaces/builtins/GUIBuiltins.cpp
index 15ce8291b3..f3818a3553 100644
--- a/xbmc/interfaces/builtins/GUIBuiltins.cpp
+++ b/xbmc/interfaces/builtins/GUIBuiltins.cpp
@@ -419,21 +419,23 @@ static int ToggleDirty(const std::vector<std::string>&)
/// @param[in] loop Send "loop" to loop the alarm.
/// }
/// \table_row2_l{
-/// <b>`ActivateWindow(window[\,dir])`</b>
+/// <b>`ActivateWindow(window[\,dir\, return])`</b>
/// ,
/// Opens the given window. The parameter window can either be the window's id\,
-/// or in the case of a standard window\, the window's name. See here for a list
-/// of window names\, and their respective ids. If\, furthermore\, the window is
+/// or in the case of a standard window\, the window's name. See \ref window_ids "here" for a list
+/// of window names\, and their respective ids.
+/// If\, furthermore\, the window is
/// Music\, Video\, Pictures\, or Program files\, then the optional dir parameter
/// specifies which folder Kodi should default to once the window is opened.
/// This must be a source as specified in sources.xml\, or a subfolder of a
-/// valid source. For some windows (MusicLibrary and VideoLibrary)\, the return
-/// parameter may be specified\, which indicates that Kodi should use this
+/// valid source. For some windows (MusicLibrary and VideoLibrary)\, a third
+/// parameter (return) may be specified\, which indicates that Kodi should use this
/// folder as the "root" of the level\, and thus the "parent directory" action
/// from within this folder will return the user to where they were prior to
/// the window activating.
/// @param[in] window The window name.
/// @param[in] dir Window starting folder (optional).
+/// @param[in] return if dir should be used as the rootfolder of the level
/// }
/// \table_row2_l{
/// <b>`ActivateWindowAndFocus(id1\, id2\,item1\, id3\,item2)`</b>
diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp
index f6cfc8206b..b3a4f0009c 100644
--- a/xbmc/windows/GUIMediaWindow.cpp
+++ b/xbmc/windows/GUIMediaWindow.cpp
@@ -554,12 +554,22 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message)
if (resetHistory)
{
m_vecItems->RemoveDiscCache(GetID());
- SetHistoryForPath(m_vecItems->GetPath());
+ // only compute the history for the provided path if "return" is not defined
+ // (otherwise the root level for the path will be added by default to the path history
+ // and we won't be able to move back to the path we came from)
+ if (!returning)
+ SetHistoryForPath(m_vecItems->GetPath());
}
}
if (message.GetParam1() != WINDOW_INVALID)
- { // first time to this window - make sure we set the root path
- m_startDirectory = returning ? dir : GetRootPath();
+ {
+ // if this is the first time to this window - make sure we set the root path
+ // if "return" is defined make sure we set the startDirectory to the directory we are
+ // moving to (so that we can move back to where we were onBack). If we are activating
+ // the same window but with a different path, do nothing - we are simply adding to the
+ // window history.
+ if (message.GetParam1() != message.GetParam2())
+ m_startDirectory = returning ? dir : GetRootPath();
}
if (message.GetParam2() == PLUGIN_REFRESH_DELAY)
{