[gtk+/wip/baedert/drawing] widget: Set :focus on focus children
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing] widget: Set :focus on focus children
- Date: Tue, 11 Jul 2017 16:19:37 +0000 (UTC)
commit 47d760becd1c498ecb4e60af844077c64c063177
Author: Timm Bäder <mail baedert org>
Date: Tue Jul 11 18:20:48 2017 +0200
widget: Set :focus on focus children
And snapshot a focus outline regardless of has_visible_focus.
gtk/gtkwidget.c | 21 ++++++++++++---------
gtk/theme/Adwaita/_common.scss | 6 ++++--
gtk/theme/Adwaita/gtk-contained-dark.css | 4 +++-
gtk/theme/Adwaita/gtk-contained.css | 4 +++-
4 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 10e9ba6..3689bc4 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -15371,15 +15371,12 @@ gtk_widget_snapshot (GtkWidget *widget,
}
- if (gtk_widget_has_visible_focus (widget))
- {
- gtk_snapshot_offset (snapshot, margin.left, margin.top);
- gtk_css_style_snapshot_outline (style,
- snapshot,
- allocation.width - margin.left - margin.right,
- allocation.height - margin.top - margin.bottom);
- gtk_snapshot_offset (snapshot, - margin.left, - margin.top);
- }
+ gtk_snapshot_offset (snapshot, margin.left, margin.top);
+ gtk_css_style_snapshot_outline (style,
+ snapshot,
+ allocation.width - margin.left - margin.right,
+ allocation.height - margin.top - margin.bottom);
+ gtk_snapshot_offset (snapshot, - margin.left, - margin.top);
if (opacity < 1.0)
gtk_snapshot_pop (snapshot);
@@ -15659,6 +15656,12 @@ gtk_widget_set_focus_child (GtkWidget *widget,
g_return_if_fail (gtk_widget_get_parent (child) == widget);
}
+ if (priv->focus_child)
+ gtk_widget_unset_state_flags (priv->focus_child, GTK_STATE_FLAG_FOCUSED);
+
+ if (child)
+ gtk_widget_set_state_flags (child, GTK_STATE_FLAG_FOCUSED, FALSE);
+
g_set_object (&priv->focus_child, child);
if (GTK_IS_CONTAINER (widget))
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index b604c14..dea9211 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -10,6 +10,10 @@ $button_transition: all 200ms $ease-out-quad;
* {
padding: 0;
+ -gtk-secondary-caret-color: $selected_bg_color
+}
+
+*:focus {
// We use the outline properties to signal the focus properties
// to the adwaita engine: using real CSS properties is faster,
// and we don't use any outlines for now.
@@ -19,8 +23,6 @@ $button_transition: all 200ms $ease-out-quad;
outline-offset: -3px;
outline-width: 1px;
-gtk-outline-radius: 2px;
-
- -gtk-secondary-caret-color: $selected_bg_color
}
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 826937d..e066a66 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -1,4 +1,6 @@
-* { padding: 0; outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px;
outline-width: 1px; -gtk-outline-radius: 2px; -gtk-secondary-caret-color: #215d9c; }
+* { padding: 0; -gtk-secondary-caret-color: #215d9c; }
+
+*:focus { outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px;
outline-width: 1px; -gtk-outline-radius: 2px; }
/*************** Base States * */
.background { color: #eeeeec; background-color: #33393b; }
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index d94b3db..82da845 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -1,4 +1,6 @@
-* { padding: 0; outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px;
outline-width: 1px; -gtk-outline-radius: 2px; -gtk-secondary-caret-color: #4a90d9; }
+* { padding: 0; -gtk-secondary-caret-color: #4a90d9; }
+
+*:focus { outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px;
outline-width: 1px; -gtk-outline-radius: 2px; }
/*************** Base States * */
.background { color: #2e3436; background-color: #e8e8e7; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]