Initial work for Aura on Linux.
This commit is contained in:
parent
949821f255
commit
84878c4c77
9 changed files with 287 additions and 9 deletions
6
atom.gyp
6
atom.gyp
|
@ -101,8 +101,10 @@
|
||||||
'atom/browser/mac/atom_application_delegate.mm',
|
'atom/browser/mac/atom_application_delegate.mm',
|
||||||
'atom/browser/native_window.cc',
|
'atom/browser/native_window.cc',
|
||||||
'atom/browser/native_window.h',
|
'atom/browser/native_window.h',
|
||||||
'atom/browser/native_window_gtk.cc',
|
'atom/browser/native_window_aura.cc',
|
||||||
'atom/browser/native_window_gtk.h',
|
'atom/browser/native_window_aura.h',
|
||||||
|
# 'atom/browser/native_window_gtk.cc',
|
||||||
|
# 'atom/browser/native_window_gtk.h',
|
||||||
'atom/browser/native_window_mac.h',
|
'atom/browser/native_window_mac.h',
|
||||||
'atom/browser/native_window_mac.mm',
|
'atom/browser/native_window_mac.mm',
|
||||||
'atom/browser/native_window_win.cc',
|
'atom/browser/native_window_win.cc',
|
||||||
|
|
|
@ -87,7 +87,7 @@ class Menu : public mate::Wrappable,
|
||||||
virtual void UpdateStates() = 0;
|
virtual void UpdateStates() = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WIN) || defined(TOOLKIT_GTK)
|
#if defined(OS_WIN) || defined(OS_LINUX)
|
||||||
virtual void AttachToWindow(Window* window) = 0;
|
virtual void AttachToWindow(Window* window) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ MenuGtk::MenuGtk() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuGtk::Popup(Window* window) {
|
void MenuGtk::Popup(Window* window) {
|
||||||
|
/*
|
||||||
uint32_t triggering_event_time;
|
uint32_t triggering_event_time;
|
||||||
gfx::Point point;
|
gfx::Point point;
|
||||||
|
|
||||||
|
@ -35,10 +36,11 @@ void MenuGtk::Popup(Window* window) {
|
||||||
|
|
||||||
menu_gtk_.reset(new ::MenuGtk(this, model_.get()));
|
menu_gtk_.reset(new ::MenuGtk(this, model_.get()));
|
||||||
menu_gtk_->PopupAsContext(point, triggering_event_time);
|
menu_gtk_->PopupAsContext(point, triggering_event_time);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuGtk::AttachToWindow(Window* window) {
|
void MenuGtk::AttachToWindow(Window* window) {
|
||||||
static_cast<NativeWindowGtk*>(window->window())->SetMenu(model_.get());
|
// static_cast<NativeWindowGtk*>(window->window())->SetMenu(model_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
202
atom/browser/native_window_aura.cc
Normal file
202
atom/browser/native_window_aura.cc
Normal file
|
@ -0,0 +1,202 @@
|
||||||
|
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/browser/native_window_aura.h"
|
||||||
|
|
||||||
|
#include "content/public/browser/web_contents_view.h"
|
||||||
|
#include "ui/aura/env.h"
|
||||||
|
#include "ui/aura/layout_manager.h"
|
||||||
|
#include "ui/aura/window.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class FillLayout : public aura::LayoutManager {
|
||||||
|
public:
|
||||||
|
explicit FillLayout(aura::Window* root)
|
||||||
|
: root_(root) {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~FillLayout() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// aura::LayoutManager:
|
||||||
|
virtual void OnWindowResized() OVERRIDE {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE {
|
||||||
|
child->SetBounds(root_->bounds());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void OnChildWindowVisibilityChanged(aura::Window* child,
|
||||||
|
bool visible) OVERRIDE {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void SetChildBounds(aura::Window* child,
|
||||||
|
const gfx::Rect& requested_bounds) OVERRIDE {
|
||||||
|
SetChildBoundsDirect(child, requested_bounds);
|
||||||
|
}
|
||||||
|
|
||||||
|
aura::Window* root_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(FillLayout);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
NativeWindowAura::NativeWindowAura(content::WebContents* web_contents,
|
||||||
|
const mate::Dictionary& options)
|
||||||
|
: NativeWindow(web_contents, options) {
|
||||||
|
aura::Env::CreateInstance();
|
||||||
|
|
||||||
|
host_.reset(aura::WindowTreeHost::Create(gfx::Rect(gfx::Size(800, 600))));
|
||||||
|
host_->InitHost();
|
||||||
|
host_->window()->SetLayoutManager(new FillLayout(host_->window()));
|
||||||
|
host_->window()->AddChild(web_contents->GetView()->GetNativeView());
|
||||||
|
}
|
||||||
|
|
||||||
|
NativeWindowAura::~NativeWindowAura() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Close() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::CloseImmediately() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Move(const gfx::Rect& pos) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Focus(bool focus) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NativeWindowAura::IsFocused() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Show() {
|
||||||
|
host_->Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Hide() {
|
||||||
|
host_->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NativeWindowAura::IsVisible() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Maximize() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Unmaximize() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Minimize() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Restore() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetFullscreen(bool fullscreen) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NativeWindowAura::IsFullscreen() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetSize(const gfx::Size& size) {
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::Size NativeWindowAura::GetSize() {
|
||||||
|
return gfx::Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetContentSize(const gfx::Size& size) {
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::Size NativeWindowAura::GetContentSize() {
|
||||||
|
return gfx::Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetMinimumSize(const gfx::Size& size) {
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::Size NativeWindowAura::GetMinimumSize() {
|
||||||
|
return gfx::Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetMaximumSize(const gfx::Size& size) {
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::Size NativeWindowAura::GetMaximumSize() {
|
||||||
|
return gfx::Size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetResizable(bool resizable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NativeWindowAura::IsResizable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetAlwaysOnTop(bool top) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NativeWindowAura::IsAlwaysOnTop() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::Center() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetPosition(const gfx::Point& position) {
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::Point NativeWindowAura::GetPosition() {
|
||||||
|
return gfx::Point(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetTitle(const std::string& title) {
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string NativeWindowAura::GetTitle() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::FlashFrame(bool flash) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetSkipTaskbar(bool skip) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::SetKiosk(bool kiosk) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NativeWindowAura::IsKiosk() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::NativeWindow NativeWindowAura::GetNativeWindow() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowAura::UpdateDraggableRegions(
|
||||||
|
const std::vector<DraggableRegion>& regions) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
|
||||||
|
const mate::Dictionary& options) {
|
||||||
|
return new NativeWindowAura(web_contents, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace atom
|
70
atom/browser/native_window_aura.h
Normal file
70
atom/browser/native_window_aura.h
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef ATOM_BROWSER_NATIVE_WINDOW_AURA_H_
|
||||||
|
#define ATOM_BROWSER_NATIVE_WINDOW_AURA_H_
|
||||||
|
|
||||||
|
#include "atom/browser/native_window.h"
|
||||||
|
|
||||||
|
#include "ui/aura/window_tree_host.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
class NativeWindowAura : public NativeWindow {
|
||||||
|
public:
|
||||||
|
explicit NativeWindowAura(content::WebContents* web_contents,
|
||||||
|
const mate::Dictionary& options);
|
||||||
|
virtual ~NativeWindowAura();
|
||||||
|
|
||||||
|
// NativeWindow:
|
||||||
|
virtual void Close() OVERRIDE;
|
||||||
|
virtual void CloseImmediately() OVERRIDE;
|
||||||
|
virtual void Move(const gfx::Rect& pos) OVERRIDE;
|
||||||
|
virtual void Focus(bool focus) OVERRIDE;
|
||||||
|
virtual bool IsFocused() OVERRIDE;
|
||||||
|
virtual void Show() OVERRIDE;
|
||||||
|
virtual void Hide() OVERRIDE;
|
||||||
|
virtual bool IsVisible() OVERRIDE;
|
||||||
|
virtual void Maximize() OVERRIDE;
|
||||||
|
virtual void Unmaximize() OVERRIDE;
|
||||||
|
virtual void Minimize() OVERRIDE;
|
||||||
|
virtual void Restore() OVERRIDE;
|
||||||
|
virtual void SetFullscreen(bool fullscreen) OVERRIDE;
|
||||||
|
virtual bool IsFullscreen() OVERRIDE;
|
||||||
|
virtual void SetSize(const gfx::Size& size) OVERRIDE;
|
||||||
|
virtual gfx::Size GetSize() OVERRIDE;
|
||||||
|
virtual void SetContentSize(const gfx::Size& size) OVERRIDE;
|
||||||
|
virtual gfx::Size GetContentSize() OVERRIDE;
|
||||||
|
virtual void SetMinimumSize(const gfx::Size& size) OVERRIDE;
|
||||||
|
virtual gfx::Size GetMinimumSize() OVERRIDE;
|
||||||
|
virtual void SetMaximumSize(const gfx::Size& size) OVERRIDE;
|
||||||
|
virtual gfx::Size GetMaximumSize() OVERRIDE;
|
||||||
|
virtual void SetResizable(bool resizable) OVERRIDE;
|
||||||
|
virtual bool IsResizable() OVERRIDE;
|
||||||
|
virtual void SetAlwaysOnTop(bool top) OVERRIDE;
|
||||||
|
virtual bool IsAlwaysOnTop() OVERRIDE;
|
||||||
|
virtual void Center() OVERRIDE;
|
||||||
|
virtual void SetPosition(const gfx::Point& position) OVERRIDE;
|
||||||
|
virtual gfx::Point GetPosition() OVERRIDE;
|
||||||
|
virtual void SetTitle(const std::string& title) OVERRIDE;
|
||||||
|
virtual std::string GetTitle() OVERRIDE;
|
||||||
|
virtual void FlashFrame(bool flash) OVERRIDE;
|
||||||
|
virtual void SetSkipTaskbar(bool skip) OVERRIDE;
|
||||||
|
virtual void SetKiosk(bool kiosk) OVERRIDE;
|
||||||
|
virtual bool IsKiosk() OVERRIDE;
|
||||||
|
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// NativeWindow:
|
||||||
|
virtual void UpdateDraggableRegions(
|
||||||
|
const std::vector<DraggableRegion>& regions) OVERRIDE;
|
||||||
|
|
||||||
|
scoped_ptr<aura::WindowTreeHost> host_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(NativeWindowAura);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace atom
|
||||||
|
|
||||||
|
#endif // ATOM_BROWSER_NATR_NATIVE_WINDOW_AURA_H_
|
|
@ -27,7 +27,8 @@ class FileChooserDialog {
|
||||||
else if (action == GTK_FILE_CHOOSER_ACTION_OPEN)
|
else if (action == GTK_FILE_CHOOSER_ACTION_OPEN)
|
||||||
confirm_text = GTK_STOCK_OPEN;
|
confirm_text = GTK_STOCK_OPEN;
|
||||||
|
|
||||||
GtkWindow* window = parent_window ? parent_window->GetNativeWindow() : NULL;
|
// GtkWindow* window = parent_window ? parent_window->GetNativeWindow() : NULL;
|
||||||
|
GtkWindow* window = NULL;
|
||||||
dialog_ = gtk_file_chooser_dialog_new(
|
dialog_ = gtk_file_chooser_dialog_new(
|
||||||
title.c_str(),
|
title.c_str(),
|
||||||
window,
|
window,
|
||||||
|
|
|
@ -24,7 +24,8 @@ class MessageBox {
|
||||||
const std::string& detail)
|
const std::string& detail)
|
||||||
: cancel_id_(0),
|
: cancel_id_(0),
|
||||||
dialog_scope_(new NativeWindow::DialogScope(parent_window)) {
|
dialog_scope_(new NativeWindow::DialogScope(parent_window)) {
|
||||||
GtkWindow* window = parent_window ? parent_window->GetNativeWindow() : NULL;
|
// GtkWindow* window = parent_window ? parent_window->GetNativeWindow() : NULL;
|
||||||
|
GtkWindow* window = NULL;
|
||||||
dialog_ = gtk_dialog_new_with_buttons(
|
dialog_ = gtk_dialog_new_with_buttons(
|
||||||
title.c_str(),
|
title.c_str(),
|
||||||
window,
|
window,
|
||||||
|
|
|
@ -62,8 +62,8 @@
|
||||||
['exclude', '(^|/)x/'],
|
['exclude', '(^|/)x/'],
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
['OS!="win"', {
|
['OS!="linux"', {
|
||||||
'sources/': [ ['exclude', '_views\\.(h|cc)$'] ]
|
'sources/': [ ['exclude', '_aura\\.(h|cc)$'] ]
|
||||||
}],
|
}],
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 1e41ef63ebd7ecb1ffb3a6fec74b5a5264f20092
|
Subproject commit a348865e723b73cd01d0b976f2d0b8d9b836176d
|
Loading…
Add table
Add a link
Reference in a new issue