[Xfce4-commits] <libxfce4ui:master> Improve code comments and error handling.
Jérôme Guelfucci
noreply at xfce.org
Thu Jun 2 23:46:08 CEST 2011
Updating branch refs/heads/master
to 83770eec38278dd1e05577b48908d4b0b0d68dfc (commit)
from 13251f7a7ab201dd20186d81ca11e21922d35628 (commit)
commit 83770eec38278dd1e05577b48908d4b0b0d68dfc
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Sun May 29 18:09:19 2011 +0200
Improve code comments and error handling.
libxfce4kbd-private/xfce-shortcuts-grabber.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/libxfce4kbd-private/xfce-shortcuts-grabber.c b/libxfce4kbd-private/xfce-shortcuts-grabber.c
index 4013840..c1ba42b 100644
--- a/libxfce4kbd-private/xfce-shortcuts-grabber.c
+++ b/libxfce4kbd-private/xfce-shortcuts-grabber.c
@@ -312,18 +312,28 @@ xfce_shortcuts_grabber_grab (XfceShortcutsGrabber *grabber,
XkbAllClientInfoMask,
XkbUseCoreKbd);
+ /* Get all keys generating keyval */
if (!gdk_keymap_get_entries_for_keyval (keymap,key->keyval,
- &keys, &n_keys)
- || n_keys == 0)
+ &keys, &n_keys))
{
XkbFreeClientMap (xmap, 0, TRUE);
TRACE ("Got no keys for keyval");
return;
}
+ if (n_keys == 0)
+ {
+ XkbFreeClientMap (xmap, 0, TRUE);
+ g_free (keys);
+
+ TRACE ("Got 0 keys for keyval");
+ return;
+ }
+
for (i = 0; i < n_keys; i ++)
{
/* Grab all hardware keys generating keyval */
+
GdkModifierType add_modifiers;
add_modifiers = FinallyGetModifiersForKeycode (xmap,
@@ -373,7 +383,14 @@ xfce_shortcuts_grabber_grab (XfceShortcutsGrabber *grabber,
}
gdk_flush ();
- gdk_error_trap_pop ();
+
+ if (gdk_error_trap_pop ())
+ {
+ if (grab)
+ TRACE ("Failed to grab");
+ else
+ TRACE ("Failed to ungrab");
+ }
}
}
More information about the Xfce4-commits
mailing list