[gtk+/wip/otte/gtk4: 127/127] API: stylecontext: Remove state argument from getters
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/gtk4: 127/127] API: stylecontext: Remove state argument from getters
- Date: Sat, 8 Oct 2016 03:20:54 +0000 (UTC)
commit 3852365e1684364711a0c112e56e8720dee73fbc
Author: Benjamin Otte <otte redhat com>
Date: Sat Oct 8 05:07:23 2016 +0200
API: stylecontext: Remove state argument from getters
The argument must always be the current state.
demos/gtk-demo/foreigndrawing.c | 38 ++++----
gtk/a11y/gtkentryaccessible.c | 3 +-
gtk/a11y/gtklabelaccessible.c | 3 +-
gtk/a11y/gtktextcellaccessible.c | 3 +-
gtk/gtkaboutdialog.c | 14 ++--
gtk/gtkcalendar.c | 12 +--
gtk/gtkcellarea.c | 8 +--
gtk/gtkcellrendererprogress.c | 2 +-
gtk/gtkcellrendererspinner.c | 4 +-
gtk/gtkcellrenderertoggle.c | 10 +-
gtk/gtkentry.c | 1 -
gtk/gtkflowbox.c | 6 +-
gtk/gtklabel.c | 2 +-
gtk/gtkmenu.c | 2 -
gtk/gtkmenuitem.c | 4 +-
gtk/gtkpopover.c | 22 ++----
gtk/gtkprintunixdialog.c | 2 +-
gtk/gtkrevealer.c | 4 +-
gtk/gtkstylecontext.c | 151 +--------------------------------
gtk/gtkstylecontext.h | 13 ---
gtk/gtkstylecontextprivate.h | 3 +-
gtk/gtktextdisplay.c | 12 +--
gtk/gtktextutil.c | 10 +--
gtk/gtktextview.c | 12 +--
gtk/gtktreeview.c | 4 +-
gtk/gtkwindow.c | 18 ++--
gtk/inspector/cellrenderergraph.c | 2 +-
tests/testframe.c | 6 +-
testsuite/gtk/firefox-stylecontext.c | 4 +-
testsuite/gtk/stylecontext.c | 51 +++++-------
30 files changed, 113 insertions(+), 313 deletions(-)
---
diff --git a/demos/gtk-demo/foreigndrawing.c b/demos/gtk-demo/foreigndrawing.c
index 29b383b..d024847 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 e289eb4..72139ba 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 88f4b77..f676f7c 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 e6a0df2..24fc72b 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 45ac289..8a53711 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/gtkcalendar.c b/gtk/gtkcalendar.c
index f274c63..d2acf34 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 575e1c7..96f1db8 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 260ed2d..2a925d3 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 e9c8148..dc7a0d1 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/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c
index ea5aebf..a6e94bd 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 3bd149a..fa4a794 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/gtkflowbox.c b/gtk/gtkflowbox.c
index ecec916..ed50e5f 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/gtklabel.c b/gtk/gtklabel.c
index 85d9e42..48a4e86 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 a17fa9e..1f08ed4 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 f41e033..c4d511f 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 5570931..4aee40f 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 877337b..708ceeb 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/gtkrevealer.c b/gtk/gtkrevealer.c
index 2e3d34f..c364e14 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 7e611e0..82245ce 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
@@ -2597,14 +2457,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 +2472,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 0beb9c6..6a6d3a8 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 421e526..45ecda4 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 dedf611..99e79cb 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/gtktextutil.c b/gtk/gtktextutil.c
index 1d7d8d2..13ea2a5 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 191deaa..84b6599 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 fa82973..d03e47e 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/gtkwindow.c b/gtk/gtkwindow.c
index 8e2875f..9a329cc 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 bbc6584..766bd05 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 22d4055..85b6fe5 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 3f0bd69..1a581fe 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 0907e78..8df88a8 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));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]