GNOME Bugzilla – Bug 362790
GtkComboBox has Color components private, unable to modify Color.
Last modified: 2016-06-08 04:16:50 UTC
Please describe the problem: In the implementation of GtkComboBox, unlike that of GtkCombo, it is impossible to set the color of a GtkComboBox due to key components that make up the ComboBox being in a private struct. GtkComboBox also does not respond to gtk_widget_modify_*(). Steps to reproduce: Try setting gtk_widget_modify_bg() on a GtkComboBox, won't do squat. At least The GtkCombo allowed you to access the inner constituencies of the combobox for color modification. Actual results: You won't change the GtkComboBox's color. Expected results: The color of the combobox to change. Does this happen every time? Yes. Other information: Exposing the inner GtkComboBoxPrivate struct to the world would allow for access to the inner workings and thereby color modification. Alternatively, override the gtk_widget_modify functions to work with the GtkComboBox.
I met the same problem !
gtk_widget_modify_base can change most widgets' color,but doesn't work with combobox
Created attachment 268890 [details] popup window can't change color If you only want to change combobox's color (not include popup menu) I have a way to do this ( but I also want to change the popup menu's color,any one can help ??? ) ============================================== I create a struct GtkComboBoxP like this : ============================================== struct GtkComboBoxP { GtkTreeModel *model; s32 col_column; s32 row_column; s32 wrap_width; GtkTreeRowReference *active_row; GtkWidget *tree_view; GtkTreeViewColumn *column; GtkWidget *cell_view; GtkWidget *cell_view_frame; GtkWidget *button; GtkWidget *box; GtkWidget *arrow; GtkWidget *separator; GtkWidget *popup_widget; }; ============================================== then copy all memory: ============================================== struct GtkComboBoxP *priv = (struct GtkComboBoxP *) GTK_COMBO_BOX(combobox)->priv; ============================================== then change color when focus change: ============================================== g_signal_connect(GTK_OBJECT(priv->button), "focus_in_event", G_CALLBACK(focus_in_widget_cbox), combobox); void focus_in_widget_cbox(GtkWidget *widget, gpointer user_data) { s32 j = focus1[CURR_WIN_INDEX].j_focus; s32 i = focus1[CURR_WIN_INDEX].i_focus; opera_data.focus_i = i; opera_data.focus_j = j; opera_data.type = win_widget_type[CURR_WIN_INDEX][i][j]; gtk_widget_modify_fg(widget, GTK_STATE_NORMAL, &color[YELLOW]); gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &color[YELLOW]); return; } ==============================================
Similar bug but for Gtk3/css https://bugzilla.gnome.org/show_bug.cgi?id=747798
I don't think we wil lfix this for gtk2 at this point