diff options
author | Wolfgang Ulbrich <[email protected]> | 2016-01-11 18:36:08 +0100 |
---|---|---|
committer | Wolfgang Ulbrich <[email protected]> | 2016-01-13 15:07:35 +0100 |
commit | 4974f96274a7cbc0056983dea03b2d42615714e4 (patch) | |
tree | 5c63349b54c0bdcdbd33b35c15edcd38c3dbc4f8 | |
parent | 8e4612599a9a6cb1f380dd6cbef9ad3d885cf77f (diff) | |
download | caja-4974f96274a7cbc0056983dea03b2d42615714e4.tar.bz2 caja-4974f96274a7cbc0056983dea03b2d42615714e4.tar.xz |
GTK3 icon-canvas-item: don't override parent container style flags
When drawing the canvas item elements, don't override the parent
container style flags, so we don't lose e.g. backdrop information.
taken from:
https://git.gnome.org/browse/nautilus/commit/?id=31dad6f
-rw-r--r-- | libcaja-private/caja-icon-canvas-item.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c index 3d719d5a..803cde76 100644 --- a/libcaja-private/caja-icon-canvas-item.c +++ b/libcaja-private/caja-icon-canvas-item.c @@ -1384,7 +1384,7 @@ draw_label_text (CajaIconCanvasItem *item, PangoLayout *editable_layout; PangoLayout *additional_layout; GtkStyleContext *context; - GtkStateFlags state; + GtkStateFlags state, base_state; gboolean have_editable, have_additional; gboolean needs_highlight, prelight_label, is_rtl_label_beside; EelIRect text_rect; @@ -1424,7 +1424,10 @@ draw_label_text (CajaIconCanvasItem *item, max_text_width = floor (caja_icon_canvas_item_get_max_text_width (item)); - state = GTK_STATE_FLAG_NORMAL; + base_state = gtk_widget_get_state_flags (GTK_WIDGET (container)); + base_state &= ~(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_PRELIGHT); + state = base_state; + gtk_widget_style_get (GTK_WIDGET (container), "activate_prelight_icon_label", &prelight_label, NULL); @@ -1432,11 +1435,7 @@ draw_label_text (CajaIconCanvasItem *item, /* if the icon is highlighted, do some set-up */ if (needs_highlight && !details->is_renaming) { - if (gtk_widget_has_focus (GTK_WIDGET (container))) { - state |= GTK_STATE_FLAG_SELECTED; - } else { - state |= GTK_STATE_FLAG_ACTIVE; - } + state |= GTK_STATE_FLAG_SELECTED; frame_x = is_rtl_label_beside ? text_rect.x0 + item->details->text_dx : text_rect.x0; frame_y = text_rect.y0; @@ -1481,16 +1480,14 @@ draw_label_text (CajaIconCanvasItem *item, if (have_editable && !details->is_renaming) { - state = GTK_STATE_FLAG_NORMAL; + state = base_state; if (prelight_label && item->details->is_prelit) { state |= GTK_STATE_FLAG_PRELIGHT; } - if (needs_highlight && gtk_widget_has_focus (GTK_WIDGET (container))) { + if (needs_highlight) { state |= GTK_STATE_FLAG_SELECTED; - } else if (needs_highlight) { - state |= GTK_STATE_FLAG_ACTIVE; } editable_layout = get_label_layout (&item->details->editable_text_layout, item, item->details->editable_text); @@ -1509,12 +1506,10 @@ draw_label_text (CajaIconCanvasItem *item, if (have_additional && !details->is_renaming) { - state = GTK_STATE_FLAG_NORMAL; + state = base_state; - if (needs_highlight && gtk_widget_has_focus (GTK_WIDGET (container))) { + if (needs_highlight) { state |= GTK_STATE_FLAG_SELECTED; - } else if (needs_highlight) { - state |= GTK_STATE_FLAG_ACTIVE; } additional_layout = get_label_layout (&item->details->additional_text_layout, item, item->details->additional_text); @@ -1533,8 +1528,6 @@ draw_label_text (CajaIconCanvasItem *item, { if (needs_highlight) { state = GTK_STATE_FLAG_SELECTED; - } else { - state = GTK_STATE_FLAG_ACTIVE; } gtk_style_context_save (context); |