[hitori/hitori-0-4] Make board rendering colours independent of the widget state
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hitori/hitori-0-4] Make board rendering colours independent of the widget state
- Date: Tue, 8 Jul 2014 22:18:29 +0000 (UTC)
commit f3ac3301b39b2b698d67353271492cc3dff131a8
Author: Philip Withnall <philip tecnocode co uk>
Date: Sun Jul 6 13:41:09 2014 +0100
Make board rendering colours independent of the widget state
The Hitori game board widget doesn’t make use of the GTK+ widget state
(e.g. insensitive, focused) correctly, so the rendering colours should
not be based on it.
Hard-code the colours so that Hitori rendering is independent of the
GTK+ state, until we make the game play area a proper GtkWidget and set
its state flags properly.
https://bugzilla.gnome.org/show_bug.cgi?id=731307
src/interface.c | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/interface.c b/src/interface.c
index 2ec969b..8f5a5af 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -154,7 +154,6 @@ draw_cell (Hitori *hitori, GtkStyleContext *style_context, cairo_t *cr, gfloat c
GtkStateFlags state = 0;
gboolean painted = FALSE;
PangoFontDescription *font_desc;
- GdkRGBA colour;
GtkBorder border;
if (hitori->board[iter.x][iter.y].status & CELL_PAINTED) {
@@ -171,8 +170,12 @@ draw_cell (Hitori *hitori, GtkStyleContext *style_context, cairo_t *cr, gfloat c
g_debug ("State: %u", state);
}
- gtk_style_context_get_background_color (style_context, state, &colour);
- gdk_cairo_set_source_rgba (cr, &colour);
+ /* Adwaita’s background colour. */
+ if (painted) {
+ cairo_set_source_rgb (cr, 0.956862745, 0.956862745, 0.956862745);
+ } else {
+ cairo_set_source_rgb (cr, 0.929411765, 0.929411765 ,0.929411765);
+ }
cairo_rectangle (cr, x_pos, y_pos, cell_size, cell_size);
cairo_fill (cr);
@@ -200,8 +203,11 @@ draw_cell (Hitori *hitori, GtkStyleContext *style_context, cairo_t *cr, gfloat c
}
/* Draw the border */
- gtk_style_context_get_border_color (style_context, state, &colour);
- gdk_cairo_set_source_rgba (cr, &colour);
+ if (painted) {
+ cairo_set_source_rgb (cr, 0.729411765, 0.737254902, 0.721568627);
+ } else {
+ cairo_set_source_rgb (cr, 0.180392157, 0.203921569, 0.211764706);
+ }
cairo_set_line_width (cr, border.left);
cairo_rectangle (cr, x_pos, y_pos, cell_size, cell_size);
cairo_stroke (cr);
@@ -218,8 +224,11 @@ draw_cell (Hitori *hitori, GtkStyleContext *style_context, cairo_t *cr, gfloat c
cairo_set_source_rgb (cr, 0.937254902, 0.160784314, 0.160784314); /* Tango's lightest
"scarlet red" */
pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
} else {
- gtk_style_context_get_color (style_context, state, &colour);
- gdk_cairo_set_source_rgba (cr, &colour);
+ if (painted) {
+ cairo_set_source_rgb (cr, 0.654901961, 0.670588235, 0.654901961);
+ } else {
+ cairo_set_source_rgb (cr, 0.180392157, 0.203921569, 0.211764706);
+ }
pango_font_description_set_weight (font_desc, PANGO_WEIGHT_NORMAL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]