}
}
+ if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_STRING_LEN, kbuf, len, DT_END)))
+ return;
+
if (len <= 0)
return; /* not mapped */
if (ev.xany.window == vt)
{
- if (ev.xbutton.state & (Button1Mask | Button3Mask))
+ if (HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END)))
+ ; // nop
+ else if (ev.xbutton.state & (Button1Mask | Button3Mask))
{
while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev))
;
if (ev.button != MEvent.button)
MEvent.clicks = 0;
- if (!HOOK_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END)))
+ if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
switch (ev.button)
{
case Button1:
&& ev.button == Button1 && MEvent.clicks <= 1)
selection_extend (ev.x, ev.y, 0);
+ if (!HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
+ return;
+
switch (ev.button)
{
case Button1:
def (KEYBOARD_COMMAND)
- def (MOUSE_CLICK)
- def (MOUSE_MOVE)
+ def (KEY_PRESS)
+ def (KEY_RELEASE)
+ def (BUTTON_PRESS)
+ def (BUTTON_RELEASE)
+ def (MOTION_NOTIFY)
DT_INT,
DT_LONG,
DT_STRING,
+ DT_STRING_LEN,
DT_USTRING_LEN,
DT_XEVENT,
};
XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0)));
break;
+ case DT_STRING_LEN:
+ {
+ char *str = va_arg (ap, char *);
+ int len = va_arg (ap, int);
+
+ XPUSHs (sv_2mortal (newSVpvn (str, len)));
+ }
+ break;
+
+ case DT_XEVENT:
+ {
+ XEvent *xe = va_arg (ap, XEvent *);
+ HV *hv = newHV ();
+
+# define set(name, sv) hv_store (hv, # name, sizeof (# name) - 1, sv, 0)
+# define setiv(name, val) hv_store (hv, # name, sizeof (# name) - 1, newSViv (val), 0)
+# undef set
+
+ setiv (type, xe->type);
+ setiv (send_event, xe->xany.send_event);
+ setiv (serial, xe->xany.serial);
+
+ switch (xe->type)
+ {
+ case KeyPress:
+ case KeyRelease:
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ setiv (time, xe->xmotion.time);
+ setiv (x, xe->xmotion.x);
+ setiv (y, xe->xmotion.y);
+ setiv (x_root, xe->xmotion.x_root);
+ setiv (y_root, xe->xmotion.y_root);
+ setiv (state, xe->xmotion.state);
+ break;
+ }
+
+ switch (xe->type)
+ {
+ case KeyPress:
+ case KeyRelease:
+ setiv (keycode, xe->xkey.keycode);
+ break;
+
+ case ButtonPress:
+ case ButtonRelease:
+ setiv (button, xe->xbutton.button);
+ break;
+
+ case MotionNotify:
+ setiv (is_hint, xe->xmotion.is_hint);
+ break;
+ }
+
+ XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv)));
+ }
+ break;
+
case DT_USTRING_LEN:
{
unicode_t *ustr = va_arg (ap, unicode_t *);
C<perl:string> action bound to it (see description of the B<keysym>
resource in the @@RXVT_NAME@@(1) manpage).
-=item on_key_press $term, $event
+=item on_key_press $term, $event, $octets
=item on_key_release $term, $event
=item on_motion_notify $term, $event
-Called whenever the corresponding X event is received for the terminal. If
-the hook returns true, then the even will be ignored by rxvt-unicode.
+Called whenever the corresponding X event is received for the terminal
+(see the XEvent manpage) If the hook returns true, then the even will be
+ignored by rxvt-unicode.
+
+C<on_key_press> additionally receives the string rxvt-unicode would
+output, if any, in locale-specific encoding.
subwindow.