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

Side by Side Diff: components/exo/wayland/server.cc

Issue 1926523002: Rename gfx::Display/Screen to display::Display/Screen in components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « components/exo.gypi ('k') | components/metrics.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "components/exo/wayland/server.h" 5 #include "components/exo/wayland/server.h"
6 6
7 #include <grp.h> 7 #include <grp.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 #include <scaler-server-protocol.h> 9 #include <scaler-server-protocol.h>
10 #include <secure-output-unstable-v1-server-protocol.h> 10 #include <secure-output-unstable-v1-server-protocol.h>
11 #include <stddef.h> 11 #include <stddef.h>
12 #include <stdint.h> 12 #include <stdint.h>
13 #include <wayland-server-core.h> 13 #include <wayland-server-core.h>
14 #include <wayland-server-protocol-core.h> 14 #include <wayland-server-protocol-core.h>
15 #include <xdg-shell-unstable-v5-server-protocol.h> 15 #include <xdg-shell-unstable-v5-server-protocol.h>
16 16
17 #include <algorithm> 17 #include <algorithm>
18 #include <iterator> 18 #include <iterator>
19 #include <string> 19 #include <string>
20 #include <utility> 20 #include <utility>
21 21
22 #include "ash/display/display_info.h" 22 #include "ash/display/display_info.h"
23 #include "ash/display/display_manager.h" 23 #include "ash/display/display_manager.h"
24 #include "ash/display/screen_ash.h"
25 #include "ash/shell.h" 24 #include "ash/shell.h"
26 #include "base/bind.h" 25 #include "base/bind.h"
27 #include "base/cancelable_callback.h" 26 #include "base/cancelable_callback.h"
28 #include "base/files/file_path.h" 27 #include "base/files/file_path.h"
29 #include "base/macros.h" 28 #include "base/macros.h"
30 #include "base/memory/free_deleter.h" 29 #include "base/memory/free_deleter.h"
31 #include "base/memory/ptr_util.h" 30 #include "base/memory/ptr_util.h"
32 #include "base/strings/stringprintf.h" 31 #include "base/strings/stringprintf.h"
33 #include "base/strings/utf_string_conversions.h" 32 #include "base/strings/utf_string_conversions.h"
34 #include "components/exo/buffer.h" 33 #include "components/exo/buffer.h"
35 #include "components/exo/display.h" 34 #include "components/exo/display.h"
36 #include "components/exo/keyboard.h" 35 #include "components/exo/keyboard.h"
37 #include "components/exo/keyboard_delegate.h" 36 #include "components/exo/keyboard_delegate.h"
38 #include "components/exo/pointer.h" 37 #include "components/exo/pointer.h"
39 #include "components/exo/pointer_delegate.h" 38 #include "components/exo/pointer_delegate.h"
40 #include "components/exo/shared_memory.h" 39 #include "components/exo/shared_memory.h"
41 #include "components/exo/shell_surface.h" 40 #include "components/exo/shell_surface.h"
42 #include "components/exo/sub_surface.h" 41 #include "components/exo/sub_surface.h"
43 #include "components/exo/surface.h" 42 #include "components/exo/surface.h"
44 #include "components/exo/touch.h" 43 #include "components/exo/touch.h"
45 #include "components/exo/touch_delegate.h" 44 #include "components/exo/touch_delegate.h"
46 #include "ipc/unix_domain_socket_util.h" 45 #include "ipc/unix_domain_socket_util.h"
47 #include "third_party/skia/include/core/SkRegion.h" 46 #include "third_party/skia/include/core/SkRegion.h"
48 #include "ui/aura/window_property.h" 47 #include "ui/aura/window_property.h"
49 #include "ui/base/hit_test.h" 48 #include "ui/base/hit_test.h"
49 #include "ui/display/display_observer.h"
50 #include "ui/display/screen.h"
50 #include "ui/events/keycodes/dom/keycode_converter.h" 51 #include "ui/events/keycodes/dom/keycode_converter.h"
51 #include "ui/gfx/display_observer.h"
52 #include "ui/views/widget/widget.h" 52 #include "ui/views/widget/widget.h"
53 #include "ui/views/widget/widget_observer.h" 53 #include "ui/views/widget/widget_observer.h"
54 54
55 #if defined(USE_OZONE) 55 #if defined(USE_OZONE)
56 #include <drm_fourcc.h> 56 #include <drm_fourcc.h>
57 #include <linux-dmabuf-unstable-v1-server-protocol.h> 57 #include <linux-dmabuf-unstable-v1-server-protocol.h>
58 #include <wayland-drm-server-protocol.h> 58 #include <wayland-drm-server-protocol.h>
59 #endif 59 #endif
60 60
61 #if defined(USE_XKBCOMMON) 61 #if defined(USE_XKBCOMMON)
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 wl_resource* resource = 932 wl_resource* resource =
933 wl_resource_create(client, &wl_shell_interface, 1, id); 933 wl_resource_create(client, &wl_shell_interface, 1, id);
934 934
935 wl_resource_set_implementation(resource, &shell_implementation, data, 935 wl_resource_set_implementation(resource, &shell_implementation, data,
936 nullptr); 936 nullptr);
937 } 937 }
938 938
939 //////////////////////////////////////////////////////////////////////////////// 939 ////////////////////////////////////////////////////////////////////////////////
940 // wl_output_interface: 940 // wl_output_interface:
941 941
942 wl_output_transform OutputTransform(gfx::Display::Rotation rotation) { 942 wl_output_transform OutputTransform(display::Display::Rotation rotation) {
943 switch (rotation) { 943 switch (rotation) {
944 case gfx::Display::ROTATE_0: 944 case display::Display::ROTATE_0:
945 return WL_OUTPUT_TRANSFORM_NORMAL; 945 return WL_OUTPUT_TRANSFORM_NORMAL;
946 case gfx::Display::ROTATE_90: 946 case display::Display::ROTATE_90:
947 return WL_OUTPUT_TRANSFORM_90; 947 return WL_OUTPUT_TRANSFORM_90;
948 case gfx::Display::ROTATE_180: 948 case display::Display::ROTATE_180:
949 return WL_OUTPUT_TRANSFORM_180; 949 return WL_OUTPUT_TRANSFORM_180;
950 case gfx::Display::ROTATE_270: 950 case display::Display::ROTATE_270:
951 return WL_OUTPUT_TRANSFORM_270; 951 return WL_OUTPUT_TRANSFORM_270;
952 } 952 }
953 NOTREACHED(); 953 NOTREACHED();
954 return WL_OUTPUT_TRANSFORM_NORMAL; 954 return WL_OUTPUT_TRANSFORM_NORMAL;
955 } 955 }
956 956
957 class WaylandDisplayObserver : public gfx::DisplayObserver { 957 class WaylandDisplayObserver : public display::DisplayObserver {
958 public: 958 public:
959 WaylandDisplayObserver(const gfx::Display& display, 959 WaylandDisplayObserver(const display::Display& display,
960 wl_resource* output_resource) 960 wl_resource* output_resource)
961 : display_id_(display.id()), output_resource_(output_resource) { 961 : display_id_(display.id()), output_resource_(output_resource) {
962 gfx::Screen::GetScreen()->AddObserver(this); 962 display::Screen::GetScreen()->AddObserver(this);
963 SendDisplayMetrics(display); 963 SendDisplayMetrics(display);
964 } 964 }
965 ~WaylandDisplayObserver() override { 965 ~WaylandDisplayObserver() override {
966 gfx::Screen::GetScreen()->RemoveObserver(this); 966 display::Screen::GetScreen()->RemoveObserver(this);
967 } 967 }
968 968
969 // Overridden from gfx::DisplayObserver: 969 // Overridden from display::DisplayObserver:
970 void OnDisplayAdded(const gfx::Display& new_display) override {} 970 void OnDisplayAdded(const display::Display& new_display) override {}
971 void OnDisplayRemoved(const gfx::Display& new_display) override {} 971 void OnDisplayRemoved(const display::Display& new_display) override {}
972 void OnDisplayMetricsChanged(const gfx::Display& display, 972 void OnDisplayMetricsChanged(const display::Display& display,
973 uint32_t changed_metrics) override { 973 uint32_t changed_metrics) override {
974 if (display.id() != display_id_) 974 if (display.id() != display_id_)
975 return; 975 return;
976 976
977 if (changed_metrics & 977 if (changed_metrics &
978 (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR | 978 (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR |
979 DISPLAY_METRIC_ROTATION)) { 979 DISPLAY_METRIC_ROTATION)) {
980 SendDisplayMetrics(display); 980 SendDisplayMetrics(display);
981 } 981 }
982 } 982 }
983 983
984 private: 984 private:
985 void SendDisplayMetrics(const gfx::Display& display) { 985 void SendDisplayMetrics(const display::Display& display) {
986 const ash::DisplayInfo& info = 986 const ash::DisplayInfo& info =
987 ash::Shell::GetInstance()->display_manager()->GetDisplayInfo( 987 ash::Shell::GetInstance()->display_manager()->GetDisplayInfo(
988 display.id()); 988 display.id());
989 989
990 const float kInchInMm = 25.4f; 990 const float kInchInMm = 25.4f;
991 const char* kUnknownMake = "unknown"; 991 const char* kUnknownMake = "unknown";
992 const char* kUnknownModel = "unknown"; 992 const char* kUnknownModel = "unknown";
993 993
994 gfx::Rect bounds = info.bounds_in_native(); 994 gfx::Rect bounds = info.bounds_in_native();
995 wl_output_send_geometry( 995 wl_output_send_geometry(
(...skipping 28 matching lines...) Expand all
1024 DISALLOW_COPY_AND_ASSIGN(WaylandDisplayObserver); 1024 DISALLOW_COPY_AND_ASSIGN(WaylandDisplayObserver);
1025 }; 1025 };
1026 1026
1027 const uint32_t output_version = 2; 1027 const uint32_t output_version = 2;
1028 1028
1029 void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) { 1029 void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) {
1030 wl_resource* resource = wl_resource_create( 1030 wl_resource* resource = wl_resource_create(
1031 client, &wl_output_interface, std::min(version, output_version), id); 1031 client, &wl_output_interface, std::min(version, output_version), id);
1032 1032
1033 // TODO(reveman): Multi-display support. 1033 // TODO(reveman): Multi-display support.
1034 const gfx::Display& display = ash::Shell::GetInstance() 1034 const display::Display& display = ash::Shell::GetInstance()
1035 ->display_manager() 1035 ->display_manager()
1036 ->GetPrimaryDisplayCandidate(); 1036 ->GetPrimaryDisplayCandidate();
1037 1037
1038 SetImplementation( 1038 SetImplementation(
1039 resource, nullptr, 1039 resource, nullptr,
1040 base::WrapUnique(new WaylandDisplayObserver(display, resource))); 1040 base::WrapUnique(new WaylandDisplayObserver(display, resource)));
1041 } 1041 }
1042 1042
1043 //////////////////////////////////////////////////////////////////////////////// 1043 ////////////////////////////////////////////////////////////////////////////////
1044 // xdg_surface_interface: 1044 // xdg_surface_interface:
1045 1045
1046 int XdgResizeComponent(uint32_t edges) { 1046 int XdgResizeComponent(uint32_t edges) {
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 DCHECK(event_loop); 2141 DCHECK(event_loop);
2142 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 2142 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
2143 } 2143 }
2144 2144
2145 void Server::Flush() { 2145 void Server::Flush() {
2146 wl_display_flush_clients(wl_display_.get()); 2146 wl_display_flush_clients(wl_display_.get());
2147 } 2147 }
2148 2148
2149 } // namespace wayland 2149 } // namespace wayland
2150 } // namespace exo 2150 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo.gypi ('k') | components/metrics.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698