bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnubg] Removing deprecated gdk_draw functions


From: Jeremy Moore
Subject: [Bug-gnubg] Removing deprecated gdk_draw functions
Date: Thu, 2 Jun 2016 10:33:25 +0300

Hello,

Continuing the gentle meander towards gtk3 compatibility, I've run
through replacing all the deprecated gdk_draw functions with cairo
functions. That gives me a warning-free build of 'make
CFLAGS+="-DGDK_DISABLE_DEPRECATED"', and no GUI or performance changes
that I could make out.

I also tried adding compatibility shims for graphical builds without
cairo but gave up because, when using GDK >= 2.8, it seems near
impossible to create such a build.

Patch follows, I hope it's of use.

Regards,
Jeremy


Index: gtkboard.c
===================================================================
RCS file: /sources/gnubg/gnubg/gtkboard.c,v
retrieving revision 1.330
diff -u -r1.330 gtkboard.c
--- gtkboard.c 14 May 2016 22:28:32 -0000 1.330
+++ gtkboard.c 2 Jun 2016 06:49:07 -0000
@@ -286,10 +286,22 @@
                   abs(bd->resigned), nResignOrientation,
anArrowPosition, bd->playing, bd->turn == 1, x, y, cx, cy);
 }

+static void
+draw_rgb_image(cairo_t *cr, unsigned char *data, int x, int y, int
width, int height)
+{
+    GdkPixbuf *pixbuf;
+
+    pixbuf = gdk_pixbuf_new_from_data(data, GDK_COLORSPACE_RGB,
FALSE, 8, width, height, width * 3, NULL, NULL);
+    gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y);
+    cairo_paint(cr);
+    g_object_unref(pixbuf);
+}
+
 static gboolean
 board_expose(GtkWidget * drawing_area, GdkEventExpose * event, BoardData * bd)
 {
     int x, y, cx, cy;
+    cairo_t *cr;
     unsigned char *puch;

     g_assert(GTK_IS_DRAWING_AREA(drawing_area));
@@ -325,9 +337,9 @@

     RenderArea(bd, puch, x, y, cx, cy);

-    /* FIXME use dithalign */
-    gdk_draw_rgb_image(gtk_widget_get_window(drawing_area),
bd->gc_copy, x, y, cx, cy,
-                       GDK_RGB_DITHER_MAX, puch, cx * 3);
+    cr = gdk_cairo_create(gtk_widget_get_window(drawing_area));
+    draw_rgb_image(cr, puch, x, y, cx, cy);
+    cairo_destroy(cr);

     free(puch);

@@ -944,6 +956,7 @@
 #endif
 {

+    cairo_t *cr;
     unsigned char *puch, *puchNew, *puchChequer;
     int s = bd->rd->nSize;

@@ -971,7 +984,6 @@
                      bd->ri.achChequer[bd->drag_colour > 0], 6 * s * 4, 0,
                      0, bd->ri.asRefract[bd->drag_colour > 0], 6 * s,
6 * s, 6 * s);

-    /* FIXME use dithalign */
     {
         GdkRegion *pr;
         GdkRectangle r;
@@ -991,10 +1003,11 @@
         gdk_region_destroy(pr);
     }

-    gdk_draw_rgb_image(gtk_widget_get_window(bd->drawing_area), bd->gc_copy,
-                       bd->x_drag - 3 * s, bd->y_drag - 3 * s, 6 * s,
6 * s, GDK_RGB_DITHER_MAX, puch, 6 * s * 3);
-    gdk_draw_rgb_image(gtk_widget_get_window(bd->drawing_area), bd->gc_copy,
-                       x - 3 * s, y - 3 * s, 6 * s, 6 * s,
GDK_RGB_DITHER_MAX, puchChequer, 6 * s * 3);
+    cr = gdk_cairo_create(gtk_widget_get_window(bd->drawing_area));
+    draw_rgb_image(cr, puch, bd->x_drag - 3 * s, bd->y_drag - 3 * s,
6 * s, 6 * s);
+    draw_rgb_image(cr, puchChequer, x - 3 * s, y - 3 * s, 6 * s, 6 * s);
+    cairo_destroy(cr);
+
     gdk_window_end_paint(gtk_widget_get_window(bd->drawing_area));
     bd->x_drag = x;
     bd->y_drag = y;
@@ -1004,6 +1017,7 @@
 board_end_drag(GtkWidget * UNUSED(widget), BoardData * bd)
 {

+    cairo_t *cr;
     unsigned char *puch;
     int s = bd->rd->nSize;

@@ -1016,9 +1030,9 @@

     RenderArea(bd, puch, bd->x_drag - 3 * s, bd->y_drag - 3 * s, 6 * s, 6 * s);

-    /* FIXME use dithalign */
-    gdk_draw_rgb_image(gtk_widget_get_window(bd->drawing_area), bd->gc_copy,
-                       bd->x_drag - 3 * s, bd->y_drag - 3 * s, 6 * s,
6 * s, GDK_RGB_DITHER_MAX, puch, 6 * s * 3);
+    cr = gdk_cairo_create(gtk_widget_get_window(bd->drawing_area));
+    draw_rgb_image(cr, puch, bd->x_drag - 3 * s, bd->y_drag - 3 * s,
6 * s, 6 * s);
+    cairo_destroy(cr);
 }

 /* This code is called on a button release event
@@ -2133,6 +2147,7 @@
         if (bd->DragTargetHelp) {       /* Display 2d drag target help */
             gint i, ptx, pty, ptcx, ptcy;
             GdkColor *TargetHelpColor;
+            cairo_t *cr;

             TargetHelpColor = (GdkColor *) malloc(sizeof(GdkColor));
             /* values of RGB components within GdkColor are
@@ -2144,18 +2159,21 @@

TargetHelpColor->green * 256 + TargetHelpColor->blue);
             /* get the closest color available in the colormap if no 24-bit */
             gdk_colormap_alloc_color(gtk_widget_get_colormap(board),
TargetHelpColor, TRUE, TRUE);
-            gdk_gc_set_foreground(bd->gc_copy, TargetHelpColor);
+            cr = gdk_cairo_create(gtk_widget_get_window(board));
+            gdk_cairo_set_source_color(cr, TargetHelpColor);

             /* draw help rectangles around target points */
             for (i = 0; i <= 3; ++i) {
                 if (bd->iTargetHelpPoints[i] != -1) {
                     /* calculate region coordinates for point */
                     point_area(bd, bd->iTargetHelpPoints[i], &ptx,
&pty, &ptcx, &ptcy);
-                    gdk_draw_rectangle(gtk_widget_get_window(board),
bd->gc_copy, FALSE, ptx + 1, pty + 1, ptcx - 2,
-                                       ptcy - 2);
+                    cairo_rectangle(cr, ptx + 1, pty + 1, ptcx - 2, ptcy - 2);
+                    cairo_set_line_width(cr, 1);
+                    cairo_stroke(cr);
                 }
             }

+            cairo_destroy(cr);
             free(TargetHelpColor);
         }
     }
@@ -3020,6 +3038,8 @@
     bd->rd->nSize = nSizeReal;

     for (i = 0; i < 2; i++) {
+        cairo_t *cr;
+
         CopyArea(auch, 20 * 3, auchBoard + 3 * 3 * BOARD_WIDTH * 3 +
3 * 3 * 3, BOARD_WIDTH * 3 * 3, 10, 10);
         CopyArea(auch + 10 * 3, 20 * 3, auchBoard + 3 * 3 *
BOARD_WIDTH * 3 + 3 * 3 * 3, BOARD_WIDTH * 3 * 3, 10, 10);
         CopyArea(auch + 10 * 3 * 20, 20 * 3,
@@ -3033,8 +3053,9 @@
                      auchChequers[i], CHEQUER_WIDTH * 3 * 4,
                      asRefract[i], CHEQUER_WIDTH * 3, CHEQUER_WIDTH *
3, CHEQUER_HEIGHT * 3);

-        gdk_draw_rgb_image(bd->appmKey[i], bd->gc_copy, 0, 0, 20, 20,
GDK_RGB_DITHER_MAX, auch, 20 * 3);
-
+        cr = gdk_cairo_create(bd->appmKey[i]);
+        draw_rgb_image(cr, auch, 0, 0, 20, 20);
+        cairo_destroy(cr);
     }
 #if defined(USE_BOARD3D)
     if (display_is_3d(bd->rd)) {        /* Restore 2d colours */
@@ -3425,6 +3446,7 @@

     unsigned char *puch, *puchDest, *auch = g_alloca(cx * cy * 4);
     int ix, iy;
+    cairo_t *cr;
     GdkPixbuf *ppb;

     puchDest = auch;
@@ -3444,24 +3466,30 @@
         puch += nStride;
     }

+    cr = gdk_cairo_create(pd);
     ppb = gdk_pixbuf_new_from_data(auch, GDK_COLORSPACE_RGB, TRUE, 8,
cx, cy, cx * 4, NULL, NULL);
-    gdk_draw_pixbuf(pd, NULL, ppb, 0, 0, x, y, cx, cy,
GDK_RGB_DITHER_MAX, 0, 0);
+    gdk_cairo_set_source_pixbuf(cr, ppb, x, y);
+    cairo_paint(cr);
     g_object_unref(G_OBJECT(ppb));
+    cairo_destroy(cr);
 }

 extern void
 DrawDie(GdkDrawable * pd, unsigned char *achDice[2], unsigned
-        char *achPip[2], const int s, GdkGC * gc, int x, int y, int
+        char *achPip[2], const int s, int x, int y, int
         fColour, int n, int alpha)
 {

     int ix, iy, afPip[9];
+    cairo_t *cr;
+    GdkPixbuf *pixbuf;
+
+    cr = gdk_cairo_create(pd);

     if (alpha)
         DrawAlphaImage(pd, x, y, achDice[fColour], DIE_WIDTH * s * 4,
DIE_WIDTH * s, DIE_HEIGHT * s);
     else
-        gdk_draw_rgb_image(pd, gc, x, y, DIE_WIDTH * s, DIE_HEIGHT *
s, GDK_RGB_DITHER_MAX, achDice[fColour],
-                           DIE_WIDTH * s * 3);
+        draw_rgb_image(cr, achDice[fColour], x, y, DIE_WIDTH * s,
DIE_HEIGHT * s);

     afPip[0] = afPip[8] = (n == 2) || (n == 3) || (n == 4) || (n ==
5) || (n == 6);
     afPip[1] = afPip[7] = 0;
@@ -3469,12 +3497,18 @@
     afPip[3] = afPip[5] = n == 6;
     afPip[4] = n & 1;

+    pixbuf = gdk_pixbuf_new_from_data(achPip[fColour],
GDK_COLORSPACE_RGB, FALSE, 8, s, s, s * 3, NULL, NULL);
+
     for (iy = 0; iy < 3; iy++)
         for (ix = 0; ix < 3; ix++)
-            if (afPip[iy * 3 + ix])
-                gdk_draw_rgb_image(pd, gc, (int) (s * 1.5 + x + 1.5 * s * ix),
-                                   (int) (s * 1.5 + y + 1.5 * s * iy), s, s,
-                                   GDK_RGB_DITHER_MAX, achPip[fColour], s * 3);
+            if (afPip[iy * 3 + ix]) {
+                gdk_cairo_set_source_pixbuf(cr, pixbuf, (int) (s *
1.5 + x + 1.5 * s * ix),
+                                            (int) (s * 1.5 + y + 1.5
* s * iy));
+                cairo_paint(cr);
+            }
+
+    g_object_unref(pixbuf);
+    cairo_destroy(cr);
 }

 static gboolean
@@ -3485,9 +3519,9 @@
         return TRUE;

     DrawDie(gtk_widget_get_window(dice), bd->ri.achDice, bd->ri.achPip,
-            bd->rd->nSize, bd->gc_copy, 0, 0, bd->turn > 0,
bd->diceRoll[0], TRUE);
+            bd->rd->nSize, 0, 0, bd->turn > 0, bd->diceRoll[0], TRUE);
     DrawDie(gtk_widget_get_window(dice), bd->ri.achDice, bd->ri.achPip,
-            bd->rd->nSize, bd->gc_copy, (DIE_WIDTH + 1) *
bd->rd->nSize, 0, bd->turn > 0, bd->diceRoll[1], TRUE);
+            bd->rd->nSize, (DIE_WIDTH + 1) * bd->rd->nSize, 0,
bd->turn > 0, bd->diceRoll[1], TRUE);

     return TRUE;
 }
@@ -3542,13 +3576,9 @@
 {

     BoardData *bd = g_malloc(sizeof(*bd));
-    GdkColormap *cmap = gtk_widget_get_colormap(GTK_WIDGET(board));
-    GdkVisual *vis = gtk_widget_get_visual(GTK_WIDGET(board));
-    GdkGCValues gcval;
     GtkWidget *pw;
     GtkWidget *pwFrame;
     GtkWidget *pwvbox;
-    GdkColor color;

     board->board_data = bd;
     bd->widget = GTK_WIDGET(board);
@@ -3560,23 +3590,6 @@
     bd->playing = FALSE;
     bd->cube_use = TRUE;
     bd->all_moves = NULL;
-
-    gcval.function = GDK_AND;
-    gcval.foreground.pixel = (guint32) ~ 0L;    /* AllPlanes */
-    gcval.background.pixel = 0;
-    bd->gc_and = gtk_gc_get(gdk_visual_get_depth(vis), cmap, &gcval,
-                            GDK_GC_FOREGROUND | GDK_GC_BACKGROUND |
GDK_GC_FUNCTION);
-
-    gcval.function = GDK_OR;
-    bd->gc_or = gtk_gc_get(gdk_visual_get_depth(vis), cmap, &gcval,
GDK_GC_FUNCTION);
-
-    bd->gc_copy = gtk_gc_get(gdk_visual_get_depth(vis), cmap, &gcval, 0);
-
-    gdk_color_parse("#000080", &color);
-    gdk_colormap_alloc_color(cmap, &color, TRUE, TRUE);
-    gcval.foreground.pixel = color.pixel;
-    bd->gc_cube = gtk_gc_get(gdk_visual_get_depth(vis), cmap, &gcval,
GDK_GC_FOREGROUND);
-
     bd->x_dice[0] = bd->x_dice[1] = -10;
     bd->diceRoll[0] = bd->diceRoll[1] = 0;

@@ -3839,6 +3852,7 @@
     int setSize = bd->rd->nSize;
     int cubeStride = setSize * CUBE_WIDTH * 4;
     int cubeFaceStride = setSize * CUBE_LABEL_WIDTH * 3;
+    cairo_t *cr;

     n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cube), "user_data"));
     if ((nValue = n % N_CUBES_IN_WIDGET - 1) == -1)
@@ -3855,10 +3869,9 @@
                        CUBE_LABEL_WIDTH * setSize, CUBE_LABEL_HEIGHT
* setSize, 2 - n / N_CUBES_IN_WIDGET);
     DrawAlphaImage(gtk_widget_get_window(cube), 0, 0,
                    TTachCube, cubeStride, CUBE_WIDTH * setSize,
CUBE_HEIGHT * setSize);
-    gdk_draw_rgb_image(gtk_widget_get_window(cube), bd->gc_copy,
-                       setSize, setSize,
-                       CUBE_LABEL_WIDTH * setSize,
-                       CUBE_LABEL_HEIGHT * setSize,
GDK_RGB_DITHER_MAX, puch, cubeFaceStride);
+    cr = gdk_cairo_create(gtk_widget_get_window(cube));
+    draw_rgb_image(cr, puch, setSize, setSize, CUBE_LABEL_WIDTH *
setSize, CUBE_LABEL_HEIGHT * setSize);
+    cairo_destroy(cr);

     return TRUE;
 }
@@ -3944,9 +3957,9 @@
     int n = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dice), "user_data"));

     if (sdd->mdt == MT_FIRSTMOVE && (n % 6 == n / 6)) {
-        DrawDie(gtk_widget_get_window(dice), &sdd->TTachGrayDice,
&sdd->TTachGrayPip, setSize, sdd->bd->gc_copy,
+        DrawDie(gtk_widget_get_window(dice), &sdd->TTachGrayDice,
&sdd->TTachGrayPip, setSize,
                 0, 0, 0, n % 6 + 1, FALSE);
-        DrawDie(gtk_widget_get_window(dice), &sdd->TTachGrayDice,
&sdd->TTachGrayPip, setSize, sdd->bd->gc_copy,
+        DrawDie(gtk_widget_get_window(dice), &sdd->TTachGrayDice,
&sdd->TTachGrayPip, setSize,
                 DIE_WIDTH * setSize, 0, 0, n / 6 + 1, FALSE);
     } else {
         int col1, col2;
@@ -3958,9 +3971,9 @@
         } else
             col1 = col2 = ((n % 6) <= n / 6);

-        DrawDie(gtk_widget_get_window(dice), sdd->TTachDice,
sdd->TTachPip, setSize, sdd->bd->gc_copy,
+        DrawDie(gtk_widget_get_window(dice), sdd->TTachDice,
sdd->TTachPip, setSize,
                 0, 0, col1, n % 6 + 1, FALSE);
-        DrawDie(gtk_widget_get_window(dice), sdd->TTachDice,
sdd->TTachPip, setSize, sdd->bd->gc_copy,
+        DrawDie(gtk_widget_get_window(dice), sdd->TTachDice,
sdd->TTachPip, setSize,
                 DIE_WIDTH * setSize, 0, col2, n / 6 + 1, FALSE);
     }
     return TRUE;
Index: gtkboard.h
===================================================================
RCS file: /sources/gnubg/gnubg/gtkboard.h,v
retrieving revision 1.103
diff -u -r1.103 gtkboard.h
--- gtkboard.h 4 Dec 2015 23:07:52 -0000 1.103
+++ gtkboard.h 2 Jun 2016 06:49:07 -0000
@@ -72,7 +72,6 @@
     GtkWidget *pipcountlabel0, *pipcountlabel1;
     GtkWidget *pwvboxcnt;

-    GdkGC *gc_and, *gc_or, *gc_copy, *gc_cube;
     GdkPixmap *appmKey[2];

     gboolean playing, computer_turn;
@@ -175,7 +174,7 @@
 extern void
 DrawDie(GdkDrawable * pd,
         unsigned char *achDice[2], unsigned char *achPip[2],
-        const int s, GdkGC * gc, int x, int y, int fColour, int n, int alpha);
+        const int s, int x, int y, int fColour, int n, int alpha);

 extern int UpdateMove(BoardData * bd, TanBoard anBoard);
 extern void stop_board_expose(BoardData * bd);
Index: gtkmovelistctrl.c
===================================================================
RCS file: /sources/gnubg/gnubg/gtkmovelistctrl.c,v
retrieving revision 1.25
diff -u -r1.25 gtkmovelistctrl.c
--- gtkmovelistctrl.c 20 Jul 2014 21:03:22 -0000 1.25
+++ gtkmovelistctrl.c 2 Jun 2016 06:49:07 -0000
@@ -351,12 +351,12 @@
 {
     CustomCellRendererMovelist *cellprogress =
CUSTOM_CELL_RENDERER_MOVELIST(cell);
     PangoLayout *layout = gtk_widget_create_pango_layout(widget, NULL);
-    GdkGC *gc;
+    cairo_t *cr;
     hintdata *phd = g_object_get_data(G_OBJECT(widget), "hintdata");
     int i, x, y, selected;
     char buf[100];
     float *ar;
-    GdkColor *pFontCol, *fg;
+    GdkColor *pFontCol;
     PangoRectangle logical_rect;
     char *cmark_sz;
     char *highlight_sz;
@@ -365,9 +365,11 @@
     /*lint --e(641) */
     selected = (flags & GTK_CELL_RENDERER_SELECTED) &&
gtk_widget_has_focus(widget);

-    gc = gdk_gc_new(window);
-    if (expose_area)
-        gdk_gc_set_clip_rectangle(gc, expose_area);
+    cr = gdk_cairo_create(window);
+    if (expose_area) {
+        cairo_rectangle(cr, expose_area->x, expose_area->y,
expose_area->width, expose_area->height);
+        cairo_clip(cr);
+    }

     if (phd->piHighlight && cellprogress->rank - 1 == *phd->piHighlight)
         pFontCol = &psHighlight->fg[GTK_STATE_SELECTED];
@@ -375,15 +377,18 @@
         pFontCol = NULL;

     if (!(flags & GTK_CELL_RENDERER_SELECTED)) {
-        gdk_gc_set_rgb_fg_color(gc,
&gtk_widget_get_style(widget)->base[GTK_STATE_NORMAL]);
-        gdk_draw_rectangle(window, gc, TRUE, background_area->x,
background_area->y,
-                           background_area->width, background_area->height);
-        gdk_gc_set_rgb_fg_color(gc,
&gtk_widget_get_style(widget)->fg[GTK_STATE_NORMAL]);
+        gdk_cairo_set_source_color(cr,
&gtk_widget_get_style(widget)->base[GTK_STATE_NORMAL]);
+        cairo_rectangle(cr, background_area->x, background_area->y,
background_area->width, background_area->height);
+        cairo_fill(cr);
+        gdk_cairo_set_source_color(cr,
&gtk_widget_get_style(widget)->fg[GTK_STATE_NORMAL]);
     } else {                    /* Draw text in reverse colours for
highlight cell */
         if (!pFontCol && selected)
             pFontCol = &gtk_widget_get_style(widget)->base[GTK_STATE_NORMAL];
     }

+    if (pFontCol)
+        gdk_cairo_set_source_color(cr, pFontCol);
+
     /* First line of control */
     cmark_sz = cellprogress->pml->cmark ? "+" : "";
     highlight_sz = (phd->piHighlight && cellprogress->rank - 1 ==
*phd->piHighlight) ? "*" : "";
@@ -398,16 +403,19 @@
     x = _s_A + _s_a - logical_rect.width;
     y = _s_B;

-    gdk_draw_layout_with_colors(window, gc, cell_area->x + x,
cell_area->y + y, layout, pFontCol, 0);
+    cairo_move_to(cr, cell_area->x + x, cell_area->y + y);
+    pango_cairo_show_layout(cr, layout);

     x = _s_A + _s_a + _s_Y * 3;
     (void) FormatEval(buf, &cellprogress->pml->esMove);
     pango_layout_set_text(layout, buf, -1);
-    gdk_draw_layout_with_colors(window, gc, cell_area->x + x,
cell_area->y + y, layout, pFontCol, 0);
+    cairo_move_to(cr, cell_area->x + x, cell_area->y + y);
+    pango_cairo_show_layout(cr, layout);

     x += _s_b + _s_Y;
     pango_layout_set_text(layout,
OutputEquity(cellprogress->pml->rScore, &ci, TRUE), -1);
-    gdk_draw_layout_with_colors(window, gc, cell_area->x + x,
cell_area->y + y, layout, pFontCol, 0);
+    cairo_move_to(cr, cell_area->x + x, cell_area->y + y);
+    pango_cairo_show_layout(cr, layout);

     if (fOutputMWC)
         x += _s_cP + _s_Y * 2;
@@ -415,7 +423,8 @@
         x += _s_c + _s_Y * 2;
     if (cellprogress->rank != 1) {
         pango_layout_set_text(layout,
OutputEquityDiff(cellprogress->pml->rScore, rBest, &ci), -1);
-        gdk_draw_layout_with_colors(window, gc, cell_area->x + x,
cell_area->y + y, layout, pFontCol, 0);
+        cairo_move_to(cr, cell_area->x + x, cell_area->y + y);
+        pango_cairo_show_layout(cr, layout);
     }

     if (fOutputMWC)
@@ -429,7 +438,8 @@
         pango_layout_set_font_description(layout, pfd);

         pango_layout_set_text(layout, FormatMove(buf, msBoard(),
cellprogress->pml->anMove), -1);
-        gdk_draw_layout_with_colors(window, gc, cell_area->x + x,
cell_area->y + y, layout, pFontCol, 0);
+        cairo_move_to(cr, cell_area->x + x, cell_area->y + y);
+        pango_cairo_show_layout(cr, layout);

         pango_font_description_set_weight(pfd, PANGO_WEIGHT_NORMAL);
         pango_layout_set_font_description(layout, pfd);
@@ -443,9 +453,9 @@
     ar = cellprogress->pml->arEvalMove;

     if (selected)
-        fg = &gtk_widget_get_style(widget)->base[GTK_STATE_NORMAL];
+        gdk_cairo_set_source_color(cr,
&gtk_widget_get_style(widget)->base[GTK_STATE_NORMAL]);
     else
-        fg = &wlCol;
+        gdk_cairo_set_source_color(cr, &wlCol);

     for (i = 0; i < 6; i++) {
         char *str;
@@ -460,7 +470,8 @@
             str++;

         pango_layout_set_text(layout, str, -1);
-        gdk_draw_layout_with_colors(window, gc, cell_area->x + x,
cell_area->y + y, layout, fg, 0);
+        cairo_move_to(cr, cell_area->x + x, cell_area->y + y);
+        pango_cairo_show_layout(cr, layout);

         if (fOutputWinPC)
             x += _s_ZP;
@@ -472,7 +483,8 @@
             if (fOutputWinPC)
                 minOff -= _s_Y;
             pango_layout_set_text(layout, "-", -1);
-            gdk_draw_layout_with_colors(window, gc, cell_area->x + x
+ minOff, cell_area->y + y, layout, fg, 0);
+            cairo_move_to(cr, cell_area->x + x + minOff, cell_area->y + y);
+            pango_cairo_show_layout(cr, layout);

             x += _s_s;
         } else
@@ -480,8 +492,5 @@
     }

     g_object_unref(layout);
-
-    if (expose_area)
-        gdk_gc_set_clip_rectangle(gc, NULL);
-    g_object_unref(gc);
+    cairo_destroy(cr);
 }
Index: gtkpanels.c
===================================================================
RCS file: /sources/gnubg/gnubg/gtkpanels.c,v
retrieving revision 1.79
diff -u -r1.79 gtkpanels.c
--- gtkpanels.c 8 Feb 2015 13:05:17 -0000 1.79
+++ gtkpanels.c 2 Jun 2016 06:49:07 -0000
@@ -1286,7 +1286,7 @@
 extern void
 ToggleDockPanels(gpointer UNUSED(p), guint UNUSED(n), GtkWidget * pw)
 {
-    int newValue = GTK_CHECK_MENU_ITEM(pw)->active;
+    int newValue = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(pw));
     if (fDockPanels != newValue) {
         fDockPanels = newValue;
         DockPanels();
Index: gtktempmap.c
===================================================================
RCS file: /sources/gnubg/gnubg/gtktempmap.c,v
retrieving revision 1.53
diff -u -r1.53 gtktempmap.c
--- gtktempmap.c 6 Feb 2015 23:25:00 -0000 1.53
+++ gtktempmap.c 2 Jun 2016 06:49:08 -0000
@@ -397,7 +397,6 @@
 ExposeDie(GtkWidget * pw, GdkEventExpose * pev, tempmapwidget * ptmw)
 {
     int *pi = (int *) g_object_get_data(G_OBJECT(pw), "user_data");
-    GdkGC *gc = ((BoardData *) (BOARD(pwBoard))->board_data)->gc_copy;
     int x, y;
     int nSizeDie;
     GtkAllocation allocation;
@@ -436,7 +435,7 @@

     gdk_window_clear_area(gtk_widget_get_window(pw), pev->area.x,
pev->area.y, pev->area.width, pev->area.height);
     DrawDie(gtk_widget_get_window(pw), ptmw->achDice, ptmw->achPips,
ptmw->nSizeDie,
-            gc, x, y, ptmw->atm[0].pms->fMove, *pi + 1, FALSE);
+            x, y, ptmw->atm[0].pms->fMove, *pi + 1, FALSE);
 }

 static void



reply via email to

[Prev in Thread] Current Thread [Next in Thread]