ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] Re: Using 'Window' key as prefix


From: Stephane Chauveau
Subject: [RP] Re: Using 'Window' key as prefix
Date: Wed Oct 16 14:44:02 2002
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021015

Henrik Enberg wrote:

Stephane Chauveau <address@hidden> writes:

What I would like is the ability to press "S-w" without a
prefix.

Oh, that's not possible without hacking the source rather severly.

Really :-)
Here is a quick & dirty patch to enable my Windows Key (mapped to Mod4).
This is from version 1.1.1.

========== at the end of grab_key()  in input.c ==================

 // grab Mod4 as a replacement for the prefix
XGrabKey(dpy, AnyKey, Mod4Mask , grab_window, True, GrabModeAsync, GrabModeAsync);

========== modified key_press() in events.c  ==================

static void
key_press (XEvent *ev)
{
 screen_info *s;
 unsigned int modifier;
 KeySym ks;

 s = find_screen (ev->xkey.root);

#ifdef HIDE_MOUSE
XWarpPointer (dpy, None, s->root, 0, 0, 0, 0, s->root_attr.width - 2, s->root_attr.height - 2);
#endif


 if (!s) return;

 modifier = ev->xkey.state;
 cook_keycode ( &ev->xkey, &ks, &modifier, NULL, 0, 1);

/**************** PATCH STARTS HERE ************/
 if (modifier & Mod4Mask)
   {
     rp_action *key_action;
if ((key_action = find_keybinding (ks, x11_mask_to_rp_mask (modifier & (~Mod4Mask)))))
   {
     char *result;
     result = command (1, key_action->data);
/* Gobble the result. */
     if (result)
       free (result);
   }
   }
 else
/**************** PATCH ENDS HERE *************/
if (ks == prefix_key.sym && (x11_mask_to_rp_mask (modifier) == prefix_key.state))
   {
     handle_key (s);
   }
 else
   {
     if (current_window())
   {
     ignore_badwindow++;
     ev->xkey.window = current_window()->w;
     XSendEvent (dpy, current_window()->w, False, KeyPressMask, ev);
     XSync (dpy, False);
     ignore_badwindow--;
   }
   }
}







reply via email to

[Prev in Thread] Current Thread [Next in Thread]