From c26a9b23a765ca45db472cad7ab150f7d0f5736f Mon Sep 17 00:00:00 2001 From: Cheng Zhao <zcbenz@gmail.com> Date: Fri, 21 Feb 2014 15:50:35 +0800 Subject: [PATCH] gtk: Should init gdk when using screen module. --- common/api/atom_api_screen.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/api/atom_api_screen.cc b/common/api/atom_api_screen.cc index 85e1ff2a95f..8e7945003e3 100644 --- a/common/api/atom_api_screen.cc +++ b/common/api/atom_api_screen.cc @@ -9,6 +9,11 @@ #include "common/v8/node_common.h" +#if defined(TOOLKIT_GTK) +#include "base/command_line.h" +#include "ui/gfx/gtk_util.h" +#endif + #define UNWRAP_SCREEN_AND_CHECK \ Screen* self = ObjectWrap::Unwrap<Screen>(args.This()); \ if (self == NULL) \ @@ -67,6 +72,10 @@ void Screen::GetPrimaryDisplay( // static void Screen::Initialize(v8::Handle<v8::Object> target) { +#if defined(TOOLKIT_GTK) + gfx::GdkInitFromCommandLine(*CommandLine::ForCurrentProcess()); +#endif + v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(New); t->InstanceTemplate()->SetInternalFieldCount(1); t->SetClassName(v8::String::NewSymbol("Screen"));