| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_CONNECTION_H_ | 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_CONNECTION_H_ |
| 6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_CONNECTION_H_ | 6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/message_loop/message_pump_libevent.h" | 10 #include "base/message_loop/message_pump_libevent.h" |
| 11 #include "ui/events/platform/platform_event_source.h" | 11 #include "ui/events/platform/platform_event_source.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/ozone/platform/wayland/wayland_object.h" | 13 #include "ui/ozone/platform/wayland/wayland_object.h" |
| 14 #include "ui/ozone/platform/wayland/wayland_output.h" |
| 14 #include "ui/ozone/platform/wayland/wayland_pointer.h" | 15 #include "ui/ozone/platform/wayland/wayland_pointer.h" |
| 15 | 16 |
| 16 namespace ui { | 17 namespace ui { |
| 17 | 18 |
| 18 class WaylandWindow; | 19 class WaylandWindow; |
| 19 | 20 |
| 20 class WaylandConnection : public PlatformEventSource, | 21 class WaylandConnection : public PlatformEventSource, |
| 21 public base::MessagePumpLibevent::Watcher { | 22 public base::MessagePumpLibevent::Watcher { |
| 22 public: | 23 public: |
| 23 WaylandConnection(); | 24 WaylandConnection(); |
| 24 ~WaylandConnection() override; | 25 ~WaylandConnection() override; |
| 25 | 26 |
| 26 bool Initialize(); | 27 bool Initialize(); |
| 27 bool StartProcessingEvents(); | 28 bool StartProcessingEvents(); |
| 28 | 29 |
| 29 // Schedules a flush of the Wayland connection. | 30 // Schedules a flush of the Wayland connection. |
| 30 void ScheduleFlush(); | 31 void ScheduleFlush(); |
| 31 | 32 |
| 32 wl_display* display() { return display_.get(); } | 33 wl_display* display() { return display_.get(); } |
| 33 wl_compositor* compositor() { return compositor_.get(); } | 34 wl_compositor* compositor() { return compositor_.get(); } |
| 34 wl_shm* shm() { return shm_.get(); } | 35 wl_shm* shm() { return shm_.get(); } |
| 35 xdg_shell* shell() { return shell_.get(); } | 36 xdg_shell* shell() { return shell_.get(); } |
| 36 | 37 |
| 37 WaylandWindow* GetWindow(gfx::AcceleratedWidget widget); | 38 WaylandWindow* GetWindow(gfx::AcceleratedWidget widget); |
| 38 void AddWindow(gfx::AcceleratedWidget widget, WaylandWindow* window); | 39 void AddWindow(gfx::AcceleratedWidget widget, WaylandWindow* window); |
| 39 void RemoveWindow(gfx::AcceleratedWidget widget); | 40 void RemoveWindow(gfx::AcceleratedWidget widget); |
| 40 | 41 |
| 42 const std::vector<std::unique_ptr<WaylandOutput>>& GetOutputList() const; |
| 43 WaylandOutput* PrimaryOutput() const; |
| 44 |
| 41 private: | 45 private: |
| 42 void Flush(); | 46 void Flush(); |
| 43 void DispatchUiEvent(Event* event); | 47 void DispatchUiEvent(Event* event); |
| 44 | 48 |
| 45 // PlatformEventSource | 49 // PlatformEventSource |
| 46 void OnDispatcherListChanged() override; | 50 void OnDispatcherListChanged() override; |
| 47 | 51 |
| 48 // base::MessagePumpLibevent::Watcher | 52 // base::MessagePumpLibevent::Watcher |
| 49 void OnFileCanReadWithoutBlocking(int fd) override; | 53 void OnFileCanReadWithoutBlocking(int fd) override; |
| 50 void OnFileCanWriteWithoutBlocking(int fd) override; | 54 void OnFileCanWriteWithoutBlocking(int fd) override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 72 wl::Object<wl_seat> seat_; | 76 wl::Object<wl_seat> seat_; |
| 73 wl::Object<wl_shm> shm_; | 77 wl::Object<wl_shm> shm_; |
| 74 wl::Object<xdg_shell> shell_; | 78 wl::Object<xdg_shell> shell_; |
| 75 | 79 |
| 76 std::unique_ptr<WaylandPointer> pointer_; | 80 std::unique_ptr<WaylandPointer> pointer_; |
| 77 | 81 |
| 78 bool scheduled_flush_ = false; | 82 bool scheduled_flush_ = false; |
| 79 bool watching_ = false; | 83 bool watching_ = false; |
| 80 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 84 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
| 81 | 85 |
| 86 std::vector<std::unique_ptr<WaylandOutput>> output_list_; |
| 87 |
| 82 DISALLOW_COPY_AND_ASSIGN(WaylandConnection); | 88 DISALLOW_COPY_AND_ASSIGN(WaylandConnection); |
| 83 }; | 89 }; |
| 84 | 90 |
| 85 } // namespace ui | 91 } // namespace ui |
| 86 | 92 |
| 87 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_CONNECTION_H_ | 93 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_CONNECTION_H_ |
| OLD | NEW |