From c9303ecfb30db08b3cc12137831ab352ac9b0812 Mon Sep 17 00:00:00 2001 From: sabetts Date: Sat, 24 Apr 2004 06:10:33 +0000 Subject: * src/data.h (struct rp_defaults): new members, font_string, fgcolor_string, bgcolor_string. * src/actions.c (set_font): return defaults.font_string when data is NULL (set_fgcolor): likewise for fgcolor_string (set_bgcolor): likewise for bgcolor_string * src/manage.c (ungrab_top_level_keys): properly grab capital letters. * src/main.c (init_defaults): init fgcolor_string, bgcolor_string, and font_string * src/input.c (grab_key): change keysym type to KeySym. convert keysym to keycode. All callers updated. --- src/actions.c | 18 ++++++++++++------ src/data.h | 4 ++++ src/input.c | 18 ++++++++++++++++-- src/input.h | 2 +- src/main.c | 4 ++++ src/manage.c | 17 +++++++++++------ 6 files changed, 48 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/actions.c b/src/actions.c index cb80a4c..8a004d9 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2340,9 +2340,8 @@ set_font (char *data) { XFontStruct *font; - /* FIXME: return a useful string. */ if (data == NULL) - return xstrdup ("dummy"); + return xstrdup (defaults.font_string); font = XLoadQueryFont (dpy, data); if (font == NULL) @@ -2356,6 +2355,9 @@ set_font (char *data) defaults.font = font; update_all_gcs(); + free (defaults.font_string); + defaults.font_string = xstrdup (data); + return NULL; } @@ -2559,9 +2561,8 @@ set_fgcolor (char *data) int i; XColor color, junk; - /* FIXME: return a meaningful string. */ if (data == NULL) - return xstrdup ("dummy"); + return xstrdup (defaults.fgcolor_string); for (i=0; iactions_last; i++) { PRINT_DEBUG(("%d\n", i)); - grab_key (XKeysymToKeycode (dpy, map->actions[i].key), map->actions[i].state, w); + grab_key (map->actions[i].key, map->actions[i].state, w); } #endif } @@ -130,23 +130,28 @@ grab_top_level_keys (Window w) void ungrab_top_level_keys (Window w) { -#ifdef HIDE_MOUSE -#else - rp_keymap *map = find_keymap (TOP_KEYMAP); + KeySym keysym, upper, lower; + rp_keymap *map; int i; + map = find_keymap (TOP_KEYMAP); + if (map == NULL) { PRINT_ERROR (("Unable to find " TOP_KEYMAP " keymap\n")); return; } + /* Make sure we ungrab the right sym. */ + for (i=0; iactions_last; i++) { PRINT_DEBUG(("%d\n", i)); - XUngrabKey(dpy, XKeysymToKeycode (dpy, map->actions[i].key), AnyModifier, w); + keysym = map->actions[i].key; + XConvertCase (keysym, &lower, &upper); + keysym = lower; + XUngrabKey(dpy, XKeysymToKeycode (dpy, keysym), AnyModifier, w); } -#endif } void -- cgit v1.2.3