From db0da4c882437f3b76a34308edeaa2c41d8c2833 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 8 May 2024 10:16:52 +0200 Subject: Merging upstream version 2.10.38. Signed-off-by: Daniel Baumann --- app/display/gimpdisplayshell-title.c | 72 ++++++++++++++++++++++++++---------- app/display/gimpimagewindow.c | 3 -- 2 files changed, 53 insertions(+), 22 deletions(-) (limited to 'app/display') diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c index ff356ce..ba14485 100644 --- a/app/display/gimpdisplayshell-title.c +++ b/app/display/gimpdisplayshell-title.c @@ -59,6 +59,11 @@ static gint gimp_display_shell_format_title (GimpDisplayShell *display, gint title_len, const gchar *format); +static gint print_unichar (gunichar c, + gchar *title, + gint title_len, + gint index); + /* public functions */ @@ -169,6 +174,21 @@ print (gchar *buf, return printed; } +static gint +print_unichar (gunichar c, + gchar *title, + gint title_len, + gint index) +{ + gchar letter[8]; + gint len; + + len = g_unichar_to_utf8 (c, letter); + letter[len] = '\0'; + + return print (title, title_len, index, "%s", letter); +} + static gint gimp_display_shell_format_title (GimpDisplayShell *shell, gchar *title, @@ -179,6 +199,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell, GimpDrawable *drawable; gint num, denom; gint i = 0; + gunichar c; g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), 0); @@ -194,13 +215,17 @@ gimp_display_shell_format_title (GimpDisplayShell *shell, gimp_zoom_model_get_fraction (shell->zoom, &num, &denom); - while (i < title_len && *format) + c = g_utf8_get_char (format); + while (i < title_len && c) { - switch (*format) + switch (c) { case '%': - format++; - switch (*format) + format = g_utf8_next_char (format); + c = g_utf8_get_char (format); + + switch (c) + { case 0: /* format string ends within %-sequence, print literal '%' */ @@ -262,27 +287,31 @@ gimp_display_shell_format_title (GimpDisplayShell *shell, break; case 'D': /* dirty flag */ - if (format[1] == 0) + format = g_utf8_next_char (format); + c = g_utf8_get_char (format); + + if (c == 0) { /* format string ends within %D-sequence, print literal '%D' */ i += print (title, title_len, i, "%%D"); break; } if (gimp_image_is_dirty (image)) - title[i++] = format[1]; - format++; + i += print_unichar (c, title, title_len, i); break; case 'C': /* clean flag */ - if (format[1] == 0) + format = g_utf8_next_char (format); + c = g_utf8_get_char (format); + + if (c == 0) { /* format string ends within %C-sequence, print literal '%C' */ i += print (title, title_len, i, "%%C"); break; } if (! gimp_image_is_dirty (image)) - title[i++] = format[1]; - format++; + i += print_unichar (c, title, title_len, i); break; case 'B': /* dirty flag (long) */ @@ -296,27 +325,31 @@ gimp_display_shell_format_title (GimpDisplayShell *shell, break; case 'N': /* not-exported flag */ - if (format[1] == 0) + format = g_utf8_next_char (format); + c = g_utf8_get_char (format); + + if (c == 0) { /* format string ends within %E-sequence, print literal '%E' */ i += print (title, title_len, i, "%%N"); break; } if (gimp_image_is_export_dirty (image)) - title[i++] = format[1]; - format++; + i += print_unichar (c, title, title_len, i); break; case 'E': /* exported flag */ - if (format[1] == 0) + format = g_utf8_next_char (format); + c = g_utf8_get_char (format); + + if (c == 0) { /* format string ends within %E-sequence, print literal '%E' */ i += print (title, title_len, i, "%%E"); break; } if (! gimp_image_is_export_dirty (image)) - title[i++] = format[1]; - format++; + i += print_unichar (c, title, title_len, i); break; case 'm': /* memory used by image */ @@ -545,17 +578,18 @@ gimp_display_shell_format_title (GimpDisplayShell *shell, default: /* format string contains unknown %-sequence, print it literally */ - i += print (title, title_len, i, "%%%c", *format); + i += print_unichar (c, title, title_len, i); break; } break; default: - title[i++] = *format; + i += print_unichar (c, title, title_len, i); break; } - format++; + format = g_utf8_next_char (format); + c = g_utf8_get_char (format); } title[MIN (i, title_len - 1)] = '\0'; diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c index fd5c501..5de1fac 100644 --- a/app/display/gimpimagewindow.c +++ b/app/display/gimpimagewindow.c @@ -1105,9 +1105,6 @@ gimp_image_window_set_aux_info (GimpSessionManaged *session_managed, else if (StartupInfo.wShowWindow == SW_SHOWMINIMIZED || StartupInfo.wShowWindow == SW_SHOWMINNOACTIVE || StartupInfo.wShowWindow == SW_MINIMIZE) - /* XXX Iconification does not seem to work. I see the - * window being iconified and immediately re-raised. - * I leave this piece of code for later improvement. */ gtk_window_iconify (GTK_WINDOW (session_managed)); else /* Another show property not relevant to min/max. -- cgit v1.2.3