pidgin/gtkconv.c

changeset 38299
770365ded9f8
parent 38298
f0a8f63f9312
parent 38192
ca1489360439
child 38358
30ba44276e74
equal deleted inserted replaced
38298:f0a8f63f9312 38299:770365ded9f8
6067 pidgin_conv_placement_place(gtkconv); 6067 pidgin_conv_placement_place(gtkconv);
6068 6068
6069 if (generated_nick_colors == NULL) { 6069 if (generated_nick_colors == NULL) {
6070 GdkColor color; 6070 GdkColor color;
6071 GdkRGBA rgba; 6071 GdkRGBA rgba;
6072 /* FIXME: No matter how I ask the GtkStyleContext, it always gives me
6073 * back black instead of the _actual_ background colour. */
6074 color = gtk_widget_get_style(gtkconv->webview)->base[GTK_STATE_NORMAL]; 6072 color = gtk_widget_get_style(gtkconv->webview)->base[GTK_STATE_NORMAL];
6075 rgba.red = color.red / 65535.0; 6073 rgba.red = color.red / 65535.0;
6076 rgba.green = color.green / 65535.0; 6074 rgba.green = color.green / 65535.0;
6077 rgba.blue = color.blue / 65535.0; 6075 rgba.blue = color.blue / 65535.0;
6076 rgba.alpha = 1.0;
6078 generated_nick_colors = generate_nick_colors(NICK_COLOR_GENERATE_COUNT, rgba); 6077 generated_nick_colors = generate_nick_colors(NICK_COLOR_GENERATE_COUNT, rgba);
6079 } 6078 }
6080 6079
6081 if(NULL == (gtkconv->nick_colors = pidgin_conversation_theme_get_nick_colors(gtkconv->theme))) 6080 if(NULL == (gtkconv->nick_colors = pidgin_conversation_theme_get_nick_colors(gtkconv->theme)))
6082 { 6081 {
11246 * expensive to find colors that not only don't conflict with the background, but also do not 11245 * expensive to find colors that not only don't conflict with the background, but also do not
11247 * conflict with each other. 11246 * conflict with each other.
11248 */ 11247 */
11249 while(i < numcolors && time(NULL) < breakout_time) 11248 while(i < numcolors && time(NULL) < breakout_time)
11250 { 11249 {
11251 GdkRGBA color = {rand() % 65536 / 65535.0, rand() % 65536 / 65535.0, rand() % 65536 / 65535.0, 1}; 11250 GdkRGBA color = {g_random_double_range(0, 1), g_random_double_range(0, 1), g_random_double_range(0, 1), 1};
11252 11251
11253 if (color_is_visible(color, background, MIN_LUMINANCE_CONTRAST_RATIO) && 11252 if (color_is_visible(color, background, MIN_LUMINANCE_CONTRAST_RATIO) &&
11254 color_is_visible(color, nick_highlight, MIN_LUMINANCE_CONTRAST_RATIO) && 11253 color_is_visible(color, nick_highlight, MIN_LUMINANCE_CONTRAST_RATIO) &&
11255 color_is_visible(color, send_color, MIN_LUMINANCE_CONTRAST_RATIO)) 11254 color_is_visible(color, send_color, MIN_LUMINANCE_CONTRAST_RATIO))
11256 { 11255 {

mercurial