5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-21 11:29:29 +08:00

Disable F5 key on windows

This commit is contained in:
Lea Anthony 2020-05-09 05:46:40 +10:00
parent cc99dcce80
commit f1d16a03ec

View File

@ -1467,7 +1467,6 @@ struct webview_priv
SetWindowText(w->priv.hwnd, w->title); SetWindowText(w->priv.hwnd, w->title);
#endif #endif
ShowWindow(w->priv.hwnd, SW_SHOWDEFAULT); ShowWindow(w->priv.hwnd, SW_SHOWDEFAULT);
UpdateWindow(w->priv.hwnd); UpdateWindow(w->priv.hwnd);
SetFocus(w->priv.hwnd); SetFocus(w->priv.hwnd);
@ -1494,6 +1493,11 @@ struct webview_priv
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_KEYUP: case WM_KEYUP:
{ {
// Disable refresh when pressing F5 on windows
if (msg.wParam == VK_F5)
{
break;
}
HRESULT r = S_OK; HRESULT r = S_OK;
IWebBrowser2 *webBrowser2; IWebBrowser2 *webBrowser2;
IOleObject *browser = *w->priv.browser; IOleObject *browser = *w->priv.browser;
@ -1616,7 +1620,6 @@ struct webview_priv
#endif #endif
} }
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen) WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen)
{ {
if (w->priv.is_fullscreen == !!fullscreen) if (w->priv.is_fullscreen == !!fullscreen)
@ -1928,21 +1931,24 @@ struct webview_priv
} }
static void webview_run_input_open_panel(id self, SEL cmd, id webview, static void webview_run_input_open_panel(id self, SEL cmd, id webview,
id listener, BOOL allowMultiple) { id listener, BOOL allowMultiple)
{
char filename[256] = ""; char filename[256] = "";
struct webview *w = struct webview *w =
(struct webview *)objc_getAssociatedObject(self, "webview"); (struct webview *)objc_getAssociatedObject(self, "webview");
webview_dialog(w, WEBVIEW_DIALOG_TYPE_OPEN, WEBVIEW_DIALOG_FLAG_FILE, "", "", webview_dialog(w, WEBVIEW_DIALOG_TYPE_OPEN, WEBVIEW_DIALOG_FLAG_FILE, "", "",
filename, 255); filename, 255);
if (strlen(filename)) { if (strlen(filename))
{
[listener chooseFilename:[NSString stringWithUTF8String:filename]]; [listener chooseFilename:[NSString stringWithUTF8String:filename]];
} else { }
else
{
[listener cancel]; [listener cancel];
} }
} }
static void webview_external_invoke(id self, SEL cmd, id arg) static void webview_external_invoke(id self, SEL cmd, id arg)
{ {
struct webview *w = struct webview *w =