Chromium Code Reviews| Index: ui/ozone/platform/wayland/wayland_display.h |
| diff --git a/ui/ozone/platform/wayland/wayland_display.h b/ui/ozone/platform/wayland/wayland_display.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..14041d2101d4632318447e675a7cbc1480f05937 |
| --- /dev/null |
| +++ b/ui/ozone/platform/wayland/wayland_display.h |
| @@ -0,0 +1,72 @@ |
| +// 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_OZONE_PLATFORM_WAYLAND_WAYLAND_DISPLAY_H_ |
| +#define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_DISPLAY_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/message_loop/message_pump_libevent.h" |
| +#include "ui/events/platform/platform_event_source.h" |
| +#include "ui/gfx/native_widget_types.h" |
| +#include "ui/ozone/platform/wayland/wayland_object.h" |
| + |
| +namespace ui { |
| + |
| +class WaylandWindow; |
| + |
| +class WaylandDisplay : public PlatformEventSource, |
| + public base::MessagePumpLibevent::Watcher { |
| + public: |
| + WaylandDisplay(); |
| + ~WaylandDisplay() override; |
| + |
| + bool Initialize(); |
| + |
| + // Flushes the Wayland connection. |
| + void Flush(); |
| + |
| + wl_compositor* GetCompositor(); |
| + wl_shm* GetShm(); |
| + xdg_shell* GetShell(); |
|
spang
2016/01/22 23:42:32
These one line assessors should all named in unix_
Michael Forney
2016/01/23 01:08:05
Done.
|
| + |
| + WaylandWindow* GetWindow(gfx::AcceleratedWidget widget); |
| + void AddWindow(WaylandWindow* window); |
| + void RemoveWindow(WaylandWindow* window); |
| + |
| + void StartProcessingEvents(); |
| + |
| + private: |
| + // base::MessagePumpLibevent::Watcher |
| + void OnFileCanReadWithoutBlocking(int fd) override; |
| + void OnFileCanWriteWithoutBlocking(int fd) override; |
| + |
| + // wl_registry_listener |
| + static void Global(void* data, |
| + wl_registry* registry, |
| + uint32_t name, |
| + const char* interface, |
| + uint32_t version); |
| + static void GlobalRemove(void* data, wl_registry* registry, uint32_t name); |
| + |
| + // xdg_shell_listener |
| + static void Ping(void* data, xdg_shell* shell, uint32_t serial); |
| + |
| + std::map<gfx::AcceleratedWidget, WaylandWindow*> windows_; |
| + |
| + wl::Object<wl_display> display_; |
| + wl::Object<wl_registry> registry_; |
| + wl::Object<wl_compositor> compositor_; |
| + wl::Object<wl_shm> shm_; |
| + wl::Object<xdg_shell> shell_; |
| + |
| + bool watching_ = false; |
| + base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WaylandDisplay); |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_DISPLAY_H_ |