diff options
author | sabetts <sabetts> | 2004-05-20 06:13:52 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2004-05-20 06:13:52 +0000 |
commit | c9b79a47d169f3358cfd9e644d38cd86658fb3de (patch) | |
tree | c135a3c259b45adfbb8e756df520c26298c8f8af | |
parent | 6f0409e582148c7611133cb1116c934ff312b204 (diff) | |
download | ratpoison-c9b79a47d169f3358cfd9e644d38cd86658fb3de.zip |
* src/input.c (rp_mask_to_x11_mask): handle the shift modifier
(x11_mask_to_rp_mask): likewise
(keysym_to_keycode_mod): Make sure lower != keysym before adding
the shift mask.
(keysym_to_string): handle the shift modifier. use 's' for super
instead of 'S'
(cook_keycode): keep the shift modifier if XLookupString didn't
gobble it.
* src/data.h (RP_SHIFT_MASK): new define
* src/actions.c (parse_keydesc): parse the shift modifier change
super to 's' from 'S'.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | doc/ratpoison.texi | 28 | ||||
-rw-r--r-- | src/actions.c | 4 | ||||
-rw-r--r-- | src/data.h | 11 | ||||
-rw-r--r-- | src/input.c | 26 |
6 files changed, 76 insertions, 9 deletions
@@ -1,5 +1,19 @@ 2004-05-19 Shawn Betts <sabetts@vcn.bc.ca> + * src/input.c (rp_mask_to_x11_mask): handle the shift modifier + (x11_mask_to_rp_mask): likewise + (keysym_to_keycode_mod): Make sure lower != keysym before adding + the shift mask. + (keysym_to_string): handle the shift modifier. use 's' for super + instead of 'S' + (cook_keycode): keep the shift modifier if XLookupString didn't + gobble it. + + * src/data.h (RP_SHIFT_MASK): new define + + * src/actions.c (parse_keydesc): parse the shift modifier change + super to 's' from 'S'. + * src/window.c (format_window_name): add %f format option 2004-05-05 Shawn Betts <sabetts@vcn.bc.ca> @@ -5,6 +5,8 @@ ratpoison NEWS --- history of user-visible changes. -*- outline -*- This options displays the frame number the window is in or a space if it is not in a window. +** Super modifier changed from S to s. S is now the shift modifier + * Changes since 1.3.0-rc2-beta1 ** New command 'set' set replaces the def* commands. For example 'defwinliststyle column' diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi index 6061d70..2af7291 100644 --- a/doc/ratpoison.texi +++ b/doc/ratpoison.texi @@ -794,6 +794,34 @@ Interactive control of ratpoison is done entirely through keystrokes. This chapter explains how keystrokes are stored and manipulated. +ratpoison uses the Emacs style key notation. A combination of +modifiers and one non-modifier key combine to invoke an action. The +syntax is one or more modifiers seperated with dashes followed by a +dash and the non-modifier key name. For instance, holding down +control, shift, and super then pressing the spacebar would be +described as: + +@example +S-C-s-space +@end example + +The following is a list of modifiers ratpoison accepts: + +@table @asis +@item S +Shift modifier +@item C +Control modifier +@item M +Meta modifier +@item A +Alt modifier +@item H +Hyper modifier +@item s +Super modifier +@end table + @menu * Key Maps:: * Default Key Bindings:: diff --git a/src/actions.c b/src/actions.c index 8a004d9..5321ed3 100644 --- a/src/actions.c +++ b/src/actions.c @@ -620,6 +620,10 @@ parse_keydesc (char *s) } else if (!strcmp (token, "S")) { + p->state |= RP_SHIFT_MASK; + } + else if (!strcmp (token, "s")) + { p->state |= RP_SUPER_MASK; } else if (!strcmp (token, "H")) @@ -261,11 +261,12 @@ struct rp_child_info /* These defines should be used to specify the modifier mask for keys and they are translated into the X11 modifier mask when the time comes to compare modifier masks. */ -#define RP_CONTROL_MASK 1 -#define RP_META_MASK 2 -#define RP_ALT_MASK 4 -#define RP_SUPER_MASK 8 -#define RP_HYPER_MASK 16 +#define RP_SHIFT_MASK 1 +#define RP_CONTROL_MASK 2 +#define RP_META_MASK 4 +#define RP_ALT_MASK 8 +#define RP_SUPER_MASK 16 +#define RP_HYPER_MASK 32 struct modifier_info { diff --git a/src/input.c b/src/input.c index 92f7b07..b9ecd4c 100644 --- a/src/input.c +++ b/src/input.c @@ -39,6 +39,7 @@ x11_mask_to_rp_mask (unsigned int mask) PRINT_DEBUG (("x11 mask = %x\n", mask)); + result |= mask & ShiftMask ? RP_SHIFT_MASK:0; result |= mask & ControlMask ? RP_CONTROL_MASK:0; result |= mask & rp_modifier_info.meta_mod_mask ? RP_META_MASK:0; result |= mask & rp_modifier_info.alt_mod_mask ? RP_ALT_MASK:0; @@ -60,6 +61,7 @@ rp_mask_to_x11_mask (unsigned int mask) PRINT_DEBUG (("rp mask = %x\n", mask)); + result |= mask & RP_SHIFT_MASK ? ShiftMask:0; result |= mask & RP_CONTROL_MASK ? ControlMask:0; result |= mask & RP_META_MASK ? rp_modifier_info.meta_mod_mask:0; result |= mask & RP_ALT_MASK ? rp_modifier_info.alt_mod_mask:0; @@ -172,7 +174,9 @@ keysym_to_keycode_mod (KeySym keysym, KeyCode *code, unsigned int *mod) *code = XKeysymToKeycode (dpy, keysym); lower = XKeycodeToKeysym (dpy, *code, 0); upper = XKeycodeToKeysym (dpy, *code, 1); - if (upper == keysym) + /* If you need to press shift to get the keysym, add the shift + mask. */ + if (upper == keysym && lower != keysym) *mod = ShiftMask; } @@ -183,7 +187,6 @@ grab_key (KeySym keysym, unsigned int modifiers, Window grab_window) { unsigned int mod_list[8]; int i; - KeySym upper, lower; KeyCode keycode; unsigned int mod; @@ -223,11 +226,12 @@ keysym_to_string (KeySym keysym, unsigned int modifier) name = sbuf_new (0); + if (modifier & RP_SHIFT_MASK) sbuf_concat (name, "S-"); if (modifier & RP_CONTROL_MASK) sbuf_concat (name, "C-"); if (modifier & RP_META_MASK) sbuf_concat (name, "M-"); if (modifier & RP_ALT_MASK) sbuf_concat (name, "A-"); if (modifier & RP_HYPER_MASK) sbuf_concat (name, "H-"); - if (modifier & RP_SUPER_MASK) sbuf_concat (name, "S-"); + if (modifier & RP_SUPER_MASK) sbuf_concat (name, "s-"); /* On solaris machines (perhaps other machines as well) this call can return NULL. In this case use the "NULL" string. */ @@ -255,6 +259,8 @@ int cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_name, int len, int ignore_bad_mods) { int nbytes; + int shift = 0; + KeySym lower, upper; if (ignore_bad_mods) { @@ -271,12 +277,24 @@ cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_nam keysym_name[nbytes] = '\0'; } + /* Find out if XLookupString gobbled the shift modifier */ + if (ev->state & ShiftMask) + { + lower = XKeycodeToKeysym (dpy, ev->keycode, 0); + upper = XKeycodeToKeysym (dpy, ev->keycode, 1); + /* If the keysym isn't affected by the shift key, then keep the + shift modifier. */ + if (lower == upper) + shift = ShiftMask; + } + *mod = ev->state; *mod &= (rp_modifier_info.meta_mod_mask | rp_modifier_info.alt_mod_mask | rp_modifier_info.hyper_mod_mask | rp_modifier_info.super_mod_mask - | ControlMask ); + | ControlMask + | shift); return nbytes; } |