forked from AuroraMiddleware/gtk
Drop gdk_atom_name
Since atoms are just interned strings now, we can just cast them to const char * where needed.
This commit is contained in:
parent
e3e9bf4bea
commit
4c083c1ed4
@ -428,7 +428,6 @@ void gdk_synthesize_window_state (GdkWindow *window,
|
||||
GdkWindowState unset_flags,
|
||||
GdkWindowState set_flags);
|
||||
|
||||
const char * _gdk_atom_name_const (GdkAtom atom);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -103,25 +103,3 @@ gdk_atom_intern_static_string (const gchar *atom_name)
|
||||
|
||||
return g_intern_static_string (atom_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_atom_name:
|
||||
* @atom: a #GdkAtom.
|
||||
*
|
||||
* Determines the string corresponding to an atom.
|
||||
*
|
||||
* Returns: a newly-allocated string containing the string
|
||||
* corresponding to @atom. When you are done with the
|
||||
* return value, you should free it using g_free().
|
||||
*/
|
||||
gchar *
|
||||
gdk_atom_name (GdkAtom atom)
|
||||
{
|
||||
return g_strdup (_gdk_atom_name_const (atom));
|
||||
}
|
||||
|
||||
const gchar *
|
||||
_gdk_atom_name_const (GdkAtom atom)
|
||||
{
|
||||
return atom;
|
||||
}
|
||||
|
@ -40,8 +40,6 @@ GdkAtom gdk_atom_intern (const gchar *atom_name,
|
||||
gboolean only_if_exists);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkAtom gdk_atom_intern_static_string (const gchar *atom_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gchar* gdk_atom_name (GdkAtom atom);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -119,10 +119,7 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *enc_name = gdk_atom_name (encoding);
|
||||
|
||||
g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled", enc_name);
|
||||
g_free (enc_name);
|
||||
g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled", (const char *)encoding);
|
||||
|
||||
if (list)
|
||||
*list = NULL;
|
||||
@ -164,9 +161,8 @@ gdk_quartz_target_to_pasteboard_type_libgtk_only (const char *target)
|
||||
NSString *
|
||||
gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom)
|
||||
{
|
||||
gchar *target = gdk_atom_name (atom);
|
||||
const char *target = (const char *)atom;
|
||||
NSString *ret = gdk_quartz_target_to_pasteboard_type_libgtk_only (target);
|
||||
g_free (target);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1083,10 +1083,9 @@ idataobject_getdata (LPDATAOBJECT This,
|
||||
}
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
gchar *target_name = gdk_atom_name (target);
|
||||
const char *target_name = (const char *)target;
|
||||
g_print ("idataobject_getdata will request target 0x%p (%s) ",
|
||||
target, target_name);
|
||||
g_free (target_name);
|
||||
});
|
||||
|
||||
|
||||
|
@ -763,7 +763,7 @@ void
|
||||
_gdk_win32_print_event (const GdkEvent *event)
|
||||
{
|
||||
gchar *escaped, *kvname;
|
||||
gchar *selection_name, *target_name, *property_name;
|
||||
const char *selection_name, *target_name, *property_name;
|
||||
|
||||
g_print ("%s%*s===> ", (debug_indent > 0 ? "\n" : ""), debug_indent, "");
|
||||
switch (event->any.type)
|
||||
@ -877,14 +877,11 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
case GDK_SELECTION_CLEAR:
|
||||
case GDK_SELECTION_REQUEST:
|
||||
case GDK_SELECTION_NOTIFY:
|
||||
selection_name = gdk_atom_name (event->selection.selection);
|
||||
target_name = gdk_atom_name (event->selection.target);
|
||||
property_name = gdk_atom_name (event->selection.property);
|
||||
selection_name = (const char *)event->selection.selection;
|
||||
target_name = (const char *)event->selection.target;
|
||||
property_name = (const char *)event->selection.property;
|
||||
g_print ("sel:%s tgt:%s prop:%s",
|
||||
selection_name, target_name, property_name);
|
||||
g_free (selection_name);
|
||||
g_free (target_name);
|
||||
g_free (property_name);
|
||||
break;
|
||||
case GDK_DRAG_ENTER:
|
||||
case GDK_DRAG_LEAVE:
|
||||
|
@ -1701,10 +1701,9 @@ convert_clipboard_selection_to_targets_target (GdkWindow *requestor)
|
||||
g_print ("... ");
|
||||
for (i = 0; i < targets->len; i++)
|
||||
{
|
||||
gchar *atom_name = gdk_atom_name (g_array_index (targets, GdkSelTargetFormat, i).target);
|
||||
const char *atom_name = (const char *)g_array_index (targets, GdkSelTargetFormat, i).target;
|
||||
|
||||
g_print ("%s", atom_name);
|
||||
g_free (atom_name);
|
||||
if (i < targets->len - 1)
|
||||
g_print (", ");
|
||||
}
|
||||
@ -1743,9 +1742,9 @@ convert_clipboard_selection_to_target (GdkWindow *requestor,
|
||||
gboolean transmute = FALSE;
|
||||
GdkAtom result = _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_GDK_SELECTION);
|
||||
gboolean found;
|
||||
gchar *atom_name;
|
||||
const char *atom_name;
|
||||
|
||||
atom_name = gdk_atom_name (target);
|
||||
atom_name = (const char *)target;
|
||||
|
||||
for (format = 0, found = FALSE;
|
||||
!found && 0 != (format = EnumClipboardFormats (format));
|
||||
@ -1761,8 +1760,6 @@ convert_clipboard_selection_to_target (GdkWindow *requestor,
|
||||
g_free (format_name);
|
||||
}
|
||||
|
||||
g_free (atom_name);
|
||||
|
||||
if (format == 0)
|
||||
{
|
||||
gint i;
|
||||
@ -2025,12 +2022,11 @@ _gdk_win32_display_set_selection_owner (GdkDisplay *display,
|
||||
g_return_val_if_fail (selection != NULL, FALSE);
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
gchar *sel_name = gdk_atom_name (selection);
|
||||
const char *sel_name = (const char *)selection;
|
||||
|
||||
g_print ("gdk_selection_owner_set_for_display: %p %s\n",
|
||||
(owner ? GDK_WINDOW_HWND (owner) : NULL),
|
||||
sel_name);
|
||||
g_free (sel_name);
|
||||
});
|
||||
|
||||
if (selection != GDK_SELECTION_CLIPBOARD)
|
||||
@ -2128,12 +2124,11 @@ _gdk_win32_display_get_selection_owner (GdkDisplay *display,
|
||||
window = NULL;
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
gchar *sel_name = gdk_atom_name (selection);
|
||||
const char *sel_name = (const char *)selection;
|
||||
|
||||
g_print ("gdk_selection_owner_get: %s = %p\n",
|
||||
sel_name,
|
||||
(window ? GDK_WINDOW_HWND (window) : NULL));
|
||||
g_free (sel_name);
|
||||
});
|
||||
|
||||
return window;
|
||||
@ -2263,14 +2258,12 @@ _gdk_win32_display_convert_selection (GdkDisplay *display,
|
||||
return;
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
gchar *sel_name = gdk_atom_name (selection);
|
||||
gchar *tgt_name = gdk_atom_name (target);
|
||||
const char *sel_name = (const char *)selection;
|
||||
const char *tgt_name = (const char *)target;
|
||||
|
||||
g_print ("gdk_selection_convert: %p %s %s\n",
|
||||
GDK_WINDOW_HWND (requestor),
|
||||
sel_name, tgt_name);
|
||||
g_free (sel_name);
|
||||
g_free (tgt_name);
|
||||
});
|
||||
|
||||
if (selection == GDK_SELECTION_CLIPBOARD)
|
||||
@ -2421,8 +2414,8 @@ _gdk_win32_selection_property_change (GdkWin32Selection *win32_sel,
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *prop_name = gdk_atom_name (property);
|
||||
gchar *type_name = gdk_atom_name (type);
|
||||
const char *prop_name = (const char *)property;
|
||||
const char *type_name = (const char *)type;
|
||||
gchar *datastring = _gdk_win32_data_to_string (data, MIN (10, format*nelements/8));
|
||||
|
||||
g_warning ("Unsupported property change on window 0x%p, %s property %s, %d-bit, target 0x%x of %d bytes: %s",
|
||||
@ -2437,8 +2430,6 @@ _gdk_win32_selection_property_change (GdkWin32Selection *win32_sel,
|
||||
nelements,
|
||||
datastring);
|
||||
g_free (datastring);
|
||||
g_free (prop_name);
|
||||
g_free (type_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2477,7 +2468,7 @@ _gdk_win32_display_get_selection_property (GdkDisplay *display,
|
||||
memmove (*data, prop->data, prop->length);
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
gchar *type_name = gdk_atom_name (prop->target);
|
||||
const char *type_name = (const char *)prop->target;
|
||||
|
||||
g_print (" %s format:%d length:%"G_GSIZE_FORMAT"\n", type_name, prop->bitness, prop->length);
|
||||
g_free (type_name);
|
||||
@ -2518,15 +2509,12 @@ _gdk_win32_display_send_selection_notify (GdkDisplay *display,
|
||||
guint32 time)
|
||||
{
|
||||
GDK_NOTE (DND, {
|
||||
gchar *sel_name = gdk_atom_name (selection);
|
||||
gchar *tgt_name = gdk_atom_name (target);
|
||||
gchar *prop_name = gdk_atom_name (property);
|
||||
const char *sel_name = (const char *)selection;
|
||||
const char *tgt_name = (const char *)target;
|
||||
const char *prop_name = (const char *)property;
|
||||
|
||||
g_print ("gdk_selection_send_notify_for_display: %p %s %s %s (no-op)\n",
|
||||
requestor, sel_name, tgt_name, prop_name);
|
||||
g_free (sel_name);
|
||||
g_free (tgt_name);
|
||||
g_free (prop_name);
|
||||
});
|
||||
}
|
||||
|
||||
@ -2547,11 +2535,10 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
|
||||
gchar *source_charset;
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
gchar *enc_name = gdk_atom_name (encoding);
|
||||
const char *enc_name = (const char *)encoding;
|
||||
|
||||
g_print ("gdk_text_property_to_text_list_for_display: %s %d %.20s %d\n",
|
||||
enc_name, format, text, length);
|
||||
g_free (enc_name);
|
||||
});
|
||||
|
||||
if (!list)
|
||||
@ -2562,7 +2549,7 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
|
||||
else if (encoding == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_UTF8_STRING))
|
||||
source_charset = g_strdup ("UTF-8");
|
||||
else
|
||||
source_charset = gdk_atom_name (encoding);
|
||||
source_charset = g_strdup ((const char *)encoding);
|
||||
|
||||
g_get_charset (&charset);
|
||||
|
||||
@ -2678,10 +2665,9 @@ _gdk_win32_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *enc_name = gdk_atom_name (encoding);
|
||||
const char *enc_name = (const char *)encoding;
|
||||
|
||||
g_warning ("gdk_text_property_to_utf8_list_for_display: encoding %s not handled\n", enc_name);
|
||||
g_free (enc_name);
|
||||
|
||||
if (list)
|
||||
*list = NULL;
|
||||
@ -2718,10 +2704,9 @@ gdk_win32_selection_clear_targets (GdkDisplay *display,
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *sel_name = gdk_atom_name (selection);
|
||||
const char *sel_name = (const char *)selection;
|
||||
|
||||
g_warning ("Unsupported generic selection %s (0x%p)", sel_name, selection);
|
||||
g_free (sel_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2730,7 +2715,7 @@ _gdk_win32_add_target_to_selformats (GdkAtom target,
|
||||
GArray *array)
|
||||
{
|
||||
gint added_count = 0;
|
||||
gchar *target_name;
|
||||
const char *target_name;
|
||||
wchar_t *target_name_w;
|
||||
GdkSelTargetFormat fmt;
|
||||
gint i;
|
||||
@ -2764,9 +2749,8 @@ _gdk_win32_add_target_to_selformats (GdkAtom target,
|
||||
*/
|
||||
starting_point = array->len;
|
||||
|
||||
target_name = gdk_atom_name (target);
|
||||
target_name = (const char *)target;
|
||||
target_name_w = g_utf8_to_utf16 (target_name, -1, NULL, NULL, NULL);
|
||||
g_free (target_name);
|
||||
|
||||
if (target_name_w == NULL)
|
||||
return added_count;
|
||||
@ -2831,19 +2815,17 @@ gdk_win32_display_add_selection_targets (GdkDisplay *display,
|
||||
gint i;
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
gchar *sel_name = gdk_atom_name (selection);
|
||||
const char *sel_name = (const char *)selection;
|
||||
|
||||
g_print ("gdk_win32_selection_add_targets: %p: %s: ",
|
||||
owner ? GDK_WINDOW_HWND (owner) : NULL,
|
||||
sel_name);
|
||||
g_free (sel_name);
|
||||
|
||||
for (i = 0; i < ntargets; i++)
|
||||
{
|
||||
gchar *tgt_name = gdk_atom_name (targets[i]);
|
||||
const char *tgt_name = (const char *)targets[i];
|
||||
|
||||
g_print ("%s", tgt_name);
|
||||
g_free (tgt_name);
|
||||
if (i < ntargets - 1)
|
||||
g_print (", ");
|
||||
}
|
||||
@ -2875,9 +2857,8 @@ gdk_win32_display_add_selection_targets (GdkDisplay *display,
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *sel_name = gdk_atom_name (selection);
|
||||
const char *sel_name = (const char *)selection;
|
||||
|
||||
g_warning ("Unsupported generic selection %s (0x%p)", sel_name, selection);
|
||||
g_free (sel_name);
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ translate_valuator_class (GdkDisplay *display,
|
||||
label = NULL;
|
||||
|
||||
_gdk_device_add_axis (device, label, use, min, max, resolution);
|
||||
GDK_NOTE (INPUT, g_message ("\n\taxis: %s %s", gdk_atom_name (label), use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)"));
|
||||
GDK_NOTE (INPUT, g_message ("\n\taxis: %s %s", (const char *)label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)"));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -99,12 +99,10 @@ gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
|
||||
|
||||
if (!xatom)
|
||||
{
|
||||
char *name = gdk_atom_name (atom);
|
||||
const char *name = (const char *)atom;
|
||||
|
||||
xatom = XInternAtom (GDK_DISPLAY_XDISPLAY (display), name, FALSE);
|
||||
insert_atom_pair (display, atom, xatom);
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
|
||||
return xatom;
|
||||
@ -302,7 +300,7 @@ gdk_x11_get_xatom_by_name (const gchar *atom_name)
|
||||
*
|
||||
* Returns the name of an X atom for its display. This
|
||||
* function is meant mainly for debugging, so for convenience, unlike
|
||||
* XAtomName() and gdk_atom_name(), the result doesn’t need to
|
||||
* XAtomName() and the result doesn’t need to
|
||||
* be freed.
|
||||
*
|
||||
* Returns: name of the X atom; this string is owned by GDK,
|
||||
@ -316,7 +314,7 @@ gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
return _gdk_atom_name_const (gdk_x11_xatom_to_atom_for_display (display, xatom));
|
||||
return (const char *)gdk_x11_xatom_to_atom_for_display (display, xatom);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -325,7 +323,7 @@ gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
|
||||
*
|
||||
* Returns the name of an X atom for GDK’s default display. This
|
||||
* function is meant mainly for debugging, so for convenience, unlike
|
||||
* XAtomName() and gdk_atom_name(), the result
|
||||
* XAtomName() and the result
|
||||
* doesn’t need to be freed. Also, this function will never return %NULL,
|
||||
* even if @xatom is invalid.
|
||||
*
|
||||
@ -335,6 +333,6 @@ gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
|
||||
const gchar *
|
||||
gdk_x11_get_xatom_name (Atom xatom)
|
||||
{
|
||||
return _gdk_atom_name_const (gdk_x11_xatom_to_atom (xatom));
|
||||
return (const char *)gdk_x11_xatom_to_atom (xatom);
|
||||
}
|
||||
|
||||
|
@ -253,17 +253,15 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
|
||||
else
|
||||
{
|
||||
NSData *data;
|
||||
gchar *name;
|
||||
const char *name;
|
||||
|
||||
name = gdk_atom_name (target);
|
||||
name = (const char *)target;
|
||||
|
||||
if (strcmp (name, "image/tiff") == 0)
|
||||
data = [pasteboard dataForType:NSTIFFPboardType];
|
||||
else
|
||||
data = [pasteboard dataForType:[NSString stringWithUTF8String:name]];
|
||||
|
||||
g_free (name);
|
||||
|
||||
if (data)
|
||||
{
|
||||
gtk_selection_data_set (selection_data,
|
||||
|
Loading…
Reference in New Issue
Block a user