[gtk+] API: Remove gdk_window_set_background()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] API: Remove gdk_window_set_background()
- Date: Sun, 16 Oct 2016 16:30:17 +0000 (UTC)
commit eace2cf4219bbb1be376567f804ae2e0c3b5821a
Author: Benjamin Otte <otte redhat com>
Date: Thu Oct 6 23:55:53 2016 +0200
API: Remove gdk_window_set_background()
Backgrounds are always transparent black.
gdk/broadway/gdkwindow-broadway.c | 11 --
gdk/gdkinternals.h | 3 -
gdk/gdkoffscreenwindow.c | 7 -
gdk/gdkwindow.c | 169 +----------------------------
gdk/gdkwindow.h | 11 --
gdk/gdkwindowimpl.h | 2 -
gdk/mir/gdkmirwindowimpl.c | 26 -----
gdk/quartz/gdkwindow-quartz.c | 10 --
gdk/wayland/gdkwindow-wayland.c | 7 -
gdk/win32/gdkwindow-win32.c | 7 -
gdk/x11/gdkdnd-x11.c | 3 +-
gdk/x11/gdkwindow-x11.c | 145 +------------------------
gtk/deprecated/gtkmisc.c | 1 -
gtk/gtkdrawingarea.c | 31 -----
gtk/gtkfixed.c | 29 -----
gtk/gtklayout.c | 31 -----
gtk/gtknotebook.c | 2 -
gtk/gtkscrolledwindow.c | 3 -
gtk/gtkstylecontext.c | 44 --------
gtk/gtkstylecontext.h | 4 -
tests/testgtk.c | 194 ---------------------------------
testsuite/reftests/reftest-snapshot.c | 7 -
22 files changed, 5 insertions(+), 742 deletions(-)
---
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 2cc6b15..2e63f33 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -43,9 +43,6 @@
#include <string.h>
/* Forward declarations */
-static void gdk_window_broadway_set_background (GdkWindow *window,
- cairo_pattern_t *pattern);
-
static void gdk_window_impl_broadway_finalize (GObject *object);
static const cairo_user_data_key_t gdk_broadway_cairo_key;
@@ -656,13 +653,6 @@ gdk_broadway_window_set_transient_for (GdkWindow *window,
}
static void
-gdk_window_broadway_set_background (GdkWindow *window,
- cairo_pattern_t *pattern)
-{
- return;
-}
-
-static void
gdk_window_broadway_set_device_cursor (GdkWindow *window,
GdkDevice *device,
GdkCursor *cursor)
@@ -1561,7 +1551,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
impl_class->restack_under = gdk_window_broadway_restack_under;
impl_class->restack_toplevel = gdk_window_broadway_restack_toplevel;
impl_class->move_resize = gdk_window_broadway_move_resize;
- impl_class->set_background = gdk_window_broadway_set_background;
impl_class->reparent = gdk_window_broadway_reparent;
impl_class->set_device_cursor = gdk_window_broadway_set_device_cursor;
impl_class->get_geometry = gdk_window_broadway_get_geometry;
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 67212ff..123323a 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -224,9 +224,6 @@ struct _GdkWindow
GList children_list_node;
GList *native_children;
-
- cairo_pattern_t *background;
-
/* The paint logic here is a bit complex because of our intermingling of
* cairo and GL. Let's first go over the cairo-alone case:
*
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index 8c01e9f..16ae806 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -500,12 +500,6 @@ gdk_offscreen_window_set_events (GdkWindow *window,
}
static void
-gdk_offscreen_window_set_background (GdkWindow *window,
- cairo_pattern_t *pattern)
-{
-}
-
-static void
gdk_offscreen_window_shape_combine_region (GdkWindow *window,
const cairo_region_t *shape_region,
gint offset_x,
@@ -705,7 +699,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
impl_class->restack_under = NULL;
impl_class->restack_toplevel = NULL;
impl_class->move_resize = gdk_offscreen_window_move_resize;
- impl_class->set_background = gdk_offscreen_window_set_background;
impl_class->reparent = gdk_offscreen_window_reparent;
impl_class->set_device_cursor = gdk_offscreen_window_set_device_cursor;
impl_class->get_geometry = gdk_offscreen_window_get_geometry;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index ba64a65..b7ffc53 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1423,9 +1423,6 @@ gdk_window_new (GdkWindow *parent,
{
window->input_only = FALSE;
window->depth = window->visual->depth;
-
- /* XXX: Cache this somehow? */
- window->background = cairo_pattern_create_rgba (0, 0, 0, 0);
}
else
{
@@ -1839,9 +1836,6 @@ gdk_window_ensure_native (GdkWindow *window)
reparent_to_impl (window);
- if (!window->input_only)
- impl_class->set_background (window, window->background);
-
impl_class->input_shape_combine_region (window,
window->input_shape,
0, 0);
@@ -2061,12 +2055,6 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
gdk_window_free_current_paint (window);
- if (window->background)
- {
- cairo_pattern_destroy (window->background);
- window->background = NULL;
- }
-
if (window->window_type == GDK_WINDOW_FOREIGN)
g_assert (window->children == NULL);
else
@@ -3433,9 +3421,6 @@ gdk_window_get_visible_region (GdkWindow *window)
static void
gdk_window_clear_backing_region (GdkWindow *window)
{
- GdkWindow *bg_window;
- cairo_pattern_t *pattern = NULL;
- int x_offset = 0, y_offset = 0;
cairo_t *cr;
if (GDK_WINDOW_DESTROYED (window))
@@ -3443,26 +3428,7 @@ gdk_window_clear_backing_region (GdkWindow *window)
cr = cairo_create (window->current_paint.surface);
- for (bg_window = window; bg_window; bg_window = bg_window->parent)
- {
- pattern = gdk_window_get_background_pattern (bg_window);
- if (pattern)
- break;
-
- x_offset += bg_window->x;
- y_offset += bg_window->y;
- }
-
- if (pattern)
- {
- cairo_translate (cr, -x_offset, -y_offset);
- cairo_set_source (cr, pattern);
- cairo_translate (cr, x_offset, y_offset);
- }
- else
- cairo_set_source_rgb (cr, 0, 0, 0);
-
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
gdk_cairo_region (cr, window->current_paint.region);
cairo_fill (cr);
@@ -6298,139 +6264,6 @@ gdk_window_move_region (GdkWindow *window,
cairo_region_destroy (expose_area);
}
-/**
- * gdk_window_set_background:
- * @window: a #GdkWindow
- * @color: a #GdkColor
- *
- * Sets the background color of @window.
- *
- * However, when using GTK+, influence the background of a widget
- * using a style class or CSS — if you’re an application — or with
- * gtk_style_context_set_background() — if you're implementing a
- * custom widget.
- *
- * See also gdk_window_set_background_pattern().
- *
- * Deprecated: 3.4: Use gdk_window_set_background_rgba() instead.
- */
-void
-gdk_window_set_background (GdkWindow *window,
- const GdkColor *color)
-{
- cairo_pattern_t *pattern;
-
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- pattern = cairo_pattern_create_rgb (color->red / 65535.,
- color->green / 65535.,
- color->blue / 65535.);
-
- gdk_window_set_background_pattern (window, pattern);
-
- cairo_pattern_destroy (pattern);
-}
-
-/**
- * gdk_window_set_background_rgba:
- * @window: a #GdkWindow
- * @rgba: a #GdkRGBA color
- *
- * Sets the background color of @window.
- *
- * See also gdk_window_set_background_pattern().
- **/
-void
-gdk_window_set_background_rgba (GdkWindow *window,
- const GdkRGBA *rgba)
-{
- cairo_pattern_t *pattern;
- GdkRGBA prev_rgba;
-
- g_return_if_fail (GDK_IS_WINDOW (window));
- g_return_if_fail (rgba != NULL);
-
- /*
- * If the new RGBA matches the previous pattern, ignore the change so that
- * we do not invalidate the window contents.
- */
- if ((window->background != NULL) &&
- (cairo_pattern_get_type (window->background) == CAIRO_PATTERN_TYPE_SOLID) &&
- (cairo_pattern_get_rgba (window->background,
- &prev_rgba.red,
- &prev_rgba.green,
- &prev_rgba.blue,
- &prev_rgba.alpha) == CAIRO_STATUS_SUCCESS) &&
- gdk_rgba_equal (&prev_rgba, rgba))
- return;
-
- pattern = cairo_pattern_create_rgba (rgba->red, rgba->green,
- rgba->blue, rgba->alpha);
-
- gdk_window_set_background_pattern (window, pattern);
-
- cairo_pattern_destroy (pattern);
-}
-
-
-/**
- * gdk_window_set_background_pattern:
- * @window: a #GdkWindow
- * @pattern: (allow-none): a pattern to use, or %NULL
- *
- * Sets the background of @window.
- *
- * A background of %NULL means that the window will inherit its
- * background from its parent window.
- *
- * The windowing system will normally fill a window with its background
- * when the window is obscured then exposed.
- */
-void
-gdk_window_set_background_pattern (GdkWindow *window,
- cairo_pattern_t *pattern)
-{
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- if (window->input_only)
- return;
-
- if (pattern)
- cairo_pattern_reference (pattern);
- if (window->background)
- cairo_pattern_destroy (window->background);
- window->background = pattern;
-
- if (gdk_window_has_impl (window))
- {
- GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
- impl_class->set_background (window, pattern);
- }
- else
- gdk_window_invalidate_rect_full (window, NULL, TRUE);
-}
-
-/**
- * gdk_window_get_background_pattern:
- * @window: a window
- *
- * Gets the pattern used to clear the background on @window. If @window
- * does not have its own background and reuses the parent's, %NULL is
- * returned and you’ll have to query it yourself.
- *
- * Returns: (nullable) (transfer none): The pattern to use for the
- * background or %NULL to use the parent’s background.
- *
- * Since: 2.22
- **/
-cairo_pattern_t *
-gdk_window_get_background_pattern (GdkWindow *window)
-{
- g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
-
- return window->background;
-}
-
static void
gdk_window_set_cursor_internal (GdkWindow *window,
GdkDevice *device,
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index d3b3240..9e14c6f 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -759,17 +759,6 @@ void gdk_window_set_startup_id (GdkWindow *window,
GDK_AVAILABLE_IN_ALL
void gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent);
-GDK_DEPRECATED_IN_3_4_FOR(gdk_window_set_background_rgba)
-void gdk_window_set_background (GdkWindow *window,
- const GdkColor *color);
-GDK_AVAILABLE_IN_ALL
-void gdk_window_set_background_rgba (GdkWindow *window,
- const GdkRGBA *rgba);
-GDK_AVAILABLE_IN_ALL
-void gdk_window_set_background_pattern (GdkWindow *window,
- cairo_pattern_t *pattern);
-GDK_AVAILABLE_IN_ALL
-cairo_pattern_t *gdk_window_get_background_pattern (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
void gdk_window_set_cursor (GdkWindow *window,
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index a6555b1..2ebf434 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -82,8 +82,6 @@ struct _GdkWindowImplClass
GdkAnchorHints anchor_hints,
gint rect_anchor_dx,
gint rect_anchor_dy);
- void (* set_background) (GdkWindow *window,
- cairo_pattern_t *pattern);
GdkEventMask (* get_events) (GdkWindow *window);
void (* set_events) (GdkWindow *window,
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index 8b161ba..61d0b60 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -56,9 +56,6 @@ struct _GdkMirWindowImpl
GdkWindowTypeHint type_hint;
MirSurfaceState surface_state;
- /* Pattern for background */
- cairo_pattern_t *background;
-
/* Current button state for checking which buttons are being pressed / released */
gdouble x;
gdouble y;
@@ -652,15 +649,6 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
impl->cairo_surface = cairo_surface_reference (cairo_surface);
- /* Draw background */
- if (impl->background)
- {
- c = cairo_create (impl->cairo_surface);
- cairo_set_source (c, impl->background);
- cairo_paint (c);
- cairo_destroy (c);
- }
-
return cairo_surface;
}
@@ -680,8 +668,6 @@ gdk_mir_window_impl_finalize (GObject *object)
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object);
g_free (impl->title);
- if (impl->background)
- cairo_pattern_destroy (impl->background);
if (impl->surface)
mir_surface_release_sync (impl->surface);
if (impl->cairo_surface)
@@ -884,18 +870,6 @@ gdk_mir_window_impl_move_to_rect (GdkWindow *window,
FALSE);
}
-static void
-gdk_mir_window_impl_set_background (GdkWindow *window,
- cairo_pattern_t *pattern)
-{
- //g_printerr ("gdk_mir_window_impl_set_background window=%p\n", window);
- GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
-
- if (impl->background)
- cairo_pattern_destroy (impl->background);
- impl->background = cairo_pattern_reference (pattern);
-}
-
static GdkEventMask
gdk_mir_window_impl_get_events (GdkWindow *window)
{
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 33a701b..e07f7b6 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -1543,15 +1543,6 @@ gdk_window_quartz_restack_toplevel (GdkWindow *window,
}
static void
-gdk_window_quartz_set_background (GdkWindow *window,
- cairo_pattern_t *pattern)
-{
- /* FIXME: We could theoretically set the background color for toplevels
- * here. (Currently we draw the background before emitting expose events)
- */
-}
-
-static void
gdk_window_quartz_set_device_cursor (GdkWindow *window,
GdkDevice *device,
GdkCursor *cursor)
@@ -2900,7 +2891,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
impl_class->lower = gdk_window_quartz_lower;
impl_class->restack_toplevel = gdk_window_quartz_restack_toplevel;
impl_class->move_resize = gdk_window_quartz_move_resize;
- impl_class->set_background = gdk_window_quartz_set_background;
impl_class->reparent = gdk_window_quartz_reparent;
impl_class->set_device_cursor = gdk_window_quartz_set_device_cursor;
impl_class->get_geometry = gdk_window_quartz_get_geometry;
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index bc4698e..bb55044 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -2655,12 +2655,6 @@ gdk_window_wayland_move_to_rect (GdkWindow *window,
impl->position_method = POSITION_METHOD_MOVE_TO_RECT;
}
-static void
-gdk_window_wayland_set_background (GdkWindow *window,
- cairo_pattern_t *pattern)
-{
-}
-
static gboolean
gdk_window_wayland_reparent (GdkWindow *window,
GdkWindow *new_parent,
@@ -3626,7 +3620,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
impl_class->restack_toplevel = gdk_window_wayland_restack_toplevel;
impl_class->move_resize = gdk_window_wayland_move_resize;
impl_class->move_to_rect = gdk_window_wayland_move_to_rect;
- impl_class->set_background = gdk_window_wayland_set_background;
impl_class->reparent = gdk_window_wayland_reparent;
impl_class->set_device_cursor = gdk_window_wayland_set_device_cursor;
impl_class->get_geometry = gdk_window_wayland_get_geometry;
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 0adb907..19d0144 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -2161,12 +2161,6 @@ _gdk_modal_current (void)
}
static void
-gdk_win32_window_set_background (GdkWindow *window,
- cairo_pattern_t *pattern)
-{
-}
-
-static void
gdk_win32_window_set_device_cursor (GdkWindow *window,
GdkDevice *device,
GdkCursor *cursor)
@@ -5929,7 +5923,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
impl_class->restack_under = gdk_win32_window_restack_under;
impl_class->restack_toplevel = gdk_win32_window_restack_toplevel;
impl_class->move_resize = gdk_win32_window_move_resize;
- impl_class->set_background = gdk_win32_window_set_background;
impl_class->reparent = gdk_win32_window_reparent;
impl_class->set_device_cursor = gdk_win32_window_set_device_cursor;
impl_class->get_geometry = gdk_win32_window_get_geometry;
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 1668551..b28407e 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -2611,7 +2611,6 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
GdkDragAnim *anim;
cairo_surface_t *win_surface;
cairo_surface_t *surface;
- cairo_pattern_t *pattern;
cairo_t *cr;
if (success)
@@ -2631,11 +2630,13 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
cairo_destroy (cr);
cairo_surface_destroy (win_surface);
+/*
pattern = cairo_pattern_create_for_surface (surface);
gdk_window_set_background_pattern (x11_context->drag_window, pattern);
cairo_pattern_destroy (pattern);
+*/
cairo_surface_destroy (surface);
anim = g_slice_new0 (GdkDragAnim);
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 41ee462..b2e314d 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -106,8 +106,6 @@ static void set_wm_name (GdkDisplay *display,
Window xwindow,
const gchar *name);
static void move_to_current_desktop (GdkWindow *window);
-static void gdk_window_x11_set_background (GdkWindow *window,
- cairo_pattern_t *pattern);
static void gdk_window_impl_x11_finalize (GObject *object);
@@ -641,7 +639,8 @@ tmp_reset_bg (GdkWindow *window)
impl->no_bg = FALSE;
- gdk_window_x11_set_background (window, window->background);
+ XSetWindowBackground (GDK_WINDOW_XDISPLAY (window),
+ GDK_WINDOW_XID (window), 0);
}
/* Unsetting and resetting window backgrounds.
@@ -2894,145 +2893,6 @@ gdk_x11_window_set_transient_for (GdkWindow *window,
GDK_WINDOW_XID (parent));
}
-static gboolean
-gdk_window_x11_set_back_color (GdkWindow *window,
- double red,
- double green,
- double blue,
- double alpha)
-{
- GdkVisual *visual = gdk_window_get_visual (window);
-
- /* I suppose we could handle these, but that'd require fiddling with
- * xrender formats... */
- if (alpha != 1.0)
- return FALSE;
-
- switch (visual->type)
- {
- case GDK_VISUAL_DIRECT_COLOR:
- case GDK_VISUAL_TRUE_COLOR:
- {
- /* If bits not used for color are used for something other than padding,
- * it's likely alpha, so we set them to 1s.
- */
- guint padding, pixel;
- gint red_prec, red_shift, green_prec, green_shift, blue_prec, blue_shift;
-
- /* Shifting by >= width-of-type isn't defined in C */
- if (visual->depth >= 32)
- padding = 0;
- else
- padding = ((~(guint32)0)) << visual->depth;
-
- pixel = ~ (visual->red_mask | visual->green_mask | visual->blue_mask | padding);
-
- gdk_visual_get_red_pixel_details (visual, NULL, &red_shift, &red_prec);
- gdk_visual_get_green_pixel_details (visual, NULL, &green_shift, &green_prec);
- gdk_visual_get_blue_pixel_details (visual, NULL, &blue_shift, &blue_prec);
-
- pixel += (((int) (red * ((1 << red_prec ) - 1))) << red_shift ) +
- (((int) (green * ((1 << green_prec) - 1))) << green_shift) +
- (((int) (blue * ((1 << blue_prec ) - 1))) << blue_shift );
-
- XSetWindowBackground (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window), pixel);
- }
- return TRUE;
-
- /* These require fiddling with the colormap, and as they're essentially unused
- * we're just gonna skip them for now.
- */
- case GDK_VISUAL_PSEUDO_COLOR:
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_STATIC_COLOR:
- default:
- break;
- }
-
- return FALSE;
-}
-
-static gboolean
-matrix_is_identity (cairo_matrix_t *matrix)
-{
- return matrix->xx == 1.0 && matrix->yy == 1.0 &&
- matrix->yx == 0.0 && matrix->xy == 0.0 &&
- matrix->x0 == 0.0 && matrix->y0 == 0.0;
-}
-
-static void
-gdk_window_x11_set_background (GdkWindow *window,
- cairo_pattern_t *pattern)
-{
- GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
- double r, g, b, a;
- cairo_surface_t *surface;
- cairo_matrix_t matrix;
-
- if (GDK_WINDOW_DESTROYED (window))
- return;
-
- if (pattern == NULL)
- {
- GdkWindow *parent;
-
- /* X throws BadMatch if the parent has a different depth when
- * using ParentRelative */
- parent = gdk_window_get_parent (window);
- if (parent && window->depth != parent->depth)
- XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window), None);
- else
- XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window), ParentRelative);
- return;
- }
-
- switch (cairo_pattern_get_type (pattern))
- {
- case CAIRO_PATTERN_TYPE_SOLID:
- cairo_pattern_get_rgba (pattern, &r, &g, &b, &a);
- if (gdk_window_x11_set_back_color (window, r, g, b, a))
- return;
- break;
- case CAIRO_PATTERN_TYPE_SURFACE:
- cairo_pattern_get_matrix (pattern, &matrix);
- if (cairo_pattern_get_surface (pattern, &surface) == CAIRO_STATUS_SUCCESS &&
- matrix_is_identity (&matrix) &&
- cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_XLIB &&
- cairo_xlib_surface_get_visual (surface) == GDK_VISUAL_XVISUAL (gdk_window_get_visual ((window))) &&
- cairo_xlib_surface_get_display (surface) == GDK_WINDOW_XDISPLAY (window))
- {
- double x, y, sx, sy;
-
- cairo_surface_get_device_offset (surface, &x, &y);
- sx = sy = 1.;
- cairo_surface_get_device_scale (surface, &sx, &sy);
- /* XXX: This still bombs for non-pixmaps, but there's no way to
- * detect we're not a pixmap in Cairo... */
- if (x == 0.0 && y == 0.0 &&
- sx == impl->window_scale && sy == impl->window_scale)
- {
- XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window),
- cairo_xlib_surface_get_drawable (surface));
- return;
- }
- }
- /* fall through */
- case CAIRO_PATTERN_TYPE_LINEAR:
- case CAIRO_PATTERN_TYPE_RADIAL:
- default:
- /* fallback: just use black */
- break;
- }
-
- XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window), None);
-}
-
static void
gdk_window_x11_set_device_cursor (GdkWindow *window,
GdkDevice *device,
@@ -5681,7 +5541,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
impl_class->restack_under = gdk_window_x11_restack_under;
impl_class->restack_toplevel = gdk_window_x11_restack_toplevel;
impl_class->move_resize = gdk_window_x11_move_resize;
- impl_class->set_background = gdk_window_x11_set_background;
impl_class->reparent = gdk_window_x11_reparent;
impl_class->set_device_cursor = gdk_window_x11_set_device_cursor;
impl_class->get_geometry = gdk_window_x11_get_geometry;
diff --git a/gtk/deprecated/gtkmisc.c b/gtk/deprecated/gtkmisc.c
index 2cab744..8035e68 100644
--- a/gtk/deprecated/gtkmisc.c
+++ b/gtk/deprecated/gtkmisc.c
@@ -445,7 +445,6 @@ gtk_misc_realize (GtkWidget *widget)
window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gtk_widget_register_window (widget, window);
- gdk_window_set_background_pattern (window, NULL);
}
}
diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c
index 16f8f3b..f396001 100644
--- a/gtk/gtkdrawingarea.c
+++ b/gtk/gtkdrawingarea.c
@@ -120,7 +120,6 @@
*/
static void gtk_drawing_area_realize (GtkWidget *widget);
-static void gtk_drawing_area_style_updated (GtkWidget *widget);
static void gtk_drawing_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_drawing_area_send_configure (GtkDrawingArea *darea);
@@ -134,7 +133,6 @@ gtk_drawing_area_class_init (GtkDrawingAreaClass *class)
widget_class->realize = gtk_drawing_area_realize;
widget_class->size_allocate = gtk_drawing_area_size_allocate;
- widget_class->style_updated = gtk_drawing_area_style_updated;
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_DRAWING_AREA);
}
@@ -158,33 +156,6 @@ gtk_drawing_area_new (void)
}
static void
-set_background (GtkWidget *widget)
-{
- if (gtk_widget_get_realized (widget) &&
- gtk_widget_get_has_window (widget))
- {
- /* We still need to call gtk_style_context_set_background() here for
- * GtkDrawingArea, since clients expect backgrounds set on it (e.g. through
- * gtk_widget_override_background_color) to be available even when they
- * don't chain up from draw().
- * This should be revisited next time we have a major API break.
- */
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- gtk_style_context_set_background (gtk_widget_get_style_context (widget),
- gtk_widget_get_window (widget));
- G_GNUC_END_IGNORE_DEPRECATIONS;
- }
-}
-
-static void
-gtk_drawing_area_style_updated (GtkWidget *widget)
-{
- GTK_WIDGET_CLASS (gtk_drawing_area_parent_class)->style_updated (widget);
-
- set_background (widget);
-}
-
-static void
gtk_drawing_area_realize (GtkWidget *widget)
{
GtkAllocation allocation;
@@ -216,8 +187,6 @@ gtk_drawing_area_realize (GtkWidget *widget)
&attributes, attributes_mask);
gtk_widget_register_window (widget, window);
gtk_widget_set_window (widget, window);
-
- set_background (widget);
}
gtk_drawing_area_send_configure (GTK_DRAWING_AREA (widget));
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 097676d..751e7b3 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -94,7 +94,6 @@ static void gtk_fixed_get_preferred_height (GtkWidget *widget,
gint *natural);
static void gtk_fixed_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static void gtk_fixed_style_updated (GtkWidget *widget);
static gboolean gtk_fixed_draw (GtkWidget *widget,
cairo_t *cr);
static void gtk_fixed_add (GtkContainer *container,
@@ -134,7 +133,6 @@ gtk_fixed_class_init (GtkFixedClass *class)
widget_class->get_preferred_height = gtk_fixed_get_preferred_height;
widget_class->size_allocate = gtk_fixed_size_allocate;
widget_class->draw = gtk_fixed_draw;
- widget_class->style_updated = gtk_fixed_style_updated;
container_class->add = gtk_fixed_add;
container_class->remove = gtk_fixed_remove;
@@ -347,31 +345,6 @@ gtk_fixed_get_child_property (GtkContainer *container,
}
static void
-set_background (GtkWidget *widget)
-{
- if (gtk_widget_get_realized (widget))
- {
- /* We still need to call gtk_style_context_set_background() here for
- * GtkFixed, since subclasses like EmacsFixed depend on the X window
- * background to be set.
- * This should be revisited next time we have a major API break.
- */
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- gtk_style_context_set_background (gtk_widget_get_style_context (widget),
- gtk_widget_get_window (widget));
- G_GNUC_END_IGNORE_DEPRECATIONS;
- }
-}
-
-static void
-gtk_fixed_style_updated (GtkWidget *widget)
-{
- GTK_WIDGET_CLASS (gtk_fixed_parent_class)->style_updated (widget);
-
- set_background (widget);
-}
-
-static void
gtk_fixed_realize (GtkWidget *widget)
{
GtkAllocation allocation;
@@ -402,8 +375,6 @@ gtk_fixed_realize (GtkWidget *widget)
&attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gtk_widget_register_window (widget, window);
-
- set_background (widget);
}
}
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index 7402651..82ccf13 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -155,7 +155,6 @@ static void gtk_layout_allocate_child (GtkLayout *layout,
GtkLayoutChild *child);
static void gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
GtkLayout *layout);
-static void gtk_layout_style_updated (GtkWidget *widget);
static void gtk_layout_set_hadjustment_values (GtkLayout *layout);
static void gtk_layout_set_vadjustment_values (GtkLayout *layout);
@@ -692,7 +691,6 @@ gtk_layout_class_init (GtkLayoutClass *class)
widget_class->get_preferred_height = gtk_layout_get_preferred_height;
widget_class->size_allocate = gtk_layout_size_allocate;
widget_class->draw = gtk_layout_draw;
- widget_class->style_updated = gtk_layout_style_updated;
container_class->add = gtk_layout_add;
container_class->remove = gtk_layout_remove;
@@ -858,26 +856,6 @@ gtk_layout_init (GtkLayout *layout)
/* Widget methods
*/
-static void
-set_background (GtkWidget *widget)
-{
- GtkLayoutPrivate *priv;
-
- if (gtk_widget_get_realized (widget))
- {
- priv = GTK_LAYOUT (widget)->priv;
-
- /* We still need to call gtk_style_context_set_background() here for
- * GtkLayout, since subclasses like EelCanvas depend on a background to
- * be set since the beginning of the draw() implementation.
- * This should be revisited next time we have a major API break.
- */
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- gtk_style_context_set_background (gtk_widget_get_style_context (widget), priv->bin_window);
- G_GNUC_END_IGNORE_DEPRECATIONS;
- }
-}
-
static void
gtk_layout_realize (GtkWidget *widget)
{
@@ -921,7 +899,6 @@ gtk_layout_realize (GtkWidget *widget)
priv->bin_window = gdk_window_new (window,
&attributes, attributes_mask);
gtk_widget_register_window (widget, priv->bin_window);
- set_background (widget);
tmp_list = priv->children;
while (tmp_list)
@@ -934,14 +911,6 @@ gtk_layout_realize (GtkWidget *widget)
}
static void
-gtk_layout_style_updated (GtkWidget *widget)
-{
- GTK_WIDGET_CLASS (gtk_layout_parent_class)->style_updated (widget);
-
- set_background (widget);
-}
-
-static void
gtk_layout_map (GtkWidget *widget)
{
GtkLayout *layout = GTK_LAYOUT (widget);
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 6450943..2b0372b 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2943,7 +2943,6 @@ show_drag_window (GtkNotebook *notebook,
GdkWindowAttr attributes;
GtkAllocation allocation;
guint attributes_mask;
- GdkRGBA transparent = {0, 0, 0, 0};
gtk_css_gadget_get_margin_allocation (page->gadget, &allocation, NULL);
attributes.x = priv->drag_window_x;
@@ -2959,7 +2958,6 @@ show_drag_window (GtkNotebook *notebook,
&attributes,
attributes_mask);
gtk_widget_register_window (widget, priv->drag_window);
- gdk_window_set_background_rgba (priv->drag_window, &transparent);
}
gtk_widget_set_child_visible (page->tab_label, FALSE);
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index a44d4fa..72edc5b 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -4155,7 +4155,6 @@ create_indicator_window (GtkScrolledWindow *scrolled_window,
GtkWidget *child)
{
GtkWidget *widget = GTK_WIDGET (scrolled_window);
- GdkRGBA transparent = { 0, 0, 0, 0 };
GtkAllocation allocation;
GdkWindow *window;
GdkWindowAttr attributes;
@@ -4177,8 +4176,6 @@ create_indicator_window (GtkScrolledWindow *scrolled_window,
&attributes, attributes_mask);
gtk_widget_register_window (widget, window);
- gdk_window_set_background_rgba (window, &transparent);
-
if (scrolled_window->priv->use_indicators)
gtk_widget_set_parent_window (child, window);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index aa80b73..1989056 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2449,50 +2449,6 @@ gtk_style_context_invalidate (GtkStyleContext *context)
}
/**
- * gtk_style_context_set_background:
- * @context: a #GtkStyleContext
- * @window: a #GdkWindow
- *
- * Sets the background of @window to the background pattern or
- * color specified in @context for its current state.
- *
- * Since: 3.0
- *
- * Deprecated: 3.18: Use gtk_render_background() instead.
- * Note that clients still using this function are now responsible
- * for calling this function again whenever @context is invalidated.
- **/
-void
-gtk_style_context_set_background (GtkStyleContext *context,
- GdkWindow *window)
-{
- g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- g_return_if_fail (GDK_IS_WINDOW (window));
-
- /* This is a sophisticated optimization.
- * If we know the GDK window's background will be opaque, we mark
- * it as opaque. This is so GDK can do all the optimizations it does
- * for opaque windows and be fast.
- * This is mainly used when scrolling.
- *
- * We could indeed just set black instead of the color we have.
- */
- if (gtk_css_style_render_background_is_opaque (gtk_style_context_lookup_style (context)))
- {
- const GdkRGBA *color;
-
- color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_BACKGROUND_COLOR));
-
- gdk_window_set_background_rgba (window, color);
- }
- else
- {
- GdkRGBA transparent = { 0.0, 0.0, 0.0, 0.0 };
- gdk_window_set_background_rgba (window, &transparent);
- }
-}
-
-/**
* gtk_style_context_get_color:
* @context: a #GtkStyleContext
* @state: state to retrieve the color for
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 9f8551f..f6838bb 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -1228,10 +1228,6 @@ void gtk_style_context_invalidate (GtkStyleContext *context);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_reset_widgets (GdkScreen *screen);
-GDK_DEPRECATED_IN_3_18_FOR(gtk_render_background)
-void gtk_style_context_set_background (GtkStyleContext *context,
- GdkWindow *window);
-
GDK_AVAILABLE_IN_3_4
void gtk_render_insertion_cursor
(GtkStyleContext *context,
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 7becaae..dbb340e 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -291,199 +291,6 @@ create_alpha_window (GtkWidget *widget)
}
/*
- * Big windows and guffaw scrolling
- */
-
-static void
-pattern_set_bg (GtkWidget *widget,
- GdkWindow *child,
- gint level)
-{
- static GdkRGBA colors[] = {
- { 0.27, 0.27, 1.0, 1.0 },
- { 0.53, 0.53, 1.0, 1.0},
- { 0.67, 0.67, 1.0, 1.0 }
- };
-
- gdk_window_set_user_data (child, widget);
- gdk_window_set_background_rgba (child, &colors[level]);
-}
-
-static void
-create_pattern (GtkWidget *widget,
- GdkWindow *parent,
- gint level,
- gint width,
- gint height)
-{
- gint h = 1;
- gint i = 0;
-
- GdkWindow *child;
-
- while (2 * h <= height)
- {
- gint w = 1;
- gint j = 0;
-
- while (2 * w <= width)
- {
- if ((i + j) % 2 == 0)
- {
- gint x = w - 1;
- gint y = h - 1;
-
- GdkWindowAttr attributes;
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = x;
- attributes.y = y;
- attributes.width = w;
- attributes.height = h;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.event_mask = GDK_EXPOSURE_MASK;
-
- child = gdk_window_new (parent, &attributes,
- GDK_WA_X | GDK_WA_Y);
-
- pattern_set_bg (widget, child, level);
-
- if (level < 2)
- create_pattern (widget, child, level + 1, w, h);
-
- gdk_window_show (child);
- }
- j++;
- w *= 2;
- }
- i++;
- h *= 2;
- }
-}
-
-#define PATTERN_SIZE (1 << 18)
-
-static void
-pattern_hadj_changed (GtkAdjustment *adjustment,
- GtkWidget *darea)
-{
- gint *old_value = g_object_get_data (G_OBJECT (adjustment), "old-value");
- gint new_value = gtk_adjustment_get_value (adjustment);
-
- if (gtk_widget_get_realized (darea))
- {
- gdk_window_scroll (gtk_widget_get_window (darea),
- *old_value - new_value, 0);
- *old_value = new_value;
- }
-}
-
-static void
-pattern_vadj_changed (GtkAdjustment *adjustment,
- GtkWidget *darea)
-{
- gint *old_value = g_object_get_data (G_OBJECT (adjustment), "old-value");
- gint new_value = gtk_adjustment_get_value (adjustment);
-
- if (gtk_widget_get_realized (darea))
- {
- gdk_window_scroll (gtk_widget_get_window (darea),
- 0, *old_value - new_value);
- *old_value = new_value;
- }
-}
-
-static void
-pattern_realize (GtkWidget *widget,
- gpointer data)
-{
- GdkWindow *window;
-
- window = gtk_widget_get_window (widget);
- pattern_set_bg (widget, window, 0);
- create_pattern (widget, window, 1, PATTERN_SIZE, PATTERN_SIZE);
-}
-
-static void
-create_big_windows (GtkWidget *widget)
-{
- static GtkWidget *window = NULL;
- GtkWidget *content_area;
- GtkWidget *darea, *grid, *scrollbar;
- GtkWidget *eventbox;
- GtkAdjustment *hadjustment;
- GtkAdjustment *vadjustment;
- static gint current_x;
- static gint current_y;
-
- if (!window)
- {
- current_x = 0;
- current_y = 0;
-
- window = gtk_dialog_new_with_buttons ("Big Windows",
- NULL, 0,
- "_Close",
- GTK_RESPONSE_NONE,
- NULL);
-
- gtk_window_set_screen (GTK_WINDOW (window),
- gtk_widget_get_screen (widget));
-
- gtk_window_set_default_size (GTK_WINDOW (window), 200, 300);
-
- g_signal_connect (window, "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- &window);
-
- g_signal_connect (window, "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
-
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
-
- grid = gtk_grid_new ();
- gtk_box_pack_start (GTK_BOX (content_area), grid, TRUE, TRUE, 0);
-
- darea = gtk_drawing_area_new ();
-
- hadjustment = gtk_adjustment_new (0, 0, PATTERN_SIZE, 10, 100, 100);
- g_signal_connect (hadjustment, "value_changed",
- G_CALLBACK (pattern_hadj_changed), darea);
- g_object_set_data (G_OBJECT (hadjustment), "old-value", ¤t_x);
-
- vadjustment = gtk_adjustment_new (0, 0, PATTERN_SIZE, 10, 100, 100);
- g_signal_connect (vadjustment, "value_changed",
- G_CALLBACK (pattern_vadj_changed), darea);
- g_object_set_data (G_OBJECT (vadjustment), "old-value", ¤t_y);
-
- g_signal_connect (darea, "realize",
- G_CALLBACK (pattern_realize),
- NULL);
-
- eventbox = gtk_event_box_new ();
- gtk_widget_set_hexpand (eventbox, TRUE);
- gtk_widget_set_vexpand (eventbox, TRUE);
- gtk_grid_attach (GTK_GRID (grid), eventbox, 0, 0, 1, 1);
-
- gtk_container_add (GTK_CONTAINER (eventbox), darea);
-
- scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, hadjustment);
- gtk_widget_set_hexpand (scrollbar, TRUE);
- gtk_grid_attach (GTK_GRID (grid), scrollbar, 0, 1, 1, 1);
-
- scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, vadjustment);
- gtk_widget_set_vexpand (scrollbar, TRUE);
- gtk_grid_attach (GTK_GRID (grid), scrollbar, 1, 0, 1, 1);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_hide (window);
-}
-
-/*
* GtkButton
*/
@@ -9278,7 +9085,6 @@ struct {
{
{ "alpha window", create_alpha_window },
{ "alpha widget", create_alpha_widgets },
- { "big windows", create_big_windows },
{ "button box", create_button_box },
{ "buttons", create_buttons },
{ "check buttons", create_check_buttons },
diff --git a/testsuite/reftests/reftest-snapshot.c b/testsuite/reftests/reftest-snapshot.c
index cd3cee7..eb69e20 100644
--- a/testsuite/reftests/reftest-snapshot.c
+++ b/testsuite/reftests/reftest-snapshot.c
@@ -96,7 +96,6 @@ static cairo_surface_t *
snapshot_widget (GtkWidget *widget, SnapshotMode mode)
{
cairo_surface_t *surface;
- cairo_pattern_t *bg;
cairo_t *cr;
g_assert (gtk_widget_get_realized (widget));
@@ -144,12 +143,6 @@ snapshot_widget (GtkWidget *widget, SnapshotMode mode)
}
break;
case SNAPSHOT_DRAW:
- bg = gdk_window_get_background_pattern (gtk_widget_get_window (widget));
- if (bg)
- {
- cairo_set_source (cr, bg);
- cairo_paint (cr);
- }
gtk_widget_draw (widget, cr);
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]