OLD | NEW |
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/gtk/notifications/balloon_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/notifications/balloon_view_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 410 |
411 // We draw black dots on the bottom left and right corners to fill in the | 411 // We draw black dots on the bottom left and right corners to fill in the |
412 // border. Otherwise, the border has a gap because the sharp corners of the | 412 // border. Otherwise, the border has a gap because the sharp corners of the |
413 // HTML view cut off the roundedness of the notification window. | 413 // HTML view cut off the roundedness of the notification window. |
414 gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender, | 414 gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender, |
415 GdkEventExpose* event) { | 415 GdkEventExpose* event) { |
416 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); | 416 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); |
417 gdk_cairo_rectangle(cr, &event->area); | 417 gdk_cairo_rectangle(cr, &event->area); |
418 cairo_clip(cr); | 418 cairo_clip(cr); |
419 | 419 |
| 420 GtkAllocation allocation; |
| 421 gtk_widget_get_allocation(sender, &allocation); |
| 422 |
420 // According to a discussion on a mailing list I found, these degenerate | 423 // According to a discussion on a mailing list I found, these degenerate |
421 // paths are the officially supported way to draw points in Cairo. | 424 // paths are the officially supported way to draw points in Cairo. |
422 cairo_set_source_rgb(cr, 0, 0, 0); | 425 cairo_set_source_rgb(cr, 0, 0, 0); |
423 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); | 426 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); |
424 cairo_set_line_width(cr, 1.0); | 427 cairo_set_line_width(cr, 1.0); |
425 cairo_move_to(cr, 0.5, sender->allocation.height - 0.5); | 428 cairo_move_to(cr, 0.5, allocation.height - 0.5); |
426 cairo_close_path(cr); | 429 cairo_close_path(cr); |
427 cairo_move_to(cr, sender->allocation.width - 0.5, | 430 cairo_move_to(cr, allocation.width - 0.5, allocation.height - 0.5); |
428 sender->allocation.height - 0.5); | |
429 cairo_close_path(cr); | 431 cairo_close_path(cr); |
430 cairo_stroke(cr); | 432 cairo_stroke(cr); |
431 cairo_destroy(cr); | 433 cairo_destroy(cr); |
432 | 434 |
433 return FALSE; | 435 return FALSE; |
434 } | 436 } |
435 | 437 |
436 gboolean BalloonViewImpl::OnExpose(GtkWidget* sender, GdkEventExpose* event) { | 438 gboolean BalloonViewImpl::OnExpose(GtkWidget* sender, GdkEventExpose* event) { |
437 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); | 439 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window)); |
438 gdk_cairo_rectangle(cr, &event->area); | 440 gdk_cairo_rectangle(cr, &event->area); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 weak_factory_.GetWeakPtr(), | 479 weak_factory_.GetWeakPtr(), |
478 false)); | 480 false)); |
479 } | 481 } |
480 } | 482 } |
481 | 483 |
482 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { | 484 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { |
483 frame_container_ = NULL; | 485 frame_container_ = NULL; |
484 Close(false); | 486 Close(false); |
485 return FALSE; // Propagate. | 487 return FALSE; // Propagate. |
486 } | 488 } |
OLD | NEW |