*** empty log message ***
authorroot <root>
Thu, 6 Jul 2006 23:48:10 +0000 (23:48 +0000)
committerroot <root>
Thu, 6 Jul 2006 23:48:10 +0000 (23:48 +0000)
Changes
MANIFEST
src/command.C
src/hookinc.h
src/main.C
src/perl/kuake [new file with mode: 0644]
src/rxvt.h
src/rxvtperl.xs
src/urxvt.pm

diff --git a/Changes b/Changes
index 9a47a7a568e92ab049e903cdfa24231faeaf3240..9aed84e653c04af9960fce4403f74829cca76883 100644 (file)
--- a/Changes
+++ b/Changes
@@ -19,14 +19,16 @@ WISH: anyevent mouse notification / manage MotionMask better.
 WISH: http://www120.pair.com/mccarthy/nextstep/intro.htmld/Workspace.html is the correct nextstep look.
 DUMB: support tex fonts
 
+7.8
 TODO: investigate -pe tabbed -g 80x25 being 23 not 24 or 25 lines
 TODO: zero scorllback buffer should free memory
-TODO: kuake
        - INCOMPATIBLE CHANGE: this version will always read ~/.Xdefaults,
           earlier versions only read it if display-resources (usually from
           .Xresources) are not set. This avoids the #1 FAQ ("why isn't my
           resource used") and seems to be logical behaviour, too. .Xdefaults
           resources have a lower priority than display-specific resources.
+        - add "kuake" perl extension that does a similar thing to the kuake
+          terminal emulator (see man urxtvperl).
         - use less "correct" color scaling that is compatible with libX11 and
           Xft (avoids off-by-one colors resulting in striped backgrounds).
         - the "depth" resource is now respected.
index a6ce565dbebac9ba7f913046a96a64373872a58c..96ddd8fe65cacc0908a52cb65151ff1d191ea0aa 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -171,6 +171,7 @@ src/perl/tabbed
 src/perl/xim-onthespot
 src/perl/readline
 src/perl/remote-clipboard
+src/perl/kuake
 src/perl/example-refresh-hooks
 src/perl/block-graphics-to-ascii
 src/perl/digital-clock
index c405c8113799b11877f1d026cdded6d464136ef8..b4097bc1de72841b64b601226f57482f03db561c 100644 (file)
@@ -1790,12 +1790,17 @@ rxvt_term::update_fade_color (unsigned int idx)
 #endif
 }
 
-#if TRANSPARENT
+#if TRANSPARENT || ENABLE_PERL
 void
 rxvt_term::rootwin_cb (XEvent &ev)
 {
   make_current ();
 
+  if (SHOULD_INVOKE (HOOK_ROOT_EVENT)
+      && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END)))
+    return;
+
+# if TRANSPARENT
   switch (ev.type)
     {
       case PropertyNotify:
@@ -1813,6 +1818,7 @@ rxvt_term::rootwin_cb (XEvent &ev)
           want_refresh = want_full_refresh = 1;
         break;
     }
+# endif
 }
 #endif
 
index 603ebe77e1fd70696f1d7658eb5f9a901a8b4982..346fc59528369189c89102ffcc20e3eafc81f928 100644 (file)
@@ -27,6 +27,7 @@
 
   def (USER_COMMAND)
 
+  def (ROOT_EVENT)
   def (X_EVENT)
   def (FOCUS_IN)
   def (FOCUS_OUT)
index 1acc5f7db6cc4c9183c6c1a1778a284efaaae62f..8b28c7fa8e9fff3025b0d9406412f4f9f700e595 100644 (file)
@@ -145,7 +145,7 @@ int rxvt_composite_vec::expand (unicode_t c, wchar_t *r)
 
 rxvt_term::rxvt_term ()
     :
-#if TRANSPARENT
+#if TRANSPARENT || ENABLE_PERL
     rootwin_ev (this, &rxvt_term::rootwin_cb),
 #endif
 #ifdef HAVE_SCROLLBARS
@@ -328,7 +328,7 @@ rxvt_term::destroy ()
 #if HAVE_SCROLLBARS
       scrollbar_ev.stop (display);
 #endif
-#if TRANSPARENT
+#if TRANSPARENT || ENABLE_PERL
       rootwin_ev.stop (display);
 #endif
       incr_ev.stop ();
@@ -506,6 +506,9 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv)
       rootwin_ev.start (display, display->root);
     }
 #endif
+#if ENABLE_PERL
+  rootwin_ev.start (display, display->root);
+#endif
 
   set_colorfgbg ();
 
diff --git a/src/perl/kuake b/src/perl/kuake
new file mode 100644 (file)
index 0000000..9ea5166
--- /dev/null
@@ -0,0 +1,52 @@
+#! perl
+
+sub on_start {
+   my ($self) = @_;
+
+   $self->{key} = $self->{argv}[0] || "F10";
+
+   $self->{keysym} = $self->XStringToKeysym ($self->{key})
+      or urxvt::fatal "cannot convert requested kuake wake-up key '$self->{key}' to keysym, unable to continue.\n";
+
+   $self->{keycode} = $self->XKeysymToKeycode ($self->{keysym})
+      or urxvt::fatal "cannot convert requested kuake wake-up key '$self->{key}' to keycode, unable to continue.\n";
+
+   $self->XGrabKey ($self->{keycode}, urxvt::AnyModifier, $self->DefaultRootWindow);
+
+   $self->XUnmapWindow ($self->parent);
+
+   $self->{unmap_me} = 1;
+
+   ()
+}
+
+sub on_map_notify {
+   my ($self) = @_;
+
+   # suppress initial map event
+   $self->XUnmapWindow ($self->parent)
+      if delete $self->{unmap_me};
+   
+   ()
+}
+
+sub on_root_event {
+   my ($self, $event) = @_;
+
+   return unless $event->{type} == urxvt::KeyPress && $event->{keycode} == $self->{keycode};
+
+   $self->mapped
+      ? $self->XUnmapWindow ($self->parent)
+      : $self->XMapWindow ($self->parent);
+
+   1
+}
+
+sub on_destroy {
+   my ($self) = @_;
+
+   $self->XUngrabKey ($self->XKeysymToKeycode ($self->{keysym}), 0, $self->DefaultRootWindow)
+      if $self->{keysym};
+
+   ()
+}
index e71e9af5cd627a345be8dd523860a06e7cb639c7..82dc3ec4bbe1a9fae412bac39b78091028f93dd4 100644 (file)
@@ -1101,7 +1101,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
     XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim);
   }
 
-#if TRANSPARENT
+#if TRANSPARENT || ENABLE_PERL
   void rootwin_cb (XEvent &xev);
   xevent_watcher rootwin_ev;
 #endif
index 6ebbe1f99e3ba8a1fc85451562356fe4d8c18a4f..ebf8864958507d0ad229c940a997bb7a625005c3 100644 (file)
@@ -790,6 +790,10 @@ BOOT:
     const_iv (Button5Mask),
     const_iv (AnyModifier),
 
+    const_iv (NoSymbol),
+    const_iv (GrabModeSync),
+    const_iv (GrabModeAsync),
+
     const_iv (EVENT_NONE),
     const_iv (EVENT_READ),
     const_iv (EVENT_WRITE),
@@ -1014,31 +1018,35 @@ rxvt_term::set_should_invoke (int htype, int inc)
        CODE:
         THIS->perl.should_invoke [htype] += inc;
 
-void
+int
 rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt)
        CODE:
-        XGrabButton (THIS->dpy, button, modifiers, window, 1,
-                     ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
-                     GrabModeSync, GrabModeSync, None, GRAB_CURSOR);
+        RETVAL = XGrabButton (THIS->dpy, button, modifiers, window, 1,
+                              ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
+                              GrabModeSync, GrabModeSync, None, GRAB_CURSOR);
+       OUTPUT: RETVAL
 
-void
+int
 rxvt_term::ungrab_button (int button, U32 modifiers, Window window = THIS->vt)
        CODE:
-        XUngrabButton (THIS->dpy, button, modifiers, window);
-
-#if 0
+        RETVAL = XUngrabButton (THIS->dpy, button, modifiers, window);
+       OUTPUT: RETVAL
 
 void
-XGrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt)
-       C_ARGS:
-        THIS->dpy, keycode, modifiers, window, 1,
-        GrabModeSync, GrabModeSync
+rxvt_term::XGrabKey (int keycode, U32 modifiers, Window window = THIS->vt, \
+                     int owner_events = 1, int pointer_mode = GrabModeAsync, int keyboard_mode = GrabModeAsync)
+       CODE:
+        XGrabKey (THIS->dpy, keycode, modifiers, window, owner_events, pointer_mode, keyboard_mode);
 
 void
-XUngrabKey (rxvt_term *THIS, int keycode, U32 modifiers, Window window = THIS->vt)
-       C_ARGS: THIS->dpy, keycode, modifiers, window
+rxvt_term::XUngrabKey (int keycode, U32 modifiers, Window window = THIS->vt)
+       CODE:
+       XUngrabKey (THIS->dpy, keycode, modifiers, window);
 
-#endif
+void
+rxvt_term::XUngrabKeyboard (Time eventtime)
+       CODE:
+       XUngrabKeyboard (THIS->dpy, eventtime);
 
 bool
 rxvt_term::grab (Time eventtime, int sync = 0)
@@ -1082,6 +1090,30 @@ rxvt_term::ungrab ()
        CODE:
         ungrab (THIS);
 
+int
+rxvt_term::XStringToKeysym (char *string)
+       CODE:
+        RETVAL = XStringToKeysym (string);
+       OUTPUT: RETVAL
+
+char *
+rxvt_term::XKeysymToString (int sym)
+       CODE:
+        RETVAL = XKeysymToString (sym);
+       OUTPUT: RETVAL
+
+int
+rxvt_term::XKeysymToKeycode (int sym)
+       CODE:
+        RETVAL = XKeysymToKeycode (THIS->dpy, sym);
+       OUTPUT: RETVAL
+
+int
+rxvt_term::XKeycodeToKeysym (int code, int index)
+       CODE:
+        RETVAL = XKeycodeToKeysym (THIS->dpy, code, index);
+       OUTPUT: RETVAL
+
 int
 rxvt_term::strwidth (SV *str)
        CODE:
index a9265809e6c23416eaf124ff903393cae87746f1..948c0d0570343d5c8c243ca3d11fa5c5df8e94c8 100644 (file)
@@ -261,6 +261,25 @@ C<OnTheSpot>, i.e.:
 
    @@RXVT_NAME@@ -pt OnTheSpot -pe xim-onthespot
 
+=item kuake<hotkey>
+
+A very primitive quake-console-like extension. It was inspired by a
+description of how the programs C<kuake> and C<yakuake> work: Whenever the
+user presses a global accelerator key (by default C<F10>), the terminal
+will show or hide itself. Another press of the accelerator key will hide
+or show it again.
+
+Initially, the window will not be shown when using this extension.
+
+This is useful if you need a single terminal thats not using any desktop
+space most of the time but is quickly available at the press of a key.
+
+The accelerator key is grabbed regardless of any modifers, so this
+extension will actually grab a physical key just for this function.
+
+If you want a quake-like animation, tell your window manager to do so
+(fvwm can do it).
+
 =item automove-background
 
 This is basically a very small extension that dynamically changes the
@@ -584,6 +603,10 @@ 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_root_event $term, $event
+
+Like C<on_x_event>, but is called for events on the root window.
+
 =item on_focus_in $term
 
 Called whenever the window gets the keyboard focus, before rxvt-unicode