From 580b8bd83c1dfd9c7c68ccebfcdc72aa5aba00ec Mon Sep 17 00:00:00 2001 From: Per Lundberg Date: Tue, 30 Jul 2013 23:05:31 +0300 Subject: [PATCH] Fixed a bug which has been bothering me a bit in the CEF1-based branch: Alt-F4 shouldn't be marked as Handled, since that makes it impossible to shut down the app by pressing Alt-F4... --- CefSharp.Wpf/WebView.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CefSharp.Wpf/WebView.cs b/CefSharp.Wpf/WebView.cs index 8c6752df7..706930f99 100644 --- a/CefSharp.Wpf/WebView.cs +++ b/CefSharp.Wpf/WebView.cs @@ -272,6 +272,14 @@ namespace CefSharp.Wpf break; } + if (message == (int) WM.SYSKEYDOWN && + wParam.ToInt32() == KeyInterop.VirtualKeyFromKey(Key.F4)) + { + // We don't want CEF to receive this event (and mark it as handled), since that makes it impossible to + // shut down a CefSharp-based app by pressing Alt-F4, which is kind of bad. + return IntPtr.Zero; + } + if (cefBrowserWrapper.SendKeyEvent(message, wParam.ToInt32())) { handled = true;