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

Side by Side Diff: window.cc

Issue 6902072: wm: Update a lot of code to use structs from geometry.h. (Closed) Base URL: ssh://gitrw.chromium.org:9222/window_manager.git@master
Patch Set: move override-redirect stacking and visibility into Window Created 9 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 | Annotate | Revision Log
« no previous file with comments | « window.h ('k') | window_manager.h » ('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 (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 "window_manager/window.h" 5 #include "window_manager/window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include <gflags/gflags.h> 9 #include <gflags/gflags.h>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 xid_str_(XidStr(xid_)), 73 xid_str_(XidStr(xid_)),
74 wm_(wm), 74 wm_(wm),
75 actor_(wm_->compositor()->CreateTexturePixmap()), 75 actor_(wm_->compositor()->CreateTexturePixmap()),
76 transient_for_xid_(None), 76 transient_for_xid_(None),
77 override_redirect_(override_redirect), 77 override_redirect_(override_redirect),
78 mapped_(false), 78 mapped_(false),
79 shaped_(false), 79 shaped_(false),
80 type_(chromeos::WM_IPC_WINDOW_UNKNOWN), 80 type_(chromeos::WM_IPC_WINDOW_UNKNOWN),
81 visibility_(VISIBILITY_UNSET), 81 visibility_(VISIBILITY_UNSET),
82 update_client_position_for_moves_(true), 82 update_client_position_for_moves_(true),
83 client_x_(geometry.bounds.x), 83 client_bounds_(geometry.bounds),
84 client_y_(geometry.bounds.y),
85 client_width_(geometry.bounds.width),
86 client_height_(geometry.bounds.height),
87 client_depth_(geometry.depth), 84 client_depth_(geometry.depth),
88 client_opacity_(1.0), 85 client_opacity_(1.0),
89 composited_shown_(false), 86 composited_shown_(false),
90 composited_x_(geometry.bounds.x), 87 composited_origin_(geometry.bounds.position()),
91 composited_y_(geometry.bounds.y),
92 composited_scale_x_(1.0), 88 composited_scale_x_(1.0),
93 composited_scale_y_(1.0), 89 composited_scale_y_(1.0),
94 composited_opacity_(1.0), 90 composited_opacity_(1.0),
95 actor_gravity_(GRAVITY_NORTHWEST), 91 actor_gravity_(GRAVITY_NORTHWEST),
96 shadow_opacity_(1.0), 92 shadow_opacity_(1.0),
97 supports_wm_take_focus_(false), 93 supports_wm_take_focus_(false),
98 supports_wm_delete_window_(false), 94 supports_wm_delete_window_(false),
99 supports_wm_ping_(false), 95 supports_wm_ping_(false),
100 wm_state_fullscreen_(false), 96 wm_state_fullscreen_(false),
101 wm_state_maximized_horz_(false), 97 wm_state_maximized_horz_(false),
(...skipping 22 matching lines...) Expand all
124 // If the window has a border, remove it -- borders make things more 120 // If the window has a border, remove it -- borders make things more
125 // confusing (we'd need to include the border when telling the compositor 121 // confusing (we'd need to include the border when telling the compositor
126 // the window's position, but it's not included when telling X to resize 122 // the window's position, but it's not included when telling X to resize
127 // the window, etc.). 123 // the window, etc.).
128 if (geometry.border_width > 0) 124 if (geometry.border_width > 0)
129 wm_->xconn()->SetWindowBorderWidth(xid_, 0); 125 wm_->xconn()->SetWindowBorderWidth(xid_, 0);
130 126
131 damage_ = wm_->xconn()->CreateDamage( 127 damage_ = wm_->xconn()->CreateDamage(
132 xid_, XConnection::DAMAGE_REPORT_LEVEL_BOUNDING_BOX); 128 xid_, XConnection::DAMAGE_REPORT_LEVEL_BOUNDING_BOX);
133 129
134 actor_->Move(composited_x_, composited_y_, 0); 130 actor_->Move(composited_x(), composited_y(), 0);
135 actor_->Hide(); 131 actor_->Hide();
136 // TODO(derat): Move this stuff to WindowManager::TrackWindow() instead. 132 // TODO(derat): Move this stuff to WindowManager::TrackWindow() instead.
137 wm_->stage()->AddActor(actor_.get()); 133 wm_->stage()->AddActor(actor_.get());
138 wm_->stacking_manager()->StackWindowAtTopOfLayer( 134 wm_->stacking_manager()->StackWindowAtTopOfLayer(
139 this, 135 this,
140 StackingManager::LAYER_TOP_CLIENT_WINDOW, 136 StackingManager::LAYER_TOP_CLIENT_WINDOW,
141 StackingManager::SHADOW_DIRECTLY_BELOW_ACTOR); 137 StackingManager::SHADOW_DIRECTLY_BELOW_ACTOR);
142 138
143 // Various properties could've been set on this window after it was 139 // Various properties could've been set on this window after it was
144 // created but before we selected PropertyChangeMask, so we need to query 140 // created but before we selected PropertyChangeMask, so we need to query
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 << " inc=" << h.size_increment 194 << " inc=" << h.size_increment
199 << " min_aspect=" << h.min_aspect_ratio 195 << " min_aspect=" << h.min_aspect_ratio
200 << " max_aspect=" << h.max_aspect_ratio 196 << " max_aspect=" << h.max_aspect_ratio
201 << " base=" << h.base_size; 197 << " base=" << h.base_size;
202 198
203 // If windows are override-redirect or have already been mapped, they 199 // If windows are override-redirect or have already been mapped, they
204 // should just make/request any desired changes directly. Also ignore 200 // should just make/request any desired changes directly. Also ignore
205 // position, aspect ratio, etc. hints for now. 201 // position, aspect ratio, etc. hints for now.
206 if (!mapped_ && !override_redirect_ && 202 if (!mapped_ && !override_redirect_ &&
207 (size_hints_.size.width > 0 && size_hints_.size.height > 0)) { 203 (size_hints_.size.width > 0 && size_hints_.size.height > 0)) {
208 ResizeClient(size_hints_.size.width, size_hints_.size.height, 204 Resize(size_hints_.size, GRAVITY_NORTHWEST);
209 GRAVITY_NORTHWEST);
210 } 205 }
211 206
212 return true; 207 return true;
213 } 208 }
214 209
215 bool Window::FetchAndApplyTransientHint() { 210 bool Window::FetchAndApplyTransientHint() {
216 DCHECK(xid_); 211 DCHECK(xid_);
217 XWindow prev_transient_for_xid = transient_for_xid_; 212 XWindow prev_transient_for_xid = transient_for_xid_;
218 if (!wm_->xconn()->GetTransientHintForWindow(xid_, &transient_for_xid_)) 213 if (!wm_->xconn()->GetTransientHintForWindow(xid_, &transient_for_xid_))
219 return false; 214 return false;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 435
441 // We don't grab the server around these two requests, so it's possible 436 // We don't grab the server around these two requests, so it's possible
442 // that a shaped window will have become unshaped between them and we'll 437 // that a shaped window will have become unshaped between them and we'll
443 // think that the window is shaped but get back an unshaped region. This 438 // think that the window is shaped but get back an unshaped region. This
444 // should be okay; we should get another ShapeNotify event for the window 439 // should be okay; we should get another ShapeNotify event for the window
445 // becoming unshaped and clear the useless mask then. 440 // becoming unshaped and clear the useless mask then.
446 if (wm_->xconn()->IsWindowShaped(xid_)) { 441 if (wm_->xconn()->IsWindowShaped(xid_)) {
447 shaped_ = true; 442 shaped_ = true;
448 443
449 if (FLAGS_load_window_shapes) { 444 if (FLAGS_load_window_shapes) {
450 ByteMap bytemap(client_width_, client_height_); 445 ByteMap bytemap(client_size());
451 if (wm_->xconn()->GetWindowBoundingRegion(xid_, &bytemap)) { 446 if (wm_->xconn()->GetWindowBoundingRegion(xid_, &bytemap)) {
452 DLOG(INFO) << "Got shape for " << xid_str(); 447 DLOG(INFO) << "Got shape for " << xid_str();
453 actor_->SetAlphaMask( 448 actor_->SetAlphaMask(
454 bytemap.bytes(), bytemap.width(), bytemap.height()); 449 bytemap.bytes(), bytemap.size().width, bytemap.size().height);
455 } else { 450 } else {
456 shaped_ = false; 451 shaped_ = false;
457 } 452 }
458 } 453 }
459 } 454 }
460 455
461 if (FLAGS_load_window_shapes && !shaped_) 456 if (FLAGS_load_window_shapes && !shaped_)
462 actor_->ClearAlphaMask(); 457 actor_->ClearAlphaMask();
463 458
464 UpdateShadowVisibility(); 459 UpdateShadowVisibility();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 return wm_->xconn()->AddButtonGrabOnWindow( 579 return wm_->xconn()->AddButtonGrabOnWindow(
585 xid_, AnyButton, ButtonPressMask, true); // synchronous=true 580 xid_, AnyButton, ButtonPressMask, true); // synchronous=true
586 } 581 }
587 582
588 bool Window::RemoveButtonGrab() { 583 bool Window::RemoveButtonGrab() {
589 DLOG(INFO) << "Removing button grab for " << xid_str(); 584 DLOG(INFO) << "Removing button grab for " << xid_str();
590 DCHECK(xid_); 585 DCHECK(xid_);
591 return wm_->xconn()->RemoveButtonGrabOnWindow(xid_, AnyButton); 586 return wm_->xconn()->RemoveButtonGrabOnWindow(xid_, AnyButton);
592 } 587 }
593 588
594 void Window::GetMaxSize(int desired_width, int desired_height, 589 void Window::GetMaxSize(const Size& desired_size, Size* size_out) const {
595 int* width_out, int* height_out) const { 590 CHECK(!desired_size.empty());
596 CHECK(desired_width > 0); 591 Size capped_size = desired_size;
597 CHECK(desired_height > 0);
598 592
599 if (size_hints_.max_size.width > 0) 593 if (size_hints_.max_size.width > 0)
600 desired_width = min(size_hints_.max_size.width, desired_width); 594 capped_size.width = min(size_hints_.max_size.width, capped_size.width);
601 if (size_hints_.min_size.width > 0) 595 if (size_hints_.min_size.width > 0)
602 desired_width = max(size_hints_.min_size.width, desired_width); 596 capped_size.width = max(size_hints_.min_size.width, capped_size.width);
597
598 if (size_hints_.max_size.height > 0)
599 capped_size.height = min(size_hints_.max_size.height, capped_size.height);
600 if (size_hints_.min_size.height > 0)
601 capped_size.height = max(size_hints_.min_size.height, capped_size.height);
603 602
604 if (size_hints_.size_increment.width > 0) { 603 if (size_hints_.size_increment.width > 0) {
605 int base_width = 604 const int base_width =
606 (size_hints_.base_size.width > 0) ? size_hints_.base_size.width : 605 (size_hints_.base_size.width > 0) ? size_hints_.base_size.width :
607 (size_hints_.min_size.width > 0) ? size_hints_.min_size.width : 606 (size_hints_.min_size.width > 0) ? size_hints_.min_size.width :
608 0; 607 0;
609 *width_out = base_width + 608 size_out->width = base_width +
610 ((desired_width - base_width) / size_hints_.size_increment.width) * 609 ((capped_size.width - base_width) / size_hints_.size_increment.width) *
611 size_hints_.size_increment.width; 610 size_hints_.size_increment.width;
612 } else { 611 } else {
613 *width_out = desired_width; 612 size_out->width = capped_size.width;
614 } 613 }
615 614
616 if (size_hints_.max_size.height > 0)
617 desired_height = min(size_hints_.max_size.height, desired_height);
618 if (size_hints_.min_size.height > 0)
619 desired_height = max(size_hints_.min_size.height, desired_height);
620
621 if (size_hints_.size_increment.height > 0) { 615 if (size_hints_.size_increment.height > 0) {
622 int base_height = 616 const int base_height =
623 (size_hints_.base_size.height > 0) ? size_hints_.base_size.height : 617 (size_hints_.base_size.height > 0) ? size_hints_.base_size.height :
624 (size_hints_.min_size.height > 0) ? size_hints_.min_size.height : 618 (size_hints_.min_size.height > 0) ? size_hints_.min_size.height :
625 0; 619 0;
626 *height_out = base_height + 620 size_out->height = base_height +
627 ((desired_height - base_height) / size_hints_.size_increment.height) * 621 ((capped_size.height - base_height) /
622 size_hints_.size_increment.height) *
628 size_hints_.size_increment.height; 623 size_hints_.size_increment.height;
629 } else { 624 } else {
630 *height_out = desired_height; 625 size_out->height = capped_size.height;
631 } 626 }
632 627
633 DLOG(INFO) << "Max size for " << xid_str() << " is " 628 DLOG(INFO) << "Max size for " << xid_str() << " is " << *size_out
634 << *width_out << "x" << *height_out 629 << " (desired was " << desired_size << ")";
635 << " (desired was " << desired_width << "x"
636 << desired_height << ")";
637 } 630 }
638 631
639 bool Window::MapClient() { 632 bool Window::MapClient() {
640 DLOG(INFO) << "Mapping " << xid_str(); 633 DLOG(INFO) << "Mapping " << xid_str();
641 DCHECK(xid_); 634 DCHECK(xid_);
642 if (!wm_->xconn()->MapWindow(xid_)) 635 if (!wm_->xconn()->MapWindow(xid_))
643 return false; 636 return false;
644 return true; 637 return true;
645 } 638 }
646 639
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 bool Window::MoveClient(int x, int y) { 705 bool Window::MoveClient(int x, int y) {
713 DCHECK_EQ(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_; 706 DCHECK_EQ(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_;
714 return MoveClientInternal(Point(x, y)); 707 return MoveClientInternal(Point(x, y));
715 } 708 }
716 709
717 bool Window::MoveClientOffscreen() { 710 bool Window::MoveClientOffscreen() {
718 return MoveClient(kOffscreenX, kOffscreenY); 711 return MoveClient(kOffscreenX, kOffscreenY);
719 } 712 }
720 713
721 bool Window::MoveClientToComposited() { 714 bool Window::MoveClientToComposited() {
722 return MoveClient(composited_x_, composited_y_); 715 return MoveClient(composited_x(), composited_y());
723 } 716 }
724 717
725 bool Window::CenterClientOverWindow(Window* win) { 718 bool Window::CenterClientOverWindow(Window* win) {
726 CHECK(win); 719 CHECK(win);
727 int center_x = win->client_x() + 0.5 * win->client_width(); 720 int center_x = win->client_x() + 0.5 * win->client_width();
728 int center_y = win->client_y() + 0.5 * win->client_height(); 721 int center_y = win->client_y() + 0.5 * win->client_height();
729 return MoveClient(center_x - 0.5 * client_width_, 722 return MoveClient(center_x - 0.5 * client_width(),
730 center_y - 0.5 * client_height_); 723 center_y - 0.5 * client_height());
731 } 724 }
732 725
733 bool Window::ResizeClient(int width, int height, Gravity gravity) { 726 bool Window::Resize(const Size& new_size, Gravity gravity) {
734 DCHECK(xid_); 727 DCHECK(xid_);
735 728
736 // Bail out early if this is a no-op. (No-op resizes won't generate 729 // Bail out early if this is a no-op. (No-op resizes won't generate
737 // ConfigureNotify events, which means that the client won't know to 730 // ConfigureNotify events, which means that the client won't know to
738 // redraw and update the _NET_WM_SYNC_REQUEST counter.) 731 // redraw and update the _NET_WM_SYNC_REQUEST counter.)
739 if (width == client_width_ && height == client_height_) 732 if (new_size == client_size())
740 return true; 733 return true;
741 734
742 SendWmSyncRequestMessage(); 735 SendWmSyncRequestMessage();
743 736
744 int dx = (gravity == GRAVITY_NORTHEAST || gravity == GRAVITY_SOUTHEAST) ? 737 int dx = (gravity == GRAVITY_NORTHEAST || gravity == GRAVITY_SOUTHEAST) ?
745 width - client_width_ : 0; 738 new_size.width - client_width() : 0;
746 int dy = (gravity == GRAVITY_SOUTHWEST || gravity == GRAVITY_SOUTHEAST) ? 739 int dy = (gravity == GRAVITY_SOUTHWEST || gravity == GRAVITY_SOUTHEAST) ?
747 height - client_height_ : 0; 740 new_size.height - client_height() : 0;
748 741
749 DLOG(INFO) << "Resizing " << xid_str() << "'s client window to " 742 DLOG(INFO) << "Resizing " << xid_str() << "'s client window to " << new_size;
750 << width << "x" << height;
751 if (dx || dy) { 743 if (dx || dy) {
752 // If we need to move the window as well due to gravity, do it all in 744 // If we need to move the window as well due to gravity, do it all in
753 // one ConfigureWindow request to the server. 745 // one ConfigureWindow request to the server.
754 if (!wm_->xconn()->ConfigureWindow( 746 if (!wm_->xconn()->ConfigureWindow(
755 xid_, Rect(client_x_ - dx, client_y_ - dy, width, height))) { 747 xid_, Rect(Point(client_x() - dx, client_y() - dy), new_size))) {
756 return false; 748 return false;
757 } 749 }
758 SaveClientPosition(client_x_ - dx, client_y_ - dy); 750 client_bounds_.move(client_x() - dx, client_y() - dy);
759 composited_x_ -= dx * composited_scale_x_; 751 composited_origin_.x -= dx * composited_scale_x_;
760 composited_y_ -= dy * composited_scale_y_; 752 composited_origin_.y -= dy * composited_scale_y_;
761 } else { 753 } else {
762 if (!wm_->xconn()->ResizeWindow(xid_, Size(width, height))) 754 if (!wm_->xconn()->ResizeWindow(xid_, new_size))
763 return false; 755 return false;
764 } 756 }
765 757
766 actor_gravity_ = gravity; 758 actor_gravity_ = gravity;
767 SaveClientSize(width, height); 759 client_bounds_.resize(new_size, GRAVITY_NORTHWEST);
768 return true; 760 return true;
769 } 761 }
770 762
771 bool Window::StackClientAbove(XWindow sibling_xid) { 763 bool Window::StackClientAbove(XWindow sibling_xid) {
772 DCHECK(xid_); 764 DCHECK(xid_);
773 CHECK(sibling_xid != None); 765 CHECK(sibling_xid != None);
774 bool result = wm_->xconn()->StackWindow(xid_, sibling_xid, true); 766 bool result = wm_->xconn()->StackWindow(xid_, sibling_xid, true);
775 return result; 767 return result;
776 } 768 }
777 769
(...skipping 13 matching lines...) Expand all
791 DCHECK_EQ(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_; 783 DCHECK_EQ(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_;
792 MoveCompositedInternal(Point(x, 0), MOVE_DIMENSIONS_X_ONLY, anim_ms); 784 MoveCompositedInternal(Point(x, 0), MOVE_DIMENSIONS_X_ONLY, anim_ms);
793 } 785 }
794 786
795 void Window::MoveCompositedY(int y, int anim_ms) { 787 void Window::MoveCompositedY(int y, int anim_ms) {
796 DCHECK_EQ(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_; 788 DCHECK_EQ(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_;
797 MoveCompositedInternal(Point(0, y), MOVE_DIMENSIONS_Y_ONLY, anim_ms); 789 MoveCompositedInternal(Point(0, y), MOVE_DIMENSIONS_Y_ONLY, anim_ms);
798 } 790 }
799 791
800 void Window::MoveCompositedToClient() { 792 void Window::MoveCompositedToClient() {
801 MoveComposited(client_x_, client_y_, 0); 793 MoveComposited(client_x(), client_y(), 0);
802 } 794 }
803 795
804 void Window::ShowComposited() { 796 void Window::ShowComposited() {
805 DLOG(INFO) << "Showing " << xid_str() << "'s composited window"; 797 DLOG(INFO) << "Showing " << xid_str() << "'s composited window";
806 DCHECK(actor_.get()); 798 DCHECK(actor_.get());
807 DCHECK_EQ(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_; 799 DCHECK_EQ(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_;
808 actor_->Show(); 800 actor_->Show();
809 composited_shown_ = true; 801 composited_shown_ = true;
810 UpdateShadowVisibility(); 802 UpdateShadowVisibility();
811 if (damage_debug_group_.get()) 803 if (damage_debug_group_.get())
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 DLOG(INFO) << "Scaling " << xid_str() << "'s composited window by (" 839 DLOG(INFO) << "Scaling " << xid_str() << "'s composited window by ("
848 << scale_x << ", " << scale_y << ") over " << anim_ms << " ms"; 840 << scale_x << ", " << scale_y << ") over " << anim_ms << " ms";
849 DCHECK(actor_.get()); 841 DCHECK(actor_.get());
850 DCHECK_GE(composited_scale_x_, 0.0); 842 DCHECK_GE(composited_scale_x_, 0.0);
851 DCHECK_GE(composited_scale_y_, 0.0); 843 DCHECK_GE(composited_scale_y_, 0.0);
852 composited_scale_x_ = scale_x; 844 composited_scale_x_ = scale_x;
853 composited_scale_y_ = scale_y; 845 composited_scale_y_ = scale_y;
854 846
855 actor_->Scale(scale_x, scale_y, anim_ms); 847 actor_->Scale(scale_x, scale_y, anim_ms);
856 if (shadow_.get()) 848 if (shadow_.get())
857 shadow_->Resize(scale_x * client_width_, scale_y * client_height_, anim_ms); 849 shadow_->Resize(scale_x * client_width(), scale_y * client_height(),
850 anim_ms);
858 851
859 // When the window's scale changes, we may need to move the client window 852 // When the window's scale changes, we may need to move the client window
860 // offscreen or back onscreen. 853 // offscreen or back onscreen.
861 if (visibility_ != VISIBILITY_UNSET) 854 if (visibility_ != VISIBILITY_UNSET)
862 UpdateClientWindowPosition(); 855 UpdateClientWindowPosition();
863 856
864 if (damage_debug_group_.get()) 857 if (damage_debug_group_.get())
865 damage_debug_group_->Scale(scale_x, scale_y, anim_ms); 858 damage_debug_group_->Scale(scale_x, scale_y, anim_ms);
866 } 859 }
867 860
868 AnimationPair* Window::CreateMoveCompositedAnimation() { 861 AnimationPair* Window::CreateMoveCompositedAnimation() {
869 DCHECK(actor_.get()); 862 DCHECK(actor_.get());
870 DCHECK(!shadow_.get()); 863 DCHECK(!shadow_.get());
871 return actor_->CreateMoveAnimation(); 864 return actor_->CreateMoveAnimation();
872 } 865 }
873 866
874 void Window::SetMoveCompositedAnimation(AnimationPair* animations) { 867 void Window::SetMoveCompositedAnimation(AnimationPair* animations) {
875 DCHECK(animations); 868 DCHECK(animations);
876 DCHECK(actor_.get()); 869 DCHECK(actor_.get());
877 composited_x_ = animations->first_animation().GetEndValue(); 870 composited_origin_.reset(
878 composited_y_ = animations->second_animation().GetEndValue(); 871 animations->first_animation().GetEndValue(),
872 animations->second_animation().GetEndValue());
879 DLOG(INFO) << "Setting custom animation to eventually move " << xid_str() 873 DLOG(INFO) << "Setting custom animation to eventually move " << xid_str()
880 << "'s composited window to (" << composited_x_ << "x" 874 << "'s composited window to (" << composited_x() << "x"
881 << composited_y_ << ")"; 875 << composited_y() << ")";
882 actor_->SetMoveAnimation(animations); 876 actor_->SetMoveAnimation(animations);
883 877
884 // Make sure that the client window is in the right position. 878 // Make sure that the client window is in the right position.
885 if (visibility_ != VISIBILITY_UNSET) 879 if (visibility_ != VISIBILITY_UNSET)
886 UpdateClientWindowPosition(); 880 UpdateClientWindowPosition();
887 881
888 if (damage_debug_group_.get()) 882 if (damage_debug_group_.get())
889 damage_debug_group_->Move(composited_x_, composited_y_, 0); 883 damage_debug_group_->Move(composited_x(), composited_y(), 0);
890 } 884 }
891 885
892 void Window::HandleMapRequested() { 886 void Window::HandleMapRequested() {
893 DCHECK(xid_); 887 DCHECK(xid_);
894 DCHECK(!override_redirect_); 888 DCHECK(!override_redirect_);
895 889
896 // Tell the client to notify us after it's repainted in response to the 890 // Tell the client to notify us after it's repainted in response to the
897 // next ConfigureNotify that it receives, and then send a synthetic 891 // next ConfigureNotify that it receives, and then send a synthetic
898 // ConfigureNotify event to the window. This lets us avoid compositing 892 // ConfigureNotify event to the window. This lets us avoid compositing
899 // new windows until the client has painted them. 893 // new windows until the client has painted them.
(...skipping 11 matching lines...) Expand all
911 mapped_ = true; 905 mapped_ = true;
912 need_to_reset_pixmap_ = true; 906 need_to_reset_pixmap_ = true;
913 907
914 // If we're still waiting for the client to redraw the window (probably in 908 // If we're still waiting for the client to redraw the window (probably in
915 // response to the _NET_WM_SYNC_REQUEST message that we sent in 909 // response to the _NET_WM_SYNC_REQUEST message that we sent in
916 // HandleMapRequested() or due to the client setting _CHROME_FREEZE_UPDATES 910 // HandleMapRequested() or due to the client setting _CHROME_FREEZE_UPDATES
917 // before mapping), then hold off on fetching the pixmap. This makes us not 911 // before mapping), then hold off on fetching the pixmap. This makes us not
918 // composite new windows until clients have painted them. 912 // composite new windows until clients have painted them.
919 if (able_to_reset_pixmap()) 913 if (able_to_reset_pixmap())
920 ResetPixmap(); 914 ResetPixmap();
915
916 if (override_redirect_)
917 SetVisibility(VISIBILITY_SHOWN);
921 } 918 }
922 919
923 void Window::HandleUnmapNotify() { 920 void Window::HandleUnmapNotify() {
924 DCHECK(xid_); 921 DCHECK(xid_);
925 mapped_ = false; 922 mapped_ = false;
923
924 if (override_redirect_)
925 SetVisibility(VISIBILITY_HIDDEN);
926
926 // We could potentially show a window onscreen even after it's been 927 // We could potentially show a window onscreen even after it's been
927 // unmapped, so we avoid hiding the shadow here. 928 // unmapped, so we avoid hiding the shadow here.
928 } 929 }
929 930
930 void Window::HandleRedirect() { 931 void Window::HandleRedirect() {
931 if (!mapped_) 932 if (!mapped_)
932 return; 933 return;
933 934
934 need_to_reset_pixmap_ = true; 935 need_to_reset_pixmap_ = true;
935 ResetPixmap(); 936 ResetPixmap();
936 937
937 // If the window is in the middle of an animation (sliding offscreen), 938 // If the window is in the middle of an animation (sliding offscreen),
938 // its client position is already updated to the final position, and its 939 // its client position is already updated to the final position, and its
939 // composited position is one frame into the animation because we've 940 // composited position is one frame into the animation because we've
940 // already updated the coordinates prior to calling this method. However, 941 // already updated the coordinates prior to calling this method. However,
941 // the content of the root window has not yet repainted, so using the 942 // the content of the root window has not yet repainted, so using the
942 // coordinates of the root window (0, 0)-(width, height) for the copying 943 // coordinates of the root window (0, 0)-(width, height) for the copying
943 // will work while the coordinates of the window will not. 944 // will work while the coordinates of the window will not.
944 wm_->xconn()->CopyArea(wm_->root(), 945 wm_->xconn()->CopyArea(wm_->root(),
945 pixmap_, 946 pixmap_,
946 Point(0, 0), // src 947 Point(0, 0), // src
947 Point(0, 0), // dest 948 Point(0, 0), // dest
948 Size(wm_->width(), wm_->height())); 949 Size(wm_->width(), wm_->height()));
949 } 950 }
950 951
951 void Window::HandleConfigureNotify(int width, int height) { 952 void Window::HandleConfigureNotify(const Rect& bounds, XWindow above_xid) {
952 DCHECK(actor_.get()); 953 DCHECK(actor_.get());
953 const bool size_changed = 954 const bool size_changed = actor_->GetBounds().size() != bounds.size();
954 actor_->GetWidth() != width || actor_->GetHeight() != height;
955 // Hold off on grabbing the window's contents if we haven't received 955 // Hold off on grabbing the window's contents if we haven't received
956 // notification that the client has drawn to the new pixmap yet. 956 // notification that the client has drawn to the new pixmap yet.
957 if (size_changed) { 957 if (size_changed) {
958 need_to_reset_pixmap_ = true; 958 need_to_reset_pixmap_ = true;
959 if (able_to_reset_pixmap()) 959 if (able_to_reset_pixmap())
960 ResetPixmap(); 960 ResetPixmap();
961 } 961 }
962
963 // If this is an override-redirect window (i.e. we didn't initiate the change
964 // ourselves), save the updated bounds and make sure that the actor is in the
965 // right place.
966 if (override_redirect_) {
967 client_bounds_ = bounds;
968 MoveCompositedInternal(bounds.position(), MOVE_DIMENSIONS_X_AND_Y, 0);
969
970 // When we see a stacking change, we attempt to restack our actor
971 // correspondingly. If we don't have an actor for the X window directly
972 // under us, we walk down the stack until we find one.
973 while (above_xid) {
Daniel Erat 2011/05/02 16:53:19 This is just lifted from WindowManager.
974 Window* above_win = wm_->GetWindow(above_xid);
975 Compositor::Actor* above_actor =
976 above_win ?
977 above_win->GetTopActor() :
978 wm_->stacking_manager()->GetActorIfLayerXid(above_xid);
979
980 if (above_actor) {
981 DLOG(INFO) << "Stacking override-redirect window " << xid_str()
982 << "'s actor above window " << XidStr(above_xid) << "'s";
983 StackCompositedAbove(above_actor, NULL, false);
984 break;
985 }
986 const XWindow* above_ptr = wm_->stacked_xids().GetUnder(above_xid);
987 above_xid = above_ptr ? *above_ptr : 0;
988 }
989 }
962 } 990 }
963 991
964 void Window::HandleDamageNotify(const Rect& bounding_box) { 992 void Window::HandleDamageNotify(const Rect& bounding_box) {
965 DCHECK(actor_.get()); 993 DCHECK(actor_.get());
966 wm_->xconn()->ClearDamage(damage_); 994 wm_->xconn()->ClearDamage(damage_);
967 actor_->UpdateTexture(); 995 actor_->UpdateTexture();
968 actor_->MergeDamagedRegion(bounding_box); 996 actor_->MergeDamagedRegion(bounding_box);
969 997
970 if (wm_->damage_debugging_enabled()) 998 if (wm_->damage_debugging_enabled())
971 UpdateDamageDebugging(bounding_box); 999 UpdateDamageDebugging(bounding_box);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 return destroyed_win; 1036 return destroyed_win;
1009 } 1037 }
1010 1038
1011 void Window::SetShadowType(Shadow::Type type) { 1039 void Window::SetShadowType(Shadow::Type type) {
1012 DCHECK(actor_.get()); 1040 DCHECK(actor_.get());
1013 1041
1014 shadow_.reset(Shadow::Create(wm_->compositor(), type)); 1042 shadow_.reset(Shadow::Create(wm_->compositor(), type));
1015 shadow_->group()->SetName(string("shadow group for window " + xid_str())); 1043 shadow_->group()->SetName(string("shadow group for window " + xid_str()));
1016 wm_->stage()->AddActor(shadow_->group()); 1044 wm_->stage()->AddActor(shadow_->group());
1017 shadow_->group()->Lower(actor_.get()); 1045 shadow_->group()->Lower(actor_.get());
1018 shadow_->Move(composited_x_, composited_y_, 0); 1046 shadow_->Move(composited_x(), composited_y(), 0);
1019 shadow_->SetOpacity(combined_opacity() * shadow_opacity_, 0); 1047 shadow_->SetOpacity(combined_opacity() * shadow_opacity_, 0);
1020 shadow_->Resize(composited_scale_x_ * actor_->GetWidth(), 1048 shadow_->Resize(composited_scale_x_ * actor_->GetWidth(),
1021 composited_scale_y_ * actor_->GetHeight(), 0); 1049 composited_scale_y_ * actor_->GetHeight(), 0);
1022 UpdateShadowVisibility(); 1050 UpdateShadowVisibility();
1023 } 1051 }
1024 1052
1025 void Window::DisableShadow() { 1053 void Window::DisableShadow() {
1026 shadow_.reset(NULL); 1054 shadow_.reset(NULL);
1027 } 1055 }
1028 1056
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 static_cast<Compositor::Actor*>(actor_.get()); 1103 static_cast<Compositor::Actor*>(actor_.get());
1076 } 1104 }
1077 1105
1078 Compositor::Actor* Window::GetBottomActor() { 1106 Compositor::Actor* Window::GetBottomActor() {
1079 DCHECK(actor_.get()); 1107 DCHECK(actor_.get());
1080 return (shadow_.get() ? shadow_->group() : actor_.get()); 1108 return (shadow_.get() ? shadow_->group() : actor_.get());
1081 } 1109 }
1082 1110
1083 void Window::CopyClientBoundsToRect(Rect* rect) const { 1111 void Window::CopyClientBoundsToRect(Rect* rect) const {
1084 DCHECK(rect); 1112 DCHECK(rect);
1085 rect->x = client_x_; 1113 *rect = client_bounds_;
1086 rect->y = client_y_;
1087 rect->width = client_width_;
1088 rect->height = client_height_;
1089 } 1114 }
1090 1115
1091 void Window::HandleSyncAlarmNotify(XID alarm_id, int64_t value) { 1116 void Window::HandleSyncAlarmNotify(XID alarm_id, int64_t value) {
1092 if (alarm_id != wm_sync_request_alarm_) { 1117 if (alarm_id != wm_sync_request_alarm_) {
1093 LOG(WARNING) << "Window " << xid_str() << " got sync alarm notify for " 1118 LOG(WARNING) << "Window " << xid_str() << " got sync alarm notify for "
1094 << " unknown alarm " << XidStr(alarm_id); 1119 << " unknown alarm " << XidStr(alarm_id);
1095 return; 1120 return;
1096 } 1121 }
1097 1122
1098 DLOG(INFO) << "Window " << xid_str() << " handling sync alarm notify with " 1123 DLOG(INFO) << "Window " << xid_str() << " handling sync alarm notify with "
1099 << "value " << value << " (current sync num is " 1124 << "value " << value << " (current sync num is "
1100 << current_wm_sync_num_ << ")"; 1125 << current_wm_sync_num_ << ")";
1101 if (value != current_wm_sync_num_ || client_has_redrawn_after_last_resize_) 1126 if (value != current_wm_sync_num_ || client_has_redrawn_after_last_resize_)
1102 return; 1127 return;
1103 1128
1104 client_has_redrawn_after_last_resize_ = true; 1129 client_has_redrawn_after_last_resize_ = true;
1105 if (able_to_reset_pixmap()) 1130 if (able_to_reset_pixmap())
1106 ResetPixmap(); 1131 ResetPixmap();
1107 } 1132 }
1108 1133
1109 void Window::SendSyntheticConfigureNotify() { 1134 void Window::SendSyntheticConfigureNotify() {
1110 const XWindow* xid_under_us_ptr = wm_->stacked_xids().GetUnder(xid_); 1135 const XWindow* xid_under_us_ptr = wm_->stacked_xids().GetUnder(xid_);
1111 const XWindow xid_under_us = xid_under_us_ptr ? *xid_under_us_ptr : 0; 1136 const XWindow xid_under_us = xid_under_us_ptr ? *xid_under_us_ptr : 0;
1112 Rect rect(client_x_, client_y_, client_width_, client_height_);
1113 DLOG(INFO) << "Sending synthetic configure notify for " << xid_str() << ": " 1137 DLOG(INFO) << "Sending synthetic configure notify for " << xid_str() << ": "
1114 << rect << ", above " << XidStr(xid_under_us); 1138 << client_bounds_ << ", above " << XidStr(xid_under_us);
1115 wm_->xconn()->SendConfigureNotifyEvent( 1139 wm_->xconn()->SendConfigureNotifyEvent(
1116 xid_, 1140 xid_,
1117 rect, 1141 client_bounds_,
1118 0, // border_width 1142 0, // border_width
1119 xid_under_us, 1143 xid_under_us,
1120 false); // override_redirect 1144 false); // override_redirect
1121 } 1145 }
1122 1146
1123 bool Window::IsClientWindowOffscreen() const { 1147 bool Window::IsClientWindowOffscreen() const {
1124 return (client_x_ >= wm_->width() || client_x_ + client_width_ < 0 || 1148 return (client_x() >= wm_->width() || client_x() + client_width() < 0 ||
1125 client_y_ >= wm_->height() || client_y_ + client_height_ < 0); 1149 client_y() >= wm_->height() || client_y() + client_height() < 0);
1126 } 1150 }
1127 1151
1128 void Window::SetWmStateInternal(int action, bool* value) const { 1152 void Window::SetWmStateInternal(int action, bool* value) const {
1129 switch (action) { 1153 switch (action) {
1130 case 0: // _NET_WM_STATE_REMOVE 1154 case 0: // _NET_WM_STATE_REMOVE
1131 *value = false; 1155 *value = false;
1132 break; 1156 break;
1133 case 1: // _NET_WM_STATE_ADD 1157 case 1: // _NET_WM_STATE_ADD
1134 *value = true; 1158 *value = true;
1135 break; 1159 break;
1136 case 2: // _NET_WM_STATE_TOGGLE 1160 case 2: // _NET_WM_STATE_TOGGLE
1137 *value = !(*value); 1161 *value = !(*value);
1138 break; 1162 break;
1139 default: 1163 default:
1140 LOG(WARNING) << "Got _NET_WM_STATE message for " << xid_str() 1164 LOG(WARNING) << "Got _NET_WM_STATE message for " << xid_str()
1141 << " with invalid action " << action; 1165 << " with invalid action " << action;
1142 } 1166 }
1143 } 1167 }
1144 1168
1145 bool Window::MoveClientInternal(const Point& origin) { 1169 bool Window::MoveClientInternal(const Point& origin) {
1146 DLOG(INFO) << "Moving " << xid_str() << "'s client window to " << origin; 1170 DLOG(INFO) << "Moving " << xid_str() << "'s client window to " << origin;
1147 DCHECK(xid_); 1171 DCHECK(xid_);
1148 if (!wm_->xconn()->MoveWindow(xid_, origin)) 1172 if (!wm_->xconn()->MoveWindow(xid_, origin))
1149 return false; 1173 return false;
1150 SaveClientPosition(origin.x, origin.y); 1174 client_bounds_.move(origin);
1151 return true; 1175 return true;
1152 } 1176 }
1153 1177
1154 void Window::MoveCompositedInternal(const Point& origin, 1178 void Window::MoveCompositedInternal(const Point& origin,
1155 MoveDimensions dimensions, 1179 MoveDimensions dimensions,
1156 int anim_ms) { 1180 int anim_ms) {
1157 switch (dimensions) { 1181 switch (dimensions) {
1158 case MOVE_DIMENSIONS_X_AND_Y: 1182 case MOVE_DIMENSIONS_X_AND_Y:
1159 DLOG(INFO) << "Moving " << xid_str() << "'s composited window to " 1183 DLOG(INFO) << "Moving " << xid_str() << "'s composited window to "
1160 << origin << " over " << anim_ms << " ms"; 1184 << origin << " over " << anim_ms << " ms";
1161 composited_x_ = origin.x; 1185 composited_origin_ = origin;
1162 composited_y_ = origin.y;
1163 break; 1186 break;
1164 case MOVE_DIMENSIONS_X_ONLY: 1187 case MOVE_DIMENSIONS_X_ONLY:
1165 DLOG(INFO) << "Moving " << xid_str() << "'s composited window's X " 1188 DLOG(INFO) << "Moving " << xid_str() << "'s composited window's X "
1166 << "position to " << origin.x << " over " << anim_ms << " ms"; 1189 << "position to " << origin.x << " over " << anim_ms << " ms";
1167 composited_x_ = origin.x; 1190 composited_origin_.x = origin.x;
1168 break; 1191 break;
1169 case MOVE_DIMENSIONS_Y_ONLY: 1192 case MOVE_DIMENSIONS_Y_ONLY:
1170 DLOG(INFO) << "Moving " << xid_str() << "'s composited window's Y " 1193 DLOG(INFO) << "Moving " << xid_str() << "'s composited window's Y "
1171 << "position to " << origin.y << " over " << anim_ms << " ms"; 1194 << "position to " << origin.y << " over " << anim_ms << " ms";
1172 composited_y_ = origin.y; 1195 composited_origin_.y = origin.y;
1173 break; 1196 break;
1174 default: 1197 default:
1175 NOTREACHED() << "Unknown move dimensions " << dimensions; 1198 NOTREACHED() << "Unknown move dimensions " << dimensions;
1176 } 1199 }
1177 1200
1178 DCHECK(actor_.get()); 1201 DCHECK(actor_.get());
1179 MoveActorToAdjustedPosition(dimensions, anim_ms); 1202 MoveActorToAdjustedPosition(dimensions, anim_ms);
1180 } 1203 }
1181 1204
1182 void Window::UpdateClientWindowPosition() { 1205 void Window::UpdateClientWindowPosition() {
1183 DCHECK_NE(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_; 1206 DCHECK_NE(visibility_, VISIBILITY_UNSET) << " xid=" << xid_str_;
1184 if (override_redirect_) 1207 if (override_redirect_)
1185 return; 1208 return;
1186 1209
1187 // Without support in X11 for transforming input events, scaled windows can't 1210 // Without support in X11 for transforming input events, scaled windows can't
1188 // receive input. 1211 // receive input.
1189 const bool should_be_onscreen = 1212 const bool should_be_onscreen =
1190 visibility_ == VISIBILITY_SHOWN && 1213 visibility_ == VISIBILITY_SHOWN &&
1191 composited_width() == client_width_ && 1214 composited_size() == client_size() &&
1192 composited_height() == client_height_ &&
1193 combined_opacity() > 0.0; 1215 combined_opacity() > 0.0;
1194 1216
1195 Point cur_pos(client_x_, client_y_); 1217 Point new_origin = client_origin();
1196 Point new_pos = cur_pos;
1197 if (should_be_onscreen) 1218 if (should_be_onscreen)
1198 new_pos.reset(composited_x_, composited_y_); 1219 new_origin.reset(composited_x(), composited_y());
1199 else 1220 else
1200 new_pos.reset(kOffscreenX, kOffscreenY); 1221 new_origin.reset(kOffscreenX, kOffscreenY);
1201 1222
1202 if (new_pos != cur_pos) 1223 if (new_origin != client_origin())
1203 MoveClientInternal(new_pos); 1224 MoveClientInternal(new_origin);
1204 } 1225 }
1205 1226
1206 bool Window::UpdateWmStateProperty() { 1227 bool Window::UpdateWmStateProperty() {
1207 DCHECK(xid_); 1228 DCHECK(xid_);
1208 vector<int> values; 1229 vector<int> values;
1209 if (wm_state_fullscreen_) 1230 if (wm_state_fullscreen_)
1210 values.push_back(wm_->GetXAtom(ATOM_NET_WM_STATE_FULLSCREEN)); 1231 values.push_back(wm_->GetXAtom(ATOM_NET_WM_STATE_FULLSCREEN));
1211 if (wm_state_maximized_horz_) 1232 if (wm_state_maximized_horz_)
1212 values.push_back(wm_->GetXAtom(ATOM_NET_WM_STATE_MAXIMIZED_HORZ)); 1233 values.push_back(wm_->GetXAtom(ATOM_NET_WM_STATE_MAXIMIZED_HORZ));
1213 if (wm_state_maximized_vert_) 1234 if (wm_state_maximized_vert_)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 wm_sync_request_alarm_ = 0; 1275 wm_sync_request_alarm_ = 0;
1255 client_has_redrawn_after_last_resize_ = true; 1276 client_has_redrawn_after_last_resize_ = true;
1256 } 1277 }
1257 1278
1258 void Window::MoveActorToAdjustedPosition(MoveDimensions dimensions, 1279 void Window::MoveActorToAdjustedPosition(MoveDimensions dimensions,
1259 int anim_ms) { 1280 int anim_ms) {
1260 DCHECK(actor_.get()); 1281 DCHECK(actor_.get());
1261 1282
1262 // Get the region that would be occupied by the actor if it were the same 1283 // Get the region that would be occupied by the actor if it were the same
1263 // size as the client window. 1284 // size as the client window.
1264 Rect scaled_rect(composited_x_, composited_y_, 1285 Rect scaled_rect(composited_x(), composited_y(),
1265 client_width_ * composited_scale_x_, 1286 client_width() * composited_scale_x_,
1266 client_height_ * composited_scale_y_); 1287 client_height() * composited_scale_y_);
1267 1288
1268 // Now resize that region accordingly for the actor's actual size and its 1289 // Now resize that region accordingly for the actor's actual size and its
1269 // gravity. 1290 // gravity.
1270 scaled_rect.resize(actor_->GetWidth() * composited_scale_x_, 1291 scaled_rect.resize(actor_->GetWidth() * composited_scale_x_,
1271 actor_->GetHeight() * composited_scale_y_, 1292 actor_->GetHeight() * composited_scale_y_,
1272 actor_gravity_); 1293 actor_gravity_);
1273 1294
1274 switch (dimensions) { 1295 switch (dimensions) {
1275 case MOVE_DIMENSIONS_X_AND_Y: 1296 case MOVE_DIMENSIONS_X_AND_Y:
1276 actor_->Move(scaled_rect.x, scaled_rect.y, anim_ms); 1297 actor_->Move(scaled_rect.x, scaled_rect.y, anim_ms);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 xid_, xid_, wm_->GetXAtom(ATOM_WM_PROTOCOLS), data, 0); 1385 xid_, xid_, wm_->GetXAtom(ATOM_WM_PROTOCOLS), data, 0);
1365 client_has_redrawn_after_last_resize_ = false; 1386 client_has_redrawn_after_last_resize_ = false;
1366 } 1387 }
1367 1388
1368 void Window::UpdateDamageDebugging(const Rect& bounding_box) { 1389 void Window::UpdateDamageDebugging(const Rect& bounding_box) {
1369 // If we don't have a group for transforming all of the actors at once, 1390 // If we don't have a group for transforming all of the actors at once,
1370 // initialize one. 1391 // initialize one.
1371 if (!damage_debug_group_.get()) { 1392 if (!damage_debug_group_.get()) {
1372 damage_debug_group_.reset(wm_->compositor()->CreateGroup()); 1393 damage_debug_group_.reset(wm_->compositor()->CreateGroup());
1373 damage_debug_group_->SetName("damage debug group for window " + xid_str_); 1394 damage_debug_group_->SetName("damage debug group for window " + xid_str_);
1374 damage_debug_group_->Move(composited_x_, composited_y_, 0); 1395 damage_debug_group_->Move(composited_x(), composited_y(), 0);
1375 damage_debug_group_->Scale(composited_scale_x_, composited_scale_y_, 0); 1396 damage_debug_group_->Scale(composited_scale_x_, composited_scale_y_, 0);
1376 damage_debug_group_->SetOpacity(combined_opacity(), 0); 1397 damage_debug_group_->SetOpacity(combined_opacity(), 0);
1377 if (actor_is_shown()) 1398 if (actor_is_shown())
1378 damage_debug_group_->Show(); 1399 damage_debug_group_->Show();
1379 else 1400 else
1380 damage_debug_group_->Hide(); 1401 damage_debug_group_->Hide();
1381 1402
1382 wm_->stage()->AddActor(damage_debug_group_.get()); 1403 wm_->stage()->AddActor(damage_debug_group_.get());
1383 damage_debug_group_->Raise(actor_.get()); 1404 damage_debug_group_->Raise(actor_.get());
1384 } 1405 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 DCHECK(actor); 1440 DCHECK(actor);
1420 actor_->SetName(string("destroyed window ") + XidStr(xid)); 1441 actor_->SetName(string("destroyed window ") + XidStr(xid));
1421 } 1442 }
1422 1443
1423 DestroyedWindow::~DestroyedWindow() { 1444 DestroyedWindow::~DestroyedWindow() {
1424 if (pixmap_) 1445 if (pixmap_)
1425 wm_->xconn()->FreePixmap(pixmap_); 1446 wm_->xconn()->FreePixmap(pixmap_);
1426 } 1447 }
1427 1448
1428 } // namespace window_manager 1449 } // namespace window_manager
OLDNEW
« no previous file with comments | « window.h ('k') | window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698