From c196ac2b631a04e2ab70bf4e42bdf25fcd2592c2 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 15 Nov 2009 03:49:22 +0200 Subject: [PATCH] Make more GdkAtom variables visible in all gdk/win32 files Make the GdkAtoms for the image formats extern and usable from all gdk/win32 files. --- gdk/win32/gdkglobals-win32.c | 4 ++++ gdk/win32/gdkmain-win32.c | 4 ++++ gdk/win32/gdkprivate-win32.h | 4 ++++ gdk/win32/gdkselection-win32.c | 33 ++++++++++++--------------------- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/gdk/win32/gdkglobals-win32.c b/gdk/win32/gdkglobals-win32.c index d30ad32e5b..ef1dbecf42 100644 --- a/gdk/win32/gdkglobals-win32.c +++ b/gdk/win32/gdkglobals-win32.c @@ -54,6 +54,10 @@ GdkAtom _utf8_string; GdkAtom _text; GdkAtom _compound_text; GdkAtom _text_uri_list; +GdkAtom _image_png; +GdkAtom _image_jpeg; +GdkAtom _image_bmp; +GdkAtom _image_gif; GdkAtom _local_dnd; GdkAtom _gdk_win32_dropfiles; diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c index 49bd59e617..f1afdf2eee 100644 --- a/gdk/win32/gdkmain-win32.c +++ b/gdk/win32/gdkmain-win32.c @@ -108,6 +108,10 @@ _gdk_windowing_init (void) _text = gdk_atom_intern ("TEXT", FALSE); _compound_text = gdk_atom_intern ("COMPOUND_TEXT", FALSE); _text_uri_list = gdk_atom_intern ("text/uri-list", FALSE); + _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); _local_dnd = gdk_atom_intern ("LocalDndSelection", FALSE); _gdk_win32_dropfiles = gdk_atom_intern ("DROPFILES_DND", FALSE); diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index be741cf538..3eda1a9834 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -416,6 +416,10 @@ extern GdkAtom _utf8_string; extern GdkAtom _text; extern GdkAtom _compound_text; extern GdkAtom _text_uri_list; +extern GdkAtom _image_png; +extern GdkAtom _image_jpeg; +extern GdkAtom _image_bmp; +extern GdkAtom _image_gif; /* DND selections */ extern GdkAtom _local_dnd; diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index dea0aa11f4..0f6b165165 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -63,10 +63,6 @@ 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; @@ -122,22 +118,17 @@ _gdk_win32_selection_init (void) 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); + _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 @@ -263,13 +254,13 @@ _gdk_dropfiles_store (gchar *data) 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); @@ -453,7 +444,7 @@ gdk_selection_convert (GdkWindow *requestor, { if (fmt == cf_png) { - targets[ntargets++] = image_png; + targets[ntargets++] = _image_png; has_png = TRUE; } } @@ -481,21 +472,21 @@ gdk_selection_convert (GdkWindow *requestor, * transparency. */ if (!has_bmp && !has_png) - targets[ntargets++] = image_bmp; + targets[ntargets++] = _image_bmp; has_bmp = TRUE; } else if (fmt == cf_jfif) { /* Ditto for JPEG */ if (!has_png) - targets[ntargets++] = image_jpeg; + targets[ntargets++] = _image_jpeg; } 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) { @@ -592,7 +583,7 @@ gdk_selection_convert (GdkWindow *requestor, 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; @@ -746,7 +737,7 @@ gdk_selection_convert (GdkWindow *requestor, data_length); } - selection_property_store (requestor, image_bmp, 8, + selection_property_store (requestor, _image_bmp, 8, data, new_length); } GlobalUnlock (hdata); @@ -1294,7 +1285,7 @@ _gdk_win32_selection_convert_to_dib (HGLOBAL hdata, g_free (target_name); }); - if (target == image_bmp) + if (target == _image_bmp) { /* No conversion is needed, just strip the BITMAPFILEHEADER */ HGLOBAL hdatanew;