OLD | NEW |
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 <alpha-compositing-unstable-v1-server-protocol.h> | 7 #include <alpha-compositing-unstable-v1-server-protocol.h> |
8 #include <gaming-input-unstable-v1-server-protocol.h> | 8 #include <gaming-input-unstable-v1-server-protocol.h> |
9 #include <gaming-input-unstable-v2-server-protocol.h> | 9 #include <gaming-input-unstable-v2-server-protocol.h> |
10 #include <grp.h> | 10 #include <grp.h> |
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 } | 2061 } |
2062 | 2062 |
2063 const struct zcr_notification_surface_v1_interface | 2063 const struct zcr_notification_surface_v1_interface |
2064 notification_surface_implementation = {notification_surface_destroy}; | 2064 notification_surface_implementation = {notification_surface_destroy}; |
2065 | 2065 |
2066 //////////////////////////////////////////////////////////////////////////////// | 2066 //////////////////////////////////////////////////////////////////////////////// |
2067 // remote_shell_interface: | 2067 // remote_shell_interface: |
2068 | 2068 |
2069 // Implements remote shell interface and monitors workspace state needed | 2069 // Implements remote shell interface and monitors workspace state needed |
2070 // for the remote shell interface. | 2070 // for the remote shell interface. |
2071 class WaylandRemoteShell : public WMHelper::MaximizeModeObserver, | 2071 class WaylandRemoteShell : public WMHelper::TabletModeObserver, |
2072 public WMHelper::ActivationObserver, | 2072 public WMHelper::ActivationObserver, |
2073 public display::DisplayObserver { | 2073 public display::DisplayObserver { |
2074 public: | 2074 public: |
2075 WaylandRemoteShell(Display* display, wl_resource* remote_shell_resource) | 2075 WaylandRemoteShell(Display* display, wl_resource* remote_shell_resource) |
2076 : display_(display), | 2076 : display_(display), |
2077 remote_shell_resource_(remote_shell_resource), | 2077 remote_shell_resource_(remote_shell_resource), |
2078 weak_ptr_factory_(this) { | 2078 weak_ptr_factory_(this) { |
2079 auto* helper = WMHelper::GetInstance(); | 2079 auto* helper = WMHelper::GetInstance(); |
2080 helper->AddMaximizeModeObserver(this); | 2080 helper->AddTabletModeObserver(this); |
2081 helper->AddActivationObserver(this); | 2081 helper->AddActivationObserver(this); |
2082 display::Screen::GetScreen()->AddObserver(this); | 2082 display::Screen::GetScreen()->AddObserver(this); |
2083 | 2083 |
2084 layout_mode_ = helper->IsMaximizeModeWindowManagerEnabled() | 2084 layout_mode_ = helper->IsTabletModeWindowManagerEnabled() |
2085 ? ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET | 2085 ? ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET |
2086 : ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; | 2086 : ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; |
2087 | 2087 |
2088 SendDisplayMetrics(); | 2088 SendDisplayMetrics(); |
2089 SendActivated(helper->GetActiveWindow(), nullptr); | 2089 SendActivated(helper->GetActiveWindow(), nullptr); |
2090 } | 2090 } |
2091 ~WaylandRemoteShell() override { | 2091 ~WaylandRemoteShell() override { |
2092 auto* helper = WMHelper::GetInstance(); | 2092 auto* helper = WMHelper::GetInstance(); |
2093 helper->RemoveMaximizeModeObserver(this); | 2093 helper->RemoveTabletModeObserver(this); |
2094 helper->RemoveActivationObserver(this); | 2094 helper->RemoveActivationObserver(this); |
2095 display::Screen::GetScreen()->RemoveObserver(this); | 2095 display::Screen::GetScreen()->RemoveObserver(this); |
2096 } | 2096 } |
2097 | 2097 |
2098 bool IsMultiDisplaySupported() const { | 2098 bool IsMultiDisplaySupported() const { |
2099 return wl_resource_get_version(remote_shell_resource_) >= 5; | 2099 return wl_resource_get_version(remote_shell_resource_) >= 5; |
2100 } | 2100 } |
2101 | 2101 |
2102 std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface, | 2102 std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface, |
2103 int container) { | 2103 int container) { |
(...skipping 26 matching lines...) Expand all Loading... |
2130 // No need to update when a primary display has changed without bounds | 2130 // No need to update when a primary display has changed without bounds |
2131 // change. See WaylandPrimaryDisplayObserver::OnDisplayMetricsChanged | 2131 // change. See WaylandPrimaryDisplayObserver::OnDisplayMetricsChanged |
2132 // for more details. | 2132 // for more details. |
2133 if (changed_metrics & | 2133 if (changed_metrics & |
2134 (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR | | 2134 (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR | |
2135 DISPLAY_METRIC_ROTATION | DISPLAY_METRIC_WORK_AREA)) { | 2135 DISPLAY_METRIC_ROTATION | DISPLAY_METRIC_WORK_AREA)) { |
2136 ScheduleSendDisplayMetrics(0); | 2136 ScheduleSendDisplayMetrics(0); |
2137 } | 2137 } |
2138 } | 2138 } |
2139 | 2139 |
2140 // Overridden from WMHelper::MaximizeModeObserver: | 2140 // Overridden from WMHelper::TabletModeObserver: |
2141 void OnMaximizeModeStarted() override { | 2141 void OnTabletModeStarted() override { |
2142 layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET; | 2142 layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET; |
2143 ScheduleSendDisplayMetrics(kConfigureDelayAfterLayoutSwitchMs); | 2143 ScheduleSendDisplayMetrics(kConfigureDelayAfterLayoutSwitchMs); |
2144 } | 2144 } |
2145 void OnMaximizeModeEnding() override { | 2145 void OnTabletModeEnding() override { |
2146 layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; | 2146 layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; |
2147 ScheduleSendDisplayMetrics(kConfigureDelayAfterLayoutSwitchMs); | 2147 ScheduleSendDisplayMetrics(kConfigureDelayAfterLayoutSwitchMs); |
2148 } | 2148 } |
2149 void OnMaximizeModeEnded() override {} | 2149 void OnTabletModeEnded() override {} |
2150 | 2150 |
2151 // Overridden from WMHelper::ActivationObserver: | 2151 // Overridden from WMHelper::ActivationObserver: |
2152 void OnWindowActivated(aura::Window* gained_active, | 2152 void OnWindowActivated(aura::Window* gained_active, |
2153 aura::Window* lost_active) override { | 2153 aura::Window* lost_active) override { |
2154 // If the origin of activation is Wayland client, then assume it's been | 2154 // If the origin of activation is Wayland client, then assume it's been |
2155 // already activated on the client side, so do not notify about the | 2155 // already activated on the client side, so do not notify about the |
2156 // activation. It means that zcr_remote_shell_v1_send_activated is used | 2156 // activation. It means that zcr_remote_shell_v1_send_activated is used |
2157 // only to notify about activations originating in Aura. | 2157 // only to notify about activations originating in Aura. |
2158 if (gained_active && ShellSurface::GetMainSurface(gained_active) && | 2158 if (gained_active && ShellSurface::GetMainSurface(gained_active) && |
2159 gained_active->GetProperty(kIgnoreWindowActivated)) { | 2159 gained_active->GetProperty(kIgnoreWindowActivated)) { |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4043 DCHECK(event_loop); | 4043 DCHECK(event_loop); |
4044 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 4044 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
4045 } | 4045 } |
4046 | 4046 |
4047 void Server::Flush() { | 4047 void Server::Flush() { |
4048 wl_display_flush_clients(wl_display_.get()); | 4048 wl_display_flush_clients(wl_display_.get()); |
4049 } | 4049 } |
4050 | 4050 |
4051 } // namespace wayland | 4051 } // namespace wayland |
4052 } // namespace exo | 4052 } // namespace exo |
OLD | NEW |