[gtk/gtk-3-24: 1/3] GDK W32: Be honest about supported clipboard formats



commit f0959c9c8d6c866f61a4632fdd05b6a208b98dc4
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Sun Oct 7 12:15:41 2018 +0000

    GDK W32: Be honest about supported clipboard formats
    
    Do not lie to W32 about the formats that we provide or accept.
    
    Originally the logic behind such lies was that GdkPixbuf allows
    us to convert any supported image to BMP or PNG, and therefore
    we should announce that we always provide/accept BMP and PNG along
    with other formats.
    
    But that's not how it works. The conversion between formats happens
    at GTK level in GtkClipboard or, if GtkClipboard is not used, with
    gtk_target_list_add_image_targets() to announce all supported image
    formats, and with gtk_selection_data_set_pixbuf() to convert from
    any GdkPixbuf formats to the format requested by the selection, and
    with gtk_selection_data_get_pixbuf() to convert from the selection
    format to GdkPixbuf, if supported.
    
    GDK simply does not play any role in this. Therefore W32 GDK backend
    should only offer formats that it can actually do conversion for
    by itself (such as image/bmp <-> CF_DIB,
    or text/uri-list <-> CFSTR_SHELLIDLIST).

 gdk/win32/gdkselection-win32.c | 36 ------------------------------------
 1 file changed, 36 deletions(-)
---
diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c
index ff4b5c7899..862d2729fc 100644
--- a/gdk/win32/gdkselection-win32.c
+++ b/gdk/win32/gdkselection-win32.c
@@ -490,10 +490,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
   fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG);
   g_array_append_val (comp, fmt);
 
-  fmt.format = CF_DIB;
-  fmt.transmute = TRUE;
-  g_array_append_val (comp, fmt);
-
   g_hash_table_replace (win32_selection->compatibility_formats, fmt.target, comp);
 
 
@@ -507,13 +503,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
   fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_JFIF);
   g_array_append_val (comp, fmt);
 
-  fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG);
-  fmt.transmute = TRUE;
-  g_array_append_val (comp, fmt);
-
-  fmt.format = CF_DIB;
-  g_array_append_val (comp, fmt);
-
   g_hash_table_replace (win32_selection->compatibility_formats, fmt.target, comp);
 
 
@@ -527,13 +516,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
   fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_GIF);
   g_array_append_val (comp, fmt);
 
-  fmt.format = _gdk_cf_array_index (cfs, GDK_WIN32_CF_INDEX_PNG);
-  fmt.transmute = TRUE;
-  g_array_append_val (comp, fmt);
-
-  fmt.format = CF_DIB;
-  g_array_append_val (comp, fmt);
-
   g_hash_table_replace (win32_selection->compatibility_formats, fmt.target, comp);
 
 
@@ -606,10 +588,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
   fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG);
   g_array_append_val (comp, fmt);
 
-  fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP);
-  fmt.transmute = TRUE;
-  g_array_append_val (comp, fmt);
-
   g_hash_table_replace (win32_selection->compatibility_targets, GINT_TO_POINTER (_gdk_cf_array_index (cfs, 
GDK_WIN32_CF_INDEX_PNG)), comp);
 
 
@@ -623,13 +601,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
   fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_JPEG);
   g_array_append_val (comp, fmt);
 
-  fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG);
-  fmt.transmute = TRUE;
-  g_array_append_val (comp, fmt);
-
-  fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP);
-  g_array_append_val (comp, fmt);
-
   g_hash_table_replace (win32_selection->compatibility_targets, GINT_TO_POINTER (_gdk_cf_array_index (cfs, 
GDK_WIN32_CF_INDEX_JFIF)), comp);
 
 
@@ -643,13 +614,6 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
   fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_GIF);
   g_array_append_val (comp, fmt);
 
-  fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG);
-  fmt.transmute = TRUE;
-  g_array_append_val (comp, fmt);
-
-  fmt.target = _gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP);
-  g_array_append_val (comp, fmt);
-
   g_hash_table_replace (win32_selection->compatibility_targets, GINT_TO_POINTER (_gdk_cf_array_index (cfs, 
GDK_WIN32_CF_INDEX_GIF)), comp);
 
 


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