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

Unified Diff: chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc

Issue 6384010: [gtk] fill in gap pixels in desktop notification corners (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/notifications/balloon_view_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
index 4b7c2eb4b102d3f52dc8e7b9127087434baf41a1..559d6b3e8a72d1d36708225dc7b9fe7bae2dc52c 100644
--- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
+++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
@@ -214,6 +214,8 @@ void BalloonViewImpl::Show(Balloon* balloon) {
html_contents_.reset(new BalloonViewHost(balloon));
html_contents_->Init();
gfx::NativeView contents = html_contents_->native_view();
+ g_signal_connect_after(contents, "expose-event",
+ G_CALLBACK(OnContentsExposeThunk), this);
// Divide the frame vertically into the shelf and the content area.
GtkWidget* vbox = gtk_vbox_new(0, 0);
@@ -388,6 +390,31 @@ void BalloonViewImpl::OnCloseButton(GtkWidget* widget) {
Close(true);
}
+// We draw black dots on the bottom left and right corners to fill in the
+// border. Otherwise, the border has a gap because the sharp corners of the
+// HTML view cut off the roundedness of the notification window.
+gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender,
+ GdkEventExpose* event) {
+ cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
+ gdk_cairo_rectangle(cr, &event->area);
+ cairo_clip(cr);
+
+ // According to a discussion on a mailing list I found, these degenerate
+ // paths are the officially supported way to draw points in Cairo.
+ cairo_set_source_rgb(cr, 0, 0, 0);
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_width(cr, 1.0);
+ cairo_move_to(cr, 0.5, sender->allocation.height - 0.5);
+ cairo_close_path(cr);
+ cairo_move_to(cr, sender->allocation.width - 0.5,
+ sender->allocation.height - 0.5);
+ cairo_close_path(cr);
+ cairo_stroke(cr);
+ cairo_destroy(cr);
+
+ return FALSE;
+}
+
gboolean BalloonViewImpl::OnExpose(GtkWidget* sender, GdkEventExpose* event) {
cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
gdk_cairo_rectangle(cr, &event->area);
« no previous file with comments | « chrome/browser/ui/gtk/notifications/balloon_view_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698