*/
static GHashTable *sel_owner_table = NULL;
-/* Well-known registered clipboard image formats */
-static UINT cf_png;
-static UINT cf_jfif;
-static UINT cf_gif;
-
/* GdkAtoms for well-known image formats */
static GdkAtom *known_pixbuf_formats;
static int n_known_pixbuf_formats;
-static GdkAtom image_png;
-static GdkAtom image_jpeg;
-static GdkAtom image_bmp;
-static GdkAtom image_gif;
/* GdkAtoms for well-known text formats */
static GdkAtom text_plain;
sel_owner_table = g_hash_table_new (NULL, NULL);
_format_atom_table = g_hash_table_new (NULL, NULL);
- /* MS Office 2007, at least, offers images in common file formats
- * using clipboard format names like "PNG" and "JFIF". So we follow
- * the lead and map the GDK target name "image/png" to the clipboard
- * format name "PNG" etc.
- */
- cf_png = RegisterClipboardFormat ("PNG");
- cf_jfif = RegisterClipboardFormat ("JFIF");
- cf_gif = RegisterClipboardFormat ("GIF");
-
pixbuf_formats = gdk_pixbuf_get_formats ();
n_known_pixbuf_formats = 0;
g_slist_free (pixbuf_formats);
- image_png = gdk_atom_intern ("image/png", FALSE);
- image_jpeg = gdk_atom_intern ("image/jpeg", FALSE);
- image_bmp = gdk_atom_intern ("image/bmp", FALSE);
- image_gif = gdk_atom_intern ("image/gif", FALSE);
-
text_plain = gdk_atom_intern ("text/plain", FALSE);
text_plain_charset_utf_8= gdk_atom_intern ("text/plain;charset=utf-8", FALSE);
text_plain_charset_CP1252 = gdk_atom_intern ("text/plain;charset=CP1252", FALSE);
g_hash_table_replace (_format_atom_table,
- GINT_TO_POINTER (cf_png),
- image_png);
+ GINT_TO_POINTER (_cf_png),
+ _image_png);
g_hash_table_replace (_format_atom_table,
GINT_TO_POINTER (CF_DIB),
- image_bmp);
+ _image_bmp);
}
/* The specifications for COMPOUND_TEXT and STRING specify that C0 and
static gchar *
get_mapped_gdk_atom_name (GdkAtom gdk_target)
{
- if (gdk_target == image_png)
+ if (gdk_target == _image_png)
return g_strdup ("PNG");
- if (gdk_target == image_jpeg)
+ if (gdk_target == _image_jpeg)
return g_strdup ("JFIF");
- if (gdk_target == image_gif)
+ if (gdk_target == _image_gif)
return g_strdup ("GIF");
return gdk_atom_name (gdk_target);
for (fmt = 0; 0 != (fmt = EnumClipboardFormats (fmt)); )
{
- if (fmt == cf_png)
+ if (fmt == _cf_png)
{
- targets[ntargets++] = image_png;
+ targets[ntargets++] = _image_png;
has_png = TRUE;
}
}
targets[ntargets++] = _utf8_string;
has_text = TRUE;
}
- else if (fmt == cf_png)
+ else if (fmt == _cf_png)
{
/* Already handled above */
}
* transparency.
*/
if (!has_bmp && !has_png)
- targets[ntargets++] = image_bmp;
+ targets[ntargets++] = _image_bmp;
has_bmp = TRUE;
}
- else if (fmt == cf_jfif)
+ else if (fmt == _cf_jfif)
{
/* Ditto for JPEG */
if (!has_png)
- targets[ntargets++] = image_jpeg;
+ targets[ntargets++] = _image_jpeg;
}
- else if (fmt == cf_gif)
+ else if (fmt == _cf_gif)
{
/* Ditto for GIF.
*/
if (!has_png)
- targets[ntargets++] = image_gif;
+ targets[ntargets++] = _image_gif;
}
else if (GetClipboardFormatName (fmt, sFormat, 80) > 0)
{
API_CALL (CloseClipboard, ());
}
- else if (selection == GDK_SELECTION_CLIPBOARD && target == image_bmp)
+ else if (selection == GDK_SELECTION_CLIPBOARD && target == _image_bmp)
{
if (!API_CALL (OpenClipboard, (GDK_WINDOW_HWND (requestor))))
return;
if (make_dibv5)
{
- BITMAPV5HEADER *bV5 = data + sizeof (BITMAPFILEHEADER);
+ BITMAPV5HEADER *bV5 = (BITMAPV5HEADER *) ((char *) data + sizeof (BITMAPFILEHEADER));
guchar *p;
int i;
bi->biSize +
bi->biClrUsed * sizeof (RGBQUAD));
- memcpy (data + sizeof (BITMAPFILEHEADER),
+ memcpy ((char *) data + sizeof (BITMAPFILEHEADER),
bi,
data_length);
}
- selection_property_store (requestor, image_bmp, 8,
+ selection_property_store (requestor, _image_bmp, 8,
data, new_length);
}
GlobalUnlock (hdata);
if (dropfiles_prop != NULL)
{
selection_property_store
- (requestor, selection, dropfiles_prop->format,
+ (requestor, dropfiles_prop->type, dropfiles_prop->format,
dropfiles_prop->data, dropfiles_prop->length);
g_free (dropfiles_prop);
dropfiles_prop = NULL;
void
_gdk_selection_property_delete (GdkWindow *window)
{
- GdkSelProp *prop;
-
GDK_NOTE (DND, g_print ("_gdk_selection_property_delete: %p (no-op)\n",
GDK_WINDOW_HWND (window)));
if (!has_image)
{
GDK_NOTE (DND, g_print ("... SetClipboardData(PNG,NULL)\n"));
- SetClipboardData (cf_png, NULL);
+ SetClipboardData (_cf_png, NULL);
GDK_NOTE (DND, g_print ("... SetClipboardData(CF_DIB,NULL)\n"));
SetClipboardData (CF_DIB, NULL);
g_free (target_name);
});
- if (target == image_bmp)
+ if (target == _image_bmp)
{
/* No conversion is needed, just strip the BITMAPFILEHEADER */
HGLOBAL hdatanew;