[libhandy/tab-fixes: 2/6] Specify tab minimum width in code rather than css
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/tab-fixes: 2/6] Specify tab minimum width in code rather than css
- Date: Tue, 9 Feb 2021 13:21:01 +0000 (UTC)
commit 762c26409ffd039050452906d9fc062057663c9e
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sun Feb 7 14:01:18 2021 +0500
Specify tab minimum width in code rather than css
Since tabs need to be animated, their minimum width is 0 and we interpret
the css minimum width as natural width instead. This won't be possible in
GTK4, and arguably it doesn't make sense to allow to override that anyway.
src/hdy-tab.c | 5 +++++
src/themes/Adwaita-dark.css | 4 +---
src/themes/Adwaita.css | 4 +---
src/themes/HighContrast.css | 4 +---
src/themes/HighContrastInverse.css | 4 +---
src/themes/_Adwaita-base.scss | 5 -----
6 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/src/hdy-tab.c b/src/hdy-tab.c
index 36d4a273..42996b97 100644
--- a/src/hdy-tab.c
+++ b/src/hdy-tab.c
@@ -19,6 +19,9 @@
#define FADE_WIDTH 18
#define CLOSE_BTN_ANIMATION_DURATION 150
+#define BASE_WIDTH 118
+#define BASE_WIDTH_PINNED 28
+
struct _HdyTab
{
GtkContainer parent_instance;
@@ -317,6 +320,8 @@ hdy_tab_measure (GtkWidget *widget,
gint min = 0, nat = 0;
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+ nat = self->pinned ? BASE_WIDTH_PINNED : BASE_WIDTH;
+
hdy_css_measure (widget, orientation, NULL, &nat);
} else {
gint child_min, child_nat;
diff --git a/src/themes/Adwaita-dark.css b/src/themes/Adwaita-dark.css
index 86ad0f53..c7699ddb 100644
--- a/src/themes/Adwaita-dark.css
+++ b/src/themes/Adwaita-dark.css
@@ -248,9 +248,7 @@ tabbar .needs-attention-left undershoot.left { background: linear-gradient(to ri
tabbar .needs-attention-right undershoot.right { background: linear-gradient(to left, rgba(21, 83, 158,
0.7), rgba(21, 83, 158, 0.5) 1px, rgba(21, 83, 158, 0) 20px); }
-tabbar tab { min-width: 118px; border-style: solid; border-color: #070707; border-width: 0 1px 0 1px;
transition: background 150ms ease-in-out; background-color: #262626; }
-
-tabbar tab.pinned { min-width: 28px; }
+tabbar tab { border-style: solid; border-color: #070707; border-width: 0 1px 0 1px; transition: background
150ms ease-in-out; background-color: #262626; }
tabbar tab:checked { background-color: #353535; }
diff --git a/src/themes/Adwaita.css b/src/themes/Adwaita.css
index 4bd7dc3b..614556f9 100644
--- a/src/themes/Adwaita.css
+++ b/src/themes/Adwaita.css
@@ -248,9 +248,7 @@ tabbar .needs-attention-left undershoot.left { background: linear-gradient(to ri
tabbar .needs-attention-right undershoot.right { background: linear-gradient(to left, rgba(53, 132, 228,
0.7), rgba(53, 132, 228, 0.5) 1px, rgba(53, 132, 228, 0) 20px); }
-tabbar tab { min-width: 118px; border-style: solid; border-color: #bfb8b1; border-width: 0 1px 0 1px;
transition: background 150ms ease-in-out; background-color: #dad6d2; }
-
-tabbar tab.pinned { min-width: 28px; }
+tabbar tab { border-style: solid; border-color: #bfb8b1; border-width: 0 1px 0 1px; transition: background
150ms ease-in-out; background-color: #dad6d2; }
tabbar tab:checked { background-color: #e8e6e3; }
diff --git a/src/themes/HighContrast.css b/src/themes/HighContrast.css
index b3717c97..26fd559a 100644
--- a/src/themes/HighContrast.css
+++ b/src/themes/HighContrast.css
@@ -248,9 +248,7 @@ tabbar .needs-attention-left undershoot.left { background: linear-gradient(to ri
tabbar .needs-attention-right undershoot.right { background: linear-gradient(to left, rgba(27, 106, 203,
0.7), rgba(27, 106, 203, 0.5) 1px, rgba(27, 106, 203, 0) 20px); }
-tabbar tab { min-width: 118px; border-style: solid; border-color: #6e645a; border-width: 0 1px 0 1px;
transition: background 150ms ease-in-out; background-color: #e1dedb; }
-
-tabbar tab.pinned { min-width: 28px; }
+tabbar tab { border-style: solid; border-color: #6e645a; border-width: 0 1px 0 1px; transition: background
150ms ease-in-out; background-color: #e1dedb; }
tabbar tab:checked { background-color: #efedec; }
diff --git a/src/themes/HighContrastInverse.css b/src/themes/HighContrastInverse.css
index a4e038ed..af03f318 100644
--- a/src/themes/HighContrastInverse.css
+++ b/src/themes/HighContrastInverse.css
@@ -248,9 +248,7 @@ tabbar .needs-attention-left undershoot.left { background: linear-gradient(to ri
tabbar .needs-attention-right undershoot.right { background: linear-gradient(to left, rgba(15, 59, 113,
0.7), rgba(15, 59, 113, 0.5) 1px, rgba(15, 59, 113, 0) 20px); }
-tabbar tab { min-width: 118px; border-style: solid; border-color: #4e4e4e; border-width: 0 1px 0 1px;
transition: background 150ms ease-in-out; background-color: #202020; }
-
-tabbar tab.pinned { min-width: 28px; }
+tabbar tab { border-style: solid; border-color: #4e4e4e; border-width: 0 1px 0 1px; transition: background
150ms ease-in-out; background-color: #202020; }
tabbar tab:checked { background-color: #303030; }
diff --git a/src/themes/_Adwaita-base.scss b/src/themes/_Adwaita-base.scss
index 5d2c6a30..bd32b631 100644
--- a/src/themes/_Adwaita-base.scss
+++ b/src/themes/_Adwaita-base.scss
@@ -441,17 +441,12 @@ tabbar {
}
tab {
- min-width: 118px;
border-style: solid;
border-color: $alt_borders_color;
border-width: 0 1px 0 1px;
transition: background 150ms ease-in-out;
background-color: $tab_bg;
- &.pinned {
- min-width: 28px;
- }
-
&:checked {
background-color: lighten($tab_bg, 6%);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]