linux: screen module can not be used in renderer.
This commit is contained in:
parent
e150a3e3b2
commit
83ff00dc29
3 changed files with 8 additions and 34 deletions
|
@ -7,34 +7,8 @@
|
||||||
|
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
|
|
||||||
#if defined(TOOLKIT_GTK)
|
|
||||||
#include "base/command_line.h"
|
|
||||||
#include "base/environment.h"
|
|
||||||
#include "base/nix/xdg_util.h"
|
|
||||||
#include "ui/gfx/gtk_util.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace mate {
|
namespace mate {
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
gfx::Display AdaptToWindowManager(const gfx::Display& display) {
|
|
||||||
gfx::Display changed(display);
|
|
||||||
#if defined(TOOLKIT_GTK)
|
|
||||||
scoped_ptr<base::Environment> env(base::Environment::Create());
|
|
||||||
base::nix::DesktopEnvironment de(base::nix::GetDesktopEnvironment(env.get()));
|
|
||||||
if (de == base::nix::DESKTOP_ENVIRONMENT_UNITY) {
|
|
||||||
// Unity's 24px global menu bar should not be included in the work area.
|
|
||||||
gfx::Rect rect(changed.work_area());
|
|
||||||
rect.set_height(rect.height() - 24);
|
|
||||||
changed.set_work_area(rect);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct Converter<gfx::Point> {
|
struct Converter<gfx::Point> {
|
||||||
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
|
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
|
||||||
|
@ -70,8 +44,7 @@ struct Converter<gfx::Rect> {
|
||||||
template<>
|
template<>
|
||||||
struct Converter<gfx::Display> {
|
struct Converter<gfx::Display> {
|
||||||
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
|
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
|
||||||
const gfx::Display& val) {
|
const gfx::Display& display) {
|
||||||
gfx::Display display(AdaptToWindowManager(val));
|
|
||||||
return mate::ObjectTemplateBuilder(isolate)
|
return mate::ObjectTemplateBuilder(isolate)
|
||||||
.SetValue("bounds", display.bounds())
|
.SetValue("bounds", display.bounds())
|
||||||
.SetValue("workArea", display.work_area())
|
.SetValue("workArea", display.work_area())
|
||||||
|
@ -88,10 +61,6 @@ namespace {
|
||||||
|
|
||||||
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
|
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
|
||||||
v8::Handle<v8::Context> context, void* priv) {
|
v8::Handle<v8::Context> context, void* priv) {
|
||||||
#if defined(TOOLKIT_GTK)
|
|
||||||
gfx::GdkInitFromCommandLine(*CommandLine::ForCurrentProcess());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gfx::Screen* screen = gfx::Screen::GetNativeScreen();
|
gfx::Screen* screen = gfx::Screen::GetNativeScreen();
|
||||||
mate::Dictionary dict(context->GetIsolate(), exports);
|
mate::Dictionary dict(context->GetIsolate(), exports);
|
||||||
dict.SetMethod("getCursorScreenPoint",
|
dict.SetMethod("getCursorScreenPoint",
|
||||||
|
|
|
@ -1 +1,6 @@
|
||||||
module.exports = process.atomBinding 'screen'
|
module.exports =
|
||||||
|
if process.platform is 'linux' and process.type is 'renderer'
|
||||||
|
# On Linux we could not access screen in renderer process.
|
||||||
|
require('remote').require 'screen'
|
||||||
|
else
|
||||||
|
process.atomBinding 'screen'
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit c1c4cfcaad43ca4a802e15328a39f574a97fa272
|
Subproject commit 7a4f3c45b7abb15256bae500c7980d54d4299471
|
Loading…
Add table
Add a link
Reference in a new issue