From e0a4c2a1df6e4c8cba389ac77caf65180f54a01a Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 4 Nov 2002 00:56:12 +0000 Subject: [PATCH] remove XSync calls from here (meta_display_ungrab): remove XSync from 2002-11-03 Havoc Pennington * src/display.c (meta_display_grab): remove XSync calls from here (meta_display_ungrab): remove XSync from here, but put in an XFlush to be sure we get the ungrab sent. * src/util.c (meta_topic): track sync count here * src/errors.c: move sync count out of here Throughout: error spew on all XSync() calls * src/run-metacity.sh: don't set METACITY_DEBUG --- ChangeLog | 14 ++++++++++++++ src/display.c | 6 ++---- src/errors.c | 16 ++++++---------- src/run-metacity.sh | 2 +- src/util.c | 11 ++++++++++- src/xprops.c | 2 ++ 6 files changed, 35 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d92c4b52..777b92843 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-11-03 Havoc Pennington + + * src/display.c (meta_display_grab): remove XSync calls from here + (meta_display_ungrab): remove XSync from here, but put in + an XFlush to be sure we get the ungrab sent. + + * src/util.c (meta_topic): track sync count here + + * src/errors.c: move sync count out of here + + Throughout: error spew on all XSync() calls + + * src/run-metacity.sh: don't set METACITY_DEBUG + 2002-11-03 Havoc Pennington * src/window-props.c (meta_display_init_window_prop_hooks): add diff --git a/src/display.c b/src/display.c index 9e3b9ed95..dd4a37b08 100644 --- a/src/display.c +++ b/src/display.c @@ -757,10 +757,8 @@ meta_display_grab (MetaDisplay *display) { if (display->server_grab_count == 0) { - XSync (display->xdisplay, False); XGrabServer (display->xdisplay); } - XSync (display->xdisplay, False); display->server_grab_count += 1; meta_verbose ("Grabbing display, grab count now %d\n", display->server_grab_count); @@ -778,10 +776,9 @@ meta_display_ungrab (MetaDisplay *display) /* FIXME we want to purge all pending "queued" stuff * at this point, such as window hide/show */ - XSync (display->xdisplay, False); XUngrabServer (display->xdisplay); + XFlush (display->xdisplay); } - XSync (display->xdisplay, False); meta_verbose ("Ungrabbing display, grab count now %d\n", display->server_grab_count); @@ -3314,6 +3311,7 @@ convert_property (MetaDisplay *display, * can send SelectionNotify */ /* FIXME the error trap pop synced anyway, right? */ + meta_topic (META_DEBUG_SYNC, "Syncing on %s\n", __FUNCTION__); XSync (display->xdisplay, False); return TRUE; diff --git a/src/errors.c b/src/errors.c index d558de03f..10ee15602 100644 --- a/src/errors.c +++ b/src/errors.c @@ -26,8 +26,6 @@ #include #include -static int sync_count = 0; - static int x_error_handler (Display *display, XErrorEvent *error); static int x_io_error_handler (Display *display); @@ -50,7 +48,6 @@ meta_error_trap_push_internal (MetaDisplay *display, if (need_sync) { XSync (display->xdisplay, False); - ++sync_count; } gdk_error_trap_push (); @@ -84,7 +81,6 @@ meta_error_trap_pop_internal (MetaDisplay *display, if (need_sync) { XSync (display->xdisplay, False); - ++sync_count; } result = gdk_error_trap_pop (); @@ -128,8 +124,8 @@ meta_error_trap_pop (MetaDisplay *display, need_sync = (display->error_traps == 1 && !last_request_was_roundtrip); if (need_sync) - meta_topic (META_DEBUG_SYNC, "%d: Syncing on error_trap_pop, traps = %d, roundtrip = %d\n", - sync_count, display->error_traps, last_request_was_roundtrip); + meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_pop, traps = %d, roundtrip = %d\n", + display->error_traps, last_request_was_roundtrip); display->error_trap_synced_at_last_pop = need_sync || last_request_was_roundtrip; @@ -156,8 +152,8 @@ meta_error_trap_push_with_return (MetaDisplay *display) need_sync = FALSE; if (need_sync) - meta_topic (META_DEBUG_SYNC, "%d: Syncing on error_trap_push_with_return, traps = %d\n", - sync_count, display->error_traps); + meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_push_with_return, traps = %d\n", + display->error_traps); meta_error_trap_push_internal (display, FALSE); } @@ -167,8 +163,8 @@ meta_error_trap_pop_with_return (MetaDisplay *display, gboolean last_request_was_roundtrip) { if (!last_request_was_roundtrip) - meta_topic (META_DEBUG_SYNC, "%d: Syncing on error_trap_pop_with_return, traps = %d, roundtrip = %d\n", - sync_count, display->error_traps, last_request_was_roundtrip); + meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_pop_with_return, traps = %d, roundtrip = %d\n", + display->error_traps, last_request_was_roundtrip); display->error_trap_synced_at_last_pop = TRUE; diff --git a/src/run-metacity.sh b/src/run-metacity.sh index 8c861113a..e46dae14b 100755 --- a/src/run-metacity.sh +++ b/src/run-metacity.sh @@ -89,5 +89,5 @@ if test -z "$ONLY_WM"; then fi if test -z "$ONLY_SETUP"; then - METACITY_VERBOSE=1 METACITY_DEBUG=1 METACITY_USE_LOGFILE=1 METACITY_DEBUG_BUTTON_GRABS=1 METACITY_DISPLAY=$CLIENT_DISPLAY exec $DEBUG ./metacity $OPTIONS + METACITY_VERBOSE=1 METACITY_USE_LOGFILE=1 METACITY_DEBUG_BUTTON_GRABS=1 METACITY_DISPLAY=$CLIENT_DISPLAY exec $DEBUG ./metacity $OPTIONS fi diff --git a/src/util.c b/src/util.c index 5d9c68a8e..8d5a57e33 100644 --- a/src/util.c +++ b/src/util.c @@ -267,6 +267,8 @@ topic_name (MetaDebugTopic topic) return "Window manager"; } +static int sync_count = 0; + void meta_topic (MetaDebugTopic topic, const char *format, @@ -281,7 +283,7 @@ meta_topic (MetaDebugTopic topic, if (!is_verbose) return; - va_start (args, format); + va_start (args, format); str = g_strdup_vprintf (format, args); va_end (args); @@ -289,6 +291,13 @@ meta_topic (MetaDebugTopic topic, if (no_prefix == 0) fprintf (out, "%s: ", topic_name (topic)); + + if (topic == META_DEBUG_SYNC) + { + ++sync_count; + fprintf (out, "%d: ", sync_count); + } + utf8_fputs (str, out); fflush (out); diff --git a/src/xprops.c b/src/xprops.c index af8facc58..cacf91f16 100644 --- a/src/xprops.c +++ b/src/xprops.c @@ -919,6 +919,8 @@ meta_prop_get_values (MetaDisplay *display, } /* Get replies for all our tasks */ + meta_topic (META_DEBUG_SYNC, "Syncing to get %d GetProperty replies in %s\n", + n_values, __FUNCTION__); XSync (display->xdisplay, False); /* Collect results, should arrive in order requested */