}
- if (!should_invoke [htype])
+ if (!term->perl.should_invoke [htype])
return false;
}
# undef def
HV *stash = gv_stashpv ("urxvt", 1);
-# define export_const_iv(name) newCONSTSUB (stash, # name, newSViv (name));
- export_const_iv (DEFAULT_RSTYLE);
- export_const_iv (OVERLAY_RSTYLE);
- export_const_iv (RS_Bold);
- export_const_iv (RS_Italic);
- export_const_iv (RS_Blink);
- export_const_iv (RS_RVid);
- export_const_iv (RS_Uline);
-
- export_const_iv (CurrentTime);
- export_const_iv (ShiftMask);
- export_const_iv (LockMask);
- export_const_iv (ControlMask);
- export_const_iv (Mod1Mask);
- export_const_iv (Mod2Mask);
- export_const_iv (Mod3Mask);
- export_const_iv (Mod4Mask);
- export_const_iv (Mod5Mask);
- export_const_iv (Button1Mask);
- export_const_iv (Button2Mask);
- export_const_iv (Button3Mask);
- export_const_iv (Button4Mask);
- export_const_iv (Button5Mask);
- export_const_iv (AnyModifier);
-
- export_const_iv (EVENT_NONE);
- export_const_iv (EVENT_READ);
- export_const_iv (EVENT_WRITE);
+ struct {
+ const char *name;
+ IV iv;
+ } *civ, const_iv[] = {
+# define const_iv(name) { # name, (IV)name }
+ const_iv (DEFAULT_RSTYLE),
+ const_iv (OVERLAY_RSTYLE),
+ const_iv (RS_Bold),
+ const_iv (RS_Italic),
+ const_iv (RS_Blink),
+ const_iv (RS_RVid),
+ const_iv (RS_Uline),
+
+ const_iv (CurrentTime),
+ const_iv (ShiftMask),
+ const_iv (LockMask),
+ const_iv (ControlMask),
+ const_iv (Mod1Mask),
+ const_iv (Mod2Mask),
+ const_iv (Mod3Mask),
+ const_iv (Mod4Mask),
+ const_iv (Mod5Mask),
+ const_iv (Button1Mask),
+ const_iv (Button2Mask),
+ const_iv (Button3Mask),
+ const_iv (Button4Mask),
+ const_iv (Button5Mask),
+ const_iv (AnyModifier),
+
+ const_iv (EVENT_NONE),
+ const_iv (EVENT_READ),
+ const_iv (EVENT_WRITE),
+
+ const_iv (NoEventMask),
+ const_iv (KeyPressMask),
+ const_iv (KeyReleaseMask),
+ const_iv (ButtonPressMask),
+ const_iv (ButtonReleaseMask),
+ const_iv (EnterWindowMask),
+ const_iv (LeaveWindowMask),
+ const_iv (PointerMotionMask),
+ const_iv (PointerMotionHintMask),
+ const_iv (Button1MotionMask),
+ const_iv (Button2MotionMask),
+ const_iv (Button3MotionMask),
+ const_iv (Button4MotionMask),
+ const_iv (Button5MotionMask),
+ const_iv (ButtonMotionMask),
+ const_iv (KeymapStateMask),
+ const_iv (ExposureMask),
+ const_iv (VisibilityChangeMask),
+ const_iv (StructureNotifyMask),
+ const_iv (ResizeRedirectMask),
+ const_iv (SubstructureNotifyMask),
+ const_iv (SubstructureRedirectMask),
+ const_iv (FocusChangeMask),
+ const_iv (PropertyChangeMask),
+ const_iv (ColormapChangeMask),
+ const_iv (OwnerGrabButtonMask),
+
+ const_iv (KeyPress),
+ const_iv (KeyRelease),
+ const_iv (ButtonPress),
+ const_iv (ButtonRelease),
+ const_iv (MotionNotify),
+ const_iv (EnterNotify),
+ const_iv (LeaveNotify),
+ const_iv (FocusIn),
+ const_iv (FocusOut),
+ const_iv (KeymapNotify),
+ const_iv (Expose),
+ const_iv (GraphicsExpose),
+ const_iv (NoExpose),
+ const_iv (VisibilityNotify),
+ const_iv (CreateNotify),
+ const_iv (DestroyNotify),
+ const_iv (UnmapNotify),
+ const_iv (MapNotify),
+ const_iv (MapRequest),
+ const_iv (ReparentNotify),
+ const_iv (ConfigureNotify),
+ const_iv (ConfigureRequest),
+ const_iv (GravityNotify),
+ const_iv (ResizeRequest),
+ const_iv (CirculateNotify),
+ const_iv (CirculateRequest),
+ const_iv (PropertyNotify),
+ const_iv (SelectionClear),
+ const_iv (SelectionRequest),
+ const_iv (SelectionNotify),
+ const_iv (ColormapNotify),
+ const_iv (ClientMessage),
+ const_iv (MappingNotify),
+ };
+
+ for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]);
+ civ-- > const_iv; )
+ newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
}
void
-set_should_invoke (int htype, int value)
- CODE:
- rxvt_perl.should_invoke [htype] = value;
-
-void
warn (const char *msg)
CODE:
rxvt_warn ("%s", msg);
rxvt_term::destroy ()
void
+rxvt_term::set_should_invoke (int htype, int inc)
+ CODE:
+ THIS->perl.should_invoke [htype] += inc;
+
+void
rxvt_term::grab_button (int button, U32 modifiers)
CODE:
XGrabButton (THIS->display->display, button, modifiers, THIS->vt, 1,
OUTPUT:
RETVAL
+void
+rxvt_term::vt_emask_add (U32 emask)
+ CODE:
+ THIS->vt_emask_perl |= emask;
+ THIS->vt_select_input ();
+
U32
rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle)
CODE:
C<perl:string> action bound to it (see description of the B<keysym>
resource in the @@RXVT_NAME@@(1) manpage).
+=item on_x_event $term, $event
+
+Called on every X event received on the vt window (and possibly other
+windows). Should only be used as a last resort. Most event structure
+members are not passed.
+
=item on_focus_in $term
Called whenever the window gets the keyboard focus, before rxvt-unicode
Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask,
Button4Mask, Button5Mask, AnyModifier
+=item urxvt::NoEventMask, KeyPressMask, KeyReleaseMask,
+ButtonPressMask, ButtonReleaseMask, EnterWindowMask, LeaveWindowMask,
+PointerMotionMask, PointerMotionHintMask, Button1MotionMask, Button2MotionMask,
+Button3MotionMask, Button4MotionMask, Button5MotionMask, ButtonMotionMask,
+KeymapStateMask, ExposureMask, VisibilityChangeMask, StructureNotifyMask,
+ResizeRedirectMask, SubstructureNotifyMask, SubstructureRedirectMask,
+FocusChangeMask, PropertyChangeMask, ColormapChangeMask, OwnerGrabButtonMask
+
+=item urxvt::KeyPress, KeyRelease, ButtonPress, ButtonRelease, MotionNotify,
+EnterNotify, LeaveNotify, FocusIn, FocusOut, KeymapNotify, Expose,
+GraphicsExpose, NoExpose, VisibilityNotify, CreateNotify, DestroyNotify,
+UnmapNotify, MapNotify, MapRequest, ReparentNotify, ConfigureNotify,
+ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify,
+CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest,
+SelectionNotify, ColormapNotify, ClientMessage, MappingNotify
+
Various constants for use in X calls and event processing.
=back
$ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin";
}
-my @hook_count;
my $verbosity = $ENV{URXVT_PERL_VERBOSITY};
sub verbose {
}
if ($htype == 1) { # DESTROY
- if (my $hook = delete $TERM->{_hook}) {
- for my $htype (0..$#$hook) {
- $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} }
- or set_should_invoke $htype, 0;
- }
- }
-
# clear package objects
%$_ = () for values %{ $TERM->{_pkg} };
defined $htype
or Carp::croak "unsupported hook type '$name'";
- unless (exists $self->{term}{_hook}[$htype]{$pkg}) {
- $hook_count[$htype]++
- or urxvt::set_should_invoke $htype, 1;
- }
+ $self->set_should_invoke ($htype, +1)
+ unless exists $self->{term}{_hook}[$htype]{$pkg};
$self->{term}{_hook}[$htype]{$pkg} = $cb;
}
defined $htype
or Carp::croak "unsupported hook type '$name'";
- if (delete $self->{term}{_hook}[$htype]{$pkg}) {
- --$hook_count[$htype]
- or urxvt::set_should_invoke $htype, 0;
- }
+ $self->set_should_invoke ($htype, -1)
+ if delete $self->{term}{_hook}[$htype]{$pkg};
}
}
Return the window id of the terminal window.
+=item $term->vt_emask_add ($x_event_mask)
+
+Adds the specified events to the vt event mask. Useful e.g. when you want
+to receive pointer events all the times:
+
+ $term->vt_emask_add (urxvt::PointerMotionMask);
+
=item $window_width = $term->width
=item $window_height = $term->height