[gtk+] colorswatch: Render focus with gtk_render_focus()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] colorswatch: Render focus with gtk_render_focus()
- Date: Wed, 8 Oct 2014 03:23:52 +0000 (UTC)
commit 100623e4553eeced147a0f799ad5a8e9f63d025e
Author: Benjamin Otte <otte redhat com>
Date: Tue Oct 7 16:52:42 2014 +0200
colorswatch: Render focus with gtk_render_focus()
gtk/gtkcolorswatch.c | 17 +++++------------
gtk/resources/theme/Adwaita/_common.scss | 2 ++
gtk/resources/theme/Adwaita/gtk-contained-dark.css | 20 ++++++++++++--------
gtk/resources/theme/Adwaita/gtk-contained.css | 20 ++++++++++++--------
4 files changed, 31 insertions(+), 28 deletions(-)
---
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 77846a6..690de3a 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -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;
}
diff --git a/gtk/resources/theme/Adwaita/_common.scss b/gtk/resources/theme/Adwaita/_common.scss
index b010bce..1ae1900 100644
--- a/gtk/resources/theme/Adwaita/_common.scss
+++ b/gtk/resources/theme/Adwaita/_common.scss
@@ -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%,
diff --git a/gtk/resources/theme/Adwaita/gtk-contained-dark.css
b/gtk/resources/theme/Adwaita/gtk-contained-dark.css
index 6dee234..19f2176 100644
--- a/gtk/resources/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/resources/theme/Adwaita/gtk-contained-dark.css
@@ -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 {
diff --git a/gtk/resources/theme/Adwaita/gtk-contained.css b/gtk/resources/theme/Adwaita/gtk-contained.css
index 81eed0e..318c463 100644
--- a/gtk/resources/theme/Adwaita/gtk-contained.css
+++ b/gtk/resources/theme/Adwaita/gtk-contained.css
@@ -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 {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]