[gtk/wip/otte/win32-cleanup: 61/63] win32: Remove special casing for pixbuf formats




commit b63b8ba0490650cc84cbb62f1919e3f9a728e0b7
Author: Benjamin Otte <otte redhat com>
Date:   Fri Jul 23 05:06:30 2021 +0200

    win32: Remove special casing for pixbuf formats
    
    That's the job of the generic code, not the Windows backend.

 gdk/win32/gdkclipdrop-win32.c | 56 +------------------------------------------
 gdk/win32/gdkclipdrop-win32.h |  4 ----
 2 files changed, 1 insertion(+), 59 deletions(-)
---
diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c
index 2c3eab6d36..7eedf61a76 100644
--- a/gdk/win32/gdkclipdrop-win32.c
+++ b/gdk/win32/gdkclipdrop-win32.c
@@ -1605,34 +1605,6 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
 
   win32_clipdrop->active_source_drags = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) g_object_unref, 
NULL);
 
-  pixbuf_formats = gdk_pixbuf_get_formats ();
-
-  win32_clipdrop->n_known_pixbuf_formats = 0;
-  for (rover = pixbuf_formats; rover != NULL; rover = rover->next)
-    {
-      char **mime_types =
-       gdk_pixbuf_format_get_mime_types ((GdkPixbufFormat *) rover->data);
-      char **mime_type;
-
-      for (mime_type = mime_types; *mime_type != NULL; mime_type++)
-       win32_clipdrop->n_known_pixbuf_formats++;
-    }
-
-  win32_clipdrop->known_pixbuf_formats = g_new (const char *, win32_clipdrop->n_known_pixbuf_formats);
-
-  i = 0;
-  for (rover = pixbuf_formats; rover != NULL; rover = rover->next)
-    {
-      char **mime_types =
-       gdk_pixbuf_format_get_mime_types ((GdkPixbufFormat *) rover->data);
-      char **mime_type;
-
-      for (mime_type = mime_types; *mime_type != NULL; mime_type++)
-       win32_clipdrop->known_pixbuf_formats[i++] = g_intern_string (*mime_type);
-    }
-
-  g_slist_free (pixbuf_formats);
-
   win32_clipdrop->compatibility_w32formats = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) 
g_array_unref);
 
   /* GTK actually has more text formats, but it's unlikely that we'd
@@ -1956,32 +1928,6 @@ _gdk_win32_get_clipboard_format_name_as_interned_mimetype (char *w32format_name)
   return result;
 }
 
-static GArray *
-get_compatibility_w32formats_for_contentformat (const char *contentformat)
-{
-  GArray *result = NULL;
-  int i;
-  GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
-
-  result = g_hash_table_lookup (clipdrop->compatibility_w32formats, contentformat);
-
-  if (result != NULL)
-    return result;
-
-  for (i = 0; i < clipdrop->n_known_pixbuf_formats; i++)
-    {
-      if (contentformat != clipdrop->known_pixbuf_formats[i])
-        continue;
-
-      /* Any format known to gdk-pixbuf can be presented as PNG or BMP */
-      result = g_hash_table_lookup (clipdrop->compatibility_w32formats,
-                                    _gdk_win32_clipdrop_atom (GDK_WIN32_ATOM_INDEX_IMAGE_PNG));
-      break;
-    }
-
-  return result;
-}
-
 static GArray *
 _gdk_win32_get_compatibility_contentformats_for_w32format (UINT w32format)
 {
@@ -2741,7 +2687,7 @@ _gdk_win32_add_contentformat_to_pairs (const char *contentformat,
   g_array_append_val (array, fmt);
   added_count += 1;
 
-  comp_pairs = get_compatibility_w32formats_for_contentformat (contentformat);
+  comp_pairs = g_hash_table_lookup (_win32_clipdrop->compatibility_w32formats, contentformat);
   for (i = 0; comp_pairs != NULL && i < comp_pairs->len; i++)
     {
       int j;
diff --git a/gdk/win32/gdkclipdrop-win32.h b/gdk/win32/gdkclipdrop-win32.h
index 1be94dad8f..6c8e3328c1 100644
--- a/gdk/win32/gdkclipdrop-win32.h
+++ b/gdk/win32/gdkclipdrop-win32.h
@@ -128,10 +128,6 @@ struct _GdkWin32Clipdrop
 {
   GObject *parent_instance;
 
-  /* interned strings for well-known image formats */
-  const char **known_pixbuf_formats;
-  int n_known_pixbuf_formats;
-
   /* GArray of GdkAtoms for various known Selection and DnD strings.
    * Size is guaranteed to be at least GDK_WIN32_ATOM_INDEX_LAST
    */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]