mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
[GTK3] Get styles for menu label, button text and combobox text colors from WidgetCache
This commit is contained in:
parent
a144db2754
commit
618138082f
2 changed files with 27 additions and 27 deletions
|
|
@ -105,7 +105,6 @@
|
|||
fun:g_object_newv
|
||||
fun:g_object_new_valist
|
||||
fun:g_object_new
|
||||
fun:_ZN13nsLookAndFeel4InitEv
|
||||
...
|
||||
}
|
||||
# set_color() in gtkstyle.c of GTK version 3.4.4 only can leak GdkRGBA
|
||||
|
|
|
|||
|
|
@ -1169,22 +1169,17 @@ nsLookAndFeel::Init()
|
|||
sInfoText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
ReleaseStyleContext(style);
|
||||
|
||||
// menu foreground & menu background
|
||||
GtkWidget *accel_label = gtk_accel_label_new("M");
|
||||
GtkWidget *menuitem = gtk_menu_item_new();
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
|
||||
g_object_ref_sink(menu);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
||||
|
||||
style = gtk_widget_get_style_context(accel_label);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
||||
sMenuText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
|
||||
sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
|
||||
g_object_unref(menu);
|
||||
style = ClaimStyleContext(MOZ_GTK_MENUITEM);
|
||||
{
|
||||
GtkStyleContext* accelStyle =
|
||||
CreateStyleForWidget(gtk_accel_label_new("M"), style);
|
||||
gtk_style_context_get_color(accelStyle, GTK_STATE_FLAG_NORMAL, &color);
|
||||
sMenuText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(accelStyle, GTK_STATE_FLAG_INSENSITIVE, &color);
|
||||
sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
|
||||
g_object_unref(accelStyle);
|
||||
}
|
||||
ReleaseStyleContext(style);
|
||||
|
||||
style = ClaimStyleContext(MOZ_GTK_MENUPOPUP);
|
||||
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
||||
|
|
@ -1208,9 +1203,6 @@ nsLookAndFeel::Init()
|
|||
GtkWidget *combobox = gtk_combo_box_new();
|
||||
GtkWidget *comboboxLabel = gtk_label_new("M");
|
||||
gtk_container_add(GTK_CONTAINER(combobox), comboboxLabel);
|
||||
#else
|
||||
GtkWidget *combobox = gtk_combo_box_new_with_entry();
|
||||
GtkWidget *comboboxLabel = gtk_bin_get_child(GTK_BIN(combobox));
|
||||
#endif
|
||||
GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
|
||||
GtkWidget *treeView = gtk_tree_view_new();
|
||||
|
|
@ -1224,7 +1216,9 @@ nsLookAndFeel::Init()
|
|||
gtk_container_add(GTK_CONTAINER(parent), button);
|
||||
gtk_container_add(GTK_CONTAINER(parent), treeView);
|
||||
gtk_container_add(GTK_CONTAINER(parent), linkButton);
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
gtk_container_add(GTK_CONTAINER(parent), combobox);
|
||||
#endif
|
||||
gtk_container_add(GTK_CONTAINER(parent), menuBar);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), menuBarItem);
|
||||
gtk_container_add(GTK_CONTAINER(window), parent);
|
||||
|
|
@ -1334,17 +1328,24 @@ nsLookAndFeel::Init()
|
|||
sTextSelectedText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
ReleaseStyleContext(style);
|
||||
|
||||
// Button text, background, border
|
||||
style = gtk_widget_get_style_context(label);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
||||
sButtonText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
|
||||
sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
// Button text color
|
||||
style = ClaimStyleContext(MOZ_GTK_BUTTON);
|
||||
{
|
||||
GtkStyleContext* labelStyle =
|
||||
CreateStyleForWidget(gtk_label_new("M"), style);
|
||||
gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_NORMAL, &color);
|
||||
sButtonText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_PRELIGHT, &color);
|
||||
sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
g_object_unref(labelStyle);
|
||||
}
|
||||
ReleaseStyleContext(style);
|
||||
|
||||
// Combobox text color
|
||||
style = gtk_widget_get_style_context(comboboxLabel);
|
||||
style = ClaimStyleContext(MOZ_GTK_COMBOBOX_ENTRY_TEXTAREA);
|
||||
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
|
||||
sComboBoxText = GDK_RGBA_TO_NS_RGBA(color);
|
||||
ReleaseStyleContext(style);
|
||||
|
||||
// Menubar text and hover text colors
|
||||
style = ClaimStyleContext(MOZ_GTK_MENUBARITEM);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue