[gtk/wip/matthiasc/context-menu] popover menubar: Use a pseudo state
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/context-menu] popover menubar: Use a pseudo state
- Date: Thu, 13 Jun 2019 00:16:24 +0000 (UTC)
commit f00bdb6e6a454f99f73a85158f9a6838f0aa2912
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jun 13 00:12:33 2019 +0000
popover menubar: Use a pseudo state
Use :selected instead of .active to
mark the active item.
gtk/gtkpopovermenubar.c | 14 +++-----------
gtk/theme/Adwaita/_common.scss | 14 +++++++-------
2 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkpopovermenubar.c b/gtk/gtkpopovermenubar.c
index 119fbacd59..7716397dfe 100644
--- a/gtk/gtkpopovermenubar.c
+++ b/gtk/gtkpopovermenubar.c
@@ -60,7 +60,6 @@
#include "gtkmarshalers.h"
#include "gtkstylecontext.h"
#include "gtkgestureclick.h"
-#include "gtkeventcontrollerkey.h"
#include "gtkeventcontrollermotion.h"
#include "gtkactionmuxerprivate.h"
#include "gtkmenutrackerprivate.h"
@@ -130,21 +129,13 @@ set_active_item (GtkPopoverMenuBar *bar,
if (changed)
{
- GtkStyleContext *context;
-
if (bar->active_item)
- {
- context = gtk_widget_get_style_context (GTK_WIDGET (bar->active_item));
- gtk_style_context_remove_class (context, "active");
- }
+ gtk_widget_unset_state_flags (GTK_WIDGET (bar->active_item), GTK_STATE_FLAG_SELECTED);
bar->active_item = item;
if (bar->active_item)
- {
- context = gtk_widget_get_style_context (GTK_WIDGET (bar->active_item));
- gtk_style_context_add_class (context, "active");
- }
+ gtk_widget_set_state_flags (GTK_WIDGET (bar->active_item), GTK_STATE_FLAG_SELECTED, FALSE);
}
if (bar->active_item)
@@ -214,6 +205,7 @@ gtk_popover_menu_bar_focus (GtkWidget *widget,
{
GtkPopoverMenuBar *bar = GTK_POPOVER_MENU_BAR (widget);
GtkWidget *next;
+
if (bar->active_item &&
gtk_widget_get_mapped (GTK_WIDGET (bar->active_item->popover)))
{
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index a9b363d350..866b9a3125 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -16,7 +16,6 @@ $window_radius: $button_radius + 3;
-gtk-secondary-caret-color: $selected_bg_color
}
-modelbutton:focus(visible),
button:focus(visible),
checkbutton:focus(visible),
radiobutton:focus(visible),
@@ -4715,7 +4714,7 @@ menubar {
min-height: 16px;
padding: 4px 8px;
- &.active { //Seems like it :hover even with keyboard focus
+ &:selected { //Seems like it :hover even with keyboard focus
box-shadow: inset 0 -3px $selected_bg_color;
color: $link_color;
}
@@ -4730,13 +4729,14 @@ menubar {
}
popover.menu {
- & .flat.image-button.model {
+ & button.flat.image-button.model {
padding: 0;
border: none;
}
- & .flat.image-button.model:hover {
+ & button.flat.image-button.model:selected {
border: none;
- color: gray;
+ color: $selected_fg_color;
+ background: $selected_bg_color;
}
& box.inline-buttons {
@@ -4780,12 +4780,12 @@ popover.menu {
margin-right: 0;
}
- & modelbutton:hover {
+ & modelbutton:selected {
color: $selected_fg_color;
background-color: $selected_bg_color;
}
- & modelbutton:hover accelerator {
+ & modelbutton:selected accelerator {
color: mix($selected_fg_color, gray, 50%);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]