Implement "blur" window event.

This commit is contained in:
Cheng Zhao 2014-01-15 14:38:38 +00:00
parent 6912a0513a
commit 406f0b7bc7
2 changed files with 10 additions and 0 deletions

View file

@ -8,8 +8,10 @@
#include "common/options_switches.h" #include "common/options_switches.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.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/gtk_util.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
#include "ui/gfx/skia_utils_gtk.h"
namespace atom { namespace atom {
@ -44,6 +46,8 @@ NativeWindowGtk::NativeWindowGtk(content::WebContents* web_contents,
g_signal_connect(window_, "delete-event", g_signal_connect(window_, "delete-event",
G_CALLBACK(OnWindowDeleteEventThunk), this); G_CALLBACK(OnWindowDeleteEventThunk), this);
g_signal_connect(window_, "focus-out-event",
G_CALLBACK(OnFocusOutThunk), this);
SetWebKitColorStyle(); SetWebKitColorStyle();
} }
@ -271,6 +275,11 @@ gboolean NativeWindowGtk::OnWindowDeleteEvent(GtkWidget* widget,
return TRUE; return TRUE;
} }
gboolean NativeWindowGtk::OnFocusOut(GtkWidget* window, GdkEventFocus*) {
NotifyWindowBlur();
return FALSE;
}
// static // static
NativeWindow* NativeWindow::Create(content::WebContents* web_contents, NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
base::DictionaryValue* options) { base::DictionaryValue* options) {

View file

@ -65,6 +65,7 @@ class NativeWindowGtk : public NativeWindow {
CHROMEGTK_CALLBACK_1(NativeWindowGtk, gboolean, OnWindowDeleteEvent, CHROMEGTK_CALLBACK_1(NativeWindowGtk, gboolean, OnWindowDeleteEvent,
GdkEvent*); GdkEvent*);
CHROMEGTK_CALLBACK_1(NativeWindowGtk, gboolean, OnFocusOut, GdkEventFocus*);
GtkWindow* window_; GtkWindow* window_;