colorswatch: Render focus with gtk_render_focus()

This commit is contained in:
Benjamin Otte 2014-10-07 16:52:42 +02:00
parent be19ee29c2
commit 100623e455
4 changed files with 31 additions and 28 deletions

View File

@ -171,18 +171,6 @@ swatch_draw (GtkWidget *widget,
gtk_render_frame (context, cr, 0, 0, width, height);
if (gtk_widget_has_visible_focus (widget))
{
cairo_set_line_width (cr, 2);
if (swatch->priv->has_color && INTENSITY (swatch->priv->color.red, swatch->priv->color.green, swatch->priv->color.blue) < 0.5)
cairo_set_source_rgba (cr, 1., 1., 1., 0.4);
else
cairo_set_source_rgba (cr, 0., 0., 0., 0.4);
_gtk_rounded_box_shrink (&background.padding_box, 3, 3, 3, 3);
_gtk_rounded_box_path (&background.padding_box, cr);
cairo_stroke (cr);
}
if (swatch->priv->icon)
{
icon_info = gtk_icon_theme_lookup_icon (theme, swatch->priv->icon, PIXBUF_SIZE,
@ -240,6 +228,11 @@ swatch_draw (GtkWidget *widget,
cairo_restore (cr);
gtk_style_context_restore (context);
if (gtk_widget_has_visible_focus (widget))
{
gtk_render_focus (context, cr, 0, 0, width, height);
}
return FALSE;
}

View File

@ -2786,6 +2786,7 @@ GtkColorSwatch {
}
&.color-light {
outline-color: transparentize(black,0.7);
&:hover {
background-image: linear-gradient(to bottom,
transparentize(white, 1) 40%,
@ -2794,6 +2795,7 @@ GtkColorSwatch {
}
}
&.color-dark {
outline-color: transparentize(white,0.5);
&:hover {
background-image: linear-gradient(to bottom,
transparentize(white, 1) 40%,

View File

@ -4161,14 +4161,18 @@ GtkColorSwatch {
border: 1px solid;
border-color: #1c1f1f;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4); }
GtkColorSwatch.color-light:hover {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.4)); }
GtkColorSwatch.color-light:hover:backdrop {
background-image: none; }
GtkColorSwatch.color-dark:hover {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.2)); }
GtkColorSwatch.color-dark:hover:backdrop {
background-image: none; }
GtkColorSwatch.color-light {
outline-color: rgba(0, 0, 0, 0.3); }
GtkColorSwatch.color-light:hover {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.4)); }
GtkColorSwatch.color-light:hover:backdrop {
background-image: none; }
GtkColorSwatch.color-dark {
outline-color: rgba(255, 255, 255, 0.5); }
GtkColorSwatch.color-dark:hover {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.2)); }
GtkColorSwatch.color-dark:hover:backdrop {
background-image: none; }
GtkColorSwatch:hover {
border-color: #1e2222; }
GtkColorSwatch:backdrop {

View File

@ -4322,14 +4322,18 @@ GtkColorSwatch {
border: 1px solid;
border-color: rgba(0, 0, 0, 0.3);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2); }
GtkColorSwatch.color-light:hover {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.4)); }
GtkColorSwatch.color-light:hover:backdrop {
background-image: none; }
GtkColorSwatch.color-dark:hover {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.2)); }
GtkColorSwatch.color-dark:hover:backdrop {
background-image: none; }
GtkColorSwatch.color-light {
outline-color: rgba(0, 0, 0, 0.3); }
GtkColorSwatch.color-light:hover {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.4)); }
GtkColorSwatch.color-light:hover:backdrop {
background-image: none; }
GtkColorSwatch.color-dark {
outline-color: rgba(255, 255, 255, 0.5); }
GtkColorSwatch.color-dark:hover {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.2)); }
GtkColorSwatch.color-dark:hover:backdrop {
background-image: none; }
GtkColorSwatch:hover {
border-color: rgba(0, 0, 0, 0.5); }
GtkColorSwatch:backdrop {