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

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

Issue 2855883009: Don't send activation event when created (Closed)
Patch Set: a better way Created 3 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 | « no previous file | no next file » | 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 <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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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. The defualt is true
163 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIgnoreWindowActivated, false); 163 // to ignore the activation event originated by creation.
164 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIgnoreWindowActivated, true);
164 165
165 wl_resource* GetSurfaceResource(Surface* surface) { 166 wl_resource* GetSurfaceResource(Surface* surface) {
166 return surface->GetProperty(kSurfaceResourceKey); 167 return surface->GetProperty(kSurfaceResourceKey);
167 } 168 }
168 169
169 //////////////////////////////////////////////////////////////////////////////// 170 ////////////////////////////////////////////////////////////////////////////////
170 // wl_buffer_interface: 171 // wl_buffer_interface:
171 172
172 void buffer_destroy(wl_client* client, wl_resource* resource) { 173 void buffer_destroy(wl_client* client, wl_resource* resource) {
173 wl_resource_destroy(resource); 174 wl_resource_destroy(resource);
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 1930
1930 void remote_surface_activate(wl_client* client, 1931 void remote_surface_activate(wl_client* client,
1931 wl_resource* resource, 1932 wl_resource* resource,
1932 uint32_t serial) { 1933 uint32_t serial) {
1933 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); 1934 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource);
1934 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); 1935 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
1935 1936
1936 // Activation on Aura is synchronous, so activation callbacks will be called 1937 // Activation on Aura is synchronous, so activation callbacks will be called
1937 // before the flag is reset. 1938 // before the flag is reset.
1938 window->SetProperty(kIgnoreWindowActivated, true); 1939 window->SetProperty(kIgnoreWindowActivated, true);
1939 GetUserDataAs<ShellSurface>(resource)->Activate(); 1940 shell_surface->Activate();
1940 window->ClearProperty(kIgnoreWindowActivated); 1941 window->SetProperty(kIgnoreWindowActivated, false);
1941 } 1942 }
1942 1943
1943 void remote_surface_maximize(wl_client* client, wl_resource* resource) { 1944 void remote_surface_maximize(wl_client* client, wl_resource* resource) {
1944 GetUserDataAs<ShellSurface>(resource)->Maximize(); 1945 GetUserDataAs<ShellSurface>(resource)->Maximize();
1945 } 1946 }
1946 1947
1947 void remote_surface_minimize(wl_client* client, wl_resource* resource) { 1948 void remote_surface_minimize(wl_client* client, wl_resource* resource) {
1948 GetUserDataAs<ShellSurface>(resource)->Minimize(); 1949 GetUserDataAs<ShellSurface>(resource)->Minimize();
1949 } 1950 }
1950 1951
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 } 2142 }
2142 void OnMaximizeModeEnded() override {} 2143 void OnMaximizeModeEnded() override {}
2143 2144
2144 // Overridden from WMHelper::ActivationObserver: 2145 // Overridden from WMHelper::ActivationObserver:
2145 void OnWindowActivated(aura::Window* gained_active, 2146 void OnWindowActivated(aura::Window* gained_active,
2146 aura::Window* lost_active) override { 2147 aura::Window* lost_active) override {
2147 // If the origin of activation is Wayland client, then assume it's been 2148 // If the origin of activation is Wayland client, then assume it's been
2148 // already activated on the client side, so do not notify about the 2149 // already activated on the client side, so do not notify about the
2149 // activation. It means that zcr_remote_shell_v1_send_activated is used 2150 // activation. It means that zcr_remote_shell_v1_send_activated is used
2150 // only to notify about activations originating in Aura. 2151 // only to notify about activations originating in Aura.
2151 if (gained_active && gained_active->GetProperty(kIgnoreWindowActivated)) 2152 if (gained_active && gained_active->GetProperty(kIgnoreWindowActivated)) {
2153 gained_active->SetProperty(kIgnoreWindowActivated, false);
2152 return; 2154 return;
2155 }
2153 2156
2154 SendActivated(gained_active, lost_active); 2157 SendActivated(gained_active, lost_active);
2155 } 2158 }
2156 2159
2157 private: 2160 private:
2158 void ScheduleSendDisplayMetrics(int delay_ms) { 2161 void ScheduleSendDisplayMetrics(int delay_ms) {
2159 needs_send_display_metrics_ = true; 2162 needs_send_display_metrics_ = true;
2160 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 2163 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
2161 FROM_HERE, base::Bind(&WaylandRemoteShell::SendDisplayMetrics, 2164 FROM_HERE, base::Bind(&WaylandRemoteShell::SendDisplayMetrics,
2162 weak_ptr_factory_.GetWeakPtr()), 2165 weak_ptr_factory_.GetWeakPtr()),
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
3950 DCHECK(event_loop); 3953 DCHECK(event_loop);
3951 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 3954 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
3952 } 3955 }
3953 3956
3954 void Server::Flush() { 3957 void Server::Flush() {
3955 wl_display_flush_clients(wl_display_.get()); 3958 wl_display_flush_clients(wl_display_.get());
3956 } 3959 }
3957 3960
3958 } // namespace wayland 3961 } // namespace wayland
3959 } // namespace exo 3962 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698