Chromium Code Reviews| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 161 // A property key containing a boolean set to true whether the current |
| 162 // OnWindowActivated invocation should be ignored. | 162 // OnWindowActivated invocation should be ignored. |
| 163 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIgnoreWindowActivated, false); | 163 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIgnoreWindowActivated, true); |
| 164 | 164 |
| 165 wl_resource* GetSurfaceResource(Surface* surface) { | 165 wl_resource* GetSurfaceResource(Surface* surface) { |
| 166 return surface->GetProperty(kSurfaceResourceKey); | 166 return surface->GetProperty(kSurfaceResourceKey); |
| 167 } | 167 } |
| 168 | 168 |
| 169 //////////////////////////////////////////////////////////////////////////////// | 169 //////////////////////////////////////////////////////////////////////////////// |
| 170 // wl_buffer_interface: | 170 // wl_buffer_interface: |
| 171 | 171 |
| 172 void buffer_destroy(wl_client* client, wl_resource* resource) { | 172 void buffer_destroy(wl_client* client, wl_resource* resource) { |
| 173 wl_resource_destroy(resource); | 173 wl_resource_destroy(resource); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 | 248 |
| 249 void surface_set_input_region(wl_client* client, | 249 void surface_set_input_region(wl_client* client, |
| 250 wl_resource* resource, | 250 wl_resource* resource, |
| 251 wl_resource* region_resource) { | 251 wl_resource* region_resource) { |
| 252 GetUserDataAs<Surface>(resource)->SetInputRegion( | 252 GetUserDataAs<Surface>(resource)->SetInputRegion( |
| 253 region_resource ? *GetUserDataAs<SkRegion>(region_resource) | 253 region_resource ? *GetUserDataAs<SkRegion>(region_resource) |
| 254 : SkRegion(SkIRect::MakeLargest())); | 254 : SkRegion(SkIRect::MakeLargest())); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void surface_commit(wl_client* client, wl_resource* resource) { | 257 void surface_commit(wl_client* client, wl_resource* resource) { |
| 258 GetUserDataAs<Surface>(resource)->Commit(); | 258 Surface* surface = GetUserDataAs<Surface>(resource); |
| 259 surface->Commit(); | |
| 260 // Enable the activation event on the shell surface's window. | |
| 261 aura::Window* window = surface->window()->parent(); | |
| 262 if (!window) { | |
| 263 return; | |
| 264 } | |
| 265 Surface* main_surface = ShellSurface::GetMainSurface(window); | |
| 266 if (main_surface) { | |
| 267 if (window->GetProperty(kIgnoreWindowActivated)) { | |
| 268 window->SetProperty(kIgnoreWindowActivated, false); | |
|
reveman
2017/05/05 18:04:29
Can we use an aura::WindowObserver for this instea
oshima
2017/05/05 23:09:33
The window becomes visible before being activated
| |
| 269 } | |
| 270 } | |
| 259 } | 271 } |
| 260 | 272 |
| 261 void surface_set_buffer_transform(wl_client* client, | 273 void surface_set_buffer_transform(wl_client* client, |
| 262 wl_resource* resource, | 274 wl_resource* resource, |
| 263 int transform) { | 275 int transform) { |
| 264 NOTIMPLEMENTED(); | 276 NOTIMPLEMENTED(); |
| 265 } | 277 } |
| 266 | 278 |
| 267 void surface_set_buffer_scale(wl_client* client, | 279 void surface_set_buffer_scale(wl_client* client, |
| 268 wl_resource* resource, | 280 wl_resource* resource, |
| (...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1929 | 1941 |
| 1930 void remote_surface_activate(wl_client* client, | 1942 void remote_surface_activate(wl_client* client, |
| 1931 wl_resource* resource, | 1943 wl_resource* resource, |
| 1932 uint32_t serial) { | 1944 uint32_t serial) { |
| 1933 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); | 1945 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 1934 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); | 1946 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); |
| 1935 | 1947 |
| 1936 // Activation on Aura is synchronous, so activation callbacks will be called | 1948 // Activation on Aura is synchronous, so activation callbacks will be called |
| 1937 // before the flag is reset. | 1949 // before the flag is reset. |
| 1938 window->SetProperty(kIgnoreWindowActivated, true); | 1950 window->SetProperty(kIgnoreWindowActivated, true); |
| 1939 GetUserDataAs<ShellSurface>(resource)->Activate(); | 1951 shell_surface->Activate(); |
| 1940 window->ClearProperty(kIgnoreWindowActivated); | 1952 window->SetProperty(kIgnoreWindowActivated, false); |
|
oshima
2017/05/05 23:09:33
we still need this because activation may fail
| |
| 1941 } | 1953 } |
| 1942 | 1954 |
| 1943 void remote_surface_maximize(wl_client* client, wl_resource* resource) { | 1955 void remote_surface_maximize(wl_client* client, wl_resource* resource) { |
| 1944 GetUserDataAs<ShellSurface>(resource)->Maximize(); | 1956 GetUserDataAs<ShellSurface>(resource)->Maximize(); |
| 1945 } | 1957 } |
| 1946 | 1958 |
| 1947 void remote_surface_minimize(wl_client* client, wl_resource* resource) { | 1959 void remote_surface_minimize(wl_client* client, wl_resource* resource) { |
| 1948 GetUserDataAs<ShellSurface>(resource)->Minimize(); | 1960 GetUserDataAs<ShellSurface>(resource)->Minimize(); |
| 1949 } | 1961 } |
| 1950 | 1962 |
| (...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3956 DCHECK(event_loop); | 3968 DCHECK(event_loop); |
| 3957 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3969 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3958 } | 3970 } |
| 3959 | 3971 |
| 3960 void Server::Flush() { | 3972 void Server::Flush() { |
| 3961 wl_display_flush_clients(wl_display_.get()); | 3973 wl_display_flush_clients(wl_display_.get()); |
| 3962 } | 3974 } |
| 3963 | 3975 |
| 3964 } // namespace wayland | 3976 } // namespace wayland |
| 3965 } // namespace exo | 3977 } // namespace exo |
| OLD | NEW |