The Gtk documentation says that gtk_widget_modify_text() is the function
to modify the text color of widgets such as GtkEntry. It also says that the
color given as parameter doesn't have to be allocated. However, when I try
this, the text color is not changed. I have no idea why it's not working:
Code:
#include <gtk/gtk.h>
int main(int argc, char* argv[])
{
gtk_init(&argc, &argv);
GtkWidget* mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(GTK_OBJECT(mainWindow), "destroy",
G_CALLBACK(gtk_main_quit), NULL);
GtkWidget* textField = gtk_entry_new();
gtk_container_add(GTK_CONTAINER(mainWindow), textField);
const GdkColor RED_COLOR = { 0, 65535, 0, 0 };
gtk_widget_modify_text(textField, GTK_STATE_NORMAL, &RED_COLOR);
gtk_widget_show_all(mainWindow);
gtk_main();
}