summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorhoro@chromium.org <horo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-09 07:24:51 +0000
committerhoro@chromium.org <horo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-09 07:24:51 +0000
commit6eba8c43ea2698284690ec96e0708228548b2be5 (patch)
tree3ce534c20eff0e2306784e48845a484dfd92fed3 /mojo
parentd56a1d82f4113e12795a08cea2d0a086ba63f63f (diff)
downloadchromium_src-6eba8c43ea2698284690ec96e0708228548b2be5.zip
chromium_src-6eba8c43ea2698284690ec96e0708228548b2be5.tar.gz
chromium_src-6eba8c43ea2698284690ec96e0708228548b2be5.tar.bz2
Revert of Connect X11 ConfigureNotify events to Mojo (https://codereview.chromium.org/354933002/)
Reason for revert: http://build.chromium.org/p/chromium.win/builders/Win%207%20Tests%20x64%20%283%29/builds/14776/steps/mojo_view_manager_unittests/logs/SetNodeBounds [ FAILED ] ViewManagerTest.SetNodeBounds (109 ms) Original issue's description: > Connect X11 ConfigureNotify events to Mojo > > This change plumbs top level window resize notifications from X11 through to the WindowManager and to the GLSurface associated with the top level window. It's an incremental step towards adding support for window manager level layout management (see crbug.com/389785). > > There's preliminary X11 Support for --start-fullscreen (don't try this) and --start-maximized command line arguments as well. This part of the patch could be broken out. > > > BUG=388524 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=281955 TBR=ben@chromium.org,sky@chromium.org,jamesr@chromium.org,hansmuller@chromium.org NOTREECHECKS=true NOTRY=true BUG=388524 Review URL: https://codereview.chromium.org/378243002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/examples/window_manager/window_manager.cc40
-rw-r--r--mojo/services/gles2/command_buffer_impl.cc17
-rw-r--r--mojo/services/gles2/command_buffer_impl.h7
-rw-r--r--mojo/services/native_viewport/native_viewport_x11.cc5
-rw-r--r--mojo/services/view_manager/node.cc1
-rw-r--r--mojo/services/view_manager/node_delegate.h8
-rw-r--r--mojo/services/view_manager/root_node_manager.cc6
-rw-r--r--mojo/services/view_manager/root_node_manager.h3
-rw-r--r--mojo/services/view_manager/view_manager_service_impl.cc6
-rw-r--r--mojo/services/view_manager/view_manager_service_impl.h3
-rw-r--r--mojo/services/view_manager/window_tree_host_impl.cc46
11 files changed, 9 insertions, 133 deletions
diff --git a/mojo/examples/window_manager/window_manager.cc b/mojo/examples/window_manager/window_manager.cc
index 5f1e843..2d3c694 100644
--- a/mojo/examples/window_manager/window_manager.cc
+++ b/mojo/examples/window_manager/window_manager.cc
@@ -13,7 +13,6 @@
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
#include "mojo/services/public/cpp/input_events/input_events_type_converters.h"
#include "mojo/services/public/cpp/view_manager/node.h"
-#include "mojo/services/public/cpp/view_manager/node_observer.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_event_dispatcher.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
@@ -157,36 +156,6 @@ class KeyboardManager : public KeyboardClient {
DISALLOW_COPY_AND_ASSIGN(KeyboardManager);
};
-class RootLayoutManager : public NodeObserver {
- public:
- explicit RootLayoutManager(ViewManager* view_manager,
- Node* root,
- Id content_node_id)
- : root_(root),
- view_manager_(view_manager),
- content_node_id_(content_node_id) {}
- virtual ~RootLayoutManager() {}
-
- private:
- // Overridden from NodeObserver:
- virtual void OnNodeBoundsChanged(Node* node,
- const gfx::Rect& /*old_bounds*/,
- const gfx::Rect& new_bounds) OVERRIDE {
- DCHECK_EQ(node, root_);
- Node* content_node = view_manager_->GetNodeById(content_node_id_);
- content_node->SetBounds(new_bounds);
- // Force the view's bitmap to be recreated
- content_node->active_view()->SetColor(SK_ColorBLUE);
- // TODO(hansmuller): Do Layout
- }
-
- Node* root_;
- ViewManager* view_manager_;
- Id content_node_id_;
-
- DISALLOW_COPY_AND_ASSIGN(RootLayoutManager);
-};
-
class WindowManager : public ApplicationDelegate,
public DebugPanel::Delegate,
public ViewObserver,
@@ -281,14 +250,10 @@ class WindowManager : public ApplicationDelegate,
view_manager_->SetEventDispatcher(this);
Node* node = Node::Create(view_manager);
- root->AddChild(node);
- node->SetBounds(gfx::Rect(root->bounds().size()));
+ view_manager->GetRoots().front()->AddChild(node);
+ node->SetBounds(gfx::Rect(800, 600));
content_node_id_ = node->id();
- root_layout_manager_.reset(
- new RootLayoutManager(view_manager, root, content_node_id_));
- root->AddObserver(root_layout_manager_.get());
-
View* view = View::Create(view_manager);
node->SetActiveView(view);
view->SetColor(SK_ColorBLUE);
@@ -430,7 +395,6 @@ class WindowManager : public ApplicationDelegate,
Node* launcher_ui_;
std::vector<Node*> windows_;
ViewManager* view_manager_;
- scoped_ptr<RootLayoutManager> root_layout_manager_;
// Id of the node most content is added to. The keyboard is NOT added here.
Id content_node_id_;
diff --git a/mojo/services/gles2/command_buffer_impl.cc b/mojo/services/gles2/command_buffer_impl.cc
index 438ff90..090b78c 100644
--- a/mojo/services/gles2/command_buffer_impl.cc
+++ b/mojo/services/gles2/command_buffer_impl.cc
@@ -73,17 +73,18 @@ void CommandBufferImpl::Initialize(
bool CommandBufferImpl::DoInitialize(
mojo::ScopedSharedBufferHandle shared_state) {
// TODO(piman): offscreen surface.
- surface_ = gfx::GLSurface::CreateViewGLSurface(widget_);
- if (!surface_.get())
+ scoped_refptr<gfx::GLSurface> surface =
+ gfx::GLSurface::CreateViewGLSurface(widget_);
+ if (!surface.get())
return false;
// TODO(piman): context sharing, virtual contexts, gpu preference.
scoped_refptr<gfx::GLContext> context = gfx::GLContext::CreateGLContext(
- NULL, surface_.get(), gfx::PreferIntegratedGpu);
+ NULL, surface.get(), gfx::PreferIntegratedGpu);
if (!context.get())
return false;
- if (!context->MakeCurrent(surface_.get()))
+ if (!context->MakeCurrent(surface.get()))
return false;
// TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but
@@ -105,14 +106,12 @@ bool CommandBufferImpl::DoInitialize(
scheduler_.reset(new gpu::GpuScheduler(
command_buffer_.get(), decoder_.get(), decoder_.get()));
decoder_->set_engine(scheduler_.get());
- decoder_->SetResizeCallback(
- base::Bind(&CommandBufferImpl::OnResize, base::Unretained(this)));
gpu::gles2::DisallowedFeatures disallowed_features;
// TODO(piman): attributes.
std::vector<int32> attrib_vector;
- if (!decoder_->Initialize(surface_,
+ if (!decoder_->Initialize(surface,
context,
false /* offscreen */,
size_,
@@ -195,9 +194,5 @@ void CommandBufferImpl::OnParseError() {
void CommandBufferImpl::DrawAnimationFrame() { client()->DrawAnimationFrame(); }
-void CommandBufferImpl::OnResize(gfx::Size size, float scale_factor) {
- surface_->Resize(size);
-}
-
} // namespace services
} // namespace mojo
diff --git a/mojo/services/gles2/command_buffer_impl.h b/mojo/services/gles2/command_buffer_impl.h
index f010388..5d1c7bd 100644
--- a/mojo/services/gles2/command_buffer_impl.h
+++ b/mojo/services/gles2/command_buffer_impl.h
@@ -21,10 +21,6 @@ class GLES2Decoder;
}
}
-namespace gfx {
-class GLSurface;
-}
-
namespace mojo {
namespace services {
@@ -53,8 +49,6 @@ class CommandBufferImpl : public InterfaceImpl<CommandBuffer> {
private:
bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state);
- void OnResize(gfx::Size size, float scale_factor);
-
void OnParseError();
void DrawAnimationFrame();
@@ -67,7 +61,6 @@ class CommandBufferImpl : public InterfaceImpl<CommandBuffer> {
scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
scoped_ptr<gpu::GpuScheduler> scheduler_;
scoped_ptr<gpu::GpuControlService> gpu_control_;
- scoped_refptr<gfx::GLSurface> surface_;
base::RepeatingTimer<CommandBufferImpl> timer_;
DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl);
diff --git a/mojo/services/native_viewport/native_viewport_x11.cc b/mojo/services/native_viewport/native_viewport_x11.cc
index 766f4d2..d47e16a 100644
--- a/mojo/services/native_viewport/native_viewport_x11.cc
+++ b/mojo/services/native_viewport/native_viewport_x11.cc
@@ -7,7 +7,6 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
@@ -134,7 +133,6 @@ class NativeViewportX11 : public NativeViewport,
case ButtonPress:
case ButtonRelease:
case MotionNotify:
- case ConfigureNotify:
return true;
case ClientMessage:
return event->xclient.message_type == atom_wm_protocols_;
@@ -161,9 +159,6 @@ class NativeViewportX11 : public NativeViewport,
ui::MouseEvent mouse_event(event);
delegate_->OnEvent(&mouse_event);
}
- } else if (event->type == ConfigureNotify) {
- bounds_ = gfx::Rect(event->xconfigure.width, event->xconfigure.height);
- delegate_->OnBoundsChanged(bounds_);
}
return ui::POST_DISPATCH_NONE;
}
diff --git a/mojo/services/view_manager/node.cc b/mojo/services/view_manager/node.cc
index 6351ac4..b231c5a 100644
--- a/mojo/services/view_manager/node.cc
+++ b/mojo/services/view_manager/node.cc
@@ -146,7 +146,6 @@ gfx::Size Node::GetMaximumSize() const {
void Node::OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
- delegate_->OnNodeBoundsChanged(this, old_bounds, new_bounds);
}
gfx::NativeCursor Node::GetCursor(const gfx::Point& point) {
diff --git a/mojo/services/view_manager/node_delegate.h b/mojo/services/view_manager/node_delegate.h
index ca4254e..d63acc9 100644
--- a/mojo/services/view_manager/node_delegate.h
+++ b/mojo/services/view_manager/node_delegate.h
@@ -11,10 +11,6 @@ namespace ui {
class Event;
}
-namespace gfx {
-class Rect;
-}
-
namespace mojo {
namespace view_manager {
namespace service {
@@ -29,10 +25,6 @@ class MOJO_VIEW_MANAGER_EXPORT NodeDelegate {
const Node* new_parent,
const Node* old_parent) = 0;
- virtual void OnNodeBoundsChanged(const Node* node,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) = 0;
-
// Invoked when the View associated with a node changes.
virtual void OnNodeViewReplaced(const Node* node,
const View* new_view,
diff --git a/mojo/services/view_manager/root_node_manager.cc b/mojo/services/view_manager/root_node_manager.cc
index 5590e49..45df25d 100644
--- a/mojo/services/view_manager/root_node_manager.cc
+++ b/mojo/services/view_manager/root_node_manager.cc
@@ -266,12 +266,6 @@ void RootNodeManager::OnNodeHierarchyChanged(const Node* node,
ProcessNodeHierarchyChanged(node, new_parent, old_parent);
}
-void RootNodeManager::OnNodeBoundsChanged(const Node* node,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- ProcessNodeBoundsChanged(node, old_bounds, new_bounds);
-}
-
void RootNodeManager::OnNodeViewReplaced(const Node* node,
const View* new_view,
const View* old_view) {
diff --git a/mojo/services/view_manager/root_node_manager.h b/mojo/services/view_manager/root_node_manager.h
index c8e8c5f..86afa83 100644
--- a/mojo/services/view_manager/root_node_manager.h
+++ b/mojo/services/view_manager/root_node_manager.h
@@ -190,9 +190,6 @@ class MOJO_VIEW_MANAGER_EXPORT RootNodeManager
virtual void OnNodeHierarchyChanged(const Node* node,
const Node* new_parent,
const Node* old_parent) OVERRIDE;
- virtual void OnNodeBoundsChanged(const Node* node,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) OVERRIDE;
virtual void OnNodeViewReplaced(const Node* node,
const View* new_view,
const View* old_view) OVERRIDE;
diff --git a/mojo/services/view_manager/view_manager_service_impl.cc b/mojo/services/view_manager/view_manager_service_impl.cc
index 1820f2c..7f0a225 100644
--- a/mojo/services/view_manager/view_manager_service_impl.cc
+++ b/mojo/services/view_manager/view_manager_service_impl.cc
@@ -810,12 +810,6 @@ void ViewManagerServiceImpl::OnNodeHierarchyChanged(const Node* node,
root_node_manager_->ProcessNodeHierarchyChanged(node, new_parent, old_parent);
}
-void ViewManagerServiceImpl::OnNodeBoundsChanged(const Node* node,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- root_node_manager_->ProcessNodeBoundsChanged(node, old_bounds, new_bounds);
-}
-
void ViewManagerServiceImpl::OnNodeViewReplaced(const Node* node,
const View* new_view,
const View* old_view) {
diff --git a/mojo/services/view_manager/view_manager_service_impl.h b/mojo/services/view_manager/view_manager_service_impl.h
index 7da14db..02c6578 100644
--- a/mojo/services/view_manager/view_manager_service_impl.h
+++ b/mojo/services/view_manager/view_manager_service_impl.h
@@ -220,9 +220,6 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl
virtual void OnNodeHierarchyChanged(const Node* node,
const Node* new_parent,
const Node* old_parent) OVERRIDE;
- virtual void OnNodeBoundsChanged(const Node* node,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) OVERRIDE;
virtual void OnNodeViewReplaced(const Node* node,
const View* new_view,
const View* old_view) OVERRIDE;
diff --git a/mojo/services/view_manager/window_tree_host_impl.cc b/mojo/services/view_manager/window_tree_host_impl.cc
index 810caf8..f6ded7f 100644
--- a/mojo/services/view_manager/window_tree_host_impl.cc
+++ b/mojo/services/view_manager/window_tree_host_impl.cc
@@ -2,13 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "mojo/services/view_manager/root_node_manager.h"
#include "mojo/services/view_manager/window_tree_host_impl.h"
+
#include "mojo/public/c/gles2/gles2.h"
#include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
#include "mojo/services/view_manager/context_factory_impl.h"
#include "ui/aura/env.h"
-#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/compositor.h"
@@ -26,47 +25,6 @@ namespace service {
ContextFactoryImpl* WindowTreeHostImpl::context_factory_ = NULL;
////////////////////////////////////////////////////////////////////////////////
-// RootLayoutManager, layout management for the root window's (one) child
-
-class RootLayoutManager : public aura::LayoutManager {
- public:
- RootLayoutManager() : child_(NULL) { }
-
- // Overridden from aura::LayoutManager
- virtual void OnWindowResized() OVERRIDE;
- virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
- 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;
- private:
- aura::Window* child_;
-
- DISALLOW_COPY_AND_ASSIGN(RootLayoutManager);
-};
-
-void RootLayoutManager::OnWindowResized() {
- if (child_) {
- gfx::Rect bounds = child_->parent()->bounds();
- child_->SetBounds(gfx::Rect(0, 0, bounds.width(), bounds.height()));
- }
-}
-
-void RootLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
- DCHECK(!child_);
- child_ = child;
-}
-
-void RootLayoutManager::SetChildBounds(aura::Window* child,
- const gfx::Rect& requested_bounds) {
- SetChildBoundsDirect(child, gfx::Rect(
- requested_bounds.width(),
- requested_bounds.height()));
-}
-
-////////////////////////////////////////////////////////////////////////////////
// WindowTreeHostImpl, public:
WindowTreeHostImpl::WindowTreeHostImpl(
@@ -90,8 +48,6 @@ WindowTreeHostImpl::WindowTreeHostImpl(
}
context_factory_ = new ContextFactoryImpl(pipe.handle1.Pass());
aura::Env::GetInstance()->set_context_factory(context_factory_);
-
- window()->SetLayoutManager(new RootLayoutManager());
}
WindowTreeHostImpl::~WindowTreeHostImpl() {