mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-16 21:50:34 +00:00
Don't pass widget state flags to GtkStyleContext API
This commit is contained in:
parent
f407871b87
commit
2182fe7d9d
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user