diff options
author | Timm Bäder <mail@baedert.org> | 2016-01-05 19:05:43 +0100 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2016-01-08 09:14:03 +0100 |
commit | 711ffd648ed191bad9f0a956cf05905a73a9e4bd (patch) | |
tree | 024fd1776912485b26053def4a7481a52c620dd6 /gtk/gtkpopover.c | |
parent | fa66b271f8c96d86bcb7eb7f315628ea3674aafd (diff) | |
download | gtk+-711ffd648ed191bad9f0a956cf05905a73a9e4bd.tar.gz |
GtkPopover: Protect against transparent backgrounds
If the background is transparent, we can't use it for the input shape,
since that will be empty. Draw a box with rounded corners irectly
instead, in fully opaque black.
https://bugzilla.gnome.org/show_bug.cgi?id=759905
Diffstat (limited to 'gtk/gtkpopover.c')
-rw-r--r-- | gtk/gtkpopover.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 53f004e5f2..d14fcfd2e8 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -108,6 +108,8 @@ #include "gtksizegroup.h" #include "a11y/gtkpopoveraccessible.h" #include "gtkmenusectionbox.h" +#include "gtkroundedboxprivate.h" +#include "gtkstylecontextprivate.h" #ifdef GDK_WINDOWING_WAYLAND #include "wayland/gdkwayland.h" @@ -882,17 +884,25 @@ gtk_popover_fill_border_path (GtkPopover *popover, GtkAllocation allocation; GtkStyleContext *context; gint x1, y1, x2, y2; + GtkRoundedBox box; context = gtk_widget_get_style_context (widget); gtk_widget_get_allocation (widget, &allocation); + cairo_set_source_rgba (cr, 0, 0, 0, 1); + gtk_popover_apply_tail_path (popover, cr); cairo_close_path (cr); cairo_fill (cr); gtk_popover_get_rect_coords (popover, &x1, &y1, &x2, &y2); - gtk_render_frame (context, cr, x1, y1, x2 - x1, y2 - y1); - gtk_render_background (context, cr, x1, y1, x2 - x1, y2 - y1); + + _gtk_rounded_box_init_rect (&box, x1, y1, x2 - x1, y2 - y1); + _gtk_rounded_box_apply_border_radius_for_style (&box, + gtk_style_context_lookup_style (context), + 0); + _gtk_rounded_box_path (&box, cr); + cairo_fill (cr); } static void |