diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-08 08:16:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-08 08:16:47 +0000 |
commit | 74f0d9eb037dc24bdfd1f0f325e483e380451d32 (patch) | |
tree | faaaf44f426c20626c05034846c0b481c0e54983 /app/display | |
parent | Adding upstream version 2.10.36. (diff) | |
download | gimp-74f0d9eb037dc24bdfd1f0f325e483e380451d32.tar.xz gimp-74f0d9eb037dc24bdfd1f0f325e483e380451d32.zip |
Adding upstream version 2.10.38.upstream/2.10.38upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'app/display')
-rw-r--r-- | app/display/gimpdisplayshell-title.c | 72 | ||||
-rw-r--r-- | app/display/gimpimagewindow.c | 3 |
2 files changed, 53 insertions, 22 deletions
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 */ @@ -170,6 +175,21 @@ print (gchar *buf, } 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, gint title_len, @@ -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. |