diff options
Diffstat (limited to 'chromium')
19 files changed, 187 insertions, 50 deletions
diff --git a/chromium/components/exo/wayland/wayland_watcher.cc b/chromium/components/exo/wayland/wayland_watcher.cc index f2dad436d7b..bc2d4b96d4a 100644 --- a/chromium/components/exo/wayland/wayland_watcher.cc +++ b/chromium/components/exo/wayland/wayland_watcher.cc @@ -15,7 +15,7 @@ WaylandWatcher::WaylandWatcher(wayland::Server* server) base::MessageLoopCurrentForUI::Get()->WatchFileDescriptor( server_->GetFileDescriptor(), true, // persistent - base::MessagePumpLibevent::WATCH_READ, &controller_, this); + base::MessagePumpForUI::WATCH_READ, &controller_, this); } WaylandWatcher::~WaylandWatcher() {} diff --git a/chromium/components/exo/wayland/wayland_watcher.h b/chromium/components/exo/wayland/wayland_watcher.h index fae62e63da7..ea1677465b8 100644 --- a/chromium/components/exo/wayland/wayland_watcher.h +++ b/chromium/components/exo/wayland/wayland_watcher.h @@ -5,7 +5,7 @@ #ifndef COMPONENTS_EXO_WAYLAND_WAYLAND_WATCHER_H_ #define COMPONENTS_EXO_WAYLAND_WAYLAND_WATCHER_H_ -#include "base/message_loop/message_pump_libevent.h" +#include "base/message_loop/message_pump_for_ui.h" #include "base/message_loop/watchable_io_message_pump_posix.h" namespace exo { @@ -13,18 +13,18 @@ namespace wayland { class Server; -class WaylandWatcher : public base::MessagePumpLibevent::FdWatcher { +class WaylandWatcher : public base::MessagePumpForUI::FdWatcher { public: explicit WaylandWatcher(wayland::Server* server); ~WaylandWatcher() override; private: - // base::MessagePumpLibevent::FdWatcher: + // base::MessagePumpForUI::FdWatcher: void OnFileCanReadWithoutBlocking(int fd) override; void OnFileCanWriteWithoutBlocking(int fd) override; - base::MessagePumpLibevent::FdWatchController controller_; + base::MessagePumpForUI::FdWatchController controller_; wayland::Server* const server_; DISALLOW_COPY_AND_ASSIGN(WaylandWatcher); diff --git a/chromium/ui/events/ozone/device/udev/device_manager_udev.cc b/chromium/ui/events/ozone/device/udev/device_manager_udev.cc index 895a4d48b92..14d7e17d01d 100644 --- a/chromium/ui/events/ozone/device/udev/device_manager_udev.cc +++ b/chromium/ui/events/ozone/device/udev/device_manager_udev.cc @@ -95,7 +95,7 @@ void DeviceManagerUdev::CreateMonitor() { int fd = device::udev_monitor_get_fd(monitor_.get()); CHECK_GT(fd, 0); base::MessageLoopCurrentForUI::Get()->WatchFileDescriptor( - fd, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); + fd, true, base::MessagePumpForUI::WATCH_READ, &controller_, this); } } diff --git a/chromium/ui/events/ozone/device/udev/device_manager_udev.h b/chromium/ui/events/ozone/device/udev/device_manager_udev.h index 26d694b909b..9d6a3ecce81 100644 --- a/chromium/ui/events/ozone/device/udev/device_manager_udev.h +++ b/chromium/ui/events/ozone/device/udev/device_manager_udev.h @@ -6,7 +6,7 @@ #define UI_EVENTS_OZONE_DEVICE_UDEV_DEVICE_MANAGER_UDEV_H_ #include "base/macros.h" -#include "base/message_loop/message_pump_libevent.h" +#include "base/message_loop/message_pump_for_ui.h" #include "base/observer_list.h" #include "device/udev_linux/scoped_udev.h" #include "ui/events/ozone/device/device_manager.h" @@ -17,7 +17,7 @@ class DeviceEvent; class DeviceEventObserver; class DeviceManagerUdev : public DeviceManager, - base::MessagePumpLibevent::FdWatcher { + base::MessagePumpForUI::FdWatcher { public: DeviceManagerUdev(); ~DeviceManagerUdev() override; @@ -33,14 +33,14 @@ class DeviceManagerUdev : public DeviceManager, void AddObserver(DeviceEventObserver* observer) override; void RemoveObserver(DeviceEventObserver* observer) override; - // base::MessagePumpLibevent::FdWatcher overrides: + // base::MessagePumpForUI::FdWatcher overrides: void OnFileCanReadWithoutBlocking(int fd) override; void OnFileCanWriteWithoutBlocking(int fd) override; device::ScopedUdevPtr udev_; device::ScopedUdevMonitorPtr monitor_; - base::MessagePumpLibevent::FdWatchController controller_; + base::MessagePumpForUI::FdWatchController controller_; base::ObserverList<DeviceEventObserver>::Unchecked observers_; diff --git a/chromium/ui/events/ozone/evdev/event_converter_evdev.cc b/chromium/ui/events/ozone/evdev/event_converter_evdev.cc index 8f9bebfa0f7..684514ff011 100644 --- a/chromium/ui/events/ozone/evdev/event_converter_evdev.cc +++ b/chromium/ui/events/ozone/evdev/event_converter_evdev.cc @@ -45,7 +45,7 @@ EventConverterEvdev::~EventConverterEvdev() { void EventConverterEvdev::Start() { base::MessageLoopCurrentForUI::Get()->WatchFileDescriptor( - fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); + fd_, true, base::MessagePumpForUI::WATCH_READ, &controller_, this); watching_ = true; } diff --git a/chromium/ui/events/ozone/evdev/event_converter_evdev.h b/chromium/ui/events/ozone/evdev/event_converter_evdev.h index 6cc2cc6b108..310039182c2 100644 --- a/chromium/ui/events/ozone/evdev/event_converter_evdev.h +++ b/chromium/ui/events/ozone/evdev/event_converter_evdev.h @@ -12,7 +12,7 @@ #include "base/callback.h" #include "base/files/file_path.h" #include "base/macros.h" -#include "base/message_loop/message_pump_libevent.h" +#include "base/message_loop/message_loop_current.h" #include "ui/events/devices/input_device.h" #include "ui/events/ozone/evdev/event_dispatch_callback.h" #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" @@ -24,7 +24,7 @@ namespace ui { enum class DomCode; class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev - : public base::MessagePumpLibevent::FdWatcher { + : public base::MessagePumpForUI::FdWatcher { public: EventConverterEvdev(int fd, const base::FilePath& path, @@ -116,7 +116,7 @@ class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev static base::TimeTicks TimeTicksFromInputEvent(const input_event& event); protected: - // base::MessagePumpLibevent::FdWatcher: + // base::MessagePumpForUI::FdWatcher: void OnFileCanWriteWithoutBlocking(int fd) override; // File descriptor to read. @@ -133,7 +133,7 @@ class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev bool watching_ = false; // Controller for watching the input fd. - base::MessagePumpLibevent::FdWatchController controller_; + base::MessagePumpForUI::FdWatchController controller_; private: DISALLOW_COPY_AND_ASSIGN(EventConverterEvdev); diff --git a/chromium/ui/events/platform/x11/BUILD.gn b/chromium/ui/events/platform/x11/BUILD.gn index 31a20f03e55..bc10e52b515 100644 --- a/chromium/ui/events/platform/x11/BUILD.gn +++ b/chromium/ui/events/platform/x11/BUILD.gn @@ -42,7 +42,7 @@ jumbo_component("x11") { deps += [ "//ui/events/ozone:events_ozone" ] } - if (use_glib) { + if (use_x11) { sources += [ "x11_event_source_glib.cc", "x11_event_source_glib.h", @@ -50,9 +50,10 @@ jumbo_component("x11") { configs += [ "//build/config/linux:glib" ] } else { + assert(ozone_platform_x11) sources += [ - "x11_event_source_libevent.cc", - "x11_event_source_libevent.h", + "x11_event_source_default.cc", + "x11_event_source_default.h", ] deps += [ "//ui/events/keycodes:x11" ] diff --git a/chromium/ui/events/platform/x11/x11_event_source.cc b/chromium/ui/events/platform/x11/x11_event_source.cc index 7e9f6df4762..69ea0a1f755 100644 --- a/chromium/ui/events/platform/x11/x11_event_source.cc +++ b/chromium/ui/events/platform/x11/x11_event_source.cc @@ -231,6 +231,17 @@ X11EventSource::GetRootCursorLocationFromCurrentEvent() const { } #endif +// TODO(crbug.com/965991): Use ui::Event in Aura/X11 +#if !defined(USE_X11) +void X11EventSource::RemoveXEventDispatcher(XEventDispatcher* dispatcher) { + delegate_->RemoveXEventDispatcher(dispatcher); +} + +void X11EventSource::AddXEventDispatcher(XEventDispatcher* dispatcher) { + delegate_->AddXEventDispatcher(dispatcher); +} +#endif + //////////////////////////////////////////////////////////////////////////////// // X11EventSource, protected diff --git a/chromium/ui/events/platform/x11/x11_event_source.h b/chromium/ui/events/platform/x11/x11_event_source.h index e818c4acfa8..86ebaec542c 100644 --- a/chromium/ui/events/platform/x11/x11_event_source.h +++ b/chromium/ui/events/platform/x11/x11_event_source.h @@ -29,6 +29,38 @@ namespace ui { class X11HotplugEventHandler; class XScopedEventSelector; +class PlatformEventDispatcher; + +// The XEventDispatcher interface is used in two different ways: the first is +// when classes want to receive XEvent directly and second is to say if classes, +// which also implement the PlatformEventDispatcher interface, are able to +// process next translated from XEvent to ui::Event events. Only used with Ozone +// X11 currently. +class EVENTS_EXPORT XEventDispatcher { + public: + // Sends XEvent to XEventDispatcher for handling. Returns true if the XEvent + // was dispatched, otherwise false. After the first XEventDispatcher returns + // true XEvent dispatching stops. + virtual bool DispatchXEvent(XEvent* xevent) = 0; + + // XEventDispatchers can be used to test if they are able to process next + // translated event sent by a PlatformEventSource. If so, they must make a + // promise internally to process next event sent by PlatformEventSource. + virtual void CheckCanDispatchNextPlatformEvent(XEvent* xev); + + // Tells that an event has been dispatched and an event handling promise must + // be removed. + virtual void PlatformEventDispatchFinished(); + + // Returns PlatformEventDispatcher if this XEventDispatcher is associated with + // a PlatformEventDispatcher as well. Used to explicitly add a + // PlatformEventDispatcher during a call from an XEventDispatcher to + // AddXEventDispatcher. + virtual PlatformEventDispatcher* GetPlatformEventDispatcher(); + + protected: + virtual ~XEventDispatcher() {} +}; // Responsible for notifying X11EventSource when new XEvents are available and // processing/dispatching XEvents. Implementations will likely be a @@ -36,10 +68,17 @@ class XScopedEventSelector; class X11EventSourceDelegate { public: X11EventSourceDelegate() = default; + virtual ~X11EventSourceDelegate() = default; // Processes (if necessary) and handles dispatching XEvents. virtual void ProcessXEvent(XEvent* xevent) = 0; + // TODO(crbug.com/965991): Use ui::Event in Aura/X11 +#if !defined(USE_X11) + virtual void AddXEventDispatcher(XEventDispatcher* dispatcher) = 0; + virtual void RemoveXEventDispatcher(XEventDispatcher* dispatcher) = 0; +#endif + private: DISALLOW_COPY_AND_ASSIGN(X11EventSourceDelegate); }; @@ -52,7 +91,6 @@ class EVENTS_EXPORT X11EventSource { ~X11EventSource(); static bool HasInstance(); - static X11EventSource* GetInstance(); // Called when there is a new XEvent available. Processes all (if any) @@ -84,6 +122,25 @@ class EVENTS_EXPORT X11EventSource { // |last_seen_server_time_| with this value. Time GetCurrentServerTime(); +// TODO(crbug.com/965991): Use ui::Event in Aura/X11 +#if !defined(USE_X11) + // Adds a XEvent dispatcher to the XEvent dispatcher list. + // Also calls XEventDispatcher::GetPlatformEventDispatcher + // to explicitly add this |dispatcher| to a list of PlatformEventDispatchers + // in case if XEventDispatcher has a PlatformEventDispatcher. Thus, + // there is no need to separately add self to the list of + // PlatformEventDispatchers. This is needed because XEventDispatchers are + // tested if they can receive an XEvent based on a XID target. If so, the + // translated XEvent into a PlatformEvent is sent to that + // PlatformEventDispatcher. + void AddXEventDispatcher(XEventDispatcher* dispatcher); + + // Removes an XEvent dispatcher from the XEvent dispatcher list. + // Also explicitly removes an XEventDispatcher from a PlatformEventDispatcher + // list if the XEventDispatcher has a PlatformEventDispatcher. + void RemoveXEventDispatcher(XEventDispatcher* dispatcher); +#endif + protected: // Extracts cookie data from |xevent| if it's of GenericType, and dispatches // the event. This function also frees up the cookie data after dispatch is diff --git a/chromium/ui/events/platform/x11/x11_event_source_libevent.cc b/chromium/ui/events/platform/x11/x11_event_source_default.cc index 949df0b8683..f00ec754b3d 100644 --- a/chromium/ui/events/platform/x11/x11_event_source_libevent.cc +++ b/chromium/ui/events/platform/x11/x11_event_source_default.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/events/platform/x11/x11_event_source_libevent.h" +#include "ui/events/platform/x11/x11_event_source_default.h" #include <memory> @@ -147,20 +147,20 @@ std::unique_ptr<ui::Event> TranslateXEventToEvent(const XEvent& xev) { } // namespace -X11EventSourceLibevent::X11EventSourceLibevent(XDisplay* display) +X11EventSourceDefault::X11EventSourceDefault(XDisplay* display) : event_source_(this, display), watcher_controller_(FROM_HERE) { AddEventWatcher(); } -X11EventSourceLibevent::~X11EventSourceLibevent() {} +X11EventSourceDefault::~X11EventSourceDefault() {} // static -X11EventSourceLibevent* X11EventSourceLibevent::GetInstance() { - return static_cast<X11EventSourceLibevent*>( +X11EventSourceDefault* X11EventSourceDefault::GetInstance() { + return static_cast<X11EventSourceDefault*>( PlatformEventSource::GetInstance()); } -void X11EventSourceLibevent::AddXEventDispatcher(XEventDispatcher* dispatcher) { +void X11EventSourceDefault::AddXEventDispatcher(XEventDispatcher* dispatcher) { dispatchers_xevent_.AddObserver(dispatcher); PlatformEventDispatcher* event_dispatcher = dispatcher->GetPlatformEventDispatcher(); @@ -168,7 +168,7 @@ void X11EventSourceLibevent::AddXEventDispatcher(XEventDispatcher* dispatcher) { AddPlatformEventDispatcher(event_dispatcher); } -void X11EventSourceLibevent::RemoveXEventDispatcher( +void X11EventSourceDefault::RemoveXEventDispatcher( XEventDispatcher* dispatcher) { dispatchers_xevent_.RemoveObserver(dispatcher); PlatformEventDispatcher* event_dispatcher = @@ -177,7 +177,7 @@ void X11EventSourceLibevent::RemoveXEventDispatcher( RemovePlatformEventDispatcher(event_dispatcher); } -void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { +void X11EventSourceDefault::ProcessXEvent(XEvent* xevent) { #if defined(USE_X11) // DispatchEvent takes ui::PlatformEvent which is XEvent* DispatchEvent(xevent); @@ -199,7 +199,7 @@ void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { #endif } -void X11EventSourceLibevent::AddEventWatcher() { +void X11EventSourceDefault::AddEventWatcher() { if (initialized_) return; if (!base::MessageLoopCurrent::Get()) @@ -207,13 +207,12 @@ void X11EventSourceLibevent::AddEventWatcher() { int fd = ConnectionNumber(event_source_.display()); base::MessageLoopCurrentForUI::Get()->WatchFileDescriptor( - fd, true, base::MessagePumpLibevent::WATCH_READ, &watcher_controller_, - this); + fd, true, base::MessagePumpForUI::WATCH_READ, &watcher_controller_, this); initialized_ = true; } -void X11EventSourceLibevent::DispatchPlatformEvent(const PlatformEvent& event, - XEvent* xevent) { +void X11EventSourceDefault::DispatchPlatformEvent(const PlatformEvent& event, + XEvent* xevent) { // First, tell the XEventDispatchers, which can have // PlatformEventDispatcher, an ui::Event is going to be sent next. // It must make a promise to handle next translated |event| sent by @@ -231,27 +230,27 @@ void X11EventSourceLibevent::DispatchPlatformEvent(const PlatformEvent& event, dispatcher.PlatformEventDispatchFinished(); } -void X11EventSourceLibevent::DispatchXEventToXEventDispatchers(XEvent* xevent) { +void X11EventSourceDefault::DispatchXEventToXEventDispatchers(XEvent* xevent) { for (XEventDispatcher& dispatcher : dispatchers_xevent_) { if (dispatcher.DispatchXEvent(xevent)) break; } } -void X11EventSourceLibevent::StopCurrentEventStream() { +void X11EventSourceDefault::StopCurrentEventStream() { event_source_.StopCurrentEventStream(); } -void X11EventSourceLibevent::OnDispatcherListChanged() { +void X11EventSourceDefault::OnDispatcherListChanged() { AddEventWatcher(); event_source_.OnDispatcherListChanged(); } -void X11EventSourceLibevent::OnFileCanReadWithoutBlocking(int fd) { +void X11EventSourceDefault::OnFileCanReadWithoutBlocking(int fd) { event_source_.DispatchXEvents(); } -void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { +void X11EventSourceDefault::OnFileCanWriteWithoutBlocking(int fd) { NOTREACHED(); } diff --git a/chromium/ui/events/platform/x11/x11_event_source_default.h b/chromium/ui/events/platform/x11/x11_event_source_default.h new file mode 100644 index 00000000000..58def8a3dea --- /dev/null +++ b/chromium/ui/events/platform/x11/x11_event_source_default.h @@ -0,0 +1,69 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_DEFAULT_H_ +#define UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_DEFAULT_H_ + +#include "base/macros.h" +#include "base/message_loop/message_pump_for_ui.h" +#include "ui/events/events_export.h" +#include "ui/events/platform/platform_event_source.h" +#include "ui/events/platform/x11/x11_event_source.h" + +namespace ui { + +// PlatformEventSource implementation which uses MessagePumpForUI::FdWatcher to +// be notified about incoming XEvents and converts XEvents to ui::Events before +// dispatching. For X11 specific events a separate list of XEventDispatchers is +// maintained. +class EVENTS_EXPORT X11EventSourceDefault + : public X11EventSourceDelegate, + public PlatformEventSource, + public base::MessagePumpForUI::FdWatcher { + public: + explicit X11EventSourceDefault(XDisplay* display); + ~X11EventSourceDefault() override; + + static X11EventSourceDefault* GetInstance(); + + // X11EventSourceDelegate: + void ProcessXEvent(XEvent* xevent) override; + void AddXEventDispatcher(XEventDispatcher* dispatcher) override; + void RemoveXEventDispatcher(XEventDispatcher* dispatcher) override; + + private: + // Registers event watcher with Libevent. + void AddEventWatcher(); + + // Tells XEventDispatchers, which can also have PlatformEventDispatchers, that + // a translated event is going to be sent next, then dispatches the event and + // notifies XEventDispatchers the event has been sent out and, most probably, + // consumed. + void DispatchPlatformEvent(const PlatformEvent& event, XEvent* xevent); + + // Sends XEvent to registered XEventDispatchers. + void DispatchXEventToXEventDispatchers(XEvent* xevent); + + // PlatformEventSource: + void StopCurrentEventStream() override; + void OnDispatcherListChanged() override; + + // base::MessagePumpForUI::FdWatcher: + void OnFileCanReadWithoutBlocking(int fd) override; + void OnFileCanWriteWithoutBlocking(int fd) override; + + X11EventSource event_source_; + + // Keep track of all XEventDispatcher to send XEvents directly to. + base::ObserverList<XEventDispatcher>::Unchecked dispatchers_xevent_; + + base::MessagePumpForUI::FdWatchController watcher_controller_; + bool initialized_ = false; + + DISALLOW_COPY_AND_ASSIGN(X11EventSourceDefault); +}; + +} // namespace ui + +#endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_DEFAULT_H_ diff --git a/chromium/ui/events/platform/x11/x11_event_source_glib.cc b/chromium/ui/events/platform/x11/x11_event_source_glib.cc index e82e4c652be..b4ad9be23f6 100644 --- a/chromium/ui/events/platform/x11/x11_event_source_glib.cc +++ b/chromium/ui/events/platform/x11/x11_event_source_glib.cc @@ -7,7 +7,6 @@ #include <glib.h> #include "ui/gfx/x/x11.h" - namespace ui { namespace { diff --git a/chromium/ui/ozone/platform/x11/gl_surface_glx_ozone.cc b/chromium/ui/ozone/platform/x11/gl_surface_glx_ozone.cc index a4be7c874e3..425519f9d28 100644 --- a/chromium/ui/ozone/platform/x11/gl_surface_glx_ozone.cc +++ b/chromium/ui/ozone/platform/x11/gl_surface_glx_ozone.cc @@ -16,7 +16,7 @@ GLSurfaceGLXOzone::~GLSurfaceGLXOzone() { } void GLSurfaceGLXOzone::RegisterEvents() { - auto* event_source = X11EventSourceLibevent::GetInstance(); + auto* event_source = X11EventSource::GetInstance(); // Can be null in tests, when we don't care about Exposes. if (event_source) { XSelectInput(gfx::GetXDisplay(), window(), ExposureMask); @@ -25,7 +25,7 @@ void GLSurfaceGLXOzone::RegisterEvents() { } void GLSurfaceGLXOzone::UnregisterEvents() { - auto* event_source = X11EventSourceLibevent::GetInstance(); + auto* event_source = X11EventSource::GetInstance(); if (event_source) event_source->RemoveXEventDispatcher(this); } diff --git a/chromium/ui/ozone/platform/x11/gl_surface_glx_ozone.h b/chromium/ui/ozone/platform/x11/gl_surface_glx_ozone.h index 0c468010cb4..84e60684150 100644 --- a/chromium/ui/ozone/platform/x11/gl_surface_glx_ozone.h +++ b/chromium/ui/ozone/platform/x11/gl_surface_glx_ozone.h @@ -6,7 +6,7 @@ #define UI_OZONE_PLATFORM_X11_GL_SURFACE_GLX_OZONE_H_ #include "base/macros.h" -#include "ui/events/platform/x11/x11_event_source_libevent.h" +#include "ui/events/platform/x11/x11_event_source.h" #include "ui/gl/gl_surface_glx.h" namespace ui { diff --git a/chromium/ui/ozone/platform/x11/ozone_platform_x11.cc b/chromium/ui/ozone/platform/x11/ozone_platform_x11.cc index ea33369f2e3..a70e2a30c6f 100644 --- a/chromium/ui/ozone/platform/x11/ozone_platform_x11.cc +++ b/chromium/ui/ozone/platform/x11/ozone_platform_x11.cc @@ -12,7 +12,7 @@ #include "ui/base/x/x11_util.h" #include "ui/display/manager/fake_display_delegate.h" #include "ui/events/devices/x11/touch_factory_x11.h" -#include "ui/events/platform/x11/x11_event_source_libevent.h" +#include "ui/events/platform/x11/x11_event_source_default.h" #include "ui/events/system_input_injector.h" #include "ui/gfx/x/x11.h" #include "ui/ozone/common/stub_overlay_manager.h" @@ -136,7 +136,7 @@ class OzonePlatformX11 : public OzonePlatform { return; XDisplay* display = gfx::GetXDisplay(); - event_source_ = std::make_unique<X11EventSourceLibevent>(display); + event_source_ = std::make_unique<X11EventSourceDefault>(display); } bool common_initialized_ = false; @@ -152,7 +152,7 @@ class OzonePlatformX11 : public OzonePlatform { std::unique_ptr<X11SurfaceFactory> surface_factory_ozone_; // Objects in both UI and GPU process. - std::unique_ptr<X11EventSourceLibevent> event_source_; + std::unique_ptr<X11EventSourceDefault> event_source_; DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); }; diff --git a/chromium/ui/ozone/platform/x11/x11_window_manager_ozone.cc b/chromium/ui/ozone/platform/x11/x11_window_manager_ozone.cc index 100bc2e793e..c17f9ae64a9 100644 --- a/chromium/ui/ozone/platform/x11/x11_window_manager_ozone.cc +++ b/chromium/ui/ozone/platform/x11/x11_window_manager_ozone.cc @@ -4,6 +4,7 @@ #include "ui/ozone/platform/x11/x11_window_manager_ozone.h" +#include "base/stl_util.h" #include "ui/ozone/platform/x11/x11_window_ozone.h" namespace ui { diff --git a/chromium/ui/ozone/platform/x11/x11_window_ozone.cc b/chromium/ui/ozone/platform/x11/x11_window_ozone.cc index c3f17315009..c62ed449d56 100644 --- a/chromium/ui/ozone/platform/x11/x11_window_ozone.cc +++ b/chromium/ui/ozone/platform/x11/x11_window_ozone.cc @@ -21,7 +21,7 @@ X11WindowOzone::X11WindowOzone(X11WindowManagerOzone* window_manager, const gfx::Rect& bounds) : X11WindowBase(delegate, bounds), window_manager_(window_manager) { DCHECK(window_manager); - auto* event_source = X11EventSourceLibevent::GetInstance(); + auto* event_source = X11EventSource::GetInstance(); if (event_source) event_source->AddXEventDispatcher(this); } @@ -31,7 +31,7 @@ X11WindowOzone::~X11WindowOzone() { } void X11WindowOzone::PrepareForShutdown() { - auto* event_source = X11EventSourceLibevent::GetInstance(); + auto* event_source = X11EventSource::GetInstance(); if (event_source) event_source->RemoveXEventDispatcher(this); } diff --git a/chromium/ui/ozone/platform/x11/x11_window_ozone.h b/chromium/ui/ozone/platform/x11/x11_window_ozone.h index e1586341f19..0efdc6b6286 100644 --- a/chromium/ui/ozone/platform/x11/x11_window_ozone.h +++ b/chromium/ui/ozone/platform/x11/x11_window_ozone.h @@ -7,7 +7,7 @@ #include "base/macros.h" #include "ui/events/platform/platform_event_dispatcher.h" -#include "ui/events/platform/x11/x11_event_source_libevent.h" +#include "ui/events/platform/x11/x11_event_source.h" #include "ui/platform_window/x11/x11_window_base.h" namespace ui { diff --git a/chromium/ui/ozone/platform/x11/x11_window_ozone_unittest.cc b/chromium/ui/ozone/platform/x11/x11_window_ozone_unittest.cc index 2a745701007..c7c794077c6 100644 --- a/chromium/ui/ozone/platform/x11/x11_window_ozone_unittest.cc +++ b/chromium/ui/ozone/platform/x11/x11_window_ozone_unittest.cc @@ -9,7 +9,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/devices/x11/touch_factory_x11.h" #include "ui/events/event.h" -#include "ui/events/platform/x11/x11_event_source_libevent.h" +#include "ui/events/platform/x11/x11_event_source_default.h" #include "ui/events/test/events_test_utils_x11.h" #include "ui/ozone/platform/x11/x11_window_manager_ozone.h" #include "ui/ozone/test/mock_platform_window_delegate.h" @@ -44,7 +44,7 @@ class X11WindowOzoneTest : public testing::Test { void SetUp() override { XDisplay* display = gfx::GetXDisplay(); - event_source_ = std::make_unique<X11EventSourceLibevent>(display); + event_source_ = std::make_unique<X11EventSourceDefault>(display); window_manager_ = std::make_unique<X11WindowManagerOzone>(); TouchFactory::GetInstance()->SetPointerDeviceForTest({kPointerDeviceId}); @@ -73,7 +73,7 @@ class X11WindowOzoneTest : public testing::Test { private: std::unique_ptr<base::test::ScopedTaskEnvironment> task_env_; std::unique_ptr<X11WindowManagerOzone> window_manager_; - std::unique_ptr<X11EventSourceLibevent> event_source_; + std::unique_ptr<X11EventSourceDefault> event_source_; DISALLOW_COPY_AND_ASSIGN(X11WindowOzoneTest); }; |