Commit 54a62731 authored by Matthias Clasen's avatar Matthias Clasen

Drop gdk_atom_intern

Atoms are just interned strings now, so we can just
use g_intern_string.
parent 4c083c1e
......@@ -121,11 +121,11 @@ _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay *display,
g_return_val_if_fail (length >= 0, 0);
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
if (encoding == gdk_atom_intern_static_string ("STRING"))
if (encoding == g_intern_static_string ("STRING"))
{
return make_list ((gchar *)text, length, TRUE, list);
}
else if (encoding == gdk_atom_intern_static_string ("UTF8_STRING"))
else if (encoding == g_intern_static_string ("UTF8_STRING"))
{
return make_list ((gchar *)text, length, FALSE, list);
}
......
......@@ -55,51 +55,3 @@
* to and from strings and to manipulate some types of
* data commonly stored in X window properties.
*/
/**
* gdk_atom_intern:
* @atom_name: a string.
* @only_if_exists: if %TRUE, GDK is allowed to not create a new atom, but
* just return %NULL if the requested atom doesn’t already
* exists. Currently, the flag is ignored, since checking the
* existance of an atom is as expensive as creating it.
*
* Finds or creates an atom corresponding to a given string.
*
* Returns: (transfer none): the atom corresponding to @atom_name.
*/
GdkAtom
gdk_atom_intern (const gchar *atom_name,
gboolean only_if_exists)
{
g_return_val_if_fail (atom_name != NULL, NULL);
return g_intern_string (atom_name);
}
/**
* gdk_atom_intern_static_string:
* @atom_name: a static string
*
* Finds or creates an atom corresponding to a given string.
*
* Note that this function is identical to gdk_atom_intern() except
* that if a new #GdkAtom is created the string itself is used rather
* than a copy. This saves memory, but can only be used if the string
* will always exist. It can be used with statically
* allocated strings in the main program, but not with statically
* allocated memory in dynamically loaded modules, if you expect to
* ever unload the module again (e.g. do not use this function in
* GTK+ theme engines).
*
* Returns: (transfer none): the atom corresponding to @atom_name
*
* Since: 2.10
*/
GdkAtom
gdk_atom_intern_static_string (const gchar *atom_name)
{
g_return_val_if_fail (atom_name != NULL, NULL);
return g_intern_static_string (atom_name);
}
......@@ -35,13 +35,6 @@
G_BEGIN_DECLS
GDK_AVAILABLE_IN_ALL
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
gint gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
GdkAtom encoding,
......
......@@ -109,11 +109,11 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (length >= 0, 0);
if (encoding == gdk_atom_intern_static_string ("STRING"))
if (encoding == g_intern_static_string ("STRING"))
{
return make_list ((gchar *)text, length, TRUE, list);
}
else if (encoding == gdk_atom_intern_static_string ("UTF8_STRING"))
else if (encoding == g_intern_static_string ("UTF8_STRING"))
{
return make_list ((gchar *)text, length, FALSE, list);
}
......@@ -132,15 +132,15 @@ GdkAtom
gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type)
{
if ([type isEqualToString:NSStringPboardType])
return gdk_atom_intern_static_string ("UTF8_STRING");
return g_intern_static_string ("UTF8_STRING");
else if ([type isEqualToString:NSTIFFPboardType])
return gdk_atom_intern_static_string ("image/tiff");
return g_intern_static_string ("image/tiff");
else if ([type isEqualToString:NSColorPboardType])
return gdk_atom_intern_static_string ("application/x-color");
return g_intern_static_string ("application/x-color");
else if ([type isEqualToString:NSURLPboardType])
return gdk_atom_intern_static_string ("text/uri-list");
return g_intern_static_string ("text/uri-list");
else
return gdk_atom_intern ([type UTF8String], FALSE);
return g_intern_string ([type UTF8String]);
}
NSString *
......
......@@ -240,7 +240,7 @@ gdk_wayland_drop_context_set_status (GdkDragContext *context,
mimetypes = gdk_content_formats_get_mime_types (context->formats, &n_mimetypes);
for (i = 0; i < n_mimetypes; i++)
{
if (mimetypes[i] != gdk_atom_intern_static_string ("DELETE"))
if (mimetypes[i] != g_intern_static_string ("DELETE"))
break;
}
......
......@@ -366,38 +366,38 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
win32_selection->known_atoms = atoms;
win32_selection->known_clipboard_formats = cfs;
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_GDK_SELECTION) = gdk_atom_intern_static_string ("GDK_SELECTION");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CLIPBOARD_MANAGER) = gdk_atom_intern_static_string ("CLIPBOARD_MANAGER");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_WM_TRANSIENT_FOR) = gdk_atom_intern_static_string ("WM_TRANSIENT_FOR");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_TARGETS) = gdk_atom_intern_static_string ("TARGETS");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_DELETE) = gdk_atom_intern_static_string ("DELETE");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_SAVE_TARGETS) = gdk_atom_intern_static_string ("SAVE_TARGETS");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_UTF8_STRING) = gdk_atom_intern_static_string ("UTF8_STRING");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_TEXT) = gdk_atom_intern_static_string ("TEXT");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_COMPOUND_TEXT) = gdk_atom_intern_static_string ("COMPOUND_TEXT");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_TEXT_URI_LIST) = gdk_atom_intern_static_string ("text/uri-list");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_TEXT_HTML) = gdk_atom_intern_static_string ("text/html");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG) = gdk_atom_intern_static_string ("image/png");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_JPEG) = gdk_atom_intern_static_string ("image/jpeg");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP) = gdk_atom_intern_static_string ("image/bmp");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_GIF) = gdk_atom_intern_static_string ("image/gif");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_LOCAL_DND_SELECTION) = gdk_atom_intern_static_string ("LocalDndSelection");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_DROPFILES_DND) = gdk_atom_intern_static_string ("DROPFILES_DND");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_OLE2_DND) = gdk_atom_intern_static_string ("OLE2_DND");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_PNG)= gdk_atom_intern_static_string ("PNG");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_JFIF) = gdk_atom_intern_static_string ("JFIF");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_GIF) = gdk_atom_intern_static_string ("GIF");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_GDK_SELECTION) = g_intern_static_string ("GDK_SELECTION");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CLIPBOARD_MANAGER) = g_intern_static_string ("CLIPBOARD_MANAGER");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_WM_TRANSIENT_FOR) = g_intern_static_string ("WM_TRANSIENT_FOR");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_TARGETS) = g_intern_static_string ("TARGETS");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_DELETE) = g_intern_static_string ("DELETE");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_SAVE_TARGETS) = g_intern_static_string ("SAVE_TARGETS");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_UTF8_STRING) = g_intern_static_string ("UTF8_STRING");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_TEXT) = g_intern_static_string ("TEXT");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_COMPOUND_TEXT) = g_intern_static_string ("COMPOUND_TEXT");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_TEXT_URI_LIST) = g_intern_static_string ("text/uri-list");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_TEXT_HTML) = g_intern_static_string ("text/html");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_PNG) = g_intern_static_string ("image/png");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_JPEG) = g_intern_static_string ("image/jpeg");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_BMP) = g_intern_static_string ("image/bmp");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_IMAGE_GIF) = g_intern_static_string ("image/gif");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_LOCAL_DND_SELECTION) = g_intern_static_string ("LocalDndSelection");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_DROPFILES_DND) = g_intern_static_string ("DROPFILES_DND");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_OLE2_DND) = g_intern_static_string ("OLE2_DND");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_PNG)= g_intern_static_string ("PNG");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_JFIF) = g_intern_static_string ("JFIF");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_GIF) = g_intern_static_string ("GIF");
/* These are a bit unusual. It's here to allow GTK+ applications
* to actually support CF_DIB and Shell ID List clipboard formats on their own,
* instead of allowing GDK to use them internally for interoperability.
*/
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CF_DIB) = gdk_atom_intern_static_string ("CF_DIB");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CFSTR_SHELLIDLIST) = gdk_atom_intern_static_string (CFSTR_SHELLIDLIST);
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CF_UNICODETEXT) = gdk_atom_intern_static_string ("CF_UNICODETEXT");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CF_TEXT) = gdk_atom_intern_static_string ("CF_TEXT");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CF_DIB) = g_intern_static_string ("CF_DIB");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CFSTR_SHELLIDLIST) = g_intern_static_string (CFSTR_SHELLIDLIST);
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CF_UNICODETEXT) = g_intern_static_string ("CF_UNICODETEXT");
_gdk_atom_array_index (atoms, GDK_WIN32_ATOM_INDEX_CF_TEXT) = g_intern_static_string ("CF_TEXT");
/* MS Office 2007, at least, offers images in common file formats
* using clipboard format names like "PNG" and "JFIF". So we follow
......@@ -448,7 +448,7 @@ gdk_win32_selection_init (GdkWin32Selection *win32_selection)
gchar **mime_type;
for (mime_type = mime_types; *mime_type != NULL; mime_type++)
win32_selection->known_pixbuf_formats[i++] = gdk_atom_intern (*mime_type, FALSE);
win32_selection->known_pixbuf_formats[i++] = g_intern_string (*mime_type);
}
g_slist_free (pixbuf_formats);
......@@ -1050,7 +1050,7 @@ _gdk_win32_add_format_to_targets (UINT format,
if (format_name != NULL)
{
target_atom = gdk_atom_intern (format_name, FALSE);
target_atom = g_intern_string (format_name);
GDK_NOTE (DND, g_print ("Maybe add as-is format %s (0x%p)\n", format_name, target_atom));
g_free (format_name);
if (array && target_atom != 0)
......@@ -2544,7 +2544,7 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
if (!list)
return 0;
if (encoding == gdk_atom_intern_static_string ("STRING"))
if (encoding == g_intern_static_string ("STRING"))
source_charset = g_strdup ("ISO-8859-1");
else if (encoding == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_UTF8_STRING))
source_charset = g_strdup ("UTF-8");
......@@ -2655,7 +2655,7 @@ _gdk_win32_display_text_property_to_utf8_list (GdkDisplay *display,
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (length >= 0, 0);
if (encoding == gdk_atom_intern_static_string ("STRING"))
if (encoding == g_intern_static_string ("STRING"))
{
return make_list ((gchar *)text, length, TRUE, list);
}
......
......@@ -520,7 +520,7 @@ gdk_check_wm_state_changed (GdkWindow *window)
}
if (!gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_NET_WM_STATE_FOCUSED")))
g_intern_static_string ("_NET_WM_STATE_FOCUSED")))
toplevel->have_focused = TRUE;
/* When have_sticky is turned on, we have to check the DESKTOP property
......@@ -847,7 +847,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
*/
if (x11_screen &&
!gdk_x11_screen_supports_net_wm_hint (x11_screen,
gdk_atom_intern_static_string ("_NET_WM_STATE_HIDDEN")))
g_intern_static_string ("_NET_WM_STATE_HIDDEN")))
{
/* If we are shown (not withdrawn) and get an unmap, it means we were
* iconified in the X sense. If we are withdrawn, and get an unmap, it
......
......@@ -1013,7 +1013,7 @@ xdnd_initialize_actions (void)
xdnd_actions_initialized = TRUE;
for (i = 0; i < xdnd_n_actions; i++)
xdnd_actions_table[i].atom = gdk_atom_intern_static_string (xdnd_actions_table[i].name);
xdnd_actions_table[i].atom = g_intern_static_string (xdnd_actions_table[i].name);
}
static GdkDragAction
......
......@@ -126,7 +126,7 @@ _gdk_x11_precache_atoms (GdkDisplay *display,
n_xatoms = 0;
for (i = 0; i < n_atoms; i++)
{
GdkAtom atom = gdk_atom_intern_static_string (atom_names[i]);
GdkAtom atom = g_intern_static_string (atom_names[i]);
if (lookup_cached_xatom (display, atom) == None)
{
atoms[n_xatoms] = atom;
......@@ -209,7 +209,7 @@ gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
}
else
{
virtual_atom = gdk_atom_intern (name, FALSE);
virtual_atom = g_intern_string (name);
XFree (name);
insert_atom_pair (display, virtual_atom, xatom);
......@@ -252,8 +252,7 @@ gdk_x11_get_xatom_by_name_for_display (GdkDisplay *display,
const gchar *atom_name)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), None);
return gdk_x11_atom_to_xatom_for_display (display,
gdk_atom_intern (atom_name, FALSE));
return gdk_x11_atom_to_xatom_for_display (display, g_intern_string (atom_name));
}
Atom
......
......@@ -156,7 +156,7 @@ get_current_desktop (GdkX11Screen *screen)
int workspace = 0;
if (!gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_NET_CURRENT_DESKTOP")))
g_intern_static_string ("_NET_CURRENT_DESKTOP")))
return workspace;
display = GDK_DISPLAY_XDISPLAY (GDK_SCREEN_DISPLAY (screen));
......@@ -208,7 +208,7 @@ gdk_x11_screen_get_work_area (GdkX11Screen *x11_screen,
area->height = HeightOfScreen (x11_screen->xscreen);
if (!gdk_x11_screen_supports_net_wm_hint (x11_screen,
gdk_atom_intern_static_string ("_NET_WORKAREA")))
g_intern_static_string ("_NET_WORKAREA")))
return;
if (workarea == None)
......@@ -1248,7 +1248,7 @@ get_netwm_cardinal_property (GdkX11Screen *x11_screen,
gulong bytes_after;
guchar *data;
atom = gdk_atom_intern_static_string (name);
atom = g_intern_static_string (name);
if (!gdk_x11_screen_supports_net_wm_hint (x11_screen, atom))
return 0;
......
......@@ -199,11 +199,11 @@ _gdk_x11_display_text_property_to_utf8_list (GdkDisplay *display,
gint length,
gchar ***list)
{
if (encoding == gdk_atom_intern_static_string ("STRING"))
if (encoding == g_intern_static_string ("STRING"))
{
return make_list ((gchar *)text, length, TRUE, list);
}
else if (encoding == gdk_atom_intern_static_string ("UTF8_STRING"))
else if (encoding == g_intern_static_string ("UTF8_STRING"))
{
return make_list ((gchar *)text, length, FALSE, list);
}
......
......@@ -174,7 +174,7 @@ gdk_x11_text_list_converter_encode (GdkX11TextListConverter *conv,
if (gdk_x11_display_utf8_to_compound_text (conv->display, tmp,
&encoding, &format, &text, &new_length))
{
if (encoding == gdk_atom_intern (conv->encoding, FALSE) &&
if (encoding == g_intern_string (conv->encoding) &&
format == conv->format)
{
result = write_output (outbuf, outbuf_size, bytes_written, text, new_length, error);
......
......@@ -213,7 +213,7 @@ static gboolean
gdk_x11_window_supports_edge_constraints (GdkWindow *window)
{
return gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_GTK_EDGE_CONSTRAINTS"));
g_intern_static_string ("_GTK_EDGE_CONSTRAINTS"));
}
static void
......@@ -437,7 +437,7 @@ gdk_x11_window_end_frame (GdkWindow *window)
if (impl->frame_sync_enabled &&
gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_WM_FRAME_DRAWN")))
g_intern_static_string ("_NET_WM_FRAME_DRAWN")))
{
impl->toplevel->frame_pending = TRUE;
_gdk_frame_clock_freeze (gdk_window_get_frame_clock (window));
......@@ -1721,7 +1721,7 @@ get_netwm_cardinal_property (GdkWindow *window,
gulong bytes_after;
guchar *data;
atom = gdk_atom_intern_static_string (name);
atom = g_intern_static_string (name);
if (!gdk_x11_screen_supports_net_wm_hint (x11_screen, atom))
return 0;
......@@ -1779,7 +1779,7 @@ gdk_x11_window_move_to_desktop (GdkWindow *window,
g_return_if_fail (GDK_IS_WINDOW (window));
atom = gdk_atom_intern_static_string ("_NET_WM_DESKTOP");
atom = g_intern_static_string ("_NET_WM_DESKTOP");
if (!gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), atom))
return;
......@@ -1819,7 +1819,7 @@ gdk_x11_window_focus (GdkWindow *window,
display = GDK_WINDOW_DISPLAY (window);
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
g_intern_static_string ("_NET_ACTIVE_WINDOW")))
{
XClientMessageEvent xclient;
......@@ -2031,7 +2031,7 @@ gdk_x11_window_set_modal_hint (GdkWindow *window,
if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (modal, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_MODAL"),
g_intern_static_string ("_NET_WM_STATE_MODAL"),
NULL);
}
......@@ -2052,7 +2052,7 @@ gdk_x11_window_set_skip_taskbar_hint (GdkWindow *window,
if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (skips_taskbar, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_SKIP_TASKBAR"),
g_intern_static_string ("_NET_WM_STATE_SKIP_TASKBAR"),
NULL);
}
......@@ -2073,7 +2073,7 @@ gdk_x11_window_set_skip_pager_hint (GdkWindow *window,
if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (skips_pager, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_SKIP_PAGER"),
g_intern_static_string ("_NET_WM_STATE_SKIP_PAGER"),
NULL);
}
......@@ -2590,7 +2590,7 @@ gdk_x11_window_get_frame_extents (GdkWindow *window,
/* first try: use _NET_FRAME_EXTENTS */
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_FRAME_EXTENTS")) &&
g_intern_static_string ("_NET_FRAME_EXTENTS")) &&
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), xwindow,
gdk_x11_get_xatom_by_name_for_display (display,
"_NET_FRAME_EXTENTS"),
......@@ -2639,7 +2639,7 @@ gdk_x11_window_get_frame_extents (GdkWindow *window,
root = GDK_WINDOW_XROOTWIN (window);
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_VIRTUAL_ROOTS")) &&
g_intern_static_string ("_NET_VIRTUAL_ROOTS")) &&
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), root,
gdk_x11_get_xatom_by_name_for_display (display,
"_NET_VIRTUAL_ROOTS"),
......@@ -2919,7 +2919,7 @@ gdk_x11_window_set_user_time (GdkWindow *window,
if (toplevel->focus_window != None &&
gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_WM_USER_TIME_WINDOW")))
g_intern_static_string ("_NET_WM_USER_TIME_WINDOW")))
xid = toplevel->focus_window;
else
xid = GDK_WINDOW_XID (window);
......@@ -3309,7 +3309,7 @@ gdk_x11_window_iconify (GdkWindow *window)
0,
GDK_WINDOW_STATE_ICONIFIED);
gdk_wmspec_change_state (TRUE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_HIDDEN"),
g_intern_static_string ("_NET_WM_STATE_HIDDEN"),
NULL);
}
}
......@@ -3325,7 +3325,7 @@ gdk_x11_window_deiconify (GdkWindow *window)
{
gdk_window_show (window);
gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_HIDDEN"),
g_intern_static_string ("_NET_WM_STATE_HIDDEN"),
NULL);
}
else
......@@ -3335,7 +3335,7 @@ gdk_x11_window_deiconify (GdkWindow *window)
GDK_WINDOW_STATE_ICONIFIED,
0);
gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_HIDDEN"),
g_intern_static_string ("_NET_WM_STATE_HIDDEN"),
NULL);
}
}
......@@ -3357,7 +3357,7 @@ gdk_x11_window_stick (GdkWindow *window)
/* Request stick during viewport scroll */
gdk_wmspec_change_state (TRUE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_STICKY"),
g_intern_static_string ("_NET_WM_STATE_STICKY"),
NULL);
/* Request desktop 0xFFFFFFFF */
......@@ -3399,7 +3399,7 @@ gdk_x11_window_unstick (GdkWindow *window)
{
/* Request unstick from viewport */
gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_STICKY"),
g_intern_static_string ("_NET_WM_STATE_STICKY"),
NULL);
move_to_current_desktop (window);
......@@ -3423,8 +3423,8 @@ gdk_x11_window_maximize (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (TRUE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_MAXIMIZED_VERT"),
gdk_atom_intern_static_string ("_NET_WM_STATE_MAXIMIZED_HORZ"));
g_intern_static_string ("_NET_WM_STATE_MAXIMIZED_VERT"),
g_intern_static_string ("_NET_WM_STATE_MAXIMIZED_HORZ"));
else
gdk_synthesize_window_state (window,
0,
......@@ -3440,8 +3440,8 @@ gdk_x11_window_unmaximize (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_MAXIMIZED_VERT"),
gdk_atom_intern_static_string ("_NET_WM_STATE_MAXIMIZED_HORZ"));
g_intern_static_string ("_NET_WM_STATE_MAXIMIZED_VERT"),
g_intern_static_string ("_NET_WM_STATE_MAXIMIZED_HORZ"));
else
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_MAXIMIZED,
......@@ -3550,7 +3550,7 @@ gdk_x11_window_fullscreen (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window))
{
gdk_wmspec_change_state (TRUE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_FULLSCREEN"),
g_intern_static_string ("_NET_WM_STATE_FULLSCREEN"),
NULL);
/* Actual XRandR layout may have change since we computed the fullscreen
* monitors in GDK_FULLSCREEN_ON_ALL_MONITORS mode.
......@@ -3590,7 +3590,7 @@ gdk_x11_window_unfullscreen (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_FULLSCREEN"),
g_intern_static_string ("_NET_WM_STATE_FULLSCREEN"),
NULL);
else
......@@ -3613,10 +3613,10 @@ gdk_x11_window_set_keep_above (GdkWindow *window,
{
if (setting)
gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_BELOW"),
g_intern_static_string ("_NET_WM_STATE_BELOW"),
NULL);
gdk_wmspec_change_state (setting, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_ABOVE"),
g_intern_static_string ("_NET_WM_STATE_ABOVE"),
NULL);
}
else
......@@ -3638,10 +3638,10 @@ gdk_x11_window_set_keep_below (GdkWindow *window, gboolean setting)
{
if (setting)
gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_ABOVE"),
g_intern_static_string ("_NET_WM_STATE_ABOVE"),
NULL);
gdk_wmspec_change_state (setting, window,
gdk_atom_intern_static_string ("_NET_WM_STATE_BELOW"),
g_intern_static_string ("_NET_WM_STATE_BELOW"),
NULL);
}
else
......@@ -4590,7 +4590,7 @@ _should_perform_ewmh_drag (GdkWindow *window,
if ((!info->last_slave || gdk_device_get_source (info->last_slave) != GDK_SOURCE_TOUCHSCREEN) &&
gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_WM_MOVERESIZE")))
g_intern_static_string ("_NET_WM_MOVERESIZE")))
return TRUE;
return FALSE;
......@@ -4881,7 +4881,7 @@ gdk_x11_window_show_window_menu (GdkWindow *window,
}
if (!gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_GTK_SHOW_WINDOW_MENU")))
g_intern_static_string ("_GTK_SHOW_WINDOW_MENU")))
return FALSE;
gdk_event_get_root_coords (event, &x_root, &y_root);
......
......@@ -203,7 +203,7 @@ swatch_drag_data_get (GtkWidget *widget,
vals[3] = color.alpha * 0xffff;
gtk_selection_data_set (selection_data,
gdk_atom_intern_static_string ("application/x-color"),
g_intern_static_string ("application/x-color"),
16, (guchar *)vals, 8);
}
......
......@@ -596,7 +596,7 @@ gtk_drag_selection_received (GtkWidget *widget,
context = g_object_get_data (G_OBJECT (widget), "drag-context");
target = gtk_selection_data_get_target (selection_data);
if (target == gdk_atom_intern_static_string ("DELETE"))
if (target == g_intern_static_string ("DELETE"))
{
gdk_drop_finish (context, TRUE, time);
}
......@@ -1014,7 +1014,7 @@ gtk_drag_content_write_mime_type_async (GdkContentProvider *provider,
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, gtk_drag_content_write_mime_type_async);
sdata.target = gdk_atom_intern (mime_type, FALSE);
sdata.target = g_intern_string (mime_type);
sdata.length = -1;
sdata.display = gtk_widget_get_display (content->widget);
......@@ -1562,9 +1562,9 @@ gtk_drag_selection_get (GtkWidget *widget,
static GdkAtom null_atom = NULL;
if (!null_atom)
null_atom = gdk_atom_intern_static_string ("NULL");
null_atom = g_intern_static_string ("NULL");
if (gtk_selection_data_get_target (selection_data) == gdk_atom_intern_static_string ("DELETE"))
if (gtk_selection_data_get_target (selection_data) == g_intern_static_string ("DELETE"))
{
g_signal_emit_by_name (info->widget,
"drag-data-delete",
......
......@@ -6288,7 +6288,7 @@ gtk_icon_view_drag_data_get (GtkWidget *widget,
goto done;
/* If drag_data_get does nothing, try providing row data. */
if (gtk_selection_data_get_target (selection_data) == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
if (gtk_selection_data_get_target (selection_data) == g_intern_static_string ("GTK_TREE_MODEL_ROW"))
gtk_tree_set_row_drag_data (selection_data,
model,
source_row);
......@@ -6386,7 +6386,7 @@ gtk_icon_view_drag_motion (GtkWidget *widget,
g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk+] drag_scroll_timeout");
}
if (target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
if (target == g_intern_static_string ("GTK_TREE_MODEL_ROW"))
{
/* Request data so we can use the source row when
* determining whether to accept the drop
......
......@@ -3087,7 +3087,7 @@ gtk_notebook_drag_motion (GtkWidget *widget,
stop_scrolling (notebook);
target = gtk_drag_dest_find_target (widget, context, NULL);
tab_target = gdk_atom_intern_static_string ("GTK_NOTEBOOK_TAB");
tab_target = g_intern_static_string ("GTK_NOTEBOOK_TAB");
if (target == tab_target)
{
......@@ -3172,7 +3172,7 @@ gtk_notebook_drag_drop (GtkWidget *widget,
GdkAtom target, tab_target;
target = gtk_drag_dest_find_target (widget, context, NULL);
tab_target = gdk_atom_intern_static_string ("GTK_NOTEBOOK_TAB");
tab_target = g_intern_static_string ("GTK_NOTEBOOK_TAB");
if (target == tab_target)
{
......@@ -3274,7 +3274,7 @@ gtk_notebook_drag_data_get (GtkWidget *widget,
GdkAtom target;
target = gtk_selection_data_get_target (data);
if (target == gdk_atom_intern_static_string ("GTK_NOTEBOOK_TAB"))
if (target == g_intern_static_string ("GTK_NOTEBOOK_TAB"))
{
gtk_selection_data_set (data,
target,
......@@ -3283,7 +3283,7 @@ gtk_notebook_drag_data_get (GtkWidget *widget,
sizeof (gpointer));
priv->rootwindow_drop = FALSE;
}
else if (target == gdk_atom_intern_static_string ("application/x-rootwindow-drop"))
else if (target == g_intern_static_string ("application/x-rootwindow-drop"))
{
gtk_selection_data_set (data, target, 8, NULL, 0);
priv->rootwindow_drop = TRUE;
......@@ -3304,7 +3304,7 @@ gtk_notebook_drag_data_received (GtkWidget *widget,
source_widget = gtk_drag_get_source_widget (context);
if (source_widget &&
gtk_selection_data_get_target (data) == gdk_atom_intern_static_string ("GTK_NOTEBOOK_TAB"))
gtk_selection_data_get_target (data) == g_intern_static_string ("GTK_NOTEBOOK_TAB"))
{
child = (void*) gtk_selection_data_get_data (data);
......
......@@ -1977,7 +1977,7 @@ drag_data_get_callback (GtkWidget *widget,
GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (user_data);
GdkAtom target = gtk_selection_data_get_target (data);
if (target == gdk_atom_intern_static_string ("DND_GTK_SIDEBAR_ROW"))
if (target == g_intern_static_string ("DND_GTK_SIDEBAR_ROW"))
{
gtk_selection_data_set (data,
target,
......@@ -2021,7 +2021,7 @@ drag_data_received_callback (GtkWidget *list_box,
else
{
sidebar->drag_list = NULL;
if (gtk_selection_data_get_target (selection_data) == gdk_atom_intern_static_string ("DND_GTK_SIDEBAR_ROW"))
if (gtk_selection_data_get_target (selection_data) == g_intern_static_string ("DND_GTK_SIDEBAR_ROW"))
sidebar->drag_data_info = DND_GTK_SIDEBAR_ROW;
}
sidebar->drag_data_received = TRUE;
......
......@@ -184,7 +184,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
selection_data->target = target;
if (!selection_data->display)
selection_data->display = gdk_display_get_default ();
if (target == gdk_atom_intern_static_string ("UTF8_STRING"))
if (target == g_intern_static_string ("UTF8_STRING"))
{
NSString *s = [pasteboard stringForType:NSStringPboardType];
......@@ -197,7 +197,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
(guchar *)utf8_string, strlen (utf8_string));
}
}
else if (target == gdk_atom_intern_static_string ("application/x-color"))
else if (target == g_intern_static_string ("application/x-color"))
{
NSColor *nscolor = [[NSColor colorFromPasteboard:pasteboard]
colorUsingColorSpaceName:NSDeviceRGBColorSpace];
......@@ -213,7 +213,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
gtk_selection_data_set (selection_data, target, 16, (guchar *)color, 8);
}
else if (target == gdk_atom_intern_static_string ("text/uri-list"))
else if (target == g_intern_static_string ("text/uri-list"))
{
if ([[pasteboard types] containsObject:NSFilenamesPboardType])
{
......@@ -222,7 +222,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
int n_files = [files count];
int i;
selection_data->target = gdk_atom_intern_static_string ("text/uri-list");
selection_data->target = g_intern_static_string ("text/uri-list");
uris = (gchar **) g_malloc (sizeof (gchar*) * (n_files + 1));
for (i = 0; i < n_files; ++i)
......@@ -242,7 +242,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
gchar *uris[2];
NSURL *url = [NSURL URLFromPasteboard:pasteboard];
selection_data->target = gdk_atom_intern_static_string ("text/uri-list");
selection_data->target = g_intern_static_string ("text/uri-list");
uris[0] = (gchar *) [[url description] UTF8String];
......
......@@ -129,17 +129,17 @@ init_atoms (void)
if (!utf8_atom)
{
utf8_atom = gdk_atom_intern_static_string ("UTF8_STRING");
text_atom = gdk_atom_intern_static_string ("TEXT");
ctext_atom = gdk_atom_intern_static_string ("COMPOUND_TEXT");
text_plain_atom = gdk_atom_intern_static_string ("text/plain");
text_plain_utf8_atom = gdk_atom_intern_static_string ("text/plain;charset=utf-8");
utf8_atom = g_intern_static_string ("UTF8_STRING");
text_atom = g_intern_static_string ("TEXT");