gtk: Should init gdk when using screen module.

This commit is contained in:
Cheng Zhao 2014-02-21 15:50:35 +08:00
parent 6c36f7e5c9
commit c26a9b23a7

View file

@ -9,6 +9,11 @@
#include "common/v8/node_common.h" #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 \ #define UNWRAP_SCREEN_AND_CHECK \
Screen* self = ObjectWrap::Unwrap<Screen>(args.This()); \ Screen* self = ObjectWrap::Unwrap<Screen>(args.This()); \
if (self == NULL) \ if (self == NULL) \
@ -67,6 +72,10 @@ void Screen::GetPrimaryDisplay(
// static // static
void Screen::Initialize(v8::Handle<v8::Object> target) { 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); v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(New);
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(v8::String::NewSymbol("Screen")); t->SetClassName(v8::String::NewSymbol("Screen"));