diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/config/embedded_linux.pri | 2 | ||||
-rw-r--r-- | src/core/core_generator.pro | 4 | ||||
-rw-r--r-- | src/core/ozone_platform_qt.cpp (renamed from src/core/ozone_platform_eglfs.cpp) | 139 | ||||
-rw-r--r-- | src/core/ozone_platform_qt.h (renamed from src/core/ozone_platform_eglfs.h) | 48 |
4 files changed, 98 insertions, 95 deletions
diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri index f9b8a35d5..11ed3e310 100644 --- a/src/core/config/embedded_linux.pri +++ b/src/core/config/embedded_linux.pri @@ -13,7 +13,7 @@ use?(gn) { ozone_auto_platforms=false \ ozone_platform_headless=true \ ozone_platform_external=true \ - ozone_platform=\"eglfs\" \ + ozone_platform=\"qt\" \ toolkit_views=false use?(icecc) { diff --git a/src/core/core_generator.pro b/src/core/core_generator.pro index c99e10ef8..9c109146f 100644 --- a/src/core/core_generator.pro +++ b/src/core/core_generator.pro @@ -84,7 +84,7 @@ SOURCES = \ media_capture_devices_dispatcher.cpp \ native_web_keyboard_event_qt.cpp \ network_delegate_qt.cpp \ - ozone_platform_eglfs.cpp \ + ozone_platform_qt.cpp \ permission_manager_qt.cpp \ process_main.cpp \ proxy_config_service_qt.cpp \ @@ -159,7 +159,7 @@ HEADERS = \ javascript_dialog_manager_qt.h \ media_capture_devices_dispatcher.h \ network_delegate_qt.h \ - ozone_platform_eglfs.h \ + ozone_platform_qt.h \ permission_manager_qt.h \ process_main.h \ proxy_config_service_qt.h \ diff --git a/src/core/ozone_platform_eglfs.cpp b/src/core/ozone_platform_qt.cpp index e6e1ab5e2..54626f0aa 100644 --- a/src/core/ozone_platform_eglfs.cpp +++ b/src/core/ozone_platform_qt.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -37,41 +37,44 @@ ** ****************************************************************************/ -#include "ozone_platform_eglfs.h" +#include "ozone_platform_qt.h" #if defined(USE_OZONE) #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "ui/events/ozone/device/device_manager.h" -#include "ui/events/ozone/evdev/event_factory_evdev.h" #include "ui/events/ozone/events_ozone.h" #include "ui/events/platform/platform_event_dispatcher.h" +#include "ui/events/platform/platform_event_source.h" #include "ui/ozone/common/native_display_delegate_ozone.h" #include "ui/ozone/common/stub_client_native_pixmap_factory.h" #include "ui/ozone/common/stub_overlay_manager.h" #include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/cursor_factory_ozone.h" #include "ui/ozone/public/gpu_platform_support_host.h" +#include "ui/ozone/public/input_controller.h" +#include "ui/ozone/public/system_input_injector.h" #include "ui/platform_window/platform_window.h" #include "ui/platform_window/platform_window_delegate.h" +#include "surface_factory_qt.h" + namespace ui { namespace { -class EglfsWindow : public PlatformWindow, public PlatformEventDispatcher { + +class PlatformWindowQt : public PlatformWindow, public PlatformEventDispatcher +{ public: - EglfsWindow(PlatformWindowDelegate* delegate, - EventFactoryEvdev* event_factory, - const gfx::Rect& bounds) + PlatformWindowQt(PlatformWindowDelegate* delegate, + const gfx::Rect& bounds) : delegate_(delegate) - , event_factory_(event_factory) , bounds_(bounds) { ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); } - ~EglfsWindow() override + ~PlatformWindowQt() override { ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); } @@ -99,94 +102,132 @@ public: private: PlatformWindowDelegate* delegate_; - EventFactoryEvdev* event_factory_; gfx::Rect bounds_; - DISALLOW_COPY_AND_ASSIGN(EglfsWindow); + DISALLOW_COPY_AND_ASSIGN(PlatformWindowQt); }; -gfx::Rect EglfsWindow::GetBounds() { +gfx::Rect PlatformWindowQt::GetBounds() +{ return bounds_; } -void EglfsWindow::SetBounds(const gfx::Rect& bounds) { +void PlatformWindowQt::SetBounds(const gfx::Rect& bounds) +{ + if (bounds == bounds_) + return; bounds_ = bounds; delegate_->OnBoundsChanged(bounds); } -bool EglfsWindow::CanDispatchEvent(const ui::PlatformEvent& ne) { +bool PlatformWindowQt::CanDispatchEvent(const ui::PlatformEvent& /*ne*/) +{ return true; } -uint32_t EglfsWindow::DispatchEvent(const ui::PlatformEvent& native_event) { +uint32_t PlatformWindowQt::DispatchEvent(const ui::PlatformEvent& native_event) +{ DispatchEventFromNativeUiEvent( native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, base::Unretained(delegate_))); return ui::POST_DISPATCH_STOP_PROPAGATION; } -} // namespace -OzonePlatformEglfs::OzonePlatformEglfs() {} +class OzonePlatformQt : public OzonePlatform { +public: + OzonePlatformQt(); + ~OzonePlatformQt() override; + + ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override; + ui::CursorFactoryOzone* GetCursorFactoryOzone() override; + GpuPlatformSupportHost* GetGpuPlatformSupportHost() override; + std::unique_ptr<PlatformWindow> CreatePlatformWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds) override; + std::unique_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() override; + ui::InputController* GetInputController() override; + std::unique_ptr<ui::SystemInputInjector> CreateSystemInputInjector() override; + ui::OverlayManagerOzone* GetOverlayManager() override; + +private: + void InitializeUI() override; + void InitializeGPU() override; + + std::unique_ptr<QtWebEngineCore::SurfaceFactoryQt> surface_factory_ozone_; + std::unique_ptr<CursorFactoryOzone> cursor_factory_ozone_; + + std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; + std::unique_ptr<InputController> input_controller_; + std::unique_ptr<OverlayManagerOzone> overlay_manager_; + + DISALLOW_COPY_AND_ASSIGN(OzonePlatformQt); +}; + -OzonePlatformEglfs::~OzonePlatformEglfs() {} +OzonePlatformQt::OzonePlatformQt() {} -ui::SurfaceFactoryOzone* OzonePlatformEglfs::GetSurfaceFactoryOzone() { - return surface_factory_ozone_.get(); +OzonePlatformQt::~OzonePlatformQt() {} + +ui::SurfaceFactoryOzone* OzonePlatformQt::GetSurfaceFactoryOzone() +{ + return surface_factory_ozone_.get(); } -ui::CursorFactoryOzone* OzonePlatformEglfs::GetCursorFactoryOzone() { - return cursor_factory_ozone_.get(); +ui::CursorFactoryOzone* OzonePlatformQt::GetCursorFactoryOzone() +{ + return cursor_factory_ozone_.get(); } -GpuPlatformSupportHost* OzonePlatformEglfs::GetGpuPlatformSupportHost() { - return gpu_platform_support_host_.get(); +GpuPlatformSupportHost* OzonePlatformQt::GetGpuPlatformSupportHost() +{ + return gpu_platform_support_host_.get(); } -std::unique_ptr<PlatformWindow> OzonePlatformEglfs::CreatePlatformWindow( - PlatformWindowDelegate* delegate, - const gfx::Rect& bounds) +std::unique_ptr<PlatformWindow> OzonePlatformQt::CreatePlatformWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds) { - return base::WrapUnique( - new EglfsWindow(delegate, - event_factory_ozone_.get(), - bounds)); + return base::WrapUnique(new PlatformWindowQt(delegate, bounds)); } -ui::InputController* OzonePlatformEglfs::GetInputController() { +ui::InputController* OzonePlatformQt::GetInputController() +{ return input_controller_.get(); } -std::unique_ptr<ui::SystemInputInjector> OzonePlatformEglfs::CreateSystemInputInjector() { +std::unique_ptr<ui::SystemInputInjector> OzonePlatformQt::CreateSystemInputInjector() +{ return nullptr; // no input injection support. } -ui::OverlayManagerOzone* OzonePlatformEglfs::GetOverlayManager() { +ui::OverlayManagerOzone* OzonePlatformQt::GetOverlayManager() +{ return overlay_manager_.get(); } -std::unique_ptr<ui::NativeDisplayDelegate> OzonePlatformEglfs::CreateNativeDisplayDelegate() +std::unique_ptr<ui::NativeDisplayDelegate> OzonePlatformQt::CreateNativeDisplayDelegate() { return base::WrapUnique(new NativeDisplayDelegateOzone()); } -OzonePlatform* CreateOzonePlatformEglfs() { return new OzonePlatformEglfs; } - -ClientNativePixmapFactory* CreateClientNativePixmapFactoryEglfs() { - return CreateStubClientNativePixmapFactory(); +void OzonePlatformQt::InitializeUI() +{ + overlay_manager_.reset(new StubOverlayManager()); + cursor_factory_ozone_.reset(new CursorFactoryOzone()); + gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost()); + input_controller_ = CreateStubInputController(); } -void OzonePlatformEglfs::InitializeUI() { - overlay_manager_.reset(new StubOverlayManager()); - device_manager_ = CreateDeviceManager(); - cursor_factory_ozone_.reset(new CursorFactoryOzone()); - event_factory_ozone_.reset(new EventFactoryEvdev(NULL, device_manager_.get(), NULL)); - gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost()); - input_controller_ = CreateStubInputController(); +void OzonePlatformQt::InitializeGPU() +{ + surface_factory_ozone_.reset(new QtWebEngineCore::SurfaceFactoryQt()); } -void OzonePlatformEglfs::InitializeGPU() { - surface_factory_ozone_.reset(new QtWebEngineCore::SurfaceFactoryQt()); +} // namespace + + +OzonePlatform* CreateOzonePlatformQt() { return new OzonePlatformQt; } + +ClientNativePixmapFactory* CreateClientNativePixmapFactoryQt() +{ + return CreateStubClientNativePixmapFactory(); } } // namespace ui diff --git a/src/core/ozone_platform_eglfs.h b/src/core/ozone_platform_qt.h index c319b1e5c..8b92b817d 100644 --- a/src/core/ozone_platform_eglfs.h +++ b/src/core/ozone_platform_qt.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -37,57 +37,19 @@ ** ****************************************************************************/ -#ifndef UI_OZONE_PLATFORM_EGLFS_OZONE_PLATFORM_EGLFS_H_ -#define UI_OZONE_PLATFORM_EGLFS_OZONE_PLATFORM_EGLFS_H_ +#ifndef UI_OZONE_PLATFORM_EGLFS_OZONE_PLATFORM_QT_H_ +#define UI_OZONE_PLATFORM_EGLFS_OZONE_PLATFORM_QT_H_ #if defined(USE_OZONE) #include "ui/ozone/public/ozone_platform.h" -#include "surface_factory_qt.h" - namespace ui { -class DeviceManager; -class EventFactoryEvdev; -class CursorFactoryOzone; - -class OzonePlatformEglfs : public OzonePlatform { - public: - OzonePlatformEglfs(); - virtual ~OzonePlatformEglfs(); - - virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override; - virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() override; - virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override; - virtual std::unique_ptr<PlatformWindow> CreatePlatformWindow( - PlatformWindowDelegate* delegate, - const gfx::Rect& bounds) override; - virtual std::unique_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() override; - virtual ui::InputController* GetInputController() override; - virtual std::unique_ptr<ui::SystemInputInjector> CreateSystemInputInjector() override; - virtual ui::OverlayManagerOzone* GetOverlayManager() override; - - private: - virtual void InitializeUI() override; - virtual void InitializeGPU() override; - std::unique_ptr<DeviceManager> device_manager_; - - std::unique_ptr<QtWebEngineCore::SurfaceFactoryQt> surface_factory_ozone_; - std::unique_ptr<CursorFactoryOzone> cursor_factory_ozone_; - std::unique_ptr<EventFactoryEvdev> event_factory_ozone_; - - std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; - std::unique_ptr<InputController> input_controller_; - std::unique_ptr<OverlayManagerOzone> overlay_manager_; - - DISALLOW_COPY_AND_ASSIGN(OzonePlatformEglfs); -}; - // Constructor hook for use in ozone_platform_list.cc -OzonePlatform* CreateOzonePlatformEglfs(); +OzonePlatform* CreateOzonePlatformQt(); } // namespace ui #endif // defined(USE_OZONE) -#endif // UI_OZONE_PLATFORM_EGLFS_OZONE_PLATFORM_EGLFS_H_ +#endif // UI_OZONE_PLATFORM_EGLFS_OZONE_PLATFORM_QT_H_ |