summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/gtk-demo/foreigndrawing.c38
-rw-r--r--gtk/a11y/gtkentryaccessible.c3
-rw-r--r--gtk/a11y/gtklabelaccessible.c3
-rw-r--r--gtk/a11y/gtktextcellaccessible.c3
-rw-r--r--gtk/gtkaboutdialog.c14
-rw-r--r--gtk/gtkaccellabel.c1
-rw-r--r--gtk/gtkbindings.c2
-rw-r--r--gtk/gtkcalendar.c12
-rw-r--r--gtk/gtkcellarea.c8
-rw-r--r--gtk/gtkcellrendererprogress.c2
-rw-r--r--gtk/gtkcellrendererspinner.c4
-rw-r--r--gtk/gtkcellrenderertext.c4
-rw-r--r--gtk/gtkcellrenderertoggle.c10
-rw-r--r--gtk/gtkentry.c1
-rw-r--r--gtk/gtkfilechooserwidget.c1
-rw-r--r--gtk/gtkflowbox.c6
-rw-r--r--gtk/gtkfontchooserwidget.c1
-rw-r--r--gtk/gtklabel.c2
-rw-r--r--gtk/gtkmenu.c2
-rw-r--r--gtk/gtkmenuitem.c4
-rw-r--r--gtk/gtkpopover.c22
-rw-r--r--gtk/gtkprintunixdialog.c2
-rw-r--r--gtk/gtkrecentchooserdefault.c2
-rw-r--r--gtk/gtkrevealer.c4
-rw-r--r--gtk/gtkstylecontext.c152
-rw-r--r--gtk/gtkstylecontext.h13
-rw-r--r--gtk/gtkstylecontextprivate.h3
-rw-r--r--gtk/gtktextdisplay.c12
-rw-r--r--gtk/gtktexthandle.c12
-rw-r--r--gtk/gtktextutil.c10
-rw-r--r--gtk/gtktextview.c12
-rw-r--r--gtk/gtktreeview.c4
-rw-r--r--gtk/gtkwidget.c1
-rw-r--r--gtk/gtkwindow.c18
-rw-r--r--gtk/inspector/cellrenderergraph.c2
-rw-r--r--tests/testframe.c6
-rw-r--r--testsuite/gtk/firefox-stylecontext.c4
-rw-r--r--testsuite/gtk/stylecontext.c51
38 files changed, 119 insertions, 332 deletions
diff --git a/demos/gtk-demo/foreigndrawing.c b/demos/gtk-demo/foreigndrawing.c
index 29b383bb3c..d0248472d4 100644
--- a/demos/gtk-demo/foreigndrawing.c
+++ b/demos/gtk-demo/foreigndrawing.c
@@ -180,11 +180,11 @@ draw_style_common (GtkStyleContext *context,
GtkBorder margin, border, padding;
int min_width, min_height;
- gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &margin);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
+ gtk_style_context_get_margin (context, &margin);
+ gtk_style_context_get_border (context, &border);
+ gtk_style_context_get_padding (context, &padding);
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"min-width", &min_width,
"min-height", &min_height,
NULL);
@@ -217,11 +217,11 @@ query_size (GtkStyleContext *context,
GtkBorder margin, border, padding;
int min_width, min_height;
- gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &margin);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
+ gtk_style_context_get_margin (context, &margin);
+ gtk_style_context_get_border (context, &border);
+ gtk_style_context_get_padding (context, &padding);
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"min-width", &min_width,
"min-height", &min_height,
NULL);
@@ -308,7 +308,7 @@ draw_menu (GtkWidget *widget,
&menu_x, &menu_y, &menu_width, &menu_height);
/* Hovered with right arrow */
- gtk_style_context_get (hoveredarrowmenuitem_context, gtk_style_context_get_state (hoveredarrowmenuitem_context),
+ gtk_style_context_get (hoveredarrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
draw_style_common (hovermenuitem_context, cr, menu_x, menu_y, menu_width, menuitem1_height,
@@ -320,13 +320,13 @@ draw_menu (GtkWidget *widget,
/* Left arrow sensitive, and right arrow insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height, menu_width, menuitem2_height,
&contents_x, &contents_y, &contents_width, &contents_height);
- gtk_style_context_get (arrowmenuitem_context, gtk_style_context_get_state (arrowmenuitem_context),
+ gtk_style_context_get (arrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (arrowmenuitem_context, cr, G_PI / 2,
contents_x,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
- gtk_style_context_get (disabledarrowmenuitem_context, gtk_style_context_get_state (disabledarrowmenuitem_context),
+ gtk_style_context_get (disabledarrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (disabledarrowmenuitem_context, cr, G_PI / 2,
@@ -337,7 +337,7 @@ draw_menu (GtkWidget *widget,
/* Left check enabled, sensitive, and right check unchecked, insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height, menu_width, menuitem3_height,
&contents_x, &contents_y, &contents_width, &contents_height);
- gtk_style_context_get (checkmenuitem_context, gtk_style_context_get_state (checkmenuitem_context),
+ gtk_style_context_get (checkmenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (checkmenuitem_context, cr,
contents_x,
@@ -345,7 +345,7 @@ draw_menu (GtkWidget *widget,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (checkmenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
- gtk_style_context_get (disabledcheckmenuitem_context, gtk_style_context_get_state (disabledcheckmenuitem_context),
+ gtk_style_context_get (disabledcheckmenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledcheckmenuitem_context, cr,
contents_x + contents_width - toggle_width,
@@ -363,7 +363,7 @@ draw_menu (GtkWidget *widget,
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height + menuitem3_height + menuitem4_height,
menu_width, menuitem5_height,
&contents_x, &contents_y, &contents_width, &contents_height);
- gtk_style_context_get (radiomenuitem_context, gtk_style_context_get_state (radiomenuitem_context),
+ gtk_style_context_get (radiomenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (radiomenuitem_context, cr,
contents_x,
@@ -371,7 +371,7 @@ draw_menu (GtkWidget *widget,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (radiomenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
- gtk_style_context_get (disabledradiomenuitem_context, gtk_style_context_get_state (disabledradiomenuitem_context),
+ gtk_style_context_get (disabledradiomenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledradiomenuitem_context, cr,
contents_x + contents_width - toggle_width,
@@ -527,7 +527,7 @@ draw_horizontal_scrollbar (GtkWidget *widget,
query_size (trough_context, NULL, height);
query_size (slider_context, NULL, height);
- gtk_style_context_get (slider_context, gtk_style_context_get_state (slider_context),
+ gtk_style_context_get (slider_context,
"min-width", &slider_width, NULL);
draw_style_common (scrollbar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
@@ -780,7 +780,7 @@ draw_combobox (GtkWidget *widget,
query_size (button_box_context, NULL, height);
query_size (arrow_context, NULL, height);
- gtk_style_context_get (arrow_context, gtk_style_context_get_state (arrow_context),
+ gtk_style_context_get (arrow_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
@@ -852,7 +852,7 @@ draw_spinbutton (GtkWidget *widget,
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
- gtk_style_context_get (up_context, gtk_style_context_get_state (up_context),
+ gtk_style_context_get (up_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
@@ -864,7 +864,7 @@ draw_spinbutton (GtkWidget *widget,
g_object_unref (pixbuf);
- gtk_style_context_get (down_context, gtk_style_context_get_state (down_context),
+ gtk_style_context_get (down_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
diff --git a/gtk/a11y/gtkentryaccessible.c b/gtk/a11y/gtkentryaccessible.c
index e289eb43e0..72139ba77c 100644
--- a/gtk/a11y/gtkentryaccessible.c
+++ b/gtk/a11y/gtkentryaccessible.c
@@ -936,8 +936,7 @@ gtk_entry_accessible_get_default_attributes (AtkText *text)
attributes = _gtk_pango_get_default_attributes (attributes,
gtk_entry_get_layout (GTK_ENTRY (widget)));
attributes = _gtk_style_context_get_attributes (attributes,
- gtk_widget_get_style_context (widget),
- gtk_widget_get_state_flags (widget));
+ gtk_widget_get_style_context (widget));
return attributes;
}
diff --git a/gtk/a11y/gtklabelaccessible.c b/gtk/a11y/gtklabelaccessible.c
index 88f4b7759c..f676f7ceef 100644
--- a/gtk/a11y/gtklabelaccessible.c
+++ b/gtk/a11y/gtklabelaccessible.c
@@ -1142,8 +1142,7 @@ gtk_label_accessible_get_default_attributes (AtkText *text)
attributes = _gtk_pango_get_default_attributes (attributes,
gtk_label_get_layout (GTK_LABEL (widget)));
attributes = _gtk_style_context_get_attributes (attributes,
- gtk_widget_get_style_context (widget),
- gtk_widget_get_state_flags (widget));
+ gtk_widget_get_style_context (widget));
return attributes;
}
diff --git a/gtk/a11y/gtktextcellaccessible.c b/gtk/a11y/gtktextcellaccessible.c
index e6a0df252b..24fc72b2d0 100644
--- a/gtk/a11y/gtktextcellaccessible.c
+++ b/gtk/a11y/gtktextcellaccessible.c
@@ -343,8 +343,7 @@ gtk_text_cell_accessible_get_default_attributes (AtkText *text)
attrib_set = _gtk_pango_get_default_attributes (NULL, text_cell->priv->layout);
attrib_set = _gtk_style_context_get_attributes (attrib_set,
- gtk_widget_get_style_context (widget),
- gtk_widget_get_state_flags (widget));
+ gtk_widget_get_style_context (widget));
return attrib_set;
}
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c
index 45ac2899ed..8a53711268 100644
--- a/gtk/gtkaboutdialog.c
+++ b/gtk/gtkaboutdialog.c
@@ -1912,12 +1912,10 @@ follow_if_link (GtkAboutDialog *about,
if (uri && !g_slist_find_custom (priv->visited_links, uri, (GCompareFunc)strcmp))
{
GdkRGBA visited_link_color;
- GtkStateFlags state;
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (about));
gtk_style_context_save (context);
- state = gtk_style_context_get_state (context) | GTK_STATE_FLAG_VISITED;
- gtk_style_context_set_state (context, state);
- gtk_style_context_get_color (context, state, &visited_link_color);
+ gtk_style_context_set_state (context, gtk_style_context_get_state (context) | GTK_STATE_FLAG_VISITED);
+ gtk_style_context_get_color (context, &visited_link_color);
gtk_style_context_restore (context);
g_object_set (G_OBJECT (tag), "foreground-rgba", &visited_link_color, NULL);
@@ -2065,8 +2063,12 @@ text_buffer_new (GtkAboutDialog *about,
GtkStateFlags state = gtk_widget_get_state_flags (GTK_WIDGET (about));
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (about));
- gtk_style_context_get_color (context, state | GTK_STATE_FLAG_LINK, &link_color);
- gtk_style_context_get_color (context, state | GTK_STATE_FLAG_VISITED, &visited_link_color);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state | GTK_STATE_FLAG_LINK);
+ gtk_style_context_get_color (context, &link_color);
+ gtk_style_context_set_state (context, state | GTK_STATE_FLAG_VISITED);
+ gtk_style_context_get_color (context, &visited_link_color);
+ gtk_style_context_restore (context);
buffer = gtk_text_buffer_new (NULL);
for (p = strings; *p; p++)
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index 2adbf7df76..01565b00c6 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -400,7 +400,6 @@ gtk_accel_label_get_accel_layout (GtkAccelLabel *accel_label)
if (!attrs)
attrs = pango_attr_list_new ();
gtk_style_context_get (context,
- gtk_style_context_get_state (context),
"font", &font_desc,
NULL);
pango_attr_list_change (attrs, pango_attr_font_desc_new (font_desc));
diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c
index a06a050a9b..cd5757ef00 100644
--- a/gtk/gtkbindings.c
+++ b/gtk/gtkbindings.c
@@ -1465,7 +1465,7 @@ gtk_bindings_activate_list (GObject *object,
context = gtk_widget_get_style_context (GTK_WIDGET (object));
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"-gtk-key-bindings", &array,
NULL);
if (array)
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index f274c63475..d2acf34349 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -1082,21 +1082,19 @@ get_component_paddings (GtkCalendar *calendar,
GtkBorder *week_padding)
{
GtkStyleContext * context;
- GtkStateFlags state;
GtkWidget *widget;
widget = GTK_WIDGET (calendar);
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
if (padding)
- gtk_style_context_get_padding (context, state, padding);
+ gtk_style_context_get_padding (context, padding);
if (day_padding)
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "day-number");
- gtk_style_context_get_padding (context, state, day_padding);
+ gtk_style_context_get_padding (context, day_padding);
gtk_style_context_restore (context);
}
@@ -1104,7 +1102,7 @@ get_component_paddings (GtkCalendar *calendar,
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "day-name");
- gtk_style_context_get_padding (context, state, day_name_padding);
+ gtk_style_context_get_padding (context, day_name_padding);
gtk_style_context_restore (context);
}
@@ -1112,7 +1110,7 @@ get_component_paddings (GtkCalendar *calendar,
{
gtk_style_context_save (context);
gtk_style_context_add_class (context, "week-number");
- gtk_style_context_get_padding (context, state, week_padding);
+ gtk_style_context_get_padding (context, week_padding);
gtk_style_context_restore (context);
}
}
@@ -2614,7 +2612,7 @@ calendar_paint_day (GtkCalendar *calendar,
cairo_save (cr);
- gtk_style_context_get_color (context, state, &color);
+ gtk_style_context_get_color (context, &color);
gdk_cairo_set_source_rgba (cr, &color);
cairo_set_line_width (cr, 1);
diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c
index 575e1c7fde..96f1db8b7d 100644
--- a/gtk/gtkcellarea.c
+++ b/gtk/gtkcellarea.c
@@ -3550,7 +3550,6 @@ gtk_cell_area_inner_cell_area (GtkCellArea *area,
{
GtkBorder border;
GtkStyleContext *context;
- GtkStateFlags state;
g_return_if_fail (GTK_IS_CELL_AREA (area));
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -3558,8 +3557,7 @@ gtk_cell_area_inner_cell_area (GtkCellArea *area,
g_return_if_fail (inner_area != NULL);
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_padding (context, state, &border);
+ gtk_style_context_get_padding (context, &border);
*inner_area = *cell_area;
@@ -3599,7 +3597,6 @@ gtk_cell_area_request_renderer (GtkCellArea *area,
{
GtkBorder border;
GtkStyleContext *context;
- GtkStateFlags state;
g_return_if_fail (GTK_IS_CELL_AREA (area));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
@@ -3608,8 +3605,7 @@ gtk_cell_area_request_renderer (GtkCellArea *area,
g_return_if_fail (natural_size != NULL);
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_padding (context, state, &border);
+ gtk_style_context_get_padding (context, &border);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
diff --git a/gtk/gtkcellrendererprogress.c b/gtk/gtkcellrendererprogress.c
index 260ed2d8fe..2a925d3156 100644
--- a/gtk/gtkcellrendererprogress.c
+++ b/gtk/gtkcellrendererprogress.c
@@ -577,7 +577,7 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
gtk_render_background (context, cr, x, y, w, h);
gtk_render_frame (context, cr, x, y, w, h);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
+ gtk_style_context_get_padding (context, &padding);
x += padding.left;
y += padding.top;
diff --git a/gtk/gtkcellrendererspinner.c b/gtk/gtkcellrendererspinner.c
index e9c8148cc0..dc7a0d19c7 100644
--- a/gtk/gtkcellrendererspinner.c
+++ b/gtk/gtkcellrendererspinner.c
@@ -355,9 +355,7 @@ gtk_paint_spinner (GtkStyleContext *context,
/* draw clip region */
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- gtk_style_context_get_color (context,
- gtk_style_context_get_state (context),
- &color);
+ gtk_style_context_get_color (context, &color);
dx = width / 2;
dy = height / 2;
radius = MIN (width / 2, height / 2);
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index bd8b902dea..15beed09bf 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -1731,16 +1731,14 @@ get_size (GtkCellRenderer *cell,
if (priv->calc_fixed_height)
{
GtkStyleContext *style_context;
- GtkStateFlags state;
PangoContext *context;
PangoFontMetrics *metrics;
PangoFontDescription *font_desc;
gint row_height;
style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
- gtk_style_context_get (style_context, state, "font", &font_desc, NULL);
+ gtk_style_context_get (style_context, "font", &font_desc, NULL);
pango_font_description_merge_static (font_desc, priv->font, TRUE);
if (priv->scale_set)
diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c
index ea5aebf72b..a6e94bdc71 100644
--- a/gtk/gtkcellrenderertoggle.c
+++ b/gtk/gtkcellrenderertoggle.c
@@ -334,7 +334,7 @@ calc_indicator_size (GtkStyleContext *context,
return;
}
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"min-width", width,
"min-height", height,
NULL);
@@ -366,8 +366,8 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
context = gtk_cell_renderer_toggle_save_context (cell, widget);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_border (context, &border);
calc_indicator_size (context, priv->indicator_size, &calc_width, &calc_height);
calc_width += xpad * 2 + padding.left + padding.right + border.left + border.right;
@@ -464,8 +464,8 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
cell_area->y + y_offset + ypad,
width, height);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_border (context, &border);
if (priv->radio)
{
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 3bd149aa50..fa4a794f7b 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -6281,7 +6281,6 @@ gtk_entry_draw_cursor (GtkEntry *entry,
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_background_color (context,
- gtk_style_context_get_state (context),
&color);
G_GNUC_END_IGNORE_DEPRECATIONS
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 13383aa8d8..05827a2082 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -6187,7 +6187,6 @@ find_good_size_from_style (GtkWidget *widget,
100);
gtk_style_context_get (context,
- gtk_style_context_get_state (context),
"font-size", &font_size,
NULL);
font_size = font_size * resolution / 72.0 + 0.5;
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index ecec916002..ed50e5f228 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2712,7 +2712,6 @@ gtk_flow_box_render (GtkCssGadget *gadget,
if (lines->len > 0)
{
- GtkStateFlags state;
cairo_path_t *path;
GtkBorder border;
GdkRGBA border_color;
@@ -2735,11 +2734,10 @@ gtk_flow_box_render (GtkCssGadget *gadget,
cairo_append_path (cr, path);
cairo_path_destroy (path);
- state = gtk_style_context_get_state (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_border_color (context, state, &border_color);
+ gtk_style_context_get_border_color (context, &border_color);
G_GNUC_END_IGNORE_DEPRECATIONS
- gtk_style_context_get_border (context, state, &border);
+ gtk_style_context_get_border (context, &border);
cairo_set_line_width (cr, border.left);
gdk_cairo_set_source_rgba (cr, &border_color);
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index afccbdc345..e244b8b128 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -852,7 +852,6 @@ gtk_font_chooser_widget_get_preview_text_height (GtkFontChooserWidget *fontchoos
GTK_CSS_PROPERTY_DPI),
100);
gtk_style_context_get (context,
- gtk_widget_get_state_flags (treeview),
"font-size", &font_size,
NULL);
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 85d9e42f0a..48a4e866a4 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3499,7 +3499,7 @@ gtk_label_update_layout_attributes (GtkLabel *label)
pango_attr_list_insert (attrs, attribute);
gtk_style_context_save_to_node (context, link->cssnode);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &link_color);
+ gtk_style_context_get_color (context, &link_color);
gtk_style_context_restore (context);
attribute = pango_attr_foreground_new (link_color.red * 65535,
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index a17fa9e9e0..1f08ed444f 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2604,7 +2604,6 @@ get_menu_padding (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
gtk_style_context_get_padding (context,
- gtk_style_context_get_state (context),
padding);
}
@@ -2617,7 +2616,6 @@ get_menu_margin (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
gtk_style_context_get_margin (context,
- gtk_style_context_get_state (context),
margin);
}
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index f41e033fe5..c4d511f9a5 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -1908,9 +1908,9 @@ gtk_menu_item_real_popup_submenu (GtkWidget *widget,
NULL);
context = gtk_widget_get_style_context (parent);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &parent_padding);
+ gtk_style_context_get_padding (context, &parent_padding);
context = gtk_widget_get_style_context (priv->submenu);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &menu_padding);
+ gtk_style_context_get_padding (context, &menu_padding);
g_object_set (priv->submenu,
"anchor-hints", (GDK_ANCHOR_FLIP_X |
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 5570931277..4aee40f7e5 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -705,7 +705,6 @@ get_margin (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
gtk_style_context_get_margin (context,
- gtk_style_context_get_state (context),
border);
}
@@ -731,7 +730,6 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
gint border_radius;
GtkStyleContext *context;
GtkBorder margin, border, widget_margin;
- GtkStateFlags state;
gtk_popover_get_pointing_to (popover, &rect);
gtk_widget_get_allocation (widget, &allocation);
@@ -770,11 +768,9 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
widget_margin.bottom = gtk_widget_get_margin_bottom (widget);
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_border (context, state, &border);
+ gtk_style_context_get_border (context, &border);
gtk_style_context_get (context,
- state,
GTK_STYLE_PROPERTY_BORDER_RADIUS, &border_radius,
NULL);
pos = get_effective_position (popover, priv->final_position);
@@ -1138,14 +1134,12 @@ gtk_popover_draw (GtkWidget *widget,
gint initial_x, initial_y, final_x, final_y;
gint gap_start, gap_end;
GtkPositionType gap_side;
- GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
gtk_widget_get_allocation (widget, &allocation);
- gtk_style_context_get_border (context, state, &border);
+ gtk_style_context_get_border (context, &border);
gtk_popover_get_rect_coords (popover,
&rect_x, &rect_y,
&rect_w, &rect_h);
@@ -1203,7 +1197,7 @@ gtk_popover_draw (GtkWidget *widget,
if (border.bottom > 0)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_border_color (context, state, &border_color);
+ gtk_style_context_get_border_color (context, &border_color);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_popover_apply_tail_path (popover, cr);
@@ -1229,17 +1223,15 @@ get_padding_and_border (GtkWidget *widget,
GtkBorder *border)
{
GtkStyleContext *context;
- GtkStateFlags state;
gint border_width;
GtkBorder tmp;
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- gtk_style_context_get_padding (context, state, border);
- gtk_style_context_get_border (context, state, &tmp);
+ gtk_style_context_get_padding (context, border);
+ gtk_style_context_get_border (context, &tmp);
border->top += tmp.top + border_width;
border->right += tmp.right + border_width;
border->bottom += tmp.bottom + border_width;
@@ -1250,12 +1242,10 @@ static gint
get_border_radius (GtkWidget *widget)
{
GtkStyleContext *context;
- GtkStateFlags state;
gint border_radius;
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get (context, state,
+ gtk_style_context_get (context,
GTK_STYLE_PROPERTY_BORDER_RADIUS, &border_radius,
NULL);
return border_radius;
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 877337bbcb..708ceebbb5 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -2763,7 +2763,7 @@ draw_page_cb (GtkWidget *widget,
}
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
pos_x = (width - w) / 2;
pos_y = (height - h) / 2 - 10;
diff --git a/gtk/gtkrecentchooserdefault.c b/gtk/gtkrecentchooserdefault.c
index 2a9cee9a84..b6b8f93c56 100644
--- a/gtk/gtkrecentchooserdefault.c
+++ b/gtk/gtkrecentchooserdefault.c
@@ -883,7 +883,7 @@ set_default_size (GtkRecentChooserDefault *impl)
context = gtk_widget_get_style_context (widget);
/* Size based on characters and the icon size */
- gtk_style_context_get (context, gtk_style_context_get_state (context), "font-size", &font_size, NULL);
+ gtk_style_context_get (context, "font-size", &font_size, NULL);
width = impl->priv->icon_size + font_size * NUM_CHARS + 0.5;
height = (impl->priv->icon_size + font_size) * NUM_LINES + 0.5;
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 2e3d34fc6b..c364e142e5 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -125,12 +125,10 @@ gtk_revealer_get_padding (GtkRevealer *revealer,
{
GtkWidget *widget = GTK_WIDGET (revealer);
GtkStyleContext *context;
- GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_padding (context, state, padding);
+ gtk_style_context_get_padding (context, padding);
}
static void
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 7e611e0f4c..6c48a7f3d8 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -492,49 +492,6 @@ gtk_style_context_get_node (GtkStyleContext *context)
return context->priv->cssnode;
}
-static GtkStateFlags
-gtk_style_context_push_state (GtkStyleContext *context,
- GtkStateFlags state)
-{
- GtkStyleContextPrivate *priv = context->priv;
- GtkStateFlags current_state;
- GtkCssNode *root;
-
- current_state = gtk_css_node_get_state (priv->cssnode);
-
- if (current_state == state)
- return state;
-
- root = gtk_style_context_get_root (context);
-
- if (GTK_IS_CSS_TRANSIENT_NODE (priv->cssnode))
- {
- /* don't emit a warning, changing state here is fine */
- }
- else if (GTK_IS_CSS_WIDGET_NODE (root))
- {
- GtkWidget *widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (root));
- g_debug ("State %u for %s %p doesn't match state %u set via gtk_style_context_set_state ()",
- state, gtk_widget_get_name (widget), widget, gtk_css_node_get_state (priv->cssnode));
- }
- else
- {
- g_debug ("State %u for context %p doesn't match state %u set via gtk_style_context_set_state ()",
- state, context, gtk_css_node_get_state (priv->cssnode));
- }
-
- gtk_css_node_set_state (priv->cssnode, state);
-
- return current_state;
-}
-
-static void
-gtk_style_context_pop_state (GtkStyleContext *context,
- GtkStateFlags saved_state)
-{
- gtk_css_node_set_state (context->priv->cssnode, saved_state);
-}
-
/**
* gtk_style_context_new:
*
@@ -806,10 +763,8 @@ gtk_style_context_query_func (guint id,
void
gtk_style_context_get_property (GtkStyleContext *context,
const gchar *property,
- GtkStateFlags state,
GValue *value)
{
- GtkStateFlags saved_state;
GtkStyleProperty *prop;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
@@ -828,18 +783,15 @@ gtk_style_context_get_property (GtkStyleContext *context,
return;
}
- saved_state = gtk_style_context_push_state (context, state);
_gtk_style_property_query (prop,
value,
gtk_style_context_query_func,
gtk_css_node_get_style (context->priv->cssnode));
- gtk_style_context_pop_state (context, saved_state);
}
/**
* gtk_style_context_get_valist:
* @context: a #GtkStyleContext
- * @state: state to retrieve the property values for
* @args: va_list of property name/return location pairs, followed by %NULL
*
* Retrieves several style property values from @context for a given state.
@@ -850,7 +802,6 @@ gtk_style_context_get_property (GtkStyleContext *context,
*/
void
gtk_style_context_get_valist (GtkStyleContext *context,
- GtkStateFlags state,
va_list args)
{
const gchar *property_name;
@@ -866,7 +817,6 @@ gtk_style_context_get_valist (GtkStyleContext *context,
gtk_style_context_get_property (context,
property_name,
- state,
&value);
G_VALUE_LCOPY (&value, args, 0, &error);
@@ -886,7 +836,6 @@ gtk_style_context_get_valist (GtkStyleContext *context,
/**
* gtk_style_context_get:
* @context: a #GtkStyleContext
- * @state: state to retrieve the property values for
* @...: property name /return value pairs, followed by %NULL
*
* Retrieves several style property values from @context for a
@@ -898,15 +847,14 @@ gtk_style_context_get_valist (GtkStyleContext *context,
*/
void
gtk_style_context_get (GtkStyleContext *context,
- GtkStateFlags state,
...)
{
va_list args;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- va_start (args, state);
- gtk_style_context_get_valist (context, state, args);
+ va_start (args, context);
+ gtk_style_context_get_valist (context, args);
va_end (args);
}
@@ -2025,8 +1973,6 @@ gtk_style_context_validate (GtkStyleContext *context,
g_signal_emit (context, signals[CHANGED], 0);
- g_object_set_data (G_OBJECT (context), "font-cache-for-get_font", NULL);
-
priv->invalidating_context = NULL;
}
@@ -2055,7 +2001,6 @@ gtk_style_context_invalidate (GtkStyleContext *context)
/**
* gtk_style_context_get_color:
* @context: a #GtkStyleContext
- * @state: state to retrieve the color for
* @color: (out): return value for the foreground color
*
* Gets the foreground color for a given state.
@@ -2067,7 +2012,6 @@ gtk_style_context_invalidate (GtkStyleContext *context)
**/
void
gtk_style_context_get_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color)
{
GdkRGBA *c;
@@ -2076,7 +2020,6 @@ gtk_style_context_get_color (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
gtk_style_context_get (context,
- state,
"color", &c,
NULL);
@@ -2087,7 +2030,6 @@ gtk_style_context_get_color (GtkStyleContext *context,
/**
* gtk_style_context_get_background_color:
* @context: a #GtkStyleContext
- * @state: state to retrieve the color for
* @color: (out): return value for the background color
*
* Gets the background color for a given state.
@@ -2107,7 +2049,6 @@ gtk_style_context_get_color (GtkStyleContext *context,
**/
void
gtk_style_context_get_background_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color)
{
GdkRGBA *c;
@@ -2116,7 +2057,6 @@ gtk_style_context_get_background_color (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
gtk_style_context_get (context,
- state,
"background-color", &c,
NULL);
@@ -2127,7 +2067,6 @@ gtk_style_context_get_background_color (GtkStyleContext *context,
/**
* gtk_style_context_get_border_color:
* @context: a #GtkStyleContext
- * @state: state to retrieve the color for
* @color: (out): return value for the border color
*
* Gets the border color for a given state.
@@ -2138,7 +2077,6 @@ gtk_style_context_get_background_color (GtkStyleContext *context,
**/
void
gtk_style_context_get_border_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color)
{
GdkRGBA *c;
@@ -2147,7 +2085,6 @@ gtk_style_context_get_border_color (GtkStyleContext *context,
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
gtk_style_context_get (context,
- state,
"border-color", &c,
NULL);
@@ -2158,7 +2095,6 @@ gtk_style_context_get_border_color (GtkStyleContext *context,
/**
* gtk_style_context_get_border:
* @context: a #GtkStyleContext
- * @state: state to retrieve the border for
* @border: (out): return value for the border settings
*
* Gets the border for a given state as a #GtkBorder.
@@ -2170,17 +2106,14 @@ gtk_style_context_get_border_color (GtkStyleContext *context,
**/
void
gtk_style_context_get_border (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *border)
{
GtkCssStyle *style;
- GtkStateFlags saved_state;
double top, left, bottom, right;
g_return_if_fail (border != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- saved_state = gtk_style_context_push_state (context, state);
style = gtk_style_context_lookup_style (context);
top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100));
@@ -2192,14 +2125,11 @@ gtk_style_context_get_border (GtkStyleContext *context,
border->left = left;
border->bottom = bottom;
border->right = right;
-
- gtk_style_context_pop_state (context, saved_state);
}
/**
* gtk_style_context_get_padding:
* @context: a #GtkStyleContext
- * @state: state to retrieve the padding for
* @padding: (out): return value for the padding settings
*
* Gets the padding for a given state as a #GtkBorder.
@@ -2210,17 +2140,14 @@ gtk_style_context_get_border (GtkStyleContext *context,
**/
void
gtk_style_context_get_padding (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *padding)
{
GtkCssStyle *style;
- GtkStateFlags saved_state;
double top, left, bottom, right;
g_return_if_fail (padding != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- saved_state = gtk_style_context_push_state (context, state);
style = gtk_style_context_lookup_style (context);
top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_TOP), 100));
@@ -2232,14 +2159,11 @@ gtk_style_context_get_padding (GtkStyleContext *context,
padding->left = left;
padding->bottom = bottom;
padding->right = right;
-
- gtk_style_context_pop_state (context, saved_state);
}
/**
* gtk_style_context_get_margin:
* @context: a #GtkStyleContext
- * @state: state to retrieve the border for
* @margin: (out): return value for the margin settings
*
* Gets the margin for a given state as a #GtkBorder.
@@ -2250,17 +2174,14 @@ gtk_style_context_get_padding (GtkStyleContext *context,
**/
void
gtk_style_context_get_margin (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *margin)
{
GtkCssStyle *style;
- GtkStateFlags saved_state;
double top, left, bottom, right;
g_return_if_fail (margin != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
- saved_state = gtk_style_context_push_state (context, state);
style = gtk_style_context_lookup_style (context);
top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_TOP), 100));
@@ -2272,67 +2193,6 @@ gtk_style_context_get_margin (GtkStyleContext *context,
margin->left = left;
margin->bottom = bottom;
margin->right = right;
-
- gtk_style_context_pop_state (context, saved_state);
-}
-
-/**
- * gtk_style_context_get_font:
- * @context: a #GtkStyleContext
- * @state: state to retrieve the font for
- *
- * Returns the font description for a given state. The returned
- * object is const and will remain valid until the
- * #GtkStyleContext::changed signal happens.
- *
- * Returns: (transfer none): the #PangoFontDescription for the given
- * state. This object is owned by GTK+ and should not be
- * freed.
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: Use gtk_style_context_get() for "font" or
- * subproperties instead.
- **/
-const PangoFontDescription *
-gtk_style_context_get_font (GtkStyleContext *context,
- GtkStateFlags state)
-{
- GHashTable *hash;
- PangoFontDescription *description, *previous;
-
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-
- /* Yuck, fonts are created on-demand but we don't return a ref.
- * Do bad things to achieve this requirement */
- gtk_style_context_get (context, state, "font", &description, NULL);
-
- hash = g_object_get_data (G_OBJECT (context), "font-cache-for-get_font");
-
- if (hash == NULL)
- {
- hash = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL,
- (GDestroyNotify) pango_font_description_free);
- g_object_set_data_full (G_OBJECT (context),
- "font-cache-for-get_font",
- hash,
- (GDestroyNotify) g_hash_table_unref);
- }
-
- previous = g_hash_table_lookup (hash, GUINT_TO_POINTER (state));
- if (previous)
- {
- pango_font_description_merge (previous, description, TRUE);
- pango_font_description_free (description);
- description = previous;
- }
- else
- {
- g_hash_table_insert (hash, GUINT_TO_POINTER (state), description);
- }
-
- return description;
}
void
@@ -2343,7 +2203,6 @@ _gtk_style_context_get_cursor_color (GtkStyleContext *context,
GdkRGBA *pc, *sc;
gtk_style_context_get (context,
- gtk_style_context_get_state (context),
"caret-color", &pc,
"-gtk-secondary-caret-color", &sc,
NULL);
@@ -2597,14 +2456,13 @@ add_attribute (AtkAttributeSet *attributes,
*/
AtkAttributeSet *
_gtk_style_context_get_attributes (AtkAttributeSet *attributes,
- GtkStyleContext *context,
- GtkStateFlags flags)
+ GtkStyleContext *context)
{
GdkRGBA color;
gchar *value;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, flags, &color);
+ gtk_style_context_get_background_color (context, &color);
G_GNUC_END_IGNORE_DEPRECATIONS
value = g_strdup_printf ("%u,%u,%u",
(guint) ceil (color.red * 65536 - color.red),
@@ -2613,7 +2471,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
attributes = add_attribute (attributes, ATK_TEXT_ATTR_BG_COLOR, value);
g_free (value);
- gtk_style_context_get_color (context, flags, &color);
+ gtk_style_context_get_color (context, &color);
value = g_strdup_printf ("%u,%u,%u",
(guint) ceil (color.red * 65536 - color.red),
(guint) ceil (color.green * 65536 - color.green),
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 0beb9c69a3..6a6d3a8577 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -1013,15 +1013,12 @@ GtkCssSection * gtk_style_context_get_section (GtkStyleContext *context,
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_property (GtkStyleContext *context,
const gchar *property,
- GtkStateFlags state,
GValue *value);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_valist (GtkStyleContext *context,
- GtkStateFlags state,
va_list args);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get (GtkStyleContext *context,
- GtkStateFlags state,
...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL
@@ -1103,32 +1100,22 @@ gboolean gtk_style_context_lookup_color (GtkStyleContext *context,
/* Some helper functions to retrieve most common properties */
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color);
GDK_DEPRECATED_IN_3_16_FOR(gtk_render_background)
void gtk_style_context_get_background_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color);
GDK_DEPRECATED_IN_3_16_FOR(gtk_render_frame)
void gtk_style_context_get_border_color (GtkStyleContext *context,
- GtkStateFlags state,
GdkRGBA *color);
-GDK_DEPRECATED_IN_3_8_FOR(gtk_style_context_get)
-const PangoFontDescription *
- gtk_style_context_get_font (GtkStyleContext *context,
- GtkStateFlags state);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_border (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *border);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_padding (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *padding);
GDK_AVAILABLE_IN_ALL
void gtk_style_context_get_margin (GtkStyleContext *context,
- GtkStateFlags state,
GtkBorder *margin);
GDK_DEPRECATED_IN_3_12
diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h
index 421e5263fc..45ecda44f4 100644
--- a/gtk/gtkstylecontextprivate.h
+++ b/gtk/gtkstylecontextprivate.h
@@ -74,8 +74,7 @@ PangoAttrList *_gtk_style_context_get_pango_attributes (GtkStyleContext *c
/* Accessibility support */
AtkAttributeSet *_gtk_style_context_get_attributes (AtkAttributeSet *attributes,
- GtkStyleContext *context,
- GtkStateFlags flags);
+ GtkStyleContext *context);
G_END_DECLS
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index dedf611897..99e79cb496 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -200,7 +200,7 @@ gtk_text_renderer_prepare_run (PangoRenderer *renderer,
selection_node = gtk_text_view_get_selection_node ((GtkTextView *)text_renderer->widget);
gtk_style_context_save_to_node (context, selection_node);
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"color", &fg_rgba,
NULL);
@@ -208,7 +208,7 @@ gtk_text_renderer_prepare_run (PangoRenderer *renderer,
}
else if (text_renderer->state == CURSOR && gtk_widget_has_focus (text_renderer->widget))
{
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"background-color", &fg_rgba,
NULL);
}
@@ -520,7 +520,6 @@ text_renderer_begin (GtkTextRenderer *text_renderer,
cairo_t *cr)
{
GtkStyleContext *context;
- GtkStateFlags state;
GdkRGBA color;
GtkCssNode *text_node;
@@ -532,8 +531,7 @@ text_renderer_begin (GtkTextRenderer *text_renderer,
text_node = gtk_text_view_get_text_node ((GtkTextView *)widget);
gtk_style_context_save_to_node (context, text_node);
- state = gtk_style_context_get_state (context);
- gtk_style_context_get_color (context, state, &color);
+ gtk_style_context_get_color (context, &color);
cairo_save (cr);
@@ -632,7 +630,7 @@ render_para (GtkTextRenderer *text_renderer,
gtk_style_context_save_to_node (context, selection_node);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &selection);
+ gtk_style_context_get_background_color (context, &selection);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_style_context_restore (context);
@@ -827,7 +825,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
GdkRGBA color;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_background_color (context, &color);
G_GNUC_END_IGNORE_DEPRECATIONS
gdk_cairo_set_source_rgba (cr, &color);
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 4e9e359a5d..19e89f1d1a 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -88,15 +88,9 @@ _gtk_text_handle_get_size (GtkTextHandle *handle,
context = gtk_widget_get_style_context (widget);
gtk_style_context_get (context,
- gtk_style_context_get_state (context),
- "min-width",
- width, NULL);
-
-
- gtk_style_context_get (context,
- gtk_style_context_get_state (context),
- "min-height",
- height, NULL);
+ "min-width", width,
+ "min-height", height,
+ NULL);
}
static void
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 1d7d8d21c0..13ea2a552f 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -242,7 +242,6 @@ _gtk_text_util_create_drag_icon (GtkWidget *widget,
style_context = gtk_widget_get_style_context (widget);
gtk_style_context_get_color (style_context,
- gtk_style_context_get_state (style_context),
&color);
gdk_cairo_set_source_rgba (cr, &color);
pango_cairo_show_layout (cr, layout);
@@ -258,14 +257,11 @@ set_attributes_from_style (GtkStyleContext *context,
GtkTextAttributes *values)
{
GdkRGBA bg_color, fg_color;
- GtkStateFlags state;
-
- state = gtk_style_context_get_state (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, state, &bg_color);
+ gtk_style_context_get_background_color (context, &bg_color);
G_GNUC_END_IGNORE_DEPRECATIONS
- gtk_style_context_get_color (context, state, &fg_color);
+ gtk_style_context_get_color (context, &fg_color);
values->appearance.bg_color.red = CLAMP (bg_color.red * 65535. + 0.5, 0, 65535);
values->appearance.bg_color.green = CLAMP (bg_color.green * 65535. + 0.5, 0, 65535);
@@ -278,7 +274,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (values->font)
pango_font_description_free (values->font);
- gtk_style_context_get (context, state, "font", &values->font, NULL);
+ gtk_style_context_get (context, "font", &values->font, NULL);
}
cairo_surface_t *
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 191deaa313..84b6599d4f 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4812,8 +4812,8 @@ text_window_set_padding (GtkTextView *text_view,
priv = text_view->priv;
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_border (context, &border);
padding.left += border.left;
padding.right += border.right;
padding.top += border.top;
@@ -7881,15 +7881,13 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
{
GtkStyleContext *context;
GdkRGBA bg_color, fg_color;
- GtkStateFlags state;
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
- state = gtk_style_context_get_state (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, state, &bg_color);
+ gtk_style_context_get_background_color (context, &bg_color);
G_GNUC_END_IGNORE_DEPRECATIONS
- gtk_style_context_get_color (context, state, &fg_color);
+ gtk_style_context_get_color (context, &fg_color);
values->appearance.bg_color.red = CLAMP (bg_color.red * 65535. + 0.5, 0, 65535);
values->appearance.bg_color.green = CLAMP (bg_color.green * 65535. + 0.5, 0, 65535);
@@ -7902,7 +7900,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (values->font)
pango_font_description_free (values->font);
- gtk_style_context_get (context, state, "font", &values->font, NULL);
+ gtk_style_context_get (context, "font", &values->font, NULL);
}
static void
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index fa82973ef9..d03e47e13f 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -4937,7 +4937,7 @@ gtk_tree_view_draw_line (GtkTreeView *tree_view,
GdkRGBA color;
cairo_set_line_width (cr, 1.0);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
gdk_cairo_set_source_rgba (cr, &color);
}
break;
@@ -5653,7 +5653,7 @@ gtk_tree_view_draw (GtkWidget *widget,
{
GdkRGBA color;
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
cairo_save (cr);
gtk_cairo_transform_to_window (cr, GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window);
if (tree_view->priv->drag_column_window_state == DRAG_COLUMN_WINDOW_STATE_ORIGINAL)
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index cdedf88e10..c35fefd5dd 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -9420,7 +9420,6 @@ update_pango_context (GtkWidget *widget,
style_context = _gtk_widget_get_style_context (widget);
gtk_style_context_get (style_context,
- gtk_style_context_get_state (style_context),
"font", &font_desc,
NULL);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 8e2875fadc..9a329cc9bb 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6452,7 +6452,6 @@ get_shadow_width (GtkWindow *window,
GtkBorder d = { 0 };
GtkBorder margin;
GtkStyleContext *context;
- GtkStateFlags s;
GtkCssValue *shadows;
*shadow_width = border;
@@ -6475,11 +6474,10 @@ get_shadow_width (GtkWindow *window,
context = _gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_save_to_node (context, priv->decoration_node);
- s = gtk_style_context_get_state (context);
/* Always sum border + padding */
- gtk_style_context_get_border (context, s, &border);
- gtk_style_context_get_padding (context, s, &d);
+ gtk_style_context_get_border (context, &border);
+ gtk_style_context_get_padding (context, &d);
sum_borders (&d, &border);
/* Calculate the size of the drop shadows ... */
@@ -6489,7 +6487,7 @@ get_shadow_width (GtkWindow *window,
if (priv->type != GTK_WINDOW_POPUP)
{
/* ... and compare it to the margin size, which we use for resize grips */
- gtk_style_context_get_margin (context, s, &margin);
+ gtk_style_context_get_margin (context, &margin);
max_borders (&border, &margin);
}
@@ -6551,10 +6549,10 @@ update_border_windows (GtkWindow *window)
context = _gtk_widget_get_style_context (widget);
gtk_style_context_save_to_node (context, priv->decoration_node);
- gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &border);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &tmp);
+ gtk_style_context_get_margin (context, &border);
+ gtk_style_context_get_border (context, &tmp);
sum_borders (&border, &tmp);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &tmp);
+ gtk_style_context_get_padding (context, &tmp);
sum_borders (&border, &tmp);
gtk_widget_style_get (widget,
"decoration-resize-handle", &handle,
@@ -9674,8 +9672,8 @@ gtk_window_draw (GtkWidget *widget,
{
GtkBorder padding, border;
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_border (context, &border);
sum_borders (&border, &padding);
gtk_render_background (context, cr,
diff --git a/gtk/inspector/cellrenderergraph.c b/gtk/inspector/cellrenderergraph.c
index bbc6584331..766bd051dd 100644
--- a/gtk/inspector/cellrenderergraph.c
+++ b/gtk/inspector/cellrenderergraph.c
@@ -192,7 +192,7 @@ gtk_cell_renderer_graph_render (GtkCellRenderer *cell,
diff = maximum - minimum;
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
cairo_set_line_width (cr, 1.0);
diff --git a/tests/testframe.c b/tests/testframe.c
index 22d4055835..85b6fe5d0c 100644
--- a/tests/testframe.c
+++ b/tests/testframe.c
@@ -40,7 +40,7 @@ spin_ythickness_cb (GtkSpinButton *spin, gpointer user_data)
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_get_padding (context, &pad);
gtk_style_context_restore (context);
@@ -76,7 +76,7 @@ spin_xthickness_cb (GtkSpinButton *spin, gpointer user_data)
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_get_padding (context, &pad);
gtk_style_context_restore (context);
@@ -159,7 +159,7 @@ int main (int argc, char **argv)
context = gtk_widget_get_style_context (frame);
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
- gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &pad);
+ gtk_style_context_get_padding (context, &pad);
gtk_style_context_restore (context);
/* Spin to control xthickness */
diff --git a/testsuite/gtk/firefox-stylecontext.c b/testsuite/gtk/firefox-stylecontext.c
index 3f0bd69d21..1a581fe06e 100644
--- a/testsuite/gtk/firefox-stylecontext.c
+++ b/testsuite/gtk/firefox-stylecontext.c
@@ -26,7 +26,7 @@ test_init_of_theme (void)
/* Get the color. This should be initialized by the theme and not be
* the default. */
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &before);
+ gtk_style_context_get_color (context, &before);
/* Add a style that sets a different color for this widget.
* This style has a higher priority than fallback, but a lower
@@ -41,7 +41,7 @@ test_init_of_theme (void)
g_object_unref (provider);
/* Get the color again. */
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &after);
+ gtk_style_context_get_color (context, &after);
/* Because the style we added does not influence the color,
* the before and after colors should be identical. */
diff --git a/testsuite/gtk/stylecontext.c b/testsuite/gtk/stylecontext.c
index 0907e78668..8df88a852d 100644
--- a/testsuite/gtk/stylecontext.c
+++ b/testsuite/gtk/stylecontext.c
@@ -162,14 +162,14 @@ test_match (void)
data = "* { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
"button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
@@ -177,14 +177,14 @@ test_match (void)
"window > button { color: #000 }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
".button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
@@ -192,7 +192,7 @@ test_match (void)
".button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
@@ -200,7 +200,7 @@ test_match (void)
"window button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
@@ -208,7 +208,7 @@ test_match (void)
"window .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
@@ -216,7 +216,7 @@ test_match (void)
"#mywindow .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
@@ -224,7 +224,7 @@ test_match (void)
"window#mywindow .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
@@ -232,7 +232,7 @@ test_match (void)
"window button.button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
data = "* { color: #f00 }\n"
@@ -241,7 +241,7 @@ test_match (void)
"window:active .button { color: #fff }";
gtk_css_provider_load_from_data (provider, data, -1, &error);
g_assert_no_error (error);
- gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
+ gtk_style_context_get_color (context, &color);
g_assert (gdk_rgba_equal (&color, &expected));
g_object_unref (provider);
@@ -262,7 +262,7 @@ test_basic_properties (void)
gtk_style_context_set_path (context, path);
gtk_widget_path_free (path);
- gtk_style_context_get (context, gtk_style_context_get_state (context),
+ gtk_style_context_get (context,
"color", &color,
"background-color", &bg_color,
"font", &font,
@@ -399,8 +399,7 @@ test_style_priorities_equal (PrioritiesFixture *f,
/* When style providers are added to the screen as well as the style context
the one specific to the style context should take priority */
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
@@ -416,8 +415,7 @@ test_style_priorities_screen_only (PrioritiesFixture *f,
GTK_STYLE_PROVIDER_PRIORITY_USER);
gdk_rgba_parse (&ref_color, "blue");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
@@ -432,8 +430,7 @@ test_style_priorities_context_only (PrioritiesFixture *f,
GTK_STYLE_PROVIDER_PRIORITY_USER);
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
@@ -451,8 +448,7 @@ test_style_priorities_screen_higher (PrioritiesFixture *f,
GTK_STYLE_PROVIDER_PRIORITY_USER);
gdk_rgba_parse (&ref_color, "blue");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
@@ -470,8 +466,7 @@ test_style_priorities_context_higher (PrioritiesFixture *f,
GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
@@ -490,8 +485,7 @@ test_style_priorities_two_screen (PrioritiesFixture *f,
GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
@@ -508,8 +502,7 @@ test_style_priorities_two_context (PrioritiesFixture *f,
GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
gdk_rgba_parse (&ref_color, "red");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
@@ -530,8 +523,7 @@ test_style_priorities_three_screen_higher (PrioritiesFixture *f,
GTK_STYLE_PROVIDER_PRIORITY_USER);
gdk_rgba_parse (&ref_color, "green");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}
@@ -551,8 +543,7 @@ test_style_priorities_three_context_higher (PrioritiesFixture *f,
GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
gdk_rgba_parse (&ref_color, "green");
- gtk_style_context_get_color (f->context, gtk_style_context_get_state (f->context),
- &color);
+ gtk_style_context_get_color (f->context, &color);
g_assert_true (gdk_rgba_equal (&ref_color, &color));
}