From: Vladislav Timonin timoninvlad@yandex.ru
To be able to Backspace multiple times.
On Windows, Back/Forward/Up/Refresh buttons don't take focus when clicked on, but we do, workaround this by sending Go Up command on Backspace ourselves. --- dlls/comdlg32/itemdlg.c | 12 ++++++++++++ dlls/comdlg32/navbar.c | 16 ++++++++++++++++ 2 files changed, 28 insertions(+)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index edf0b3f10aa..ab3555424b8 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -3376,7 +3376,19 @@ static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationComplete(IExplorerBro if (!hwnd) ERR("Failed to update navbar.\n"); else + { + IShellView *shellview; + HWND shellview_hwnd; + SendMessageW(hwnd, NBM_SETPIDL, 0, (LPARAM)pidlFolder); + + /* keep focus on the explorer browser to be able to Backspace multiple times */ + hr = IExplorerBrowser_GetCurrentView(This->peb, &IID_IShellView, (void**)&shellview); + if (SUCCEEDED(hr)) + hr = IShellView_GetWindow(shellview, &shellview_hwnd); + if (SUCCEEDED(hr)) + SetFocus(shellview_hwnd); + } }
events_OnFolderChange(This); diff --git a/dlls/comdlg32/navbar.c b/dlls/comdlg32/navbar.c index e5e952f36a4..60e90e0782a 100644 --- a/dlls/comdlg32/navbar.c +++ b/dlls/comdlg32/navbar.c @@ -40,6 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); #define IDC_OVERFLOW 205
#define BACKGROUND_SUBCLASS_ID 1 +#define BACKSPACE_SUBCLASS_ID 2
typedef struct { HWND parent_hwnd; @@ -184,6 +185,17 @@ static LRESULT NAVBAR_OVERFLOW_DrawIcon(HWND hwnd, NAVBAR_INFO *info, UINT msg, return DefWindowProcW(hwnd, msg, wparam, lparam); }
+static LRESULT CALLBACK NAVBAR_BackspaceProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, UINT_PTR id_subclass, DWORD_PTR ref_data) +{ + NAVBAR_INFO *info = (NAVBAR_INFO *)ref_data; + + if (msg == WM_KEYDOWN && wparam == VK_BACK) + /* match navigation direction with ShellView_OnNotify */ + SendMessageW(info->container_hwnd, WM_COMMAND, IDC_NAVUP, (LPARAM)hwnd); + + return DefSubclassProc(hwnd, msg, wparam, lparam); +} + static LRESULT CALLBACK NAVBAR_BACKGROUND_SubclassProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, UINT_PTR id_subclass, DWORD_PTR ref_data) { switch (msg) @@ -412,6 +424,7 @@ static LRESULT NAVBAR_Create(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) SendMessageW(info->back_btn_hwnd, WM_SETFONT, (WPARAM)gui_font, FALSE); set_icon(info->icons, ILI_BACK, info->back_btn_hwnd); set_title_and_add_tooltip(info, info->back_btn_hwnd, IDS_BACK); + SetWindowSubclass(info->back_btn_hwnd, NAVBAR_BackspaceProc, BACKSPACE_SUBCLASS_ID, (DWORD_PTR)info);
x += cs->cy + 1; info->fwd_btn_hwnd = CreateWindowExW(0, WC_BUTTONW, NULL, @@ -421,6 +434,7 @@ static LRESULT NAVBAR_Create(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) SendMessageW(info->fwd_btn_hwnd, WM_SETFONT, (WPARAM)gui_font, FALSE); set_icon(info->icons, ILI_FORWARD, info->fwd_btn_hwnd); set_title_and_add_tooltip(info, info->fwd_btn_hwnd, IDS_FORWARD); + SetWindowSubclass(info->fwd_btn_hwnd, NAVBAR_BackspaceProc, BACKSPACE_SUBCLASS_ID, (DWORD_PTR)info);
x += cs->cy + 1; info->up_btn_hwnd = CreateWindowExW(0, WC_BUTTONW, NULL, @@ -430,6 +444,7 @@ static LRESULT NAVBAR_Create(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) SendMessageW(info->up_btn_hwnd, WM_SETFONT, (WPARAM)gui_font, FALSE); set_icon(info->icons, ILI_UP, info->up_btn_hwnd); set_title_and_add_tooltip(info, info->up_btn_hwnd, IDS_UPFOLDER); + SetWindowSubclass(info->up_btn_hwnd, NAVBAR_BackspaceProc, BACKSPACE_SUBCLASS_ID, (DWORD_PTR)info);
x += cs->cy + 1; info->background_hwnd = CreateWindowExW(0, WC_STATICW, NULL, @@ -584,6 +599,7 @@ static LRESULT NAVBAR_SetPIDL(HWND hwnd, NAVBAR_INFO *info, UINT msg, WPARAM wpa SendMessageW(crumb1->hwnd, WM_SETFONT, (LPARAM)gui_font, FALSE); SendMessageW(crumb1->hwnd, BCM_GETIDEALSIZE, 0, (LPARAM)&full_size); SetWindowLongPtrW(crumb1->hwnd, GWLP_USERDATA, (LPARAM)crumb1->pidl); + SetWindowSubclass(crumb1->hwnd, NAVBAR_BackspaceProc, BACKSPACE_SUBCLASS_ID, (DWORD_PTR)info);
crumb1->full_w = full_size.cx + padding; crumb1->current_w = crumb1->full_w;