summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2015-11-22 11:43:39 +0100
committerTimm Bäder <mail@baedert.org>2015-11-22 17:11:35 +0100
commit2182fe7d9d6246e7acfe4e9ef0ca26c4a6893be6 (patch)
treec683c8395a737d897ab2aabea1c97e0f0e557dfd
parentf407871b87288115fe839ffe13a86c789a44ba87 (diff)
downloadgtk+-2182fe7d9d6246e7acfe4e9ef0ca26c4a6893be6.tar.gz
Don't pass widget state flags to GtkStyleContext API
-rw-r--r--gtk/gtkaboutdialog.c8
-rw-r--r--gtk/gtkbindings.c4
-rw-r--r--gtk/gtkcalendar.c2
-rw-r--r--gtk/gtkcheckbutton.c2
-rw-r--r--gtk/gtkentry.c27
-rw-r--r--gtk/gtkfilechooserwidget.c7
-rw-r--r--gtk/gtkflowbox.c2
-rw-r--r--gtk/gtkframe.c2
-rw-r--r--gtk/gtkheaderbar.c2
-rw-r--r--gtk/gtkinfobar.c2
-rw-r--r--gtk/gtkmenu.c12
-rw-r--r--gtk/gtkpaned.c5
-rw-r--r--gtk/gtkpopover.c18
-rw-r--r--gtk/gtkscrolledwindow.c10
-rw-r--r--gtk/gtktextutil.c2
-rw-r--r--gtk/gtktextview.c2
-rw-r--r--gtk/gtkviewport.c2
-rw-r--r--gtk/gtkwidget.c2
18 files changed, 58 insertions, 53 deletions
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c
index 24a8ba0493..269c84051b 100644
--- a/gtk/gtkaboutdialog.c
+++ b/gtk/gtkaboutdialog.c
@@ -1919,9 +1919,13 @@ 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));
- GtkStateFlags state = gtk_widget_get_state_flags (GTK_WIDGET (about));
- gtk_style_context_get_color (context, state | GTK_STATE_FLAG_VISITED, &visited_link_color);
+ 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_restore (context);
g_object_set (G_OBJECT (tag), "foreground-rgba", &visited_link_color, NULL);
diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c
index 2edfec0c0c..ac45da2f93 100644
--- a/gtk/gtkbindings.c
+++ b/gtk/gtkbindings.c
@@ -1433,7 +1433,6 @@ gtk_bindings_activate_list (GObject *object,
{
GtkStyleContext *context;
GtkBindingSet *binding_set;
- GtkStateFlags state;
gboolean handled = FALSE;
gboolean unbound = FALSE;
GPtrArray *array;
@@ -1442,9 +1441,8 @@ gtk_bindings_activate_list (GObject *object,
return FALSE;
context = gtk_widget_get_style_context (GTK_WIDGET (object));
- state = gtk_widget_get_state_flags (GTK_WIDGET (object));
- gtk_style_context_get (context, state,
+ gtk_style_context_get (context, gtk_style_context_get_state (context),
"-gtk-key-bindings", &array,
NULL);
if (array)
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 1c735cf64d..bb31f5fe1e 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -1086,7 +1086,7 @@ get_component_paddings (GtkCalendar *calendar,
widget = GTK_WIDGET (calendar);
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
if (padding)
gtk_style_context_get_padding (context, state, padding);
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 9e79b0b5d4..0b4ed9a64b 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -365,7 +365,7 @@ get_padding_and_border (GtkWidget *widget,
GtkBorder tmp;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, border);
gtk_style_context_get_border (context, state, &tmp);
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 2ac7964c9a..59fa348776 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3884,7 +3884,6 @@ get_progress_area (GtkWidget *widget,
GtkStyleContext *context;
GtkBorder border, entry_borders;
gint frame_width, text_area_width, text_area_height;
- GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
_gtk_entry_get_borders (entry, &entry_borders);
@@ -3900,15 +3899,15 @@ get_progress_area (GtkWidget *widget,
*width = text_area_width + entry_borders.left + entry_borders.right;
*height = text_area_height + entry_borders.top + entry_borders.bottom;
- state = gtk_style_context_get_state (context);
-
/* if the text area got resized by a subclass, subtract the left/right
* border width, so that the progress bar won't extend over the resized
* text area.
*/
if (frame_width > *width)
{
- gtk_style_context_get_border (context, state, &border);
+ gtk_style_context_get_border (context,
+ gtk_style_context_get_state (context),
+ &border);
if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
{
*x = (frame_width - *width) + border.left;
@@ -3925,7 +3924,9 @@ get_progress_area (GtkWidget *widget,
GtkBorder margin;
gtk_style_context_save_to_node (context, private->progress_node);
- gtk_style_context_get_margin (context, state, &margin);
+ gtk_style_context_get_margin (context,
+ gtk_style_context_get_state (context),
+ &margin);
gtk_style_context_restore (context);
*x += margin.left;
@@ -6549,7 +6550,6 @@ gtk_entry_draw_text (GtkEntry *entry,
{
GtkEntryPrivate *priv = entry->priv;
GtkWidget *widget = GTK_WIDGET (entry);
- GtkStateFlags state = 0;
GdkRGBA text_color;
GdkRGBA bar_text_color = { 0 };
GtkStyleContext *context;
@@ -6561,16 +6561,19 @@ gtk_entry_draw_text (GtkEntry *entry,
if (gtk_entry_get_display_mode (entry) == DISPLAY_BLANK)
return;
- state = gtk_widget_get_state_flags (widget);
context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_color (context, state, &text_color);
+ gtk_style_context_get_color (context,
+ gtk_style_context_get_state (context),
+ &text_color);
/* Get foreground color for progressbars */
if (priv->progress_node)
{
gtk_style_context_save_to_node (context, priv->progress_node);
- gtk_style_context_get_color (context, state, &bar_text_color);
+ gtk_style_context_get_color (context,
+ gtk_style_context_get_state (context),
+ &bar_text_color);
gtk_style_context_restore (context);
}
@@ -6692,12 +6695,12 @@ gtk_entry_draw_cursor (GtkEntry *entry,
if (!block_at_line_end)
{
- GtkStateFlags state;
GdkRGBA color;
- state = gtk_widget_get_state_flags (widget);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_style_context_get_background_color (context, state, &color);
+ gtk_style_context_get_background_color (context,
+ gtk_style_context_get_state (context),
+ &color);
G_GNUC_END_IGNORE_DEPRECATIONS
gdk_cairo_rectangle (cr, &rect);
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index b10dd2e68f..57d9d8e2f1 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -6127,13 +6127,11 @@ find_good_size_from_style (GtkWidget *widget,
gint *height)
{
GtkStyleContext *context;
- GtkStateFlags state;
double font_size;
GdkScreen *screen;
double resolution;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
screen = gtk_widget_get_screen (widget);
if (screen)
@@ -6145,7 +6143,10 @@ find_good_size_from_style (GtkWidget *widget,
else
resolution = 96.0; /* wheeee */
- gtk_style_context_get (context, state, "font-size", &font_size, NULL);
+ 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;
*width = font_size * NUM_CHARS;
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 5c42dda516..d035174237 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -390,7 +390,7 @@ gtk_flow_box_child_draw (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_render_background (context, cr, 0, 0, allocation.width, allocation.height);
gtk_render_frame (context, cr, 0, 0, allocation.width, allocation.height);
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 8909bea22c..a875e58d1d 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -630,7 +630,7 @@ get_padding_and_border (GtkFrame *frame,
GtkStateFlags state;
context = gtk_widget_get_style_context (GTK_WIDGET (frame));
- state = gtk_widget_get_state_flags (GTK_WIDGET (frame));
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, border);
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 4b9882ed1b..da32b350a0 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -125,7 +125,7 @@ get_css_padding_and_border (GtkWidget *widget,
GtkBorder tmp;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, border);
gtk_style_context_get_border (context, state, &tmp);
diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c
index 5b11ba7c7c..8e421b8914 100644
--- a/gtk/gtkinfobar.c
+++ b/gtk/gtkinfobar.c
@@ -322,7 +322,7 @@ get_padding_and_border (GtkWidget *widget,
GtkBorder tmp;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, border);
gtk_style_context_get_border (context, state, &tmp);
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index a3da298e55..771362dcd3 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2594,12 +2594,12 @@ get_menu_padding (GtkWidget *widget,
GtkBorder *padding)
{
GtkStyleContext *context;
- GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
- gtk_style_context_get_padding (context, state, padding);
+ gtk_style_context_get_padding (context,
+ gtk_style_context_get_state (context),
+ padding);
}
static void
@@ -2607,12 +2607,12 @@ get_menu_margin (GtkWidget *widget,
GtkBorder *margin)
{
GtkStyleContext *context;
- GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
- gtk_style_context_get_margin (context, state, margin);
+ gtk_style_context_get_margin (context,
+ gtk_style_context_get_state (context),
+ margin);
}
static void
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 54f0c47690..246d6cc34b 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1457,9 +1457,10 @@ gtk_paned_size_allocate (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
{
GtkBorder margin;
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
- gtk_style_context_get_margin (gtk_widget_get_style_context (widget),
- gtk_widget_get_state_flags (widget),
+ gtk_style_context_get_margin (context,
+ gtk_style_context_get_state (context),
&margin);
if (gtk_widget_get_mapped (widget))
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 8a56db06f3..1df1554c23 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -648,11 +648,11 @@ get_margin (GtkWidget *widget,
GtkBorder *border)
{
GtkStyleContext *context;
- GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
- gtk_style_context_get_margin (context, state, border);
+ gtk_style_context_get_margin (context,
+ gtk_style_context_get_state (context),
+ border);
}
static void
@@ -675,7 +675,6 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
GtkPositionType gap_side, pos;
GtkAllocation allocation;
gint border_radius;
- GtkStateFlags state;
GtkStyleContext *context;
GtkBorder margin, border;
@@ -709,10 +708,9 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
rect.y += gtk_widget_get_margin_top (widget);
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
- gtk_style_context_get_border (context, state, &border);
- gtk_style_context_get (context, state,
+ gtk_style_context_get (context,
+ gtk_style_context_get_state (context),
GTK_STYLE_PROPERTY_BORDER_RADIUS, &border_radius,
NULL);
pos = get_effective_position (popover, priv->final_position);
@@ -1064,7 +1062,7 @@ gtk_popover_draw (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_widget_get_allocation (widget, &allocation);
gtk_style_context_get_border (context, state, &border);
@@ -1157,7 +1155,7 @@ get_padding_and_border (GtkWidget *widget,
GtkBorder tmp;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@@ -1177,7 +1175,7 @@ get_border_radius (GtkWidget *widget)
gint border_radius;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_style_context_get (context, state,
GTK_STYLE_PROPERTY_BORDER_RADIUS, &border_radius,
NULL);
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index da37c0d4fb..a85083e52a 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2220,7 +2220,7 @@ gtk_scrolled_window_draw_scrollbars_junction (GtkScrolledWindow *scrolled_window
GtkStateFlags state;
GtkBorder padding, border;
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, &padding);
gtk_style_context_get_border (context, state, &border);
@@ -2409,7 +2409,7 @@ gtk_scrolled_window_draw (GtkWidget *widget,
GtkStateFlags state;
GtkBorder padding, border;
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, &padding);
gtk_style_context_get_border (context, state, &border);
@@ -2635,7 +2635,7 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget,
GtkBorder padding, border;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_border (context, state, &border);
gtk_style_context_get_padding (context, state, &padding);
@@ -2759,7 +2759,7 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
gtk_widget_get_preferred_width (priv->vscrollbar, &sb_width, NULL);
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
gtk_style_context_get_padding (context, state, &padding);
@@ -3882,7 +3882,7 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
GtkBorder padding, border;
context = gtk_widget_get_style_context (GTK_WIDGET (widget));
- state = gtk_widget_get_state_flags (GTK_WIDGET (widget));
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, &padding);
gtk_style_context_get_border (context, state, &border);
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 27dadd5bd7..f880c233d7 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -262,7 +262,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
GtkStateFlags state;
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
- state = gtk_widget_get_state_flags (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);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 2fca666478..eb43db5f91 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -7821,7 +7821,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
GtkStateFlags state;
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
- state = gtk_widget_get_state_flags (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);
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 93a1e9ed5a..c5192000dd 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -370,7 +370,7 @@ viewport_get_view_allocation (GtkViewport *viewport,
view_allocation->y = 0;
context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, &padding);
gtk_style_context_get_border (context, state, &border);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 78cfd5e002..ab31680939 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10400,7 +10400,7 @@ update_pango_context (GtkWidget *widget,
style_context = _gtk_widget_get_style_context (widget);
gtk_style_context_get (style_context,
- _gtk_widget_get_state_flags (widget),
+ gtk_style_context_get_state (style_context),
"font", &font_desc,
NULL);