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

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

Issue 1874933002: exo: Further improve ignored-by-shelf test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/shell_surface.h" 5 #include "components/exo/shell_surface.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/window_resizer.h" 9 #include "ash/wm/window_resizer.h"
10 #include "ash/wm/window_state.h" 10 #include "ash/wm/window_state.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 origin_ += pending_origin_offset_; 372 origin_ += pending_origin_offset_;
373 pending_origin_offset_ = gfx::Vector2d(); 373 pending_origin_offset_ = gfx::Vector2d();
374 374
375 // Update resize direction to reflect acknowledged configure requests. 375 // Update resize direction to reflect acknowledged configure requests.
376 resize_component_ = pending_resize_component_; 376 resize_component_ = pending_resize_component_;
377 377
378 if (widget_) { 378 if (widget_) {
379 UpdateWidgetBounds(); 379 UpdateWidgetBounds();
380 380
381 gfx::Point surface_origin = GetSurfaceOrigin(); 381 gfx::Point surface_origin = GetSurfaceOrigin();
382 gfx::Rect hit_test_bounds =
383 surface_->GetHitTestBounds() + surface_origin.OffsetFromOrigin();
384 382
385 // Only allow the shelf to recognize this window if the hit-test bounds 383 // Determine if window should be ignored by shelf if all configure requests
386 // contains the widget bounds. This prevents shaped windows that might 384 // have been acknowledged.
387 // only occupy a small area of the widget from dimming the shelf when 385 if (pending_configs_.empty()) {
388 // maximized. 386 gfx::Rect hit_test_bounds =
389 bool ignored_by_shelf = !hit_test_bounds.Contains( 387 surface_->GetHitTestBounds() + surface_origin.OffsetFromOrigin();
390 gfx::Rect(widget_->GetNativeWindow()->bounds().size()));
391 388
392 // Update state and shelf visibility if |ignored_by_shelf| changed. 389 // When maximized, only allow the shelf to recognize this window if the
393 ash::wm::WindowState* window_state = 390 // hit-test bounds contains the widget bounds. This prevents shaped
394 ash::wm::GetWindowState(widget_->GetNativeWindow()); 391 // windows that might only occupy a small area of the widget from dimming
395 if (ignored_by_shelf != window_state->ignored_by_shelf()) { 392 // the shelf when maximized.
396 window_state->set_ignored_by_shelf(ignored_by_shelf); 393 bool ignored_by_shelf = widget_->IsMaximized() &&
397 ash::Shell::GetInstance()->UpdateShelfVisibility(); 394 !hit_test_bounds.Contains(gfx::Rect(
395 widget_->GetNativeWindow()->bounds().size()));
396
397 // Update state and shelf visibility if |ignored_by_shelf| changed.
398 ash::wm::WindowState* window_state =
399 ash::wm::GetWindowState(widget_->GetNativeWindow());
400 if (ignored_by_shelf != window_state->ignored_by_shelf()) {
401 window_state->set_ignored_by_shelf(ignored_by_shelf);
402 ash::Shell::GetInstance()->UpdateShelfVisibility();
403 }
398 } 404 }
399 405
400 // Update surface bounds. 406 // Update surface bounds.
401 surface_->SetBounds(gfx::Rect(surface_origin, surface_->layer()->size())); 407 surface_->SetBounds(gfx::Rect(surface_origin, surface_->layer()->size()));
402 408
403 // Show widget if not already visible. 409 // Show widget if not already visible.
404 if (!widget_->IsClosed() && !widget_->IsVisible()) 410 if (!widget_->IsClosed() && !widget_->IsVisible())
405 widget_->Show(); 411 widget_->Show();
406 } 412 }
407 } 413 }
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 DCHECK(!ignore_window_bounds_changes_); 899 DCHECK(!ignore_window_bounds_changes_);
894 ignore_window_bounds_changes_ = true; 900 ignore_window_bounds_changes_ = true;
895 widget_->SetBounds(new_widget_bounds); 901 widget_->SetBounds(new_widget_bounds);
896 ignore_window_bounds_changes_ = false; 902 ignore_window_bounds_changes_ = false;
897 903
898 // A change to the widget size requires surface bounds to be re-adjusted. 904 // A change to the widget size requires surface bounds to be re-adjusted.
899 surface_->SetBounds(gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size())); 905 surface_->SetBounds(gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size()));
900 } 906 }
901 907
902 } // namespace exo 908 } // 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