Commit a2e68b3c authored by dnicoara@chromium.org's avatar dnicoara@chromium.org

[Ozone] Migrate platform DRI & GBM to platform_window

BUG=392280
NOTRY=true

Review URL: https://codereview.chromium.org/402213002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284714 0039d316-1c4b-4281-b951-d872f2087c98
parent 1b2635e8
......@@ -100,8 +100,6 @@
'common/gpu/ozone_gpu_message_params.cc',
'common/gpu/ozone_gpu_message_params.h',
'common/gpu/ozone_gpu_messages.h',
'common/window/platform_window_compat.cc',
'common/window/platform_window_compat.h',
'public/ozone_platform.cc',
'public/ozone_platform.h',
'public/ozone_switches.cc',
......
......@@ -55,6 +55,8 @@
'dri_util.h',
'dri_vsync_provider.cc',
'dri_vsync_provider.h',
'dri_window.cc',
'dri_window.h',
'dri_wrapper.cc',
'dri_wrapper.h',
'hardware_display_controller.cc',
......
......@@ -2,78 +2,68 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/ozone/common/window/platform_window_compat.h"
#include "ui/ozone/platform/dri/dri_window.h"
#include "ui/events/event.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
#include "ui/ozone/public/event_factory_ozone.h"
#include "ui/ozone/public/surface_factory_ozone.h"
#include "ui/platform_window/platform_window_delegate.h"
namespace ui {
PlatformWindowCompat::PlatformWindowCompat(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds)
DriWindow::DriWindow(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds)
: delegate_(delegate), bounds_(bounds) {
widget_ = SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget();
delegate_->OnAcceleratedWidgetAvailable(widget_);
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
}
PlatformWindowCompat::~PlatformWindowCompat() {
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
DriWindow::~DriWindow() {
PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
}
bool PlatformWindowCompat::CanDispatchEvent(const ui::PlatformEvent& ne) {
CHECK(ne);
ui::Event* event = static_cast<ui::Event*>(ne);
if (event->IsMouseEvent() || event->IsScrollEvent())
return ui::CursorFactoryOzone::GetInstance()->GetCursorWindow() == widget_;
return true;
}
void DriWindow::Show() {}
uint32_t PlatformWindowCompat::DispatchEvent(const ui::PlatformEvent& ne) {
ui::Event* event = static_cast<ui::Event*>(ne);
delegate_->DispatchEvent(event);
return ui::POST_DISPATCH_STOP_PROPAGATION;
}
void DriWindow::Hide() {}
gfx::Rect PlatformWindowCompat::GetBounds() {
return bounds_;
}
void DriWindow::Close() {}
void PlatformWindowCompat::SetBounds(const gfx::Rect& bounds) {
void DriWindow::SetBounds(const gfx::Rect& bounds) {
bounds_ = bounds;
delegate_->OnBoundsChanged(bounds);
}
void PlatformWindowCompat::Show() {
gfx::Rect DriWindow::GetBounds() {
return bounds_;
}
void PlatformWindowCompat::Hide() {
}
void DriWindow::SetCapture() {}
void PlatformWindowCompat::Close() {
}
void DriWindow::ReleaseCapture() {}
void PlatformWindowCompat::SetCapture() {
}
void DriWindow::ToggleFullscreen() {}
void PlatformWindowCompat::ReleaseCapture() {
}
void DriWindow::Maximize() {}
void PlatformWindowCompat::ToggleFullscreen() {
}
void DriWindow::Minimize() {}
void PlatformWindowCompat::Maximize() {
}
void DriWindow::Restore() {}
void PlatformWindowCompat::Minimize() {
bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) {
CHECK(ne);
Event* event = static_cast<Event*>(ne);
if (event->IsMouseEvent() || event->IsScrollEvent())
return ui::CursorFactoryOzone::GetInstance()->GetCursorWindow() == widget_;
return true;
}
void PlatformWindowCompat::Restore() {
uint32_t DriWindow::DispatchEvent(const PlatformEvent& ne) {
Event* event = static_cast<Event*>(ne);
delegate_->DispatchEvent(event);
return POST_DISPATCH_STOP_PROPAGATION;
}
} // namespace ui
......@@ -2,43 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_OZONE_COMMON_WINDOW_PLATFORM_WINDOW_COMPAT_H_
#define UI_OZONE_COMMON_WINDOW_PLATFORM_WINDOW_COMPAT_H_
#ifndef UI_OZONE_PLATFORM_DRI_DRI_WINDOW_H_
#define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_H_
#include "ui/base/cursor/cursor.h"
#include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/ozone_export.h"
#include "ui/platform_window/platform_window.h"
namespace gfx {
class Point;
class Rect;
}
namespace ui {
class PlatformWindowDelegate;
// This is just transitional code. Will be removed shortly.
class OZONE_EXPORT PlatformWindowCompat : public PlatformWindow,
public ui::PlatformEventDispatcher {
class DriWindow : public PlatformWindow,
public PlatformEventDispatcher {
public:
PlatformWindowCompat(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds);
virtual ~PlatformWindowCompat();
// ui::PlatformEventDispatcher:
virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE;
virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE;
DriWindow(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds);
virtual ~DriWindow();
// PlatformWindow:
virtual gfx::Rect GetBounds() OVERRIDE;
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
virtual void Show() OVERRIDE;
virtual void Hide() OVERRIDE;
virtual void Close() OVERRIDE;
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
virtual gfx::Rect GetBounds() OVERRIDE;
virtual void SetCapture() OVERRIDE;
virtual void ReleaseCapture() OVERRIDE;
virtual void ToggleFullscreen() OVERRIDE;
......@@ -46,14 +32,18 @@ class OZONE_EXPORT PlatformWindowCompat : public PlatformWindow,
virtual void Minimize() OVERRIDE;
virtual void Restore() OVERRIDE;
// PlatformEventDispatcher:
virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE;
virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE;
private:
PlatformWindowDelegate* delegate_;
gfx::AcceleratedWidget widget_;
gfx::Rect bounds_;
gfx::AcceleratedWidget widget_;
DISALLOW_COPY_AND_ASSIGN(PlatformWindowCompat);
DISALLOW_COPY_AND_ASSIGN(DriWindow);
};
} // namespace ui
#endif // UI_OZONE_COMMON_WINDOW_PLATFORM_WINDOW_COMPAT_H_
#endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_H_
......@@ -8,10 +8,10 @@
#include "ui/events/ozone/device/device_manager.h"
#include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
#include "ui/events/ozone/evdev/event_factory_evdev.h"
#include "ui/ozone/common/window/platform_window_compat.h"
#include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h"
#include "ui/ozone/platform/dri/dri_buffer.h"
#include "ui/ozone/platform/dri/dri_surface_factory.h"
#include "ui/ozone/platform/dri/dri_window.h"
#include "ui/ozone/platform/dri/dri_wrapper.h"
#include "ui/ozone/platform/dri/screen_manager.h"
#include "ui/ozone/platform/dri/virtual_terminal_manager.h"
......@@ -65,8 +65,7 @@ class OzonePlatformDri : public OzonePlatform {
virtual scoped_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
const gfx::Rect& bounds) OVERRIDE {
return make_scoped_ptr<PlatformWindow>(
new PlatformWindowCompat(delegate, bounds));
return scoped_ptr<PlatformWindow>(new DriWindow(delegate, bounds));
}
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
......
......@@ -11,8 +11,8 @@
#include "base/at_exit.h"
#include "ui/events/ozone/device/device_manager.h"
#include "ui/events/ozone/evdev/event_factory_evdev.h"
#include "ui/ozone/common/window/platform_window_compat.h"
#include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h"
#include "ui/ozone/platform/dri/dri_window.h"
#include "ui/ozone/platform/dri/dri_wrapper.h"
#include "ui/ozone/platform/dri/gbm_buffer.h"
#include "ui/ozone/platform/dri/gbm_surface.h"
......@@ -97,8 +97,7 @@ class OzonePlatformGbm : public OzonePlatform {
virtual scoped_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
const gfx::Rect& bounds) OVERRIDE {
return make_scoped_ptr<PlatformWindow>(
new PlatformWindowCompat(delegate, bounds));
return scoped_ptr<PlatformWindow>(new DriWindow(delegate, bounds));
}
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment