Broken pipe

This commit is contained in:
Matthias Clasen 2005-09-11 05:40:51 +00:00
parent 797c2e6a45
commit 1f700be359
7 changed files with 66 additions and 34 deletions

View File

@ -896,7 +896,7 @@ _gdk_windowing_set_default_display (GdkDisplay *display)
gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"), gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"),
gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8, gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
PropModeReplace, PropModeReplace,
startup_id, strlen (startup_id)); (guchar *)startup_id, strlen (startup_id));
} }
} }

View File

@ -1919,7 +1919,7 @@ xdnd_initialize_actions (void)
xdnd_actions_initialized = TRUE; xdnd_actions_initialized = TRUE;
for (i=0; i < xdnd_n_actions; i++) for (i=0; i < xdnd_n_actions; i++)
xdnd_actions_table[i].atom = gdk_atom_intern (xdnd_actions_table[i].name, FALSE); xdnd_actions_table[i].atom = gdk_atom_intern_static_string (xdnd_actions_table[i].name);
} }
static GdkDragAction static GdkDragAction
@ -2938,14 +2938,14 @@ _gdk_dnd_init (GdkDisplay *display)
gdk_display_add_client_message_filter ( gdk_display_add_client_message_filter (
display, display,
gdk_atom_intern ("_MOTIF_DRAG_AND_DROP_MESSAGE", FALSE), gdk_atom_intern_static_string ("_MOTIF_DRAG_AND_DROP_MESSAGE"),
motif_dnd_filter, NULL); motif_dnd_filter, NULL);
for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++) for (i = 0; i < G_N_ELEMENTS (xdnd_filters); i++)
{ {
gdk_display_add_client_message_filter ( gdk_display_add_client_message_filter (
display, display,
gdk_atom_intern (xdnd_filters[i].atom_name, FALSE), gdk_atom_intern_static_string (xdnd_filters[i].atom_name),
xdnd_filters[i].func, NULL); xdnd_filters[i].func, NULL);
} }
} }
@ -3408,8 +3408,8 @@ gdk_drag_motion (GdkDragContext *context,
/* GTK+ traditionally has used application/x-rootwin-drop, /* GTK+ traditionally has used application/x-rootwin-drop,
* but the XDND spec specifies x-rootwindow-drop. * but the XDND spec specifies x-rootwindow-drop.
*/ */
GdkAtom target1 = gdk_atom_intern ("application/x-rootwindow-drop", FALSE); GdkAtom target1 = gdk_atom_intern_static_string ("application/x-rootwindow-drop");
GdkAtom target2 = gdk_atom_intern ("application/x-rootwin-drop", FALSE); GdkAtom target2 = gdk_atom_intern_static_string ("application/x-rootwin-drop");
if (g_list_find (context->targets, if (g_list_find (context->targets,
GDK_ATOM_TO_POINTER (target1)) || GDK_ATOM_TO_POINTER (target1)) ||
@ -3798,7 +3798,7 @@ gdk_drag_get_selection (GdkDragContext *context)
return gdk_x11_xatom_to_atom_for_display (GDK_DRAWABLE_DISPLAY (context->source_window), return gdk_x11_xatom_to_atom_for_display (GDK_DRAWABLE_DISPLAY (context->source_window),
(PRIVATE_DATA (context))->motif_selection); (PRIVATE_DATA (context))->motif_selection);
else if (context->protocol == GDK_DRAG_PROTO_XDND) else if (context->protocol == GDK_DRAG_PROTO_XDND)
return gdk_atom_intern ("XdndSelection", FALSE); return gdk_atom_intern_static_string ("XdndSelection");
else else
return GDK_NONE; return GDK_NONE;
} }

View File

@ -222,7 +222,7 @@ _gdk_events_init (GdkDisplay *display)
display_sources = g_list_prepend (display_sources,display_source); display_sources = g_list_prepend (display_sources,display_source);
gdk_display_add_client_message_filter (display, gdk_display_add_client_message_filter (display,
gdk_atom_intern ("WM_PROTOCOLS", FALSE), gdk_atom_intern_static_string ("WM_PROTOCOLS"),
gdk_wm_protocols_filter, gdk_wm_protocols_filter,
NULL); NULL);
} }

View File

@ -101,7 +101,7 @@ _gdk_windowing_init (void)
XSetErrorHandler (gdk_x_error); XSetErrorHandler (gdk_x_error);
XSetIOErrorHandler (gdk_x_io_error); XSetIOErrorHandler (gdk_x_io_error);
_gdk_selection_property = gdk_atom_intern ("GDK_SELECTION", FALSE); _gdk_selection_property = gdk_atom_intern_static_string ("GDK_SELECTION");
} }
void void

View File

@ -219,7 +219,7 @@ _gdk_x11_precache_atoms (GdkDisplay *display,
n_xatoms = 0; n_xatoms = 0;
for (i = 0; i < n_atoms; i++) for (i = 0; i < n_atoms; i++)
{ {
GdkAtom atom = gdk_atom_intern (atom_names[i], FALSE); GdkAtom atom = gdk_atom_intern_static_string (atom_names[i]);
if (lookup_cached_xatom (display, atom) == None) if (lookup_cached_xatom (display, atom) == None)
{ {
atoms[n_xatoms] = atom; atoms[n_xatoms] = atom;
@ -354,9 +354,9 @@ virtual_atom_check_init (void)
} }
} }
GdkAtom static GdkAtom
gdk_atom_intern (const gchar *atom_name, intern_atom (const gchar *atom_name,
gboolean only_if_exists) gboolean dup)
{ {
GdkAtom result; GdkAtom result;
@ -367,7 +367,7 @@ gdk_atom_intern (const gchar *atom_name,
{ {
result = INDEX_TO_ATOM (virtual_atom_array->len); result = INDEX_TO_ATOM (virtual_atom_array->len);
g_ptr_array_add (virtual_atom_array, g_strdup (atom_name)); g_ptr_array_add (virtual_atom_array, dup ? g_strdup (atom_name) : atom_name);
g_hash_table_insert (virtual_atom_hash, g_hash_table_insert (virtual_atom_hash,
g_ptr_array_index (virtual_atom_array, g_ptr_array_index (virtual_atom_array,
ATOM_TO_INDEX (result)), ATOM_TO_INDEX (result)),
@ -377,6 +377,38 @@ gdk_atom_intern (const gchar *atom_name,
return result; return result;
} }
GdkAtom
gdk_atom_intern (const gchar *atom_name,
gboolean only_if_exists)
{
return intern_atom (atom_name, TRUE);
}
/**
* 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 <emphasis>always</emphasis> 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: the atom corresponding to @atom_name
*
* Since: 2.10
*/
GdkAtom
gdk_atom_intern_static_string (const gchar *atom_name)
{
return intern_atom (atom_name, FALSE);
}
static G_CONST_RETURN char * static G_CONST_RETURN char *
get_atom_name (GdkAtom atom) get_atom_name (GdkAtom atom)
{ {

View File

@ -591,7 +591,7 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
{ {
return make_list ((gchar *)text, length, TRUE, list); return make_list ((gchar *)text, length, TRUE, list);
} }
else if (encoding == gdk_atom_intern ("UTF8_STRING", FALSE)) else if (encoding == gdk_atom_intern_static_string ("UTF8_STRING"))
{ {
return make_list ((gchar *)text, length, FALSE, list); return make_list ((gchar *)text, length, FALSE, list);
} }

View File

@ -2042,7 +2042,7 @@ gdk_x11_window_move_to_current_desktop (GdkWindow *window)
return; return;
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern ("_NET_WM_DESKTOP", FALSE))) gdk_atom_intern_static_string ("_NET_WM_DESKTOP")))
{ {
XEvent xev; XEvent xev;
Atom type; Atom type;
@ -2116,7 +2116,7 @@ gdk_window_focus (GdkWindow *window,
display = GDK_WINDOW_DISPLAY (window); display = GDK_WINDOW_DISPLAY (window);
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern ("_NET_ACTIVE_WINDOW", FALSE))) gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
{ {
XEvent xev; XEvent xev;
@ -2341,7 +2341,7 @@ gdk_window_set_modal_hint (GdkWindow *window,
if (GDK_WINDOW_IS_MAPPED (window)) if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (modal, window, gdk_wmspec_change_state (modal, window,
gdk_atom_intern ("_NET_WM_STATE_MODAL", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_MODAL"),
NULL); NULL);
} }
@ -2376,7 +2376,7 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window,
if (GDK_WINDOW_IS_MAPPED (window)) if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (skips_taskbar, window, gdk_wmspec_change_state (skips_taskbar, window,
gdk_atom_intern ("_NET_WM_STATE_SKIP_TASKBAR", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_SKIP_TASKBAR"),
NULL); NULL);
} }
@ -2413,7 +2413,7 @@ gdk_window_set_skip_pager_hint (GdkWindow *window,
if (GDK_WINDOW_IS_MAPPED (window)) if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (skips_pager, window, gdk_wmspec_change_state (skips_pager, window,
gdk_atom_intern ("_NET_WM_STATE_SKIP_PAGER", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_SKIP_PAGER"),
NULL); NULL);
} }
@ -4279,7 +4279,7 @@ gdk_window_stick (GdkWindow *window)
/* Request stick during viewport scroll */ /* Request stick during viewport scroll */
gdk_wmspec_change_state (TRUE, window, gdk_wmspec_change_state (TRUE, window,
gdk_atom_intern ("_NET_WM_STATE_STICKY", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_STICKY"),
NULL); NULL);
/* Request desktop 0xFFFFFFFF */ /* Request desktop 0xFFFFFFFF */
@ -4340,7 +4340,7 @@ gdk_window_unstick (GdkWindow *window)
/* Request unstick from viewport */ /* Request unstick from viewport */
gdk_wmspec_change_state (FALSE, window, gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern ("_NET_WM_STATE_STICKY", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_STICKY"),
NULL); NULL);
/* Get current desktop, then set it; this is a race, but not /* Get current desktop, then set it; this is a race, but not
@ -4413,8 +4413,8 @@ gdk_window_maximize (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window)) if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (TRUE, window, gdk_wmspec_change_state (TRUE, window,
gdk_atom_intern ("_NET_WM_STATE_MAXIMIZED_VERT", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_MAXIMIZED_VERT"),
gdk_atom_intern ("_NET_WM_STATE_MAXIMIZED_HORZ", FALSE)); gdk_atom_intern_static_string ("_NET_WM_STATE_MAXIMIZED_HORZ"));
else else
gdk_synthesize_window_state (window, gdk_synthesize_window_state (window,
0, 0,
@ -4448,8 +4448,8 @@ gdk_window_unmaximize (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window)) if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (FALSE, window, gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern ("_NET_WM_STATE_MAXIMIZED_VERT", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_MAXIMIZED_VERT"),
gdk_atom_intern ("_NET_WM_STATE_MAXIMIZED_HORZ", FALSE)); gdk_atom_intern_static_string ("_NET_WM_STATE_MAXIMIZED_HORZ"));
else else
gdk_synthesize_window_state (window, gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_MAXIMIZED, GDK_WINDOW_STATE_MAXIMIZED,
@ -4486,7 +4486,7 @@ gdk_window_fullscreen (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window)) if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (TRUE, window, gdk_wmspec_change_state (TRUE, window,
gdk_atom_intern ("_NET_WM_STATE_FULLSCREEN", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_FULLSCREEN"),
GDK_NONE); GDK_NONE);
else else
@ -4522,7 +4522,7 @@ gdk_window_unfullscreen (GdkWindow *window)
if (GDK_WINDOW_IS_MAPPED (window)) if (GDK_WINDOW_IS_MAPPED (window))
gdk_wmspec_change_state (FALSE, window, gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern ("_NET_WM_STATE_FULLSCREEN", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_FULLSCREEN"),
GDK_NONE); GDK_NONE);
else else
@ -4560,10 +4560,10 @@ gdk_window_set_keep_above (GdkWindow *window, gboolean setting)
{ {
if (setting) if (setting)
gdk_wmspec_change_state (FALSE, window, gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern ("_NET_WM_STATE_BELOW", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_BELOW"),
GDK_NONE); GDK_NONE);
gdk_wmspec_change_state (setting, window, gdk_wmspec_change_state (setting, window,
gdk_atom_intern ("_NET_WM_STATE_ABOVE", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_ABOVE"),
GDK_NONE); GDK_NONE);
} }
else else
@ -4601,10 +4601,10 @@ gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
{ {
if (setting) if (setting)
gdk_wmspec_change_state (FALSE, window, gdk_wmspec_change_state (FALSE, window,
gdk_atom_intern ("_NET_WM_STATE_ABOVE", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_ABOVE"),
GDK_NONE); GDK_NONE);
gdk_wmspec_change_state (setting, window, gdk_wmspec_change_state (setting, window,
gdk_atom_intern ("_NET_WM_STATE_BELOW", FALSE), gdk_atom_intern_static_string ("_NET_WM_STATE_BELOW"),
GDK_NONE); GDK_NONE);
} }
else else
@ -5881,7 +5881,7 @@ gdk_window_begin_resize_drag (GdkWindow *window,
return; return;
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern ("_NET_WM_MOVERESIZE", FALSE))) gdk_atom_intern_static_string ("_NET_WM_MOVERESIZE")))
wmspec_resize_drag (window, edge, button, root_x, root_y, timestamp); wmspec_resize_drag (window, edge, button, root_x, root_y, timestamp);
else else
emulate_resize_drag (window, edge, button, root_x, root_y, timestamp); emulate_resize_drag (window, edge, button, root_x, root_y, timestamp);
@ -5916,7 +5916,7 @@ gdk_window_begin_move_drag (GdkWindow *window,
return; return;
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window), if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern ("_NET_WM_MOVERESIZE", FALSE))) gdk_atom_intern_static_string ("_NET_WM_MOVERESIZE")))
wmspec_moveresize (window, _NET_WM_MOVERESIZE_MOVE, root_x, root_y, wmspec_moveresize (window, _NET_WM_MOVERESIZE_MOVE, root_x, root_y,
timestamp); timestamp);
else else