Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 02 May 2016 22:31:38 UTC Commit: f948916ad07d08bdb4ede16b7ea733ff3d12ea55 https://github.com/geany/geany/commit/f948916ad07d08bdb4ede16b7ea733ff3d12ea...
Log Message: ----------- Don't get properties of a non-current style state to please GTK 3.20
GTK 3.20 doesn't like getting a style property for a non-current state, unless the call is wrapped in a save()/restore() pair.
So, fix the code to either use the current state or temporarily save the context.
gb.c now uses different states, but it shouldn't really matter given how they are used, and even gives a native behavior when the window loses focus, as it now properly reacts to BACKDROP state.
Modified Paths: -------------- src/build.c src/document.c src/gb.c
Modified: src/build.c 8 lines changed, 7 insertions(+), 1 deletions(-) =================================================================== @@ -1805,7 +1805,13 @@ static RowWidgets *build_add_dialog_row(GeanyDocument *doc, GtkTable *table, gui label = gtk_label_new(text); g_free(text); #if GTK_CHECK_VERSION(3,0,0) - gtk_style_context_get_color(gtk_widget_get_style_context(label), GTK_STATE_FLAG_INSENSITIVE, &insensitive_color); +{ + GtkStyleContext *ctx = gtk_widget_get_style_context(label); + + gtk_style_context_save(ctx); + gtk_style_context_get_color(ctx, GTK_STATE_FLAG_INSENSITIVE, &insensitive_color); + gtk_style_context_restore(ctx); +} #else insensitive_color = gtk_widget_get_style(label)->text[GTK_STATE_INSENSITIVE]; #endif
Modified: src/document.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -3269,7 +3269,7 @@ const GdkColor *document_get_status_color(GeanyDocument *doc) gtk_widget_path_iter_set_name(path, -1, document_status_styles[status].name); gtk_style_context_set_screen(ctx, gtk_widget_get_screen(GTK_WIDGET(doc->editor->sci))); gtk_style_context_set_path(ctx, path); - gtk_style_context_get_color(ctx, GTK_STATE_FLAG_NORMAL, &color); + gtk_style_context_get_color(ctx, gtk_style_context_get_state(ctx), &color); document_status_styles[status].color.red = 0xffff * color.red; document_status_styles[status].color.green = 0xffff * color.green; document_status_styles[status].color.blue = 0xffff * color.blue;
Modified: src/gb.c 7 lines changed, 4 insertions(+), 3 deletions(-) =================================================================== @@ -99,10 +99,11 @@ static gboolean geany_pong_area_draw(GtkWidget *area, cairo_t *cr, GeanyPong *se /* we use the window style context because the area one has a transparent * background and we want something to paint for the overlay */ GtkStyleContext *ctx = gtk_widget_get_style_context(GTK_WIDGET(self)); + GtkStateFlags state = gtk_style_context_get_state(ctx); GdkRGBA fg, bg;
- gtk_style_context_get_color(ctx, GTK_STATE_FLAG_ACTIVE, &fg); - gtk_style_context_get_background_color(ctx, GTK_STATE_FLAG_BACKDROP, &bg); + gtk_style_context_get_color(ctx, state, &fg); + gtk_style_context_get_background_color(ctx, state, &bg); #else GtkStyle *style = gtk_widget_get_style(area); GdkColor fg = style->fg[GTK_STATE_NORMAL]; @@ -144,7 +145,7 @@ static gboolean geany_pong_area_draw(GtkWidget *area, cairo_t *cr, GeanyPong *se layout = pango_cairo_create_layout(cr); #if GTK_CHECK_VERSION(3, 0, 0) PangoFontDescription *font = NULL; - gtk_style_context_get(ctx, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &font, NULL); + gtk_style_context_get(ctx, state, GTK_STYLE_PROPERTY_FONT, &font, NULL); if (font) { pango_layout_set_font_description(layout, font);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).