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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_window_gtk.cc

Issue 8879005: Fix bug where panels sometimes don't align on bottom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to latest Created 9 years 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 | « chrome/browser/ui/panels/panel_browser_window_gtk.h ('k') | 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/panels/panel_browser_window_gtk.h" 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/ui/browser_list.h" 8 #include "chrome/browser/ui/browser_list.h"
9 #include "chrome/browser/ui/panels/panel.h" 9 #include "chrome/browser/ui/panels/panel.h"
10 #include "chrome/browser/ui/panels/panel_manager.h" 10 #include "chrome/browser/ui/panels/panel_manager.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 BrowserWindowGtk::OnSizeChanged(width, height); 140 BrowserWindowGtk::OnSizeChanged(width, height);
141 141
142 if (window_size_known_) 142 if (window_size_known_)
143 return; 143 return;
144 144
145 window_size_known_ = true; 145 window_size_known_ = true;
146 int top = bounds_.bottom() - height; 146 int top = bounds_.bottom() - height;
147 int left = bounds_.right() - width; 147 int left = bounds_.right() - width;
148 148
149 gtk_window_move(window_, left, top); 149 gtk_window_move(window_, left, top);
150 StartBoundsAnimation(bounds_, gfx::Rect(left, top, width, height)); 150 StartBoundsAnimation(gfx::Rect(left, top, width, height), bounds_);
151 panel_->OnWindowSizeAvailable(); 151 panel_->OnWindowSizeAvailable();
152 152
153 content::NotificationService::current()->Notify( 153 content::NotificationService::current()->Notify(
154 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, 154 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN,
155 content::Source<Panel>(panel_.get()), 155 content::Source<Panel>(panel_.get()),
156 content::NotificationService::NoDetails()); 156 content::NotificationService::NoDetails());
157 } 157 }
158 158
159 bool PanelBrowserWindowGtk::UseCustomFrame() { 159 bool PanelBrowserWindowGtk::UseCustomFrame() {
160 // We always use custom frame for panels. 160 // We always use custom frame for panels.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 return gfx::Size(window_size.width() - frame.width(), 415 return gfx::Size(window_size.width() - frame.width(),
416 window_size.height() - frame.height()); 416 window_size.height() - frame.height());
417 } 417 }
418 418
419 int PanelBrowserWindowGtk::TitleOnlyHeight() const { 419 int PanelBrowserWindowGtk::TitleOnlyHeight() const {
420 return titlebar_widget()->allocation.height; 420 return titlebar_widget()->allocation.height;
421 } 421 }
422 422
423 void PanelBrowserWindowGtk::StartBoundsAnimation( 423 void PanelBrowserWindowGtk::StartBoundsAnimation(
424 const gfx::Rect& from_bounds, const gfx::Rect& to_bounds) { 424 const gfx::Rect& from_bounds, const gfx::Rect& to_bounds) {
425 animation_start_bounds_ = from_bounds; 425 if (bounds_animator_.get() && bounds_animator_->is_animating()) {
426 animation_start_bounds_ = last_animation_progressed_bounds_;
427 } else {
428 animation_start_bounds_ = from_bounds;
429 }
426 430
427 bounds_animator_.reset(new PanelSlideAnimation( 431 bounds_animator_.reset(new PanelSlideAnimation(
428 this, panel_.get(), from_bounds, to_bounds)); 432 this, panel_.get(), from_bounds, to_bounds));
433
429 bounds_animator_->Show(); 434 bounds_animator_->Show();
435 last_animation_progressed_bounds_ = animation_start_bounds_;
430 } 436 }
431 437
432 bool PanelBrowserWindowGtk::IsAnimatingBounds() const { 438 bool PanelBrowserWindowGtk::IsAnimatingBounds() const {
433 return bounds_animator_.get() && bounds_animator_->is_animating(); 439 return bounds_animator_.get() && bounds_animator_->is_animating();
434 } 440 }
435 441
436 void PanelBrowserWindowGtk::WillProcessEvent(GdkEvent* event) { 442 void PanelBrowserWindowGtk::WillProcessEvent(GdkEvent* event) {
437 // Nothing to do. 443 // Nothing to do.
438 } 444 }
439 445
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 // - Say you minimize the window to 100x3 and move it to 900,997 to keep it 505 // - Say you minimize the window to 100x3 and move it to 900,997 to keep it
500 // anchored to the bottom. 506 // anchored to the bottom.
501 // - resize is an async operation and the window manager will decide that 507 // - resize is an async operation and the window manager will decide that
502 // the move will take the window off screen and it won't honor the 508 // the move will take the window off screen and it won't honor the
503 // request. 509 // request.
504 // - When resize finally happens, you'll have a 100x3 window a x,y=900,900. 510 // - When resize finally happens, you'll have a 100x3 window a x,y=900,900.
505 bool move = (animation_start_bounds_.bottom() != bounds_.bottom()) || 511 bool move = (animation_start_bounds_.bottom() != bounds_.bottom()) ||
506 (animation_start_bounds_.right() != bounds_.right()); 512 (animation_start_bounds_.right() != bounds_.right());
507 if (move) 513 if (move)
508 gtk_window_move(window_, new_bounds.x(), new_bounds.y()); 514 gtk_window_move(window_, new_bounds.x(), new_bounds.y());
515
516 last_animation_progressed_bounds_ = new_bounds;
509 } 517 }
510 518
511 void PanelBrowserWindowGtk::CreateDragWidget() { 519 void PanelBrowserWindowGtk::CreateDragWidget() {
512 DCHECK(!drag_widget_); 520 DCHECK(!drag_widget_);
513 drag_widget_ = gtk_invisible_new(); 521 drag_widget_ = gtk_invisible_new();
514 g_signal_connect_after(drag_widget_, "drag-begin", 522 g_signal_connect_after(drag_widget_, "drag-begin",
515 G_CALLBACK(OnDragBeginThunk), this); 523 G_CALLBACK(OnDragBeginThunk), this);
516 g_signal_connect(drag_widget_, "drag-failed", 524 g_signal_connect(drag_widget_, "drag-failed",
517 G_CALLBACK(OnDragFailedThunk), this); 525 G_CALLBACK(OnDragFailedThunk), this);
518 g_signal_connect(drag_widget_, "button-release-event", 526 g_signal_connect(drag_widget_, "button-release-event",
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 769 }
762 } 770 }
763 771
764 bool NativePanelTestingGtk::IsWindowSizeKnown() const { 772 bool NativePanelTestingGtk::IsWindowSizeKnown() const {
765 return panel_browser_window_gtk_->window_size_known_; 773 return panel_browser_window_gtk_->window_size_known_;
766 } 774 }
767 775
768 bool NativePanelTestingGtk::IsAnimatingBounds() const { 776 bool NativePanelTestingGtk::IsAnimatingBounds() const {
769 return panel_browser_window_gtk_->IsAnimatingBounds(); 777 return panel_browser_window_gtk_->IsAnimatingBounds();
770 } 778 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698