From 483e674c1b76ef50ead340f0523f3a9f6ec8c93c Mon Sep 17 00:00:00 2001 From: Megax <megax@yeahunter.hu> Date: Tue, 17 May 2016 20:45:04 +0200 Subject: [PATCH] * Optimized spinbutton. --- gtk-3.20/scss/_functions.scss | 9 ----- gtk-3.20/scss/widgets/_button.scss | 65 ++++++++++++++++++++++-------- gtk-3.20/scss/widgets/_entry.scss | 9 +++-- 3 files changed, 54 insertions(+), 29 deletions(-) diff --git a/gtk-3.20/scss/_functions.scss b/gtk-3.20/scss/_functions.scss index 39bd4be..74dc76a 100755 --- a/gtk-3.20/scss/_functions.scss +++ b/gtk-3.20/scss/_functions.scss @@ -93,12 +93,3 @@ $modules: () !default; @return transparentize(black, $_lbg * .8); } } - -// entries -@function entry_focus_border($fc:$selected_bg_color) { - @if $variant == 'light' { - @return $fc; - } @else { - @return if($fc == $selected_bg_color, $selected_borders_color, shade($fc, .65)); - } -} diff --git a/gtk-3.20/scss/widgets/_button.scss b/gtk-3.20/scss/widgets/_button.scss index cd4796c..7f4bd49 100755 --- a/gtk-3.20/scss/widgets/_button.scss +++ b/gtk-3.20/scss/widgets/_button.scss @@ -379,21 +379,60 @@ &:active, &:checked, &:hover { color: $text_color; } - &:disabled { color: mix($text_color, $base_color, .7); } + &:disabled { color: alpha($insensitive_fg_color, .8); } + + &:backdrop { color: mix($backdrop_base_color, $backdrop_fg_color, .9); } + + &:backdrop:disabled { color: alpha($backdrop_insensitive_color, .8); } } &:not(.vertical) { + @extend %entry; + @include linear-gradient($base_color, to top); + @include border($base_color); + + padding: 0; + + color: $text_color; + caret-color: $text_color; + + &:focus, &:active { border-color: border_focus($borders_color); } + + &:disabled { + @include linear-gradient(shade($base_color, .9), to top); + + color: mix($base_color, $text_color, .5); + } + entry { // reset all the other props since the spinbutton node is styled here + border: 0; border-radius: 0; + box-shadow: none; } button { - @extend %linked_middle; + border-radius: 0; + border-color: alpha($borders_color, .8); + border-style: none none none solid; + background-image: none; + box-shadow: none; - &:first-child { border-radius: $roundness 0 0 $roundness; } + &:dir(rtl) { border-style: none solid none none; } - &:last-child { border-radius: 0 $roundness $roundness 0; } + &:active { box-shadow: inset 0 2px 3px -1px transparentize($black, .8); } + + &:backdrop { border-color: alpha($backdrop_borders_color, .8); } + + &:backdrop:disabled { + border-style: none none none solid; // It is needed or it gets overridden + + &:dir(rtl) { border-style: none solid none none; } + } + + &:dir(rtr):first-child { border-radius: $roundness 0 0 $roundness; } + + &:dir(ltl):last-child { border-radius: 0 $roundness $roundness 0; } } } @@ -404,20 +443,14 @@ } button { - @extend %linked_vertical_entry; - - &:first-child { - border-width: 1px; - border-bottom-width: 0; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; + &.up { + border-style: solid solid none solid; + border-radius: $roundness $roundness 0 0; } - &:last-child { - border-width: 1px; - border-top-width: 0; - border-top-left-radius: 0; - border-top-right-radius: 0; + &.down { + border-style: none solid solid solid; + border-radius: 0 0 $roundness $roundness; } } } diff --git a/gtk-3.20/scss/widgets/_entry.scss b/gtk-3.20/scss/widgets/_entry.scss index d097a37..b142ebe 100755 --- a/gtk-3.20/scss/widgets/_entry.scss +++ b/gtk-3.20/scss/widgets/_entry.scss @@ -87,7 +87,6 @@ } %entry { - padding: $spacing; border-width: 1px; border-style: solid; border-radius: $roundness; @@ -124,6 +123,8 @@ @include linear-gradient($bg, to top); @include border($bg); + padding: $spacing; + color: $fg; caret-color: $fg; @@ -143,7 +144,7 @@ .linked:not(.vertical) > & { @extend %linked_entry; } .linked:not(.vertical) > &:focus + &, .linked:not(.vertical) > &:focus + button, - .linked:not(.vertical) > &:focus + combobox > box > button.combo { border-left-color: entry_focus_border(); } + .linked:not(.vertical) > &:focus + combobox > box > button.combo { border-left-color: border_focus($borders_color); } .linked:not(.vertical) > &:drop(active) + &, .linked:not(.vertical) > &:drop(active) + button, @@ -165,7 +166,7 @@ // color back the top border of a linked focused entry following another entry. // :not(:only-child) is a specificity bump hack. - + entry:focus:not(:only-child) { border-top-color: entry_focus_border(); } + + entry:focus:not(:only-child) { border-top-color: border_focus($borders_color); } + entry:drop(active):not(:only-child) { border-top-color: $drop_target_color; } @@ -174,7 +175,7 @@ &:focus:not(:only-child) { + entry, + button, - + combobox > box > button.combo { border-top-color: entry_focus_border(); } + + combobox > box > button.combo { border-top-color: border_focus($borders_color); } } &:drop(active):not(:only-child) {