From 8d848b832c477212e165ddfec050a00346fda1f1 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Mon, 4 Dec 2023 22:56:20 +0200
Subject: [PATCH 23/23] sdl3: Replace SDL_FillRect() call with
 SDL_FillSurfaceRect()

The function has been renamed in sdl3.

See RM #26

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/gui-sdl3/action_dialog.c |  4 ++--
 client/gui-sdl3/canvas.c        | 32 +++++++++++++++++---------------
 client/gui-sdl3/dialogs.c       | 16 +++++++++-------
 client/gui-sdl3/graphics.c      | 22 +++++++++++++---------
 client/gui-sdl3/gui_string.c    | 10 +++++-----
 client/gui-sdl3/gui_tilespec.c  |  6 +++---
 client/gui-sdl3/helpdlg.c       |  6 ++++--
 client/gui-sdl3/mapctrl.c       | 12 ++++++------
 client/gui-sdl3/mapview.c       |  4 ++--
 client/gui-sdl3/optiondlg.c     |  4 ++--
 client/gui-sdl3/repodlgs.c      | 18 +++++++++---------
 client/gui-sdl3/sprite.c        | 12 ++++++------
 client/gui-sdl3/widget_label.c  | 16 +++++++++-------
 client/gui-sdl3/widget_window.c |  3 ++-
 client/gui-sdl3/wldlg.c         | 32 ++++++++++++++++----------------
 15 files changed, 105 insertions(+), 92 deletions(-)

diff --git a/client/gui-sdl3/action_dialog.c b/client/gui-sdl3/action_dialog.c
index 8c257cf86b..23bab9ff28 100644
--- a/client/gui-sdl3/action_dialog.c
+++ b/client/gui-sdl3/action_dialog.c
@@ -1506,8 +1506,8 @@ void popup_sabotage_dialog(struct unit *actor, struct city *pcity,
       area2.y = buf->size.h / 2 - 1;
       area2.w = buf->size.w - adj_size(20);
 
-      SDL_FillRect(buf->theme , &area2, map_rgba(buf->theme->format,
-                                                 *get_theme_color(COLOR_THEME_SABOTAGEDLG_SEPARATOR)));
+      SDL_FillSurfaceRect(buf->theme , &area2, map_rgba(buf->theme->format,
+                                                        *get_theme_color(COLOR_THEME_SABOTAGEDLG_SEPARATOR)));
     }
 
     if (buf == last) {
diff --git a/client/gui-sdl3/canvas.c b/client/gui-sdl3/canvas.c
index 2fae29f8b9..cd4839fcb6 100644
--- a/client/gui-sdl3/canvas.c
+++ b/client/gui-sdl3/canvas.c
@@ -131,7 +131,7 @@ void canvas_put_sprite_full_scaled(struct canvas *pcanvas,
 }
 
 /**********************************************************************//**
-  Draw a full sprite onto the canvas.  If "fog" is specified draw it with
+  Draw a full sprite onto the canvas. If "fog" is specified draw it with
   fog.
 **************************************************************************/
 void canvas_put_sprite_fogged(struct canvas *pcanvas,
@@ -156,11 +156,12 @@ void canvas_put_rectangle(struct canvas *pcanvas, struct color *pcolor,
 {
   SDL_Rect dst = {canvas_x, canvas_y, width, height};
 
-  SDL_FillRect(pcanvas->surf, &dst, SDL_MapRGBA(pcanvas->surf->format,
-                                                pcolor->color->r,
-                                                pcolor->color->g,
-                                                pcolor->color->b,
-                                                pcolor->color->a));
+  SDL_FillSurfaceRect(pcanvas->surf, &dst,
+                      SDL_MapRGBA(pcanvas->surf->format,
+                                  pcolor->color->r,
+                                  pcolor->color->g,
+                                  pcolor->color->b,
+                                  pcolor->color->a));
 }
 
 /**********************************************************************//**
@@ -174,11 +175,12 @@ void canvas_fill_sprite_area(struct canvas *pcanvas,
                   GET_SURF(psprite)->w,
                   GET_SURF(psprite)->h};
 
-  SDL_FillRect(pcanvas->surf, &dst, SDL_MapRGBA(pcanvas->surf->format,
-                                                pcolor->color->r,
-                                                pcolor->color->g,
-                                                pcolor->color->b,
-                                                pcolor->color->a));
+  SDL_FillSurfaceRect(pcanvas->surf, &dst,
+                      SDL_MapRGBA(pcanvas->surf->format,
+                                  pcolor->color->r,
+                                  pcolor->color->g,
+                                  pcolor->color->b,
+                                  pcolor->color->a));
 }
 
 /**********************************************************************//**
@@ -203,8 +205,8 @@ void canvas_put_curved_line(struct canvas *pcanvas, struct color *pcolor,
 }
 
 /**********************************************************************//**
-  Return the size of the given text in the given font.  This size should
-  include the ascent and descent of the text.  Either of width or height
+  Return the size of the given text in the given font. This size should
+  include the ascent and descent of the text. Either of width or height
   may be NULL in which case those values simply shouldn't be filled out.
 **************************************************************************/
 void get_text_size(int *width, int *height,
@@ -230,9 +232,9 @@ void get_text_size(int *width, int *height,
 }
 
 /**********************************************************************//**
-  Draw the text onto the canvas in the given color and font.  The canvas
+  Draw the text onto the canvas in the given color and font. The canvas
   position does not account for the ascent of the text; this function must
-  take care of this manually.  The text will not be NULL but may be empty.
+  take care of this manually. The text will not be NULL but may be empty.
 **************************************************************************/
 void canvas_put_text(struct canvas *pcanvas, int canvas_x, int canvas_y,
                      enum client_font font, struct color *pcolor,
diff --git a/client/gui-sdl3/dialogs.c b/client/gui-sdl3/dialogs.c
index d0ff0dc6dc..79adae09ce 100644
--- a/client/gui-sdl3/dialogs.c
+++ b/client/gui-sdl3/dialogs.c
@@ -1861,7 +1861,7 @@ void popup_advanced_terrain_dialog(struct tile *ptile,
     area.h += buf->size.h;
     /* ----------- */
 
-#if 0 /* FIXME: specific connect buttons */
+#if 0 /* FIXME: Specific connect buttons */
     if (unit_has_type_flag(focus_unit, UTYF_WORKERS)) {
       create_active_iconlabel(buf, pwindow->dst->surface, pstr, _("Connect here"),
                               connect_here_callback);
@@ -2032,7 +2032,7 @@ void popup_advanced_terrain_dialog(struct tile *ptile,
         widget_add_as_prev(buf, last->prev);
         area.h += buf->size.h;
 
-        /* separator */
+        /* Separator */
         buf = create_iconlabel(NULL, pwindow->dst, NULL, WF_FREE_THEME);
         buf->id = ID_SEPARATOR;
         widget_add_as_prev(buf, last->prev->prev);
@@ -2040,7 +2040,7 @@ void popup_advanced_terrain_dialog(struct tile *ptile,
       }
 #undef ADV_NUM_SEEN
     } else { /* n == 1 */
-      /* one unit - give orders */
+      /* One unit - give orders */
       punit = unit_list_get(ptile->units, 0);
       punittype = unit_type_get(punit);
       if (punit != focus_unit) {
@@ -2167,7 +2167,7 @@ void popup_advanced_terrain_dialog(struct tile *ptile,
   area2.h = adj_size(2);
 
   buf = buf->prev;
-  while (buf) {
+  while (buf != NULL) {
     if (buf == advanced_terrain_dlg->end_active_widget_list) {
       w -= units_h;
     }
@@ -2184,8 +2184,9 @@ void popup_advanced_terrain_dialog(struct tile *ptile,
       area2.y = buf->size.h / 2 - 1;
       area2.w = buf->size.w - adj_size(20);
 
-      SDL_FillRect(buf->theme, &area2, map_rgba(buf->theme->format,
-                                      *get_theme_color(COLOR_THEME_ADVANCEDTERRAINDLG_TEXT)));
+      SDL_FillSurfaceRect(buf->theme, &area2,
+                          map_rgba(buf->theme->format,
+                                   *get_theme_color(COLOR_THEME_ADVANCEDTERRAINDLG_TEXT)));
     }
 
     if (buf == advanced_terrain_dlg->begin_widget_list
@@ -3155,7 +3156,8 @@ void popup_races_dialog(struct player *pplayer)
   /* Create Imprv Background Icon */
   main_bg = create_surf(adj_size(96*2), adj_size(64), SDL_SWSURFACE);
 
-  SDL_FillRect(main_bg, NULL, map_rgba(main_bg->format, bg_color));
+  SDL_FillSurfaceRect(main_bg, NULL,
+                      map_rgba(main_bg->format, bg_color));
 
   create_frame(main_bg,
                0, 0, main_bg->w - 1, main_bg->h - 1,
diff --git a/client/gui-sdl3/graphics.c b/client/gui-sdl3/graphics.c
index c7bb98e2d0..9bc698e22c 100644
--- a/client/gui-sdl3/graphics.c
+++ b/client/gui-sdl3/graphics.c
@@ -371,9 +371,10 @@ SDL_Surface *create_filled_surface(Uint16 w, Uint16 h, Uint32 flags,
     pcolor = &color;
   }
 
-  SDL_FillRect(new_surf, NULL,
-               SDL_MapRGBA(new_surf->format, pcolor->r, pcolor->g, pcolor->b,
-                           pcolor->a));
+  SDL_FillSurfaceRect(new_surf, NULL,
+                      SDL_MapRGBA(new_surf->format,
+                                  pcolor->r, pcolor->g, pcolor->b,
+                                  pcolor->a));
 
   if (pcolor->a != 255) {
     SDL_SetSurfaceAlphaMod(new_surf, pcolor->a);
@@ -388,13 +389,15 @@ SDL_Surface *create_filled_surface(Uint16 w, Uint16 h, Uint32 flags,
 **************************************************************************/
 int clear_surface(SDL_Surface *surf, SDL_Rect *dstrect)
 {
-  /* SDL_FillRect might change the rectangle, so we create a copy */
+  /* SDL_FillSurfaceRect() might change the rectangle, so we create a copy */
   if (dstrect) {
     SDL_Rect _dstrect = *dstrect;
 
-    return SDL_FillRect(surf, &_dstrect, SDL_MapRGBA(surf->format, 0, 0, 0, 0));
+    return SDL_FillSurfaceRect(surf, &_dstrect,
+                               SDL_MapRGBA(surf->format, 0, 0, 0, 0));
   } else {
-    return SDL_FillRect(surf, NULL, SDL_MapRGBA(surf->format, 0, 0, 0, 0));
+    return SDL_FillSurfaceRect(surf, NULL,
+                               SDL_MapRGBA(surf->format, 0, 0, 0, 0));
   }
 }
 
@@ -445,7 +448,7 @@ Uint32 getpixel(SDL_Surface *surf, Sint16 x, Sint16 y)
     return *((Uint32 *)surf->pixels + y * surf->pitch / sizeof(Uint32) + x);
 
   default:
-    return 0; /* shouldn't happen, but avoids warnings */
+    return 0; /* Shouldn't happen, but avoids warnings */
   }
 }
 
@@ -843,8 +846,9 @@ int fill_rect_alpha(SDL_Surface *surf, SDL_Rect *prect,
   }
 
   if (pcolor->a == 255) {
-    return SDL_FillRect(surf, prect,
-                        SDL_MapRGB(surf->format, pcolor->r, pcolor->g, pcolor->b));
+    return SDL_FillSurfaceRect(surf, prect,
+                               SDL_MapRGB(surf->format,
+                                          pcolor->r, pcolor->g, pcolor->b));
   }
 
   if (!pcolor->a) {
diff --git a/client/gui-sdl3/gui_string.c b/client/gui-sdl3/gui_string.c
index e0bc2f7f3f..6b6bb367ef 100644
--- a/client/gui-sdl3/gui_string.c
+++ b/client/gui-sdl3/gui_string.c
@@ -45,8 +45,8 @@
 static struct ttf_font_chain {
   struct ttf_font_chain *next;
   TTF_Font *font;
-  Uint16 ptsize;                /* size of font */
-  Uint16 count;                 /* number of strings alliased with this font */
+  Uint16 ptsize;                /* Size of font */
+  Uint16 count;                 /* Number of strings alliased with this font */
 } *font_tab = NULL;
 
 static char *font_with_full_path = NULL;
@@ -372,17 +372,17 @@ static SDL_Surface *create_utf8_multi_surf(utf8_str *pstr)
   switch (pstr->render) {
   case 1:
     text = create_surf(w, count * tmp[0]->h, SDL_SWSURFACE);
-    SDL_FillRect(text, NULL, color);
+    SDL_FillSurfaceRect(text, NULL, color);
     SDL_SetColorKey(text, SDL_TRUE, color);
     break;
   case 2:
     text = create_surf_with_format(tmp[0]->format,
                                    w, count * tmp[0]->h);
-    SDL_FillRect(text, NULL, color);
+    SDL_FillSurfaceRect(text, NULL, color);
     break;
   default:
     text = create_surf(w, count * tmp[0]->h, SDL_SWSURFACE);
-    SDL_FillRect(text, NULL, color);
+    SDL_FillSurfaceRect(text, NULL, color);
     break;
   }
 
diff --git a/client/gui-sdl3/gui_tilespec.c b/client/gui-sdl3/gui_tilespec.c
index 275f0c54c9..bc2abfc9c4 100644
--- a/client/gui-sdl3/gui_tilespec.c
+++ b/client/gui-sdl3/gui_tilespec.c
@@ -195,8 +195,8 @@ void tilespec_setup_city_icons(void)
   load_city_icon_surface(spr, police, "city.police");
   /* ================================================================= */
   icons->worklist = create_surf(9,9, SDL_SWSURFACE);
-  SDL_FillRect(icons->worklist, NULL,
-               SDL_MapRGB(icons->worklist->format, 255, 255,255));
+  SDL_FillSurfaceRect(icons->worklist, NULL,
+                      SDL_MapRGB(icons->worklist->format, 255, 255,255));
 
   create_frame(icons->worklist,
                0, 0, icons->worklist->w - 1, icons->worklist->h - 1,
@@ -382,7 +382,7 @@ void setup_auxiliary_tech_icons(void)
 
   /* Create icons */
   surf = create_surf(adj_size(50), adj_size(50), SDL_SWSURFACE);
-  SDL_FillRect(surf, NULL, map_rgba(surf->format, bg_color));
+  SDL_FillSurfaceRect(surf, NULL, map_rgba(surf->format, bg_color));
   create_frame(surf,
                0 , 0, surf->w - 1, surf->h - 1,
                get_theme_color(COLOR_THEME_SCIENCEDLG_FRAME));
diff --git a/client/gui-sdl3/helpdlg.c b/client/gui-sdl3/helpdlg.c
index 3f79a9d6bc..969742843a 100644
--- a/client/gui-sdl3/helpdlg.c
+++ b/client/gui-sdl3/helpdlg.c
@@ -276,7 +276,8 @@ void popup_impr_info(Impr_type_id impr)
 
     /* Background template for entries in scroll list */
     background_tmpl = create_surf(adj_size(135), adj_size(40), SDL_SWSURFACE);
-    SDL_FillRect(background_tmpl, NULL, map_rgba(background_tmpl->format, bg_color));
+    SDL_FillSurfaceRect(background_tmpl, NULL,
+                        map_rgba(background_tmpl->format, bg_color));
 
     create_frame(background_tmpl,
                  0, 0, background_tmpl->w - 1, background_tmpl->h - 1,
@@ -707,7 +708,8 @@ void popup_unit_info(Unit_type_id type_id)
 
     /* Background template for entries in scroll list */
     background_tmpl = create_surf(adj_size(135), adj_size(40), SDL_SWSURFACE);
-    SDL_FillRect(background_tmpl, NULL, map_rgba(background_tmpl->format, bg_color));
+    SDL_FillSurfaceRect(background_tmpl, NULL,
+                        map_rgba(background_tmpl->format, bg_color));
 
     create_frame(background_tmpl,
                  0, 0, background_tmpl->w - 1, background_tmpl->h - 1,
diff --git a/client/gui-sdl3/mapctrl.c b/client/gui-sdl3/mapctrl.c
index ae10572f0b..b0d5d4e8d4 100644
--- a/client/gui-sdl3/mapctrl.c
+++ b/client/gui-sdl3/mapctrl.c
@@ -924,7 +924,7 @@ static void remake_unitinfo(int w, int h)
     h += (units_info_window->size.h - units_info_window->area.h);
   }
 
-  /* clear area under old map window */
+  /* Clear area under old map window */
   clear_surface(pwidget->dst->surface, &pwidget->size);
   widget_mark_dirty(pwidget);
 
@@ -948,16 +948,16 @@ static void remake_unitinfo(int w, int h)
 
   area.w = w - BLOCKU_W - (units_info_window->size.w - units_info_window->area.w);
   area.h = h - (units_info_window->size.h - units_info_window->area.h);
-  SDL_FillRect(pwidget->theme, &area, map_rgba(pwidget->theme->format, bg_color));
+  SDL_FillSurfaceRect(pwidget->theme, &area, map_rgba(pwidget->theme->format, bg_color));
 
-  /* economy button */
+  /* Economy button */
   pwidget = tax_button;
   FREESURFACE(pwidget->gfx);
   pwidget->size.x = pwidget->dst->surface->w - w + units_info_window->area.x
                                              + (BLOCKU_W - pwidget->size.w) / 2;
   pwidget->size.y = pwidget->dst->surface->h - h + pwidget->area.y + 2;
 
-  /* research button */
+  /* Research button */
   pwidget = pwidget->prev;
   FREESURFACE(pwidget->gfx);
   pwidget->size.x = pwidget->dst->surface->w - w + units_info_window->area.x
@@ -965,7 +965,7 @@ static void remake_unitinfo(int w, int h)
   pwidget->size.y = pwidget->dst->surface->h - h + units_info_window->area.y +
                     pwidget->size.h + 2;
 
-  /* revolution button */
+  /* Revolution button */
   pwidget = pwidget->prev;
   FREESURFACE(pwidget->gfx);
   pwidget->size.x = pwidget->dst->surface->w - w + units_info_window->area.x
@@ -973,7 +973,7 @@ static void remake_unitinfo(int w, int h)
   pwidget->size.y = pwidget->dst->surface->h - h + units_info_window->area.y +
                     pwidget->size.h * 2 + 2;
 
-  /* show/hide unit's window button */
+  /* Show/hide unit's window button */
   pwidget = pwidget->prev;
   FREESURFACE(pwidget->gfx);
   pwidget->size.x = pwidget->dst->surface->w - w + units_info_window->area.x
diff --git a/client/gui-sdl3/mapview.c b/client/gui-sdl3/mapview.c
index ff860aad5b..a0a885a80d 100644
--- a/client/gui-sdl3/mapview.c
+++ b/client/gui-sdl3/mapview.c
@@ -447,8 +447,8 @@ void update_info_label(void)
     area.w = tmp->w + adj_size(8);
     area.h = tmp->h + adj_size(4);
 
-    SDL_FillRect(main_data.gui->surface, &area,
-                 map_rgba(main_data.gui->surface->format, bg_color));
+    SDL_FillSurfaceRect(main_data.gui->surface, &area,
+                        map_rgba(main_data.gui->surface->format, bg_color));
 
     /* Horizontal lines */
     create_line(main_data.gui->surface,
diff --git a/client/gui-sdl3/optiondlg.c b/client/gui-sdl3/optiondlg.c
index de4f69e0d6..e4370602e2 100644
--- a/client/gui-sdl3/optiondlg.c
+++ b/client/gui-sdl3/optiondlg.c
@@ -1300,8 +1300,8 @@ static void option_dialog_worklist(struct option_dialog *pdialog)
   background->theme = create_surf(area.w, area.h, SDL_SWSURFACE);
   widget_set_area(background, area);
   widget_set_position(background, area.x, area.y);
-  SDL_FillRect(background->theme, NULL,
-               map_rgba(background->theme->format, bg_color));
+  SDL_FillSurfaceRect(background->theme, NULL,
+                      map_rgba(background->theme->format, bg_color));
 
   create_frame(background->theme,
                0, 0, background->theme->w - 1, background->theme->h - 1,
diff --git a/client/gui-sdl3/repodlgs.c b/client/gui-sdl3/repodlgs.c
index 9ccc8bdebe..77c247b38d 100644
--- a/client/gui-sdl3/repodlgs.c
+++ b/client/gui-sdl3/repodlgs.c
@@ -2104,7 +2104,7 @@ void economy_report_dialog_popup(bool make_modal)
     /* Create Imprv Background Icon */
     background = create_surf(adj_size(116), adj_size(116), SDL_SWSURFACE);
 
-    SDL_FillRect(background, NULL, map_rgba(background->format, bg_color));
+    SDL_FillSurfaceRect(background, NULL, map_rgba(background->format, bg_color));
 
     create_frame(background,
                  0, 0, background->w - 1, background->h - 1,
@@ -2446,7 +2446,7 @@ SDL_Surface *create_select_tech_icon(utf8_str *pstr, Tech_type_id tech_id,
 
   text = create_text_surf_smaller_than_w(pstr, adj_size(100 - 4));
 
-  /* create label surface */
+  /* Create label surface */
   surf = create_surf(w, h, SDL_SWSURFACE);
 
   if (tech_id == research_get(client_player())->researching) {
@@ -2455,7 +2455,7 @@ SDL_Surface *create_select_tech_icon(utf8_str *pstr, Tech_type_id tech_id,
     color.a = 128;
   }
 
-  SDL_FillRect(surf, NULL, map_rgba(surf->format, color));
+  SDL_FillSurfaceRect(surf, NULL, map_rgba(surf->format, color));
 
   create_frame(surf,
                0,0, surf->w - 1, surf->h - 1,
@@ -2464,13 +2464,13 @@ SDL_Surface *create_select_tech_icon(utf8_str *pstr, Tech_type_id tech_id,
   tmp = get_tech_icon(tech_id);
 
   if (mode == TIM_SMALL_MODE) {
-    /* draw name tech text */
+    /* Draw name tech text */
     dst.x = adj_size(35) + (surf->w - text->w - adj_size(35)) / 2;
     dst.y = (surf->h - text->h) / 2;
     alphablit(text, NULL, surf, &dst, 255);
     FREESURFACE(text);
 
-    /* draw tech icon */
+    /* Draw tech icon */
     text = resize_surface(tmp, adj_size(25), adj_size(25), 1);
     dst.x = (adj_size(35) - text->w) / 2;
     dst.y = (surf->h - text->h) / 2;
@@ -2479,19 +2479,19 @@ SDL_Surface *create_select_tech_icon(utf8_str *pstr, Tech_type_id tech_id,
 
   } else {
 
-    /* draw name tech text */
+    /* Draw name tech text */
     dst.x = (surf->w - text->w) / 2;
     dst.y = adj_size(20);
     alphablit(text, NULL, surf, &dst, 255);
     dst.y += text->h + adj_size(10);
     FREESURFACE(text);
 
-    /* draw tech icon */
+    /* Draw tech icon */
     dst.x = (surf->w - tmp->w) / 2;
     alphablit(tmp, NULL, surf, &dst, 255);
     dst.y += tmp->w + adj_size(10);
 
-    /* fill array with iprvm. icons */
+    /* Fill array with iprvm. icons */
     w = 0;
     improvement_iterate(pimprove) {
       requirement_vector_iterate(&pimprove->reqs, preq) {
@@ -2511,7 +2511,7 @@ SDL_Surface *create_select_tech_icon(utf8_str *pstr, Tech_type_id tech_id,
         dst.x = (surf->w - surf_array[0]->w) / 2;
       }
 
-      /* draw iprvm. icons */
+      /* Draw iprvm. icons */
       buf_array = surf_array;
       h = 0;
       while (w) {
diff --git a/client/gui-sdl3/sprite.c b/client/gui-sdl3/sprite.c
index df52925c72..fe29a3527c 100644
--- a/client/gui-sdl3/sprite.c
+++ b/client/gui-sdl3/sprite.c
@@ -141,12 +141,12 @@ struct sprite *create_sprite(int width, int height, struct color *pcolor)
 
   mypixbuf = SDL_CreateSurface(width, height, SDL_PIXELFORMAT_RGBA8888);
 
-  SDL_FillRect(mypixbuf, NULL,
-               SDL_MapRGBA(mypixbuf->format,
-                           pcolor->color->r,
-                           pcolor->color->g,
-                           pcolor->color->b,
-                           pcolor->color->a));
+  SDL_FillSurfaceRect(mypixbuf, NULL,
+                      SDL_MapRGBA(mypixbuf->format,
+                                  pcolor->color->r,
+                                  pcolor->color->g,
+                                  pcolor->color->b,
+                                  pcolor->color->a));
 
   return ctor_sprite(mypixbuf);
 }
diff --git a/client/gui-sdl3/widget_label.c b/client/gui-sdl3/widget_label.c
index 10b41ff4c1..73d967e12a 100644
--- a/client/gui-sdl3/widget_label.c
+++ b/client/gui-sdl3/widget_label.c
@@ -268,7 +268,7 @@ struct widget *create_themelabel2(SDL_Surface *icon, struct gui_layer *pdest,
 
   colorkey = SDL_MapRGBA(ptheme->format, pstr->bgcol.r,
                          pstr->bgcol.g, pstr->bgcol.b, pstr->bgcol.a);
-  SDL_FillRect(ptheme, NULL, colorkey);
+  SDL_FillSurfaceRect(ptheme, NULL, colorkey);
 
   label->size.x = 0;
   label->size.y = 0;
@@ -283,7 +283,8 @@ struct widget *create_themelabel2(SDL_Surface *icon, struct gui_layer *pdest,
   area.y = label->size.h;
 
   if (flags & WF_RESTORE_BACKGROUND) {
-    SDL_FillRect(ptheme, &area, map_rgba(ptheme->format, bg_color));
+    SDL_FillSurfaceRect(ptheme, &area,
+                        map_rgba(ptheme->format, bg_color));
     store = pstr->bgcol;
     SDL_GetRGBA(getpixel(ptheme, area.x , area.y), ptheme->format,
                 &pstr->bgcol.r, &pstr->bgcol.g,
@@ -329,7 +330,7 @@ struct widget *convert_iconlabel_to_themeiconlabel2(struct widget *icon_label)
                          icon_label->string_utf8->bgcol.g,
                          icon_label->string_utf8->bgcol.b,
                          icon_label->string_utf8->bgcol.a);
-  SDL_FillRect(ptheme, NULL, colorkey);
+  SDL_FillSurfaceRect(ptheme, NULL, colorkey);
 
   start = icon_label->size;
   icon_label->size.x = 0;
@@ -338,15 +339,16 @@ struct widget *convert_iconlabel_to_themeiconlabel2(struct widget *icon_label)
   pdest = icon_label->dst->surface;
   icon_label->dst->surface = ptheme;
 
-  /* normal */
+  /* Normal */
   redraw_iconlabel(icon_label);
 
-  /* selected */
+  /* Selected */
   area.x = 0;
   area.y = icon_label->size.h;
 
   if (flags & WF_RESTORE_BACKGROUND) {
-    SDL_FillRect(ptheme, &area, map_rgba(ptheme->format, bg_color));
+    SDL_FillSurfaceRect(ptheme, &area,
+                        map_rgba(ptheme->format, bg_color));
     store = icon_label->string_utf8->bgcol;
     SDL_GetRGBA(getpixel(ptheme, area.x , area.y), ptheme->format,
                 &icon_label->string_utf8->bgcol.r,
@@ -410,7 +412,7 @@ static int redraw_themelabel(struct widget *label)
 
   y = (label->size.h - text->h) / 2;
 
-  /* redraw theme */
+  /* Redraw theme */
   if (label->theme) {
     ret = blit_entire_src(label->theme, label->dst->surface, label->size.x, label->size.y);
     if (ret) {
diff --git a/client/gui-sdl3/widget_window.c b/client/gui-sdl3/widget_window.c
index c916b8b4aa..4608e8a284 100644
--- a/client/gui-sdl3/widget_window.c
+++ b/client/gui-sdl3/widget_window.c
@@ -291,7 +291,8 @@ bool resize_window(struct widget *pwindow, SDL_Surface *bcgd,
       pcolor = &color;
     }
 
-    SDL_FillRect(pwindow->theme, NULL, map_rgba(pwindow->theme->format, *pcolor));
+    SDL_FillSurfaceRect(pwindow->theme, NULL,
+                        map_rgba(pwindow->theme->format, *pcolor));
 
     return TRUE;
   }
diff --git a/client/gui-sdl3/wldlg.c b/client/gui-sdl3/wldlg.c
index efd45672df..1312b08e08 100644
--- a/client/gui-sdl3/wldlg.c
+++ b/client/gui-sdl3/wldlg.c
@@ -1096,9 +1096,9 @@ void popup_worklist_editor(struct city *pcity, struct global_worklist *gwl)
   advanced_tech = (pcity == NULL);
 
   /* --------------- */
-  /* create Target Background Icon */
+  /* Create Target Background Icon */
   main_surf = create_surf(adj_size(116), adj_size(116), SDL_SWSURFACE);
-  SDL_FillRect(main_surf, NULL, map_rgba(main_surf->format, bg_color));
+  SDL_FillSurfaceRect(main_surf, NULL, map_rgba(main_surf->format, bg_color));
 
   create_frame(main_surf,
                0, 0, main_surf->w - 1, main_surf->h - 1,
@@ -1704,9 +1704,9 @@ void popup_worklist_editor(struct city *pcity, struct global_worklist *gwl)
   dst.w = adj_size(130);
   dst.h = adj_size(145);
 
-  SDL_FillRect(pwindow->theme, &dst,
-               map_rgba(pwindow->theme->format,
-                        *get_theme_color(COLOR_THEME_BACKGROUND)));
+  SDL_FillSurfaceRect(pwindow->theme, &dst,
+                      map_rgba(pwindow->theme->format,
+                               *get_theme_color(COLOR_THEME_BACKGROUND)));
 
   create_frame(pwindow->theme,
                dst.x, dst.y, dst.w - 1, dst.h - 1,
@@ -1731,9 +1731,9 @@ void popup_worklist_editor(struct city *pcity, struct global_worklist *gwl)
     dst.w = adj_size(130);
     dst.h = pwindow->size.h - dst.y - adj_size(4);
 
-    SDL_FillRect(pwindow->theme, &dst,
-                 map_rgba(pwindow->theme->format,
-                          *get_theme_color(COLOR_THEME_BACKGROUND)));
+    SDL_FillSurfaceRect(pwindow->theme, &dst,
+                        map_rgba(pwindow->theme->format,
+                                 *get_theme_color(COLOR_THEME_BACKGROUND)));
 
     create_frame(pwindow->theme,
                  dst.x, dst.y, dst.w - 1, dst.h - 1,
@@ -1748,18 +1748,18 @@ void popup_worklist_editor(struct city *pcity, struct global_worklist *gwl)
                       (main_window_width() - pwindow->size.w) / 2,
                       (main_window_height() - pwindow->size.h) / 2);
 
-  /* name */
+  /* Name */
   buf = pwindow->prev;
   buf->size.x = area.x + (adj_size(130) - buf->size.w) / 2;
   buf->size.y = area.y + adj_size(4);
 
-  /* size of worklist (without production) */
+  /* Size of worklist (without production) */
   buf = buf->prev;
   buf->size.x = area.x + (adj_size(130) - buf->size.w) / 2;
   buf->size.y = buf->next->size.y + buf->next->size.h;
 
   if (pcity) {
-    /* current build and progress bar */
+    /* Current build and progress bar */
     buf = buf->prev;
     buf->size.x = area.x + (adj_size(130) - buf->size.w) / 2;
     buf->size.y = buf->next->size.y + buf->next->size.h + adj_size(5);
@@ -1768,23 +1768,23 @@ void popup_worklist_editor(struct city *pcity, struct global_worklist *gwl)
     buf->size.x = area.x + (adj_size(130) - buf->size.w) / 2;
     buf->size.y = buf->next->size.y + buf->next->size.h;
   } else {
-    /* rename worklist */
+    /* Rename worklist */
     buf = buf->prev;
     buf->size.x = area.x + (adj_size(130) - buf->size.w) / 2;
     buf->size.y = area.y + 1 + (adj_size(145) - buf->size.h) / 2;
   }
 
-  /* ok button */
+  /* Ok button */
   buf = buf->prev;
   buf->size.x = area.x + (adj_size(65) - buf->size.w) / 2;
   buf->size.y = area.y + adj_size(135) - buf->size.h;
 
-  /* exit button */
+  /* Exit button */
   buf = buf->prev;
   buf->size.x = area.x + adj_size(65) + (adj_size(65) - buf->size.w) / 2;
   buf->size.y = area.y + adj_size(135) - buf->size.h;
 
-  /* worklist */
+  /* Worklist */
   /* editor->work->scroll->count: including production */
   if (len > 0) {
     /* FIXME */
@@ -1801,7 +1801,7 @@ void popup_worklist_editor(struct city *pcity, struct global_worklist *gwl)
                                   adj_size(225), FALSE);
   }
 
-  /* global worklists */
+  /* Global worklists */
   if (editor->global) {
     setup_vertical_widgets_position(1,
                                     area.x + adj_size(4),
-- 
2.42.0

