]> khamidou — GitHub mirrors - electron.git/commitdiff
Implement "blur" window event.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 15 Jan 2014 14:38:38 +0000 (14:38 +0000)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 15 Jan 2014 14:38:38 +0000 (14:38 +0000)
browser/native_window_gtk.cc
browser/native_window_gtk.h

index 9b73882023090ca35d01ac07bbece66cfe9e7820..f749e19d095e9ffa91bd30252e60bc9ad2220709 100644 (file)
@@ -8,8 +8,10 @@
 #include "common/options_switches.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_view.h"
+#include "content/public/common/renderer_preferences.h"
 #include "ui/gfx/gtk_util.h"
 #include "ui/gfx/rect.h"
+#include "ui/gfx/skia_utils_gtk.h"
 
 namespace atom {
 
@@ -44,6 +46,8 @@ NativeWindowGtk::NativeWindowGtk(content::WebContents* web_contents,
 
   g_signal_connect(window_, "delete-event",
                    G_CALLBACK(OnWindowDeleteEventThunk), this);
+  g_signal_connect(window_, "focus-out-event",
+                   G_CALLBACK(OnFocusOutThunk), this);
 
   SetWebKitColorStyle();
 }
@@ -271,6 +275,11 @@ gboolean NativeWindowGtk::OnWindowDeleteEvent(GtkWidget* widget,
   return TRUE;
 }
 
+gboolean NativeWindowGtk::OnFocusOut(GtkWidget* window, GdkEventFocus*) {
+  NotifyWindowBlur();
+  return FALSE;
+}
+
 // static
 NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
                                    base::DictionaryValue* options) {
index 553d13116a41fef37dbcd4fed3f4fd4ea60d3415..96ca18edd4e16845e4c3a2c7cc7a4f486280975e 100644 (file)
@@ -65,6 +65,7 @@ class NativeWindowGtk : public NativeWindow {
 
   CHROMEGTK_CALLBACK_1(NativeWindowGtk, gboolean, OnWindowDeleteEvent,
                        GdkEvent*);
+  CHROMEGTK_CALLBACK_1(NativeWindowGtk, gboolean, OnFocusOut, GdkEventFocus*);
 
   GtkWindow* window_;