From 76d0e1e398af66d55e97b438d2dd4178505be42d Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 24 Jul 2018 19:38:17 +0200 Subject: [PATCH] API: Remove gtk_render_frame_gap() That function does not make sense at all in a CSS world. So better don't support it anymore. --- docs/reference/gtk/gtk4-sections.txt | 1 - gtk/gtkrender.c | 125 --------------------------- gtk/gtkrender.h | 10 --- 3 files changed, 136 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 021d4cbda8..f035fe37cb 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4907,7 +4907,6 @@ gtk_render_check gtk_render_expander gtk_render_focus gtk_render_frame -gtk_render_frame_gap gtk_render_handle gtk_render_layout gtk_render_line diff --git a/gtk/gtkrender.c b/gtk/gtkrender.c index 0481d67756..6272a74ac3 100644 --- a/gtk/gtkrender.c +++ b/gtk/gtkrender.c @@ -508,131 +508,6 @@ gtk_render_line (GtkStyleContext *context, gtk_do_render_line (context, cr, x0, y0, x1, y1); } -static void -gtk_css_style_render_frame_gap (GtkCssStyle *style, - cairo_t *cr, - gdouble x, - gdouble y, - gdouble width, - gdouble height, - GtkPositionType gap_side, - gdouble xy0_gap, - gdouble xy1_gap) -{ - gint border_width; - gdouble x0, y0, x1, y1, xc = 0.0, yc = 0.0, wc = 0.0, hc = 0.0; - GtkBorder border; - - border.top = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100); - border.right = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100); - border.bottom = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100); - border.left = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100); - - border_width = MIN (MIN (border.top, border.bottom), - MIN (border.left, border.right)); - - cairo_save (cr); - - switch (gap_side) - { - case GTK_POS_TOP: - xc = x + xy0_gap + border_width; - yc = y; - wc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0); - hc = border_width; - break; - - case GTK_POS_BOTTOM: - xc = x + xy0_gap + border_width; - yc = y + height - border_width; - wc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0); - hc = border_width; - break; - - case GTK_POS_LEFT: - xc = x; - yc = y + xy0_gap + border_width; - wc = border_width; - hc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0); - break; - - case GTK_POS_RIGHT: - xc = x + width - border_width; - yc = y + xy0_gap + border_width; - wc = border_width; - hc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0); - break; - - default: - g_assert_not_reached (); - break; - } - - cairo_clip_extents (cr, &x0, &y0, &x1, &y1); - cairo_rectangle (cr, x0, y0, x1 - x0, yc - y0); - cairo_rectangle (cr, x0, yc, xc - x0, hc); - cairo_rectangle (cr, xc + wc, yc, x1 - (xc + wc), hc); - cairo_rectangle (cr, x0, yc + hc, x1 - x0, y1 - (yc + hc)); - cairo_clip (cr); - - gtk_css_style_render_border (style, cr, - x, y, width, height); - - cairo_restore (cr); -} - -/** - * gtk_render_frame_gap: - * @context: a #GtkStyleContext - * @cr: a #cairo_t - * @x: X origin of the rectangle - * @y: Y origin of the rectangle - * @width: rectangle width - * @height: rectangle height - * @gap_side: side where the gap is - * @xy0_gap: initial coordinate (X or Y depending on @gap_side) for the gap - * @xy1_gap: end coordinate (X or Y depending on @gap_side) for the gap - * - * Renders a frame around the rectangle defined by (@x, @y, @width, @height), - * leaving a gap on one side. @xy0_gap and @xy1_gap will mean X coordinates - * for %GTK_POS_TOP and %GTK_POS_BOTTOM gap sides, and Y coordinates for - * %GTK_POS_LEFT and %GTK_POS_RIGHT. - * - * Typical rendering of a frame with a gap: - * - * ![](frame-gap.png) - **/ -void -gtk_render_frame_gap (GtkStyleContext *context, - cairo_t *cr, - gdouble x, - gdouble y, - gdouble width, - gdouble height, - GtkPositionType gap_side, - gdouble xy0_gap, - gdouble xy1_gap) -{ - g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); - g_return_if_fail (cr != NULL); - g_return_if_fail (xy0_gap <= xy1_gap); - g_return_if_fail (xy0_gap >= 0); - - if (width <= 0 || height <= 0) - return; - - if (gap_side == GTK_POS_LEFT || - gap_side == GTK_POS_RIGHT) - g_return_if_fail (xy1_gap <= height); - else - g_return_if_fail (xy1_gap <= width); - - gtk_css_style_render_frame_gap (gtk_style_context_lookup_style (context), - cr, - x, y, width, height, gap_side, - xy0_gap, xy1_gap); -} - /** * gtk_render_handle: * @context: a #GtkStyleContext diff --git a/gtk/gtkrender.h b/gtk/gtkrender.h index 938212f340..65390dc101 100644 --- a/gtk/gtkrender.h +++ b/gtk/gtkrender.h @@ -111,16 +111,6 @@ void gtk_render_slider (GtkStyleContext *context, gdouble height, GtkOrientation orientation); GDK_AVAILABLE_IN_ALL -void gtk_render_frame_gap (GtkStyleContext *context, - cairo_t *cr, - gdouble x, - gdouble y, - gdouble width, - gdouble height, - GtkPositionType gap_side, - gdouble xy0_gap, - gdouble xy1_gap); -GDK_AVAILABLE_IN_ALL void gtk_render_handle (GtkStyleContext *context, cairo_t *cr, gdouble x,