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

Side by Side Diff: components/exo/shell_surface.cc

Issue 2360533002: exo: Implement minimal support for version 6 of XDG shell. (Closed)
Patch Set: exo: Implement basic support for version 6 of XDG shell. Created 4 years, 2 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 | components/exo/wayland/server.cc » ('j') | 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/shell_surface.h" 5 #include "components/exo/shell_surface.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/shelf/wm_shelf.h" 10 #include "ash/common/shelf/wm_shelf.h"
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 return value; 630 return value;
631 } 631 }
632 632
633 //////////////////////////////////////////////////////////////////////////////// 633 ////////////////////////////////////////////////////////////////////////////////
634 // SurfaceDelegate overrides: 634 // SurfaceDelegate overrides:
635 635
636 void ShellSurface::OnSurfaceCommit() { 636 void ShellSurface::OnSurfaceCommit() {
637 surface_->CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces(); 637 surface_->CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces();
638 surface_->CommitSurfaceHierarchy(); 638 surface_->CommitSurfaceHierarchy();
639 639
640 if (enabled() && !widget_) 640 if (enabled() && !widget_) {
641 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); 641 // Defer widget creation until surface contains some contents.
642 if (surface_->content_size().IsEmpty())
643 Configure();
644 else
645 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL);
646 }
642 647
643 // Apply the accumulated pending origin offset to reflect acknowledged 648 // Apply the accumulated pending origin offset to reflect acknowledged
644 // configure requests. 649 // configure requests.
645 origin_ += pending_origin_offset_; 650 origin_ += pending_origin_offset_;
646 pending_origin_offset_ = gfx::Vector2d(); 651 pending_origin_offset_ = gfx::Vector2d();
647 652
648 // Update resize direction to reflect acknowledged configure requests. 653 // Update resize direction to reflect acknowledged configure requests.
649 resize_component_ = pending_resize_component_; 654 resize_component_ = pending_resize_component_;
650 655
651 if (widget_) { 656 if (widget_) {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 new CustomWindowStateDelegate(widget_))); 1074 new CustomWindowStateDelegate(widget_)));
1070 1075
1071 // Receive accessibility changes to update shadow underlay. 1076 // Receive accessibility changes to update shadow underlay.
1072 WMHelper::GetInstance()->AddAccessibilityObserver(this); 1077 WMHelper::GetInstance()->AddAccessibilityObserver(this);
1073 1078
1074 // Show widget next time Commit() is called. 1079 // Show widget next time Commit() is called.
1075 pending_show_widget_ = true; 1080 pending_show_widget_ = true;
1076 } 1081 }
1077 1082
1078 void ShellSurface::Configure() { 1083 void ShellSurface::Configure() {
1079 DCHECK(widget_);
1080
1081 // Delay configure callback if |scoped_configure_| is set. 1084 // Delay configure callback if |scoped_configure_| is set.
1082 if (scoped_configure_) { 1085 if (scoped_configure_) {
1083 scoped_configure_->set_needs_configure(); 1086 scoped_configure_->set_needs_configure();
1084 return; 1087 return;
1085 } 1088 }
1086 1089
1087 gfx::Vector2d origin_offset = pending_origin_config_offset_; 1090 gfx::Vector2d origin_offset = pending_origin_config_offset_;
1088 pending_origin_config_offset_ = gfx::Vector2d(); 1091 pending_origin_config_offset_ = gfx::Vector2d();
1089 1092
1090 // If surface is being resized, save the resize direction. 1093 // If surface is being resized, save the resize direction.
1091 int resize_component = 1094 int resize_component =
1092 resizer_ ? resizer_->details().window_component : HTCAPTION; 1095 resizer_ ? resizer_->details().window_component : HTCAPTION;
1093 1096
1094 if (configure_callback_.is_null()) { 1097 if (configure_callback_.is_null()) {
1095 pending_origin_offset_ += origin_offset; 1098 pending_origin_offset_ += origin_offset;
1096 pending_resize_component_ = resize_component; 1099 pending_resize_component_ = resize_component;
1097 return; 1100 return;
1098 } 1101 }
1099 1102
1100 uint32_t serial = configure_callback_.Run( 1103 uint32_t serial;
1101 widget_->GetWindowBoundsInScreen().size(), 1104 if (widget_) {
Daniele Castagna 2016/10/20 20:09:16 Can you mention in the CL description why the widg
reveman 2017/01/30 22:54:05 Done.
1102 ash::wm::GetWindowState(widget_->GetNativeWindow())->GetStateType(), 1105 serial = configure_callback_.Run(
1103 IsResizing(), widget_->IsActive()); 1106 widget_->GetWindowBoundsInScreen().size(),
1107 ash::wm::GetWindowState(widget_->GetNativeWindow())->GetStateType(),
1108 IsResizing(), widget_->IsActive());
1109 } else {
1110 serial = configure_callback_.Run(
1111 gfx::Size(), ash::wm::WINDOW_STATE_TYPE_NORMAL, false, false);
1112 }
1104 1113
1105 // Apply origin offset and resize component at the first Commit() after this 1114 // Apply origin offset and resize component at the first Commit() after this
1106 // configure request has been acknowledged. 1115 // configure request has been acknowledged.
1107 pending_configs_.push_back({serial, origin_offset, resize_component}); 1116 pending_configs_.push_back({serial, origin_offset, resize_component});
1108 LOG_IF(WARNING, pending_configs_.size() > 100) 1117 LOG_IF(WARNING, pending_configs_.size() > 100)
1109 << "Number of pending configure acks for shell surface has reached: " 1118 << "Number of pending configure acks for shell surface has reached: "
1110 << pending_configs_.size(); 1119 << pending_configs_.size();
1111 } 1120 }
1112 1121
1113 void ShellSurface::AttemptToStartDrag(int component) { 1122 void ShellSurface::AttemptToStartDrag(int component) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 shadow_overlay_->layer()->Add(shadow->layer()); 1400 shadow_overlay_->layer()->Add(shadow->layer());
1392 window->AddChild(shadow_overlay_); 1401 window->AddChild(shadow_overlay_);
1393 shadow_overlay_->Show(); 1402 shadow_overlay_->Show();
1394 } 1403 }
1395 shadow_overlay_->SetBounds(shadow_bounds); 1404 shadow_overlay_->SetBounds(shadow_bounds);
1396 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1405 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1397 } 1406 }
1398 } 1407 }
1399 1408
1400 } // namespace exo 1409 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | components/exo/wayland/server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698