[gtk+] More error trap cleanups
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] More error trap cleanups
- Date: Mon, 20 Sep 2010 20:41:05 +0000 (UTC)
commit 2ddfaeddad4b88fb213c75d1fa9d4d2f28649871
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Sep 20 16:38:48 2010 -0400
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.
gdk/x11/gdkasync.c | 2 +-
gdk/x11/gdkdisplay-x11.c | 9 ++++-----
gdk/x11/gdkdnd-x11.c | 14 ++++++--------
gdk/x11/gdkscreen-x11.c | 7 ++-----
gdk/x11/gdkwindow-x11.c | 7 ++-----
gtk/gtkplug.c | 1 -
gtk/gtksocket-x11.c | 4 ----
gtk/gtksocket.c | 4 +---
gtk/gtktrayicon-x11.c | 2 --
gtk/gtkxembed.c | 1 -
10 files changed, 16 insertions(+), 35 deletions(-)
---
diff --git a/gdk/x11/gdkasync.c b/gdk/x11/gdkasync.c
index 70bb06f..f216c0b 100644
--- a/gdk/x11/gdkasync.c
+++ b/gdk/x11/gdkasync.c
@@ -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);
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 3986290..db8175c 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -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 ();
}
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 6835a66..e2a77b6 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -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)
{
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 1bde6aa..1e298fb 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -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)
{
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 59d412f..69944d8 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -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 &&
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index 9496edb..2f3b4e9 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -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);
diff --git a/gtk/gtksocket-x11.c b/gtk/gtksocket-x11.c
index f5b217b..f3ebce4 100644
--- a/gtk/gtksocket-x11.c
+++ b/gtk/gtksocket-x11.c
@@ -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);
diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c
index 3d4d99b..751eba4 100644
--- a/gtk/gtksocket.c
+++ b/gtk/gtksocket.c
@@ -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,
diff --git a/gtk/gtktrayicon-x11.c b/gtk/gtktrayicon-x11.c
index 6e34a6b..f055e78 100644
--- a/gtk/gtktrayicon-x11.c
+++ b/gtk/gtktrayicon-x11.c
@@ -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;
diff --git a/gtk/gtkxembed.c b/gtk/gtkxembed.c
index 6979371..127d0fe 100644
--- a/gtk/gtkxembed.c
+++ b/gtk/gtkxembed.c
@@ -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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]