Skip to content

Commit b5f6126

Browse files
committed
WIP (41)
1 parent b5f3c8a commit b5f6126

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/WinWebDiffLib/WebWindow.hpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ class CWebWindow
135135
return m_parent->OnNavigationCompleted(sender, args);
136136
}).Get(), nullptr);
137137

138-
HRESULT hr = m_webview->CallDevToolsProtocolMethod(L"DOM.enable", L"{}", nullptr);
139138
m_webview->CallDevToolsProtocolMethod(L"Page.enable", L"{}", nullptr);
140139

141140
if (args && deferral)
@@ -658,7 +657,7 @@ class CWebWindow
658657
wchar_t buf[32];
659658
swprintf_s(buf, L"%0*d", n, i);
660659
std::wstring frameId = buf;
661-
SaveResourceTree(false, (std::filesystem::path(dirname) / (L"frameId" + frameId)), frame, callback);
660+
SaveResourceTree(false, (std::filesystem::path(dirname) / (L"Frame" + frameId)), frame, callback);
662661
++i;
663662
}
664663
}
@@ -1085,12 +1084,21 @@ class CWebWindow
10851084
args->get_KeyEventKind(&kind);
10861085
args->get_VirtualKey(&virtualKey);
10871086
args->get_KeyEventLParam(&lParam);
1088-
bool handled = false;
10891087
if (kind == COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN || kind == COREWEBVIEW2_KEY_EVENT_KIND_SYSTEM_KEY_DOWN)
10901088
{
1091-
short vkmenu = GetKeyState(VK_MENU);
1092-
short vkctrl = GetKeyState(VK_CONTROL);
1093-
if (vkmenu &&virtualKey == 'D')
1089+
bool handled = false;
1090+
short vkmenu = GetAsyncKeyState(VK_MENU);
1091+
short vkctrl = GetAsyncKeyState(VK_CONTROL);
1092+
if (virtualKey == VK_F6 ||
1093+
virtualKey == VK_ESCAPE ||
1094+
(vkctrl && virtualKey == 'O') ||
1095+
(vkctrl && virtualKey == 'J') ||
1096+
(vkctrl && virtualKey == 'W'))
1097+
{
1098+
PostMessage(m_hWnd, WM_KEYDOWN, virtualKey, lParam);
1099+
handled = true;
1100+
}
1101+
else if (vkmenu && virtualKey == 'D')
10941102
{
10951103
::SendMessage(m_hEdit, EM_SETSEL, 0, -1);
10961104
::SetFocus(m_hEdit);
@@ -1107,9 +1115,9 @@ class CWebWindow
11071115
::SetFocus(m_hEdit);
11081116
handled = true;
11091117
}
1118+
if (handled)
1119+
args->put_Handled(handled);
11101120
}
1111-
1112-
args->put_Handled(handled);
11131121
return S_OK;
11141122
}
11151123

@@ -1346,6 +1354,7 @@ class CWebWindow
13461354
int length = GetWindowTextLength(m_hEdit);
13471355
std::wstring url(length, 0);
13481356
GetWindowText(m_hEdit, const_cast<wchar_t*>(url.data()), length + 1);
1357+
SetFocus();
13491358
Navigate(url);
13501359
return 0;
13511360
}

0 commit comments

Comments
 (0)