Skip to content

Commit 9a0ff8b

Browse files
authored
[BROWSEUI] Fix backspace button behavior in win32 shell browser (reactos#7837)
Update backspace button functionality to align with standard modern Windows behavior in the win32 shell browser.
1 parent 1b564c1 commit 9a0ff8b

1 file changed

Lines changed: 33 additions & 7 deletions

File tree

dll/win32/browseui/shellbrowser.cpp

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,19 +3163,41 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::v_CheckZoneCrossing(LPCITEMIDLIST pidl)
31633163
HRESULT STDMETHODCALLTYPE CShellBrowser::GoBack()
31643164
{
31653165
CComPtr<ITravelLog> travelLog;
3166-
HRESULT hResult = GetTravelLog(&travelLog);
3166+
CComPtr<ITravelEntry> unusedEntry;
3167+
HRESULT hResult;
3168+
3169+
hResult = GetTravelLog(&travelLog);
31673170
if (FAILED_UNEXPECTEDLY(hResult))
31683171
return hResult;
3169-
return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
3172+
3173+
hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_BACK, &unusedEntry);
3174+
if (SUCCEEDED(hResult))
3175+
{
3176+
unusedEntry.Release();
3177+
return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_BACK);
3178+
}
3179+
3180+
return hResult;
31703181
}
31713182

31723183
HRESULT STDMETHODCALLTYPE CShellBrowser::GoForward()
31733184
{
31743185
CComPtr<ITravelLog> travelLog;
3175-
HRESULT hResult = GetTravelLog(&travelLog);
3186+
CComPtr<ITravelEntry> unusedEntry;
3187+
HRESULT hResult;
3188+
3189+
hResult = GetTravelLog(&travelLog);
31763190
if (FAILED_UNEXPECTEDLY(hResult))
31773191
return hResult;
3178-
return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
3192+
3193+
hResult = travelLog->GetTravelEntry(static_cast<IDropTarget *>(this), TLOG_FORE, &unusedEntry);
3194+
if (SUCCEEDED(hResult))
3195+
{
3196+
unusedEntry.Release();
3197+
return travelLog->Travel(static_cast<IDropTarget *>(this), TLOG_FORE);
3198+
}
3199+
3200+
return hResult;
31793201
}
31803202

31813203
HRESULT STDMETHODCALLTYPE CShellBrowser::GoHome()
@@ -3953,10 +3975,14 @@ LRESULT CShellBrowser::OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &
39533975

39543976
LRESULT CShellBrowser::OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
39553977
{
3956-
// FIXME: This does not appear to be what windows does.
3957-
HRESULT hResult = NavigateToParent();
3978+
HRESULT hResult;
3979+
if (LOBYTE(GetVersion()) < 6)
3980+
hResult = NavigateToParent();
3981+
else if (FAILED(hResult = GoBack()))
3982+
hResult = GoForward();
3983+
39583984
if (FAILED(hResult))
3959-
TRACE("NavigateToParent failed with hResult=%08lx\n", hResult);
3985+
TRACE("Backspace navigation failed with hResult=%08lx\n", hResult);
39603986
return 0;
39613987
}
39623988

0 commit comments

Comments
 (0)