| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasViewportKey, false); | 151 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasViewportKey, false); |
| 152 | 152 |
| 153 // A property key containing a boolean set to true if a security object is | 153 // A property key containing a boolean set to true if a security object is |
| 154 // associated with window. | 154 // associated with window. |
| 155 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasSecurityKey, false); | 155 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasSecurityKey, false); |
| 156 | 156 |
| 157 // A property key containing a boolean set to true if a blending object is | 157 // A property key containing a boolean set to true if a blending object is |
| 158 // associated with window. | 158 // associated with window. |
| 159 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasBlendingKey, false); | 159 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasBlendingKey, false); |
| 160 | 160 |
| 161 // A property key containing a boolean set to true whether the current |
| 162 // OnWindowActivated invocation should be ignored. |
| 163 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIgnoreWindowActivated, false); |
| 164 |
| 161 wl_resource* GetSurfaceResource(Surface* surface) { | 165 wl_resource* GetSurfaceResource(Surface* surface) { |
| 162 return surface->GetProperty(kSurfaceResourceKey); | 166 return surface->GetProperty(kSurfaceResourceKey); |
| 163 } | 167 } |
| 164 | 168 |
| 165 //////////////////////////////////////////////////////////////////////////////// | 169 //////////////////////////////////////////////////////////////////////////////// |
| 166 // wl_buffer_interface: | 170 // wl_buffer_interface: |
| 167 | 171 |
| 168 void buffer_destroy(wl_client* client, wl_resource* resource) { | 172 void buffer_destroy(wl_client* client, wl_resource* resource) { |
| 169 wl_resource_destroy(resource); | 173 wl_resource_destroy(resource); |
| 170 } | 174 } |
| (...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 | 1923 |
| 1920 void remote_surface_set_top_inset(wl_client* client, | 1924 void remote_surface_set_top_inset(wl_client* client, |
| 1921 wl_resource* resource, | 1925 wl_resource* resource, |
| 1922 int32_t height) { | 1926 int32_t height) { |
| 1923 GetUserDataAs<ShellSurface>(resource)->SetTopInset(height); | 1927 GetUserDataAs<ShellSurface>(resource)->SetTopInset(height); |
| 1924 } | 1928 } |
| 1925 | 1929 |
| 1926 void remote_surface_activate(wl_client* client, | 1930 void remote_surface_activate(wl_client* client, |
| 1927 wl_resource* resource, | 1931 wl_resource* resource, |
| 1928 uint32_t serial) { | 1932 uint32_t serial) { |
| 1933 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 1934 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); |
| 1935 |
| 1936 // Activation on Aura is synchronous, so activation callbacks will be called |
| 1937 // before the flag is reset. |
| 1938 window->SetProperty(kIgnoreWindowActivated, true); |
| 1929 GetUserDataAs<ShellSurface>(resource)->Activate(); | 1939 GetUserDataAs<ShellSurface>(resource)->Activate(); |
| 1940 window->ClearProperty(kIgnoreWindowActivated); |
| 1930 } | 1941 } |
| 1931 | 1942 |
| 1932 void remote_surface_maximize(wl_client* client, wl_resource* resource) { | 1943 void remote_surface_maximize(wl_client* client, wl_resource* resource) { |
| 1933 GetUserDataAs<ShellSurface>(resource)->Maximize(); | 1944 GetUserDataAs<ShellSurface>(resource)->Maximize(); |
| 1934 } | 1945 } |
| 1935 | 1946 |
| 1936 void remote_surface_minimize(wl_client* client, wl_resource* resource) { | 1947 void remote_surface_minimize(wl_client* client, wl_resource* resource) { |
| 1937 GetUserDataAs<ShellSurface>(resource)->Minimize(); | 1948 GetUserDataAs<ShellSurface>(resource)->Minimize(); |
| 1938 } | 1949 } |
| 1939 | 1950 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2114 } | 2125 } |
| 2115 void OnMaximizeModeEnding() override { | 2126 void OnMaximizeModeEnding() override { |
| 2116 layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; | 2127 layout_mode_ = ZCR_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED; |
| 2117 ScheduleSendDisplayMetrics(kConfigureDelayAfterLayoutSwitchMs); | 2128 ScheduleSendDisplayMetrics(kConfigureDelayAfterLayoutSwitchMs); |
| 2118 } | 2129 } |
| 2119 void OnMaximizeModeEnded() override {} | 2130 void OnMaximizeModeEnded() override {} |
| 2120 | 2131 |
| 2121 // Overridden from WMHelper::ActivationObserver: | 2132 // Overridden from WMHelper::ActivationObserver: |
| 2122 void OnWindowActivated(aura::Window* gained_active, | 2133 void OnWindowActivated(aura::Window* gained_active, |
| 2123 aura::Window* lost_active) override { | 2134 aura::Window* lost_active) override { |
| 2135 // If the origin of activation is Wayland client, then assume it's been |
| 2136 // already activated on the client side, so do not notify about the |
| 2137 // activation. It means that zcr_remote_shell_v1_send_activated is used |
| 2138 // only to notify about activations originating in Aura. |
| 2139 if (gained_active && gained_active->GetProperty(kIgnoreWindowActivated)) |
| 2140 return; |
| 2141 |
| 2124 SendActivated(gained_active, lost_active); | 2142 SendActivated(gained_active, lost_active); |
| 2125 } | 2143 } |
| 2126 | 2144 |
| 2127 private: | 2145 private: |
| 2128 void ScheduleSendDisplayMetrics(int delay_ms) { | 2146 void ScheduleSendDisplayMetrics(int delay_ms) { |
| 2129 needs_send_display_metrics_ = true; | 2147 needs_send_display_metrics_ = true; |
| 2130 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 2148 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 2131 FROM_HERE, base::Bind(&WaylandRemoteShell::SendDisplayMetrics, | 2149 FROM_HERE, base::Bind(&WaylandRemoteShell::SendDisplayMetrics, |
| 2132 weak_ptr_factory_.GetWeakPtr()), | 2150 weak_ptr_factory_.GetWeakPtr()), |
| 2133 base::TimeDelta::FromMilliseconds(delay_ms)); | 2151 base::TimeDelta::FromMilliseconds(delay_ms)); |
| (...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3926 DCHECK(event_loop); | 3944 DCHECK(event_loop); |
| 3927 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3945 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3928 } | 3946 } |
| 3929 | 3947 |
| 3930 void Server::Flush() { | 3948 void Server::Flush() { |
| 3931 wl_display_flush_clients(wl_display_.get()); | 3949 wl_display_flush_clients(wl_display_.get()); |
| 3932 } | 3950 } |
| 3933 | 3951 |
| 3934 } // namespace wayland | 3952 } // namespace wayland |
| 3935 } // namespace exo | 3953 } // namespace exo |
| OLD | NEW |