summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-11-06 16:00:56 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-11-06 16:00:56 +0000
commitc613fed9ef688d742bfc85fb569b8174938acce0 (patch)
treec91ee67478a1001007def6631a01cf63303f206a
parent6c18374142f9b45ede0fdecef660f503e854ccb0 (diff)
downloadmetacity-c613fed9ef688d742bfc85fb569b8174938acce0.tar.gz
metacity-c613fed9ef688d742bfc85fb569b8174938acce0.tar.bz2
push an error trap around the whole window-key-grab loop
2002-11-06 Havoc Pennington <hp@pobox.com> * src/keybindings.c (grab_keys): push an error trap around the whole window-key-grab loop (ungrab_all_keys): avoid requiring return value from the error trap, unless in debugging mode (regrab_window_bindings, regrab_screen_bindings): push traps around the loops, for efficiency * src/display.c (event_callback): fix from Padraig O'Briain to compress extra MappingNotify events to avoid extra work.
-rw-r--r--ChangeLog12
-rw-r--r--src/display.c34
-rw-r--r--src/keybindings.c34
-rwxr-xr-xsrc/run-metacity.sh18
4 files changed, 83 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 32b39cf..cce726a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-11-06 Havoc Pennington <hp@pobox.com>
+
+ * src/keybindings.c (grab_keys): push an error trap around the
+ whole window-key-grab loop
+ (ungrab_all_keys): avoid requiring return value from the error
+ trap, unless in debugging mode
+ (regrab_window_bindings, regrab_screen_bindings): push traps
+ around the loops, for efficiency
+
+ * src/display.c (event_callback): fix from Padraig O'Briain to
+ compress extra MappingNotify events to avoid extra work.
+
2002-11-05 Calum Benson <calum.benson@sun.com>
* src/themes/Crux/active-restore-button.png:
diff --git a/src/display.c b/src/display.c
index dd4a37b..d9b23f7 100644
--- a/src/display.c
+++ b/src/display.c
@@ -1666,10 +1666,34 @@ event_callback (XEvent *event,
}
break;
case MappingNotify:
- /* Let XLib know that there is a new keyboard mapping.
- */
- XRefreshKeyboardMapping (&event->xmapping);
- meta_display_process_mapping_event (display, event);
+ {
+ gboolean ignore_current;
+
+ ignore_current = FALSE;
+
+ /* Check whether the next event is an identical MappingNotify
+ * event. If it is, ignore the current event, we'll update
+ * when we get the next one.
+ */
+ if (XPending (display->xdisplay))
+ {
+ XEvent next_event;
+
+ XPeekEvent (display->xdisplay, &next_event);
+
+ if (next_event.type == MappingNotify &&
+ next_event.xmapping.request == event->xmapping.request)
+ ignore_current = TRUE;
+ }
+
+ if (!ignore_current)
+ {
+ /* Let XLib know that there is a new keyboard mapping.
+ */
+ XRefreshKeyboardMapping (&event->xmapping);
+ meta_display_process_mapping_event (display, event);
+ }
+ }
break;
default:
break;
@@ -3311,7 +3335,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__);
+ meta_topic (META_DEBUG_SYNC, "Syncing on %s\n", G_GNUC_FUNCTION);
XSync (display->xdisplay, False);
return TRUE;
diff --git a/src/keybindings.c b/src/keybindings.c
index 80bb068..dd162af 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -604,6 +604,8 @@ regrab_screen_bindings (MetaDisplay *display)
{
GSList *tmp;
+ meta_error_trap_push (display); /* for efficiency push outer trap */
+
tmp = display->screens;
while (tmp != NULL)
{
@@ -614,6 +616,8 @@ regrab_screen_bindings (MetaDisplay *display)
tmp = tmp->next;
}
+
+ meta_error_trap_pop (display, FALSE);
}
static void
@@ -624,6 +628,7 @@ regrab_window_bindings (MetaDisplay *display)
windows = meta_display_list_windows (display);
+ meta_error_trap_push (display); /* for efficiency push outer trap */
tmp = windows;
while (tmp != NULL)
{
@@ -634,6 +639,7 @@ regrab_window_bindings (MetaDisplay *display)
tmp = tmp->next;
}
+ meta_error_trap_pop (display, FALSE);
g_slist_free (windows);
}
@@ -882,6 +888,8 @@ grab_keys (MetaKeyBinding *bindings,
int i;
g_assert (n_bindings == 0 || bindings != NULL);
+
+ meta_error_trap_push (display);
i = 0;
while (i < n_bindings)
@@ -896,24 +904,34 @@ grab_keys (MetaKeyBinding *bindings,
++i;
}
+
+ meta_error_trap_pop (display, FALSE);
}
static void
ungrab_all_keys (MetaDisplay *display,
Window xwindow)
{
- int result;
-
- meta_error_trap_push_with_return (display);
+ if (meta_is_debugging ())
+ meta_error_trap_push_with_return (display);
+ else
+ meta_error_trap_push (display);
XUngrabKey (display->xdisplay, AnyKey, AnyModifier,
xwindow);
+
+ if (meta_is_debugging ())
+ {
+ int result;
- result = meta_error_trap_pop_with_return (display, FALSE);
-
- if (result != Success)
- meta_topic (META_DEBUG_KEYBINDINGS,
- "Ungrabbing all keys on 0x%lx failed\n", xwindow);
+ result = meta_error_trap_pop_with_return (display, FALSE);
+
+ if (result != Success)
+ meta_topic (META_DEBUG_KEYBINDINGS,
+ "Ungrabbing all keys on 0x%lx failed\n", xwindow);
+ }
+ else
+ meta_error_trap_pop (display, FALSE);
}
void
diff --git a/src/run-metacity.sh b/src/run-metacity.sh
index e46dae1..a131033 100755
--- a/src/run-metacity.sh
+++ b/src/run-metacity.sh
@@ -8,6 +8,10 @@ if test -z "$CLIENT_DISPLAY"; then
CLIENT_DISPLAY=:1
fi
+if test -z "$METACITY_DISPLAY"; then
+ export METACITY_DISPLAY=$CLIENT_DISPLAY
+fi
+
if test -z "$SCREENS"; then
SCREENS=1
fi
@@ -52,7 +56,17 @@ if test -z "$ONLY_WM"; then
if test -n "$XMON_DIR"; then
echo "Launching xmond"
- $XMON_DIR/xmonui | $XMON_DIR/xmond -server $XNEST_DISPLAY &
+ $XMON_DIR/xmonui | $XMON_DIR/xmond -server localhost:$XNEST_DISPLAY &
+ sleep 1
+ fi
+
+ if test -n "$XSCOPE_DIR"; then
+ ## xscope doesn't like to die when it should, it backgrounds itself
+ killall -9 xscope
+ killall -9 xscope
+ echo "Launching xscope"
+ DISPLAY= $XSCOPE_DIR/xscope -o1 -i28 > xscoped-replies.txt &
+ export METACITY_DISPLAY=localhost:28
sleep 1
fi
@@ -89,5 +103,5 @@ if test -z "$ONLY_WM"; then
fi
if test -z "$ONLY_SETUP"; then
- METACITY_VERBOSE=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 exec $DEBUG ./metacity $OPTIONS
fi