Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Side by Side Diff: ui/ozone/platform/wayland/wayland_connection.h

Issue 2027943002: [WIP] Make content_shell run under Wayland Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (09.28.2016)Rebase on master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_output.h"
15 #include "ui/ozone/platform/wayland/wayland_pointer.h" 15 #include "ui/ozone/platform/wayland/wayland_pointer.h"
16 #include "ui/ozone/public/ozone_platform_screen_delegate.h"
16 17
17 namespace ui { 18 namespace ui {
18 19
19 class WaylandWindow; 20 class WaylandWindow;
20 21
21 class WaylandConnection : public PlatformEventSource, 22 class WaylandConnection : public PlatformEventSource,
22 public base::MessagePumpLibevent::Watcher { 23 public base::MessagePumpLibevent::Watcher {
23 public: 24 public:
24 WaylandConnection(); 25 WaylandConnection();
25 ~WaylandConnection() override; 26 ~WaylandConnection() override;
26 27
27 bool Initialize(); 28 bool Initialize();
28 bool StartProcessingEvents(); 29 bool StartProcessingEvents();
30 static WaylandConnection* GetInstance() { return instance_; }
29 31
30 // Schedules a flush of the Wayland connection. 32 // Schedules a flush of the Wayland connection.
31 void ScheduleFlush(); 33 void ScheduleFlush();
32 34
33 wl_display* display() { return display_.get(); } 35 wl_display* display() { return display_.get(); }
34 wl_compositor* compositor() { return compositor_.get(); } 36 wl_compositor* compositor() { return compositor_.get(); }
35 wl_shm* shm() { return shm_.get(); } 37 wl_shm* shm() { return shm_.get(); }
36 xdg_shell* shell() { return shell_.get(); } 38 xdg_shell* shell() { return shell_.get(); }
37 39
38 WaylandWindow* GetWindow(gfx::AcceleratedWidget widget); 40 WaylandWindow* GetWindow(gfx::AcceleratedWidget widget);
39 void AddWindow(gfx::AcceleratedWidget widget, WaylandWindow* window); 41 void AddWindow(gfx::AcceleratedWidget widget, WaylandWindow* window);
40 void RemoveWindow(gfx::AcceleratedWidget widget); 42 void RemoveWindow(gfx::AcceleratedWidget widget);
41 43
42 const std::vector<std::unique_ptr<WaylandOutput>>& GetOutputList() const; 44 const std::vector<std::unique_ptr<WaylandOutput>>& GetOutputList() const;
43 WaylandOutput* PrimaryOutput() const; 45 WaylandOutput* PrimaryOutput() const;
46 void SetOutputObserver(OzonePlatformScreenDelegate*);
47 void OnOutputGeometryChanged(int32_t name, const gfx::Rect&);
44 48
45 private: 49 private:
46 void Flush(); 50 void Flush();
47 void DispatchUiEvent(Event* event); 51 void DispatchUiEvent(Event* event);
48 52
49 // PlatformEventSource 53 // PlatformEventSource
50 void OnDispatcherListChanged() override; 54 void OnDispatcherListChanged() override;
51 55
52 // base::MessagePumpLibevent::Watcher 56 // base::MessagePumpLibevent::Watcher
53 void OnFileCanReadWithoutBlocking(int fd) override; 57 void OnFileCanReadWithoutBlocking(int fd) override;
54 void OnFileCanWriteWithoutBlocking(int fd) override; 58 void OnFileCanWriteWithoutBlocking(int fd) override;
55 59
56 // wl_registry_listener 60 // wl_registry_listener
57 static void Global(void* data, 61 static void Global(void* data,
58 wl_registry* registry, 62 wl_registry* registry,
59 uint32_t name, 63 uint32_t name,
60 const char* interface, 64 const char* interface,
61 uint32_t version); 65 uint32_t version);
62 static void GlobalRemove(void* data, wl_registry* registry, uint32_t name); 66 static void GlobalRemove(void* data, wl_registry* registry, uint32_t name);
63 67
64 // wl_seat_listener 68 // wl_seat_listener
65 static void Capabilities(void* data, wl_seat* seat, uint32_t capabilities); 69 static void Capabilities(void* data, wl_seat* seat, uint32_t capabilities);
66 static void Name(void* data, wl_seat* seat, const char* name); 70 static void Name(void* data, wl_seat* seat, const char* name);
67 71
68 // xdg_shell_listener 72 // xdg_shell_listener
69 static void Ping(void* data, xdg_shell* shell, uint32_t serial); 73 static void Ping(void* data, xdg_shell* shell, uint32_t serial);
70 74
71 std::map<gfx::AcceleratedWidget, WaylandWindow*> window_map_; 75 std::map<gfx::AcceleratedWidget, WaylandWindow*> window_map_;
76 static WaylandConnection* instance_;
72 77
73 wl::Object<wl_display> display_; 78 wl::Object<wl_display> display_;
74 wl::Object<wl_registry> registry_; 79 wl::Object<wl_registry> registry_;
75 wl::Object<wl_compositor> compositor_; 80 wl::Object<wl_compositor> compositor_;
76 wl::Object<wl_seat> seat_; 81 wl::Object<wl_seat> seat_;
77 wl::Object<wl_shm> shm_; 82 wl::Object<wl_shm> shm_;
78 wl::Object<xdg_shell> shell_; 83 wl::Object<xdg_shell> shell_;
79 84
80 std::unique_ptr<WaylandPointer> pointer_; 85 std::unique_ptr<WaylandPointer> pointer_;
81 86
82 bool scheduled_flush_ = false; 87 bool scheduled_flush_ = false;
83 bool watching_ = false; 88 bool watching_ = false;
84 base::MessagePumpLibevent::FileDescriptorWatcher controller_; 89 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
85 90
86 std::vector<std::unique_ptr<WaylandOutput>> output_list_; 91 std::vector<std::unique_ptr<WaylandOutput>> output_list_;
92 OzonePlatformScreenDelegate* output_observer_;
87 93
88 DISALLOW_COPY_AND_ASSIGN(WaylandConnection); 94 DISALLOW_COPY_AND_ASSIGN(WaylandConnection);
89 }; 95 };
90 96
91 } // namespace ui 97 } // namespace ui
92 98
93 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_CONNECTION_H_ 99 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_CONNECTION_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/wayland/ozone_platform_wayland.cc ('k') | ui/ozone/platform/wayland/wayland_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698