From bef99bf6887b43ca0d951a2e1f3a525f97c76fde Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 8 Jul 2023 20:56:21 +0300 Subject: [PATCH 13/13] gtk: Drop unused display_color_type See osdn #48297 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.0/colors.c | 28 ---------------------------- client/gui-gtk-3.0/colors.h | 10 ++-------- client/gui-gtk-3.0/gui_main.c | 6 +----- client/gui-gtk-3.22/colors.c | 28 ---------------------------- client/gui-gtk-3.22/colors.h | 8 +------- client/gui-gtk-3.22/gui_main.c | 6 +----- client/gui-gtk-4.0/colors.c | 8 -------- client/gui-gtk-4.0/colors.h | 8 +------- client/gui-gtk-4.0/gui_main.c | 7 ++----- 9 files changed, 8 insertions(+), 101 deletions(-) diff --git a/client/gui-gtk-3.0/colors.c b/client/gui-gtk-3.0/colors.c index f0eee5f8b2..e117daf906 100644 --- a/client/gui-gtk-3.0/colors.c +++ b/client/gui-gtk-3.0/colors.c @@ -31,34 +31,6 @@ #include "colors.h" -/************************************************************************//** - Get display color type of default visual -****************************************************************************/ -enum Display_color_type get_visual(void) -{ - GdkVisual *visual; - GdkVisualType type; - - visual = gdk_screen_get_system_visual(gdk_screen_get_default()); - type = gdk_visual_get_visual_type(visual); - - if (type == GDK_VISUAL_STATIC_GRAY) { - /* StaticGray, use black and white */ - log_verbose("found B/W display."); - return BW_DISPLAY; - } - - if (type < GDK_VISUAL_STATIC_COLOR) { - /* No color visual available at default depth */ - log_verbose("found grayscale(?) display."); - return GRAYSCALE_DISPLAY; - } - - log_verbose("color system booted ok."); - - return COLOR_DISPLAY; -} - /************************************************************************//** Allocate a color (well, sort of) and return a pointer to it. diff --git a/client/gui-gtk-3.0/colors.h b/client/gui-gtk-3.0/colors.h index 6e239e058d..f9ce6d417f 100644 --- a/client/gui-gtk-3.0/colors.h +++ b/client/gui-gtk-3.0/colors.h @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,10 +21,4 @@ struct color { GdkRGBA color; }; -enum Display_color_type { - BW_DISPLAY, GRAYSCALE_DISPLAY, COLOR_DISPLAY -}; - -enum Display_color_type get_visual(void); - -#endif /* FC__COLORS_H */ +#endif /* FC__COLORS_H */ diff --git a/client/gui-gtk-3.0/gui_main.c b/client/gui-gtk-3.0/gui_main.c index 6ddfcf7058..3b07fadb86 100644 --- a/client/gui-gtk-3.0/gui_main.c +++ b/client/gui-gtk-3.0/gui_main.c @@ -177,7 +177,6 @@ GtkTextView *main_message_area; GtkTextBuffer *message_buffer = NULL; static GtkWidget *allied_chat_toggle_button; -static enum Display_color_type display_color_type; /* practically unused */ static gint timer_id; /* ditto */ static GIOChannel *srv_channel; static guint srv_id; @@ -1763,12 +1762,9 @@ int ui_main(int argc, char **argv) 0, 0, 0, 0); g_signal_connect(toplevel, "focus", G_CALLBACK(toplevel_focus), NULL); - - display_color_type = get_visual(); - options_iterate(client_optset, poption) { if (OT_FONT == option_type(poption)) { - /* Force to call the appropriated callback. */ + /* Force to call the appropriate callback. */ option_changed(poption); } } options_iterate_end; diff --git a/client/gui-gtk-3.22/colors.c b/client/gui-gtk-3.22/colors.c index 510fd3cd41..705bd3b68f 100644 --- a/client/gui-gtk-3.22/colors.c +++ b/client/gui-gtk-3.22/colors.c @@ -31,34 +31,6 @@ #include "colors.h" -/************************************************************************//** - Get display color type of default visual -****************************************************************************/ -enum Display_color_type get_visual(void) -{ - GdkVisual *visual; - GdkVisualType type; - - visual = gdk_screen_get_system_visual(gdk_screen_get_default()); - type = gdk_visual_get_visual_type(visual); - - if (type == GDK_VISUAL_STATIC_GRAY) { - /* StaticGray, use black and white */ - log_verbose("found B/W display."); - return BW_DISPLAY; - } - - if (type < GDK_VISUAL_STATIC_COLOR) { - /* No color visual available at default depth */ - log_verbose("found grayscale(?) display."); - return GRAYSCALE_DISPLAY; - } - - log_verbose("color system booted ok."); - - return COLOR_DISPLAY; -} - /************************************************************************//** Allocate a color (well, sort of) and return a pointer to it. diff --git a/client/gui-gtk-3.22/colors.h b/client/gui-gtk-3.22/colors.h index aac1f148ef..4007610860 100644 --- a/client/gui-gtk-3.22/colors.h +++ b/client/gui-gtk-3.22/colors.h @@ -22,10 +22,4 @@ struct color { GdkRGBA color; }; -enum Display_color_type { - BW_DISPLAY, GRAYSCALE_DISPLAY, COLOR_DISPLAY -}; - -enum Display_color_type get_visual(void); - -#endif /* FC__COLORS_H */ +#endif /* FC__COLORS_H */ diff --git a/client/gui-gtk-3.22/gui_main.c b/client/gui-gtk-3.22/gui_main.c index 847c5806c6..93d0119493 100644 --- a/client/gui-gtk-3.22/gui_main.c +++ b/client/gui-gtk-3.22/gui_main.c @@ -177,7 +177,6 @@ GtkTextView *main_message_area; GtkTextBuffer *message_buffer = NULL; static GtkWidget *allied_chat_toggle_button; -static enum Display_color_type display_color_type; /* practically unused */ static gint timer_id; /* ditto */ static GIOChannel *srv_channel; static guint srv_id; @@ -1920,12 +1919,9 @@ int ui_main(int argc, char **argv) 0, 0, 0, 0); g_signal_connect(toplevel, "focus", G_CALLBACK(toplevel_focus), NULL); - - display_color_type = get_visual(); - options_iterate(client_optset, poption) { if (OT_FONT == option_type(poption)) { - /* Force to call the appropriated callback. */ + /* Force to call the appropriate callback. */ option_changed(poption); } } options_iterate_end; diff --git a/client/gui-gtk-4.0/colors.c b/client/gui-gtk-4.0/colors.c index 32f3329225..5a914f0db2 100644 --- a/client/gui-gtk-4.0/colors.c +++ b/client/gui-gtk-4.0/colors.c @@ -31,14 +31,6 @@ #include "colors.h" -/************************************************************************//** - Get display color type of default visual -****************************************************************************/ -enum Display_color_type get_visual(void) -{ - return COLOR_DISPLAY; -} - /************************************************************************//** Allocate a color (well, sort of) and return a pointer to it. diff --git a/client/gui-gtk-4.0/colors.h b/client/gui-gtk-4.0/colors.h index aac1f148ef..4007610860 100644 --- a/client/gui-gtk-4.0/colors.h +++ b/client/gui-gtk-4.0/colors.h @@ -22,10 +22,4 @@ struct color { GdkRGBA color; }; -enum Display_color_type { - BW_DISPLAY, GRAYSCALE_DISPLAY, COLOR_DISPLAY -}; - -enum Display_color_type get_visual(void); - -#endif /* FC__COLORS_H */ +#endif /* FC__COLORS_H */ diff --git a/client/gui-gtk-4.0/gui_main.c b/client/gui-gtk-4.0/gui_main.c index fd4be14246..ef04293d12 100644 --- a/client/gui-gtk-4.0/gui_main.c +++ b/client/gui-gtk-4.0/gui_main.c @@ -169,8 +169,7 @@ GtkTextView *main_message_area; GtkTextBuffer *message_buffer = NULL; static GtkWidget *allied_chat_toggle_button; -static enum Display_color_type display_color_type; /* practically unused */ -static gint timer_id; /* ditto */ +static gint timer_id; /* Ditto */ static GIOChannel *srv_channel; static guint srv_id; gint cur_x, cur_y; @@ -1941,11 +1940,9 @@ static void activate_gui(GtkApplication *app, gpointer data) 0, 0, 0, 0); g_signal_connect(toplevel, "move-focus", G_CALLBACK(toplevel_focus), NULL); - display_color_type = get_visual(); - options_iterate(client_optset, poption) { if (OT_FONT == option_type(poption)) { - /* Force to call the appropriated callback. */ + /* Force to call the appropriate callback. */ option_changed(poption); } } options_iterate_end; -- 2.40.1