From 9492f007af301aba8f7f1f6a9dfce609f2842035 Mon Sep 17 00:00:00 2001 From: Bush2021 <79072750+Bush2021@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:09:04 -0400 Subject: [PATCH] fix: update GetTopContainerView to use `GetFocus()` Instead of passing `hwnd` from `WindowFromPoint()` as an argument, it now uses `GetFocus()` to retrieve `top_container_view`. This change was made to fix #98. --- src/tabbookmark.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tabbookmark.h b/src/tabbookmark.h index b6cd0c5..f9a0d49 100644 --- a/src/tabbookmark.h +++ b/src/tabbookmark.h @@ -203,7 +203,12 @@ bool HandleBookmark(WPARAM wParam, PMOUSEHOOKSTRUCT pmouse) { POINT pt = pmouse->pt; HWND hwnd = WindowFromPoint(pt); - NodePtr top_container_view = GetTopContainerView(hwnd); + NodePtr top_container_view = GetTopContainerView( + GetFocus()); // Must use `GetFocus()`, otherwise when opening bookmarks + // in a bookmark folder (and similar expanded menus), + // `top_container_view` cannot be obtained, making it + // impossible to correctly determine `is_on_new_tab`. See + // #98. bool is_on_bookmark = IsOnBookmark(hwnd, pt); bool is_on_new_tab = IsOnNewTab(top_container_view);