More error trap cleanups

Remove syncs in front of gdk_error_trap_pop() calls, and convert
gdk_error_trap_pop() calls to gdk_error_trap_pop_ignored() in gdk.
This commit is contained in:
Matthias Clasen 2010-09-20 16:38:48 -04:00
parent 14e38da150
commit 2ddfaeddad
10 changed files with 16 additions and 35 deletions

View File

@ -655,7 +655,7 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
win_has_wm_state ? wm_state_atom : None,
&has_wm_state,
&state.children, &state.nchildren);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (!result)
{
g_free (state.children);

View File

@ -265,7 +265,7 @@ gdk_check_wm_desktop_changed (GdkWindow *window)
0, G_MAXLONG, False, XA_CARDINAL, &type,
&format, &nitems,
&bytes_after, &data);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (type != None)
{
@ -306,7 +306,7 @@ gdk_check_wm_state_changed (GdkWindow *window)
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
0, G_MAXLONG, False, XA_ATOM, &type, &format, &nitems,
&bytes_after, &data);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (type != None)
{
@ -735,7 +735,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
event->configure.x = tx;
event->configure.y = ty;
}
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
else
{
@ -1347,7 +1347,6 @@ gdk_display_open (const gchar *display_name)
XQueryPointer (display_x11->xdisplay,
GDK_SCREEN_X11 (display_x11->default_screen)->xroot_window,
&root, &child, &rootx, &rooty, &winx, &winy, &xmask);
gdk_flush ();
if (G_UNLIKELY (gdk_error_trap_pop () == BadWindow))
{
g_warning ("Connection to display %s appears to be untrusted. Pointer and keyboard grabs and inter-client communication may not work as expected.", gdk_display_get_name (display));
@ -2413,7 +2412,7 @@ gdk_display_store_clipboard (GdkDisplay *display,
GDK_WINDOW_XID (clipboard_window), time_);
}
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}

View File

@ -622,8 +622,7 @@ gdk_window_cache_destroy (GdkWindowCache *cache)
g_list_foreach (cache->children, (GFunc)free_cache_child,
gdk_screen_get_display (cache->screen));
gdk_flush ();
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
g_list_free (cache->children);
g_hash_table_destroy (cache->child_hash);
@ -769,7 +768,7 @@ get_client_window_at_coords (GdkWindowCache *cache,
tmp_list = tmp_list->next;
}
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (retval)
return retval;
@ -2626,7 +2625,7 @@ xdnd_check_dest (GdkDisplay *display,
}
}
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
return retval ? (proxy ? proxy : win) : None;
}
@ -2693,7 +2692,7 @@ xdnd_read_actions (GdkDragContext *context)
if (data)
XFree (data);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
else
{
@ -2767,8 +2766,7 @@ xdnd_manage_source_filter (GdkDragContext *context,
*/
}
gdk_display_sync (gdk_drawable_get_display (window));
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
}
@ -3285,7 +3283,7 @@ _gdk_drag_get_protocol_for_display (GdkDisplay *display,
}
#endif
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (rootwin)
{

View File

@ -1522,7 +1522,7 @@ gdk_event_send_client_message_to_all_recurse (GdkDisplay *display,
result = send || found;
out:
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
return result;
}
@ -1755,7 +1755,6 @@ fetch_net_wm_check_window (GdkScreen *screen)
/* Find out if this WM goes away, so we can reset everything. */
XSelectInput (screen_x11->xdisplay, *xwindow, StructureNotifyMask);
gdk_display_sync (display);
error = gdk_error_trap_pop ();
if (!error)
@ -2083,9 +2082,7 @@ gdk_x11_screen_get_window_manager_name (GdkScreen *screen)
&n_items, &bytes_after,
(guchar **)&name);
gdk_display_sync (screen_x11->display);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
if (name != NULL)
{

View File

@ -1092,8 +1092,7 @@ _gdk_windowing_window_destroy_foreign (GdkWindow *window)
XSendEvent (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
False, 0, (XEvent *)&xclient);
gdk_display_sync (GDK_WINDOW_DISPLAY (window));
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
static GdkWindow *
@ -2955,7 +2954,7 @@ gdk_window_get_frame_extents (GdkWindow *window,
if (vroots)
XFree (vroots);
gdk_error_trap_pop ();
gdk_error_trap_pop_ignored ();
}
void
@ -3191,7 +3190,6 @@ _gdk_windowing_window_at_device_position (GdkDisplay *display,
gdk_error_trap_push ();
XQueryPointer (xdisplay, xwindow,
&root, &child, &rootx, &rooty, &winx, &winy, &xmask);
gdk_flush ();
if (gdk_error_trap_pop ())
continue;
if (child != None)
@ -3232,7 +3230,6 @@ _gdk_windowing_window_at_device_position (GdkDisplay *display,
gdk_error_trap_push ();
XQueryPointer (xdisplay, xwindow,
&root, &xwindow, &rootx, &rooty, &winx, &winy, &xmask);
gdk_flush ();
if (gdk_error_trap_pop ())
break;
if (get_toplevel && xwindow_last != root &&

View File

@ -683,7 +683,6 @@ gtk_plug_realize (GtkWidget *widget)
{
gdk_error_trap_push ();
gdk_window_destroy (gdk_window);
gdk_flush ();
gdk_error_trap_pop_ignored ();
gdk_window = gdk_window_new (gtk_widget_get_root_window (widget),
&attributes, attributes_mask);

View File

@ -151,7 +151,6 @@ _gtk_socket_windowing_send_key_event (GtkSocket *socket,
False,
(mask_key_presses ? KeyPressMask : NoEventMask),
(XEvent *)&xkey);
gdk_display_sync (gdk_screen_get_display (screen));
gdk_error_trap_pop_ignored ();
}
@ -245,7 +244,6 @@ _gtk_socket_windowing_send_configure_event (GtkSocket *socket)
XSendEvent (GDK_WINDOW_XDISPLAY (socket->plug_window),
GDK_WINDOW_XWINDOW (socket->plug_window),
False, NoEventMask, (XEvent *)&xconfigure);
gdk_display_sync (gtk_widget_get_display (GTK_WIDGET (socket)));
gdk_error_trap_pop_ignored ();
}
@ -575,7 +573,6 @@ _gtk_socket_windowing_filter_func (GdkXEvent *gdk_xevent,
socket->plug_window,
protocol, TRUE);
gdk_display_sync (display);
gdk_error_trap_pop_ignored ();
return_val = GDK_FILTER_REMOVE;
}
@ -596,7 +593,6 @@ _gtk_socket_windowing_filter_func (GdkXEvent *gdk_xevent,
{
gdk_error_trap_push ();
gdk_window_show (socket->plug_window);
gdk_flush ();
gdk_error_trap_pop_ignored ();
_gtk_socket_unmap_notify (socket);

View File

@ -541,8 +541,7 @@ gtk_socket_size_allocate (GtkWidget *widget,
g_message ("GtkSocket - sending synthetic configure: %d %d",
allocation->width, allocation->height));
}
gdk_display_sync (gtk_widget_get_display (widget));
gdk_error_trap_pop_ignored ();
}
}
@ -918,7 +917,6 @@ _gtk_socket_add_window (GtkSocket *socket,
gtk_drag_dest_set_proxy (GTK_WIDGET (socket), socket->plug_window,
protocol, TRUE);
gdk_display_sync (display);
gdk_error_trap_pop_ignored ();
gdk_window_add_filter (socket->plug_window,

View File

@ -694,7 +694,6 @@ gtk_tray_icon_send_manager_message (GtkTrayIcon *icon,
gdk_error_trap_push ();
XSendEvent (display,
icon->priv->manager_window, False, NoEventMask, (XEvent *)&ev);
gdk_display_sync (gtk_widget_get_display (widget));
gdk_error_trap_pop_ignored ();
}
@ -951,7 +950,6 @@ _gtk_tray_icon_send_message (GtkTrayIcon *icon,
icon->priv->manager_window, False,
StructureNotifyMask, (XEvent *)&ev);
}
gdk_display_sync (gtk_widget_get_display (GTK_WIDGET (icon)));
gdk_error_trap_pop_ignored ();
return stamp;

View File

@ -166,7 +166,6 @@ _gtk_xembed_send_message (GdkWindow *recipient,
XSendEvent (GDK_WINDOW_XDISPLAY(recipient),
GDK_WINDOW_XWINDOW (recipient),
False, NoEventMask, (XEvent *)&xclient);
gdk_display_sync (display);
gdk_error_trap_pop_ignored ();
}