summaryrefslogtreecommitdiffstats
path: root/app/core
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-08 08:16:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-08 08:16:52 +0000
commitdb0da4c882437f3b76a34308edeaa2c41d8c2833 (patch)
tree7f4486279e1f9819d406f1425cab495d5852bf81 /app/core
parentReleasing progress-linux version 2.10.36-3~progress7.99u1. (diff)
downloadgimp-db0da4c882437f3b76a34308edeaa2c41d8c2833.tar.xz
gimp-db0da4c882437f3b76a34308edeaa2c41d8c2833.zip
Merging upstream version 2.10.38.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'app/core')
-rw-r--r--app/core/core-enums.c29
-rw-r--r--app/core/core-enums.h11
-rw-r--r--app/core/gimp-utils.c45
-rw-r--r--app/core/gimp-utils.h6
-rw-r--r--app/core/gimpimage-new.c11
-rw-r--r--app/core/gimppalette-load.c4
-rw-r--r--app/core/gimppattern.c23
7 files changed, 120 insertions, 9 deletions
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index f8ecb14..31969dd 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -926,6 +926,35 @@ gimp_paste_type_get_type (void)
}
GType
+gimp_win32_pointer_input_api_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_WIN32_POINTER_INPUT_API_WINTAB, "GIMP_WIN32_POINTER_INPUT_API_WINTAB", "wintab" },
+ { GIMP_WIN32_POINTER_INPUT_API_WINDOWS_INK, "GIMP_WIN32_POINTER_INPUT_API_WINDOWS_INK", "windows-ink" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_WIN32_POINTER_INPUT_API_WINTAB, NC_("win32-pointer-input-api", "Wintab"), NULL },
+ { GIMP_WIN32_POINTER_INPUT_API_WINDOWS_INK, NC_("win32-pointer-input-api", "Windows Ink"), NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpWin32PointerInputAPI", values);
+ gimp_type_set_translation_context (type, "win32-pointer-input-api");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
gimp_thumbnail_size_get_type (void)
{
static const GEnumValue values[] =
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 8826145..7a80238 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -414,6 +414,17 @@ typedef enum /*< pdb-skip >*/
} GimpPasteType;
+#define GIMP_TYPE_WIN32_POINTER_INPUT_API (gimp_win32_pointer_input_api_get_type ())
+
+GType gimp_win32_pointer_input_api_get_type (void) G_GNUC_CONST;
+
+typedef enum /*< pdb-skip >*/
+{
+ GIMP_WIN32_POINTER_INPUT_API_WINTAB, /*< desc="Wintab" >*/
+ GIMP_WIN32_POINTER_INPUT_API_WINDOWS_INK /*< desc="Windows Ink" >*/
+} GimpWin32PointerInputAPI;
+
+
#define GIMP_TYPE_THUMBNAIL_SIZE (gimp_thumbnail_size_get_type ())
GType gimp_thumbnail_size_get_type (void) G_GNUC_CONST;
diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c
index d3df098..cac4000 100644
--- a/app/core/gimp-utils.c
+++ b/app/core/gimp-utils.c
@@ -1049,6 +1049,51 @@ gimp_idle_run_async_full (gint priority,
return g_object_ref (data->async);
}
+#if defined(G_OS_WIN32)
+
+gboolean
+gimp_win32_have_wintab (void)
+{
+ gunichar2 wchars_buffer[MAX_PATH + 1];
+ UINT wchars_count = 0;
+
+ memset (wchars_buffer, 0, sizeof (wchars_buffer));
+ wchars_count = GetSystemDirectoryW (wchars_buffer, MAX_PATH);
+ if (wchars_count > 0 && wchars_count < MAX_PATH)
+ {
+ char *system32_directory = g_utf16_to_utf8 (wchars_buffer, -1, NULL, NULL, NULL);
+
+ if (system32_directory)
+ {
+ GFile *file = g_file_new_build_filename (system32_directory, "Wintab32.dll", NULL);
+ gboolean exists = g_file_query_exists (file, NULL);
+
+ g_object_unref (file);
+ g_free (system32_directory);
+
+ return exists;
+ }
+ }
+
+ return FALSE;
+}
+
+gboolean
+gimp_win32_have_windows_ink (void)
+{
+ wchar_t buf[100];
+ DWORD ret;
+
+ memset (buf, 0, sizeof (buf));
+ ret = GetEnvironmentVariableW (L"GDK_WIN32_FEATURES", buf, sizeof (buf) - 1);
+ if (ret > 0 && ret < 100)
+ return wcsstr (buf, L"winpointer") != NULL;
+
+ return FALSE;
+}
+
+#endif
+
/* debug stuff */
diff --git a/app/core/gimp-utils.h b/app/core/gimp-utils.h
index 8373de7..e9810bf 100644
--- a/app/core/gimp-utils.h
+++ b/app/core/gimp-utils.h
@@ -112,5 +112,11 @@ GimpImage * gimp_create_image_from_buffer (Gimp *gimp,
GeglBuffer *buffer,
const gchar *image_name);
+#ifdef G_OS_WIN32
+
+gboolean gimp_win32_have_wintab (void);
+gboolean gimp_win32_have_windows_ink (void);
+
+#endif
#endif /* __APP_GIMP_UTILS_H__ */
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 4d0fa7b..c307d63 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -61,9 +61,20 @@ gimp_image_new_get_last_template (Gimp *gimp,
if (image)
{
+ const gchar *comment;
+
+ comment = gimp_template_get_comment (gimp->config->default_image);
+
gimp_config_sync (G_OBJECT (gimp->config->default_image),
G_OBJECT (template), 0);
gimp_template_set_from_image (template, image);
+
+ /* Do not pass around the comment from the current active comment. Only
+ * pass comments stored in actual templates. This can be even considered
+ * as data leak otherwise (creating 2 images in a row and not realizing
+ * the second will have the metadata comment from the first). See #11384.
+ */
+ g_object_set (template, "comment", comment, NULL);
}
else
{
diff --git a/app/core/gimppalette-load.c b/app/core/gimppalette-load.c
index 7605b92..817c055 100644
--- a/app/core/gimppalette-load.c
+++ b/app/core/gimppalette-load.c
@@ -1095,7 +1095,7 @@ gimp_palette_load_ase (GimpContext *context,
/* Convert 4 bytes to a 32bit float value */
tmp = GINT32_FROM_BE (tmp);
- pixels[j] = *(gfloat *) &tmp;
+ memcpy (&pixels[j], &tmp, 4);
}
if (! valid_color)
@@ -1206,7 +1206,7 @@ gimp_palette_load_css (GimpContext *context,
g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- regex = g_regex_new (".*color.*:(?P<param>.*);", G_REGEX_CASELESS, 0, error);
+ regex = g_regex_new (".*color.*:(?P<param>.*)", G_REGEX_CASELESS, 0, error);
if (! regex)
return NULL;
diff --git a/app/core/gimppattern.c b/app/core/gimppattern.c
index 22d2d78..12b15b6 100644
--- a/app/core/gimppattern.c
+++ b/app/core/gimppattern.c
@@ -143,13 +143,14 @@ gimp_pattern_get_new_preview (GimpViewable *viewable,
gint width,
gint height)
{
- GimpPattern *pattern = GIMP_PATTERN (viewable);
+ GimpPattern *pattern = GIMP_PATTERN (viewable);
GimpTempBuf *temp_buf;
GeglBuffer *src_buffer;
gint true_width;
gint true_height;
gint copy_width;
gint copy_height;
+ gboolean has_temp_buf = FALSE;
true_width = gimp_temp_buf_get_width (pattern->mask);
true_height = gimp_temp_buf_get_height (pattern->mask);
@@ -174,13 +175,21 @@ gimp_pattern_get_new_preview (GimpViewable *viewable,
temp_buf = gimp_temp_buf_new (copy_width, copy_height,
gimp_temp_buf_get_format (pattern->mask));
- gegl_buffer_get (src_buffer,
- GEGL_RECTANGLE (0, 0, copy_width, copy_height),
- scale, gimp_temp_buf_get_format (temp_buf),
- gimp_temp_buf_get_data (temp_buf),
- GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_CLAMP);
+ if (temp_buf)
+ {
+ gegl_buffer_get (src_buffer,
+ GEGL_RECTANGLE (0, 0, copy_width, copy_height),
+ scale, gimp_temp_buf_get_format (temp_buf),
+ gimp_temp_buf_get_data (temp_buf),
+ GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_CLAMP);
+
+ has_temp_buf = TRUE;
+ }
}
- else
+
+ /* If scaled image pattern could not be loaded,
+ * use the default pattern */
+ if (! has_temp_buf)
{
GeglBuffer *dest_buffer;