summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-29 23:54:18 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-29 23:54:18 +0000
commitbcd594823bcda11d0662d5a0a692a4efd779651c (patch)
tree3a14f73567d0fa26c61f6a9aa1529967eda4f09d
parent266f71cb592ae98fad57867848ddf75f3321cdde (diff)
downloadchromium_src-bcd594823bcda11d0662d5a0a692a4efd779651c.zip
chromium_src-bcd594823bcda11d0662d5a0a692a4efd779651c.tar.gz
chromium_src-bcd594823bcda11d0662d5a0a692a4efd779651c.tar.bz2
GTK: Fix notification animation so it scrolls up from the bottom right.
We need to give the window an initial position from which to animate from. BUG=34514 TEST=Play around with http://www.html5rocks.com/samples/notifications/quick/ and make sure the notifications animate up from the bottom. Review URL: http://codereview.chromium.org/1578001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43017 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/notifications/balloon_view_gtk.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/chrome/browser/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/gtk/notifications/balloon_view_gtk.cc
index 2c9855f..6d8cfa4 100644
--- a/chrome/browser/gtk/notifications/balloon_view_gtk.cc
+++ b/chrome/browser/gtk/notifications/balloon_view_gtk.cc
@@ -85,6 +85,10 @@ const int kOriginLabelCharacters = 18;
// with changes in the default font size.
const int kDefaultShelfHeight = 24;
+// The amount that the bubble collections class offsets from the side of the
+// screen.
+const int kScreenBorder = 5;
+
// Makes the website label relatively smaller to the base text size.
const char* kLabelMarkup = "<span size=\"smaller\">%s</span>";
@@ -292,15 +296,26 @@ void BalloonViewImpl::Show(Balloon* balloon) {
NotificationService::AllSources());
// We don't do InitThemesFor() because it just forces a redraw.
- // Position the view elements according to the balloon position and show.
- RepositionToBalloon();
- gtk_widget_show_all(GTK_WIDGET(hbox_));
- gtk_widget_show(frame_container_);
-
gtk_util::ActAsRoundedWindow(frame_container_, gfx::kGdkBlack, 3,
gtk_util::ROUNDED_ALL,
gtk_util::BORDER_ALL);
+ // Realize the frame container so we can do size calculations.
+ gtk_widget_realize(frame_container_);
+
+ // Update to make sure we have everything sized properly and then move our
+ // window offscreen for its initial animation.
+ html_contents_->UpdateActualSize(balloon_->content_size());
+ int window_width;
+ gtk_window_get_size(GTK_WINDOW(frame_container_), &window_width, NULL);
+
+ int pos_x = gdk_screen_width() - window_width - kScreenBorder;
+ int pos_y = gdk_screen_height();
+ gtk_window_move(GTK_WINDOW(frame_container_), pos_x, pos_y);
+ balloon_->SetPosition(gfx::Point(pos_x, pos_y), false);
+
+ gtk_widget_show_all(frame_container_);
+
notification_registrar_.Add(this,
NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon));
}