From: Cheng Zhao Date: Wed, 14 Jan 2015 22:51:20 +0000 (-0800) Subject: Add some more attributes for Display X-Git-Tag: v0.20.7~10^2~7 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=551c39e2411ea09b3b98c9f9105b636a8eb22b0d;p=electron.git Add some more attributes for Display --- diff --git a/atom/common/native_mate_converters/gfx_converter.cc b/atom/common/native_mate_converters/gfx_converter.cc index 3d74bdb4..57e7bd88 100644 --- a/atom/common/native_mate_converters/gfx_converter.cc +++ b/atom/common/native_mate_converters/gfx_converter.cc @@ -78,6 +78,21 @@ bool Converter::FromV8(v8::Isolate* isolate, return true; } +template<> +struct Converter { + static v8::Handle ToV8(v8::Isolate* isolate, + const gfx::Display::TouchSupport& val) { + switch (val) { + case gfx::Display::TOUCH_SUPPORT_UNKNOWN: + return StringToV8(isolate, "unknown"); + case gfx::Display::TOUCH_SUPPORT_AVAILABLE: + return StringToV8(isolate, "available"); + case gfx::Display::TOUCH_SUPPORT_UNAVAILABLE: + return StringToV8(isolate, "unavailable"); + } + } +}; + v8::Handle Converter::ToV8(v8::Isolate* isolate, const gfx::Display& val) { mate::Dictionary dict(isolate, v8::Object::New(isolate)); @@ -87,6 +102,8 @@ v8::Handle Converter::ToV8(v8::Isolate* isolate, dict.Set("size", val.size()); dict.Set("workAreaSize", val.work_area_size()); dict.Set("scaleFactor", val.device_scale_factor()); + dict.Set("rotation", val.RotationAsDegree()); + dict.Set("touchSupport", val.touch_support()); return dict.GetHandle(); }