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

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

Issue 2868623002: Don't send activation event when created (Closed)
Patch Set: 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // A property key containing a boolean set to true if a security object is 152 // A property key containing a boolean set to true if a security object is
153 // associated with window. 153 // associated with window.
154 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasSecurityKey, false); 154 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasSecurityKey, false);
155 155
156 // A property key containing a boolean set to true if a blending object is 156 // A property key containing a boolean set to true if a blending object is
157 // associated with window. 157 // associated with window.
158 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasBlendingKey, false); 158 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasBlendingKey, false);
159 159
160 // A property key containing a boolean set to true whether the current 160 // A property key containing a boolean set to true whether the current
161 // OnWindowActivated invocation should be ignored. 161 // OnWindowActivated invocation should be ignored. The defualt is true
162 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIgnoreWindowActivated, false); 162 // to ignore the activation event originated by creation.
163 DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIgnoreWindowActivated, true);
163 164
164 wl_resource* GetSurfaceResource(Surface* surface) { 165 wl_resource* GetSurfaceResource(Surface* surface) {
165 return surface->GetProperty(kSurfaceResourceKey); 166 return surface->GetProperty(kSurfaceResourceKey);
166 } 167 }
167 168
168 //////////////////////////////////////////////////////////////////////////////// 169 ////////////////////////////////////////////////////////////////////////////////
169 // wl_buffer_interface: 170 // wl_buffer_interface:
170 171
171 void buffer_destroy(wl_client* client, wl_resource* resource) { 172 void buffer_destroy(wl_client* client, wl_resource* resource) {
172 wl_resource_destroy(resource); 173 wl_resource_destroy(resource);
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 1929
1929 void remote_surface_activate(wl_client* client, 1930 void remote_surface_activate(wl_client* client,
1930 wl_resource* resource, 1931 wl_resource* resource,
1931 uint32_t serial) { 1932 uint32_t serial) {
1932 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); 1933 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource);
1933 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow(); 1934 aura::Window* window = shell_surface->GetWidget()->GetNativeWindow();
1934 1935
1935 // Activation on Aura is synchronous, so activation callbacks will be called 1936 // Activation on Aura is synchronous, so activation callbacks will be called
1936 // before the flag is reset. 1937 // before the flag is reset.
1937 window->SetProperty(kIgnoreWindowActivated, true); 1938 window->SetProperty(kIgnoreWindowActivated, true);
1938 GetUserDataAs<ShellSurface>(resource)->Activate(); 1939 shell_surface->Activate();
1939 window->ClearProperty(kIgnoreWindowActivated); 1940 window->SetProperty(kIgnoreWindowActivated, false);
1940 } 1941 }
1941 1942
1942 void remote_surface_maximize(wl_client* client, wl_resource* resource) { 1943 void remote_surface_maximize(wl_client* client, wl_resource* resource) {
1943 GetUserDataAs<ShellSurface>(resource)->Maximize(); 1944 GetUserDataAs<ShellSurface>(resource)->Maximize();
1944 } 1945 }
1945 1946
1946 void remote_surface_minimize(wl_client* client, wl_resource* resource) { 1947 void remote_surface_minimize(wl_client* client, wl_resource* resource) {
1947 GetUserDataAs<ShellSurface>(resource)->Minimize(); 1948 GetUserDataAs<ShellSurface>(resource)->Minimize();
1948 } 1949 }
1949 1950
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 } 2115 }
2115 void OnMaximizeModeEnded() override {} 2116 void OnMaximizeModeEnded() override {}
2116 2117
2117 // Overridden from WMHelper::ActivationObserver: 2118 // Overridden from WMHelper::ActivationObserver:
2118 void OnWindowActivated(aura::Window* gained_active, 2119 void OnWindowActivated(aura::Window* gained_active,
2119 aura::Window* lost_active) override { 2120 aura::Window* lost_active) override {
2120 // If the origin of activation is Wayland client, then assume it's been 2121 // If the origin of activation is Wayland client, then assume it's been
2121 // already activated on the client side, so do not notify about the 2122 // already activated on the client side, so do not notify about the
2122 // activation. It means that zcr_remote_shell_v1_send_activated is used 2123 // activation. It means that zcr_remote_shell_v1_send_activated is used
2123 // only to notify about activations originating in Aura. 2124 // only to notify about activations originating in Aura.
2124 if (gained_active && gained_active->GetProperty(kIgnoreWindowActivated)) 2125 if (gained_active && gained_active->GetProperty(kIgnoreWindowActivated)) {
2126 gained_active->SetProperty(kIgnoreWindowActivated, false);
2125 return; 2127 return;
2128 }
2126 2129
2127 SendActivated(gained_active, lost_active); 2130 SendActivated(gained_active, lost_active);
2128 } 2131 }
2129 2132
2130 private: 2133 private:
2131 void ScheduleSendDisplayMetrics(int delay_ms) { 2134 void ScheduleSendDisplayMetrics(int delay_ms) {
2132 needs_send_display_metrics_ = true; 2135 needs_send_display_metrics_ = true;
2133 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 2136 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
2134 FROM_HERE, base::Bind(&WaylandRemoteShell::SendDisplayMetrics, 2137 FROM_HERE, base::Bind(&WaylandRemoteShell::SendDisplayMetrics,
2135 weak_ptr_factory_.GetWeakPtr()), 2138 weak_ptr_factory_.GetWeakPtr()),
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
3909 DCHECK(event_loop); 3912 DCHECK(event_loop);
3910 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 3913 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
3911 } 3914 }
3912 3915
3913 void Server::Flush() { 3916 void Server::Flush() {
3914 wl_display_flush_clients(wl_display_.get()); 3917 wl_display_flush_clients(wl_display_.get());
3915 } 3918 }
3916 3919
3917 } // namespace wayland 3920 } // namespace wayland
3918 } // namespace exo 3921 } // 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