display: Copy background setter code from mutter
This code uses the new GDK API to set the window background. https://bugzilla.gnome.org/show_bug.cgi?id=626870
This commit is contained in:
parent
6c990cd60c
commit
c1b95ff43f
1 changed files with 14 additions and 27 deletions
|
@ -434,39 +434,26 @@ clear_exposed_input_region (FooScrollArea *area,
|
||||||
cairo_region_destroy (viewport);
|
cairo_region_destroy (viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* taken from mutter */
|
||||||
static void
|
static void
|
||||||
setup_background_cr (GdkWindow *window,
|
setup_background_cr (GdkWindow *window, cairo_t *cr, int x_offset, int y_offset)
|
||||||
cairo_t *cr,
|
|
||||||
int x_offset,
|
|
||||||
int y_offset)
|
|
||||||
{
|
{
|
||||||
GdkPixmap *pixmap;
|
GdkWindow *parent = gdk_window_get_parent (window);
|
||||||
GdkWindow *parent;
|
cairo_pattern_t *bg_pattern;
|
||||||
gint x, y;
|
|
||||||
GdkColor bg_color;
|
|
||||||
gboolean parent_relative;
|
|
||||||
|
|
||||||
gdk_window_get_back_pixmap (window, &pixmap, &parent_relative);
|
bg_pattern = gdk_window_get_background_pattern (window);
|
||||||
parent = gdk_window_get_effective_parent (window);
|
if (bg_pattern == NULL && parent)
|
||||||
gdk_window_get_geometry (window, &x, &y, NULL, NULL, NULL);
|
|
||||||
gdk_window_get_background (window, &bg_color);
|
|
||||||
|
|
||||||
if (parent_relative && parent)
|
|
||||||
{
|
{
|
||||||
x_offset += x;
|
gint window_x, window_y;
|
||||||
y_offset += y;
|
|
||||||
|
|
||||||
setup_background_cr (parent, cr, x_offset, y_offset);
|
gdk_window_get_position (window, &window_x, &window_y);
|
||||||
|
setup_background_cr (parent, cr, x_offset + window_x, y_offset + window_y);
|
||||||
}
|
}
|
||||||
else if (pixmap &&
|
else if (bg_pattern)
|
||||||
!parent_relative/* &&
|
|
||||||
pixmap != GDK_NO_BG*/)
|
|
||||||
{
|
{
|
||||||
gdk_cairo_set_source_pixmap (cr, pixmap, -x_offset, -y_offset);
|
cairo_translate (cr, - x_offset, - y_offset);
|
||||||
}
|
cairo_set_source (cr, bg_pattern);
|
||||||
else
|
cairo_translate (cr, x_offset, y_offset);
|
||||||
{
|
|
||||||
gdk_cairo_set_source_color (cr, &bg_color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue