summaryrefslogtreecommitdiff
path: root/src/keybindings.c
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 /src/keybindings.c
parent6c18374142f9b45ede0fdecef660f503e854ccb0 (diff)
downloadmetacity-c613fed9ef688d742bfc85fb569b8174938acce0.tar.gz
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.
Diffstat (limited to 'src/keybindings.c')
-rw-r--r--src/keybindings.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/keybindings.c b/src/keybindings.c
index 80bb068b..dd162af7 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