Hi,

the attached patch seems to fix the problem for me.  I basically invoke
the relevant hooks early in key_press() and key_release() to allow the
embedded terminals to do their own event processing.

The perl wrapper functions needs to do an additional refresh_check(),
similar to the x_cb() that usually calls the key_press() and
key_release() functions.

HTH,
Martin

On 01.03.2014 23:33, Martin Pohlack wrote:
> Something like this here:
> 
> ----------------------------------------------------------------------
> --- rxvt-unicode-9.19.orig/src/command.C      2013-05-06 07:37:06.000000000 
> +0200
> +++ rxvt-unicode-9.19/src/command.C   2014-03-01 22:34:34.388207806 +0100
> @@ -486,6 +486,8 @@
>        valid_keysym = keysym != NoSymbol;
>      }
>  
> +  if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, 
> DT_STR_LEN, kbuf, len, DT_END)))
> +    return;
>    if (valid_keysym)
>      {
>  #ifdef KEYSYM_RESOURCE
> ----------------------------------------------------------------------
> 
> seems to do almost the right thing.  It forwards the key events to the 
> embedded terminal instances, calls the correct functions in them with the 
> right parameters and invokes the scrolling functionality, but the new 
> scrollstate is not visually updated.  Somewhere a refresh of some kind is 
> needed.  If you scroll with the mouse wheel on the non-updated state, you see 
> what I mean.
> 
> Martin
> 
> On 01.03.2014 11:59, Martin Pohlack wrote:
>> It looks to me as if Shift-PgUp and similar events are directly consumed
>> in the master terminal in command.C:rxvt_term::key_press() starting
>> around here:
>>
>> ...
>>       if (saveLines)
>>         {
>> #ifdef UNSHIFTED_SCROLLKEYS
>>           if (!ctrl && !meta)
>> #else
>>           if (IS_SCROLL_MOD)
>> #endif
>>             {
>>               int lnsppg;
>> ...
>>
>> There is no hook invoked before that, which could transfer the key
>> events to the embedded child terminal (from tabbed).
>>
>> When I dump "this" in screen.C:rxvt_term::scr_changeview() I get the
>> address of the master instance when keys are sent without mouse focus
>> and the address of the child instance when mouse is directly over the
>> embedded terminal.
>>
>> Intuitively, a hook should be inserted somewhere at the start of
>> key_press() to allow for childs to do a full event consumptions.
>> Details are tricky though.
>>
>> Martin
>>
>> On 28.02.2014 19:03, Martin Pohlack wrote:
>>> Hi again,
>>>
>>> I also observe the problem with xfce and focus follows mouse.
>>>
>>> I think the difference is, which instance of urxvt receives and cooks
>>> the key sequence, so whether the embedded tab instances receive events
>>> directly or whether the outer instances receives, processes, and
>>> forwards them.
>>>
>>> Last time I instrumented the relevant code path with printfs to gain
>>> some clarity ... maybe I find the time again in the next weeks.
>>>
>>> Martin
>>>
>>> On 28.02.2014 08:01, Vas No Medas wrote:
>>>> Hello again.
>>>>
>>>> I've tried installing rxvt-unicode 9.15 and rxvt-unicode 9.14, enabled
>>>> tabbed extension there and the bug was also there. (At  first I though
>>>> that it was broken again after 9.15)
>>>>
>>>> Also I thought that it could be a problem with awesome, so I installed
>>>> xubuntu on virtualbox, launch rxvt-unicode 9.18 + tabbed there and tried
>>>> scrolling up-down with Shift+PageUp/PageDown and it also didn't work
>>>> when mouse pointer was not in window.
>>>>
>>>> I also tried diving with gdb in rxvt-unicode source code to see where it
>>>> differs between when mouse pointer is inside/outside, but haven't
>>>> succeeded. Maybe anyone knows why and how it detects mouse outside window?
>>>>
>>>> Vas
>>>>
>>>>
>>>> On Mon, Feb 24, 2014 at 3:31 AM, Michael Traxler <[email protected]
>>>> <mailto:[email protected]>> wrote:
>>>>
>>>>     Hi,
>>>>
>>>>     I can verify the wrong behaviour of urxvt-9.19 and tabbedex together
>>>>     with
>>>>     awesome and the shift-page-up/down. Only works if the mouse is in the
>>>>     terminal, even though the focus is on urxvt (never dared to report!).
>>>>
>>>>     shift-cursor-left/right to change the tab is working without
>>>>     problems even if
>>>>     the mouse is outside of urxvt.
>>>>
>>>>     Michael
>>>>
>>>>     ------------------------------__---------
>>>>
>>>>
>>>>     On Sun, 23 Feb 2014, Vas No Medas wrote:
>>>>
>>>>         Hi, Martin!
>>>>
>>>>         I've disabled the scrolling redefinition. Now I can't scroll
>>>>         line-by-line
>>>>         with Shift+Up/Down.
>>>>         Shift+PageUp/PageDown (I haven't redefined it) works only when
>>>>         mouse is
>>>>         inside urxvt.
>>>>         I've also investigated a bit:
>>>>         Alt+S (searchable-scrollback) works even if mouse is outside.
>>>>         Ctrl+Shift+Up/Down/Left/Right work even if mouse is outside.
>>>>
>>>>         I've also tried disabling
>>>>         !URxvt*.iso14755: false
>>>>         !URxvt*.iso14755_52: false
>>>>         But still no luck.
>>>>
>>>>
>>>>
>>>>         On Sun, Feb 23, 2014 at 8:58 PM, Martin Pohlack
>>>>         <[email protected]
>>>>         <mailto:[email protected]>>__wrote:
>>>>
>>>>             Hi,
>>>>
>>>>             your resources do contain redefinitions for scrolling:
>>>>
>>>>               URxvt*.keysym.Shift-Up: command:\033]720;1\007
>>>>               URxvt*.keysym.Shift-Down: command:\033]721;1\007
>>>>
>>>>             Do you still see the problem if you use the defaults there
>>>>             (remove them)
>>>>             + reload X resources (or logout / login)?
>>>>
>>>>             If you trace the processing of the key sequences, I would
>>>>             assume that
>>>>             they are processed in the main instance and not the tabbed
>>>>             ones and
>>>>             therefore never arrive in the specific instances.
>>>>
>>>>             Martin
>>>>
>>>>             On 23.02.2014 13:48, Vas No Medas wrote:
>>>>
>>>>                 Hello!
>>>>
>>>>                 I have awesome WM and urxvt v9.19 with tabbed plugin
>>>>                 enabled. Also I
>>>>                 scroll with Shift+Up/Down. When I switch focus to my
>>>>                 urxvt terminal but
>>>>                 leave mouse outside, Shift+Up/Down has no effect.
>>>>                 However, if I move the
>>>>                 mouse in, scrolling works just right.
>>>>
>>>>                 Also when I disable tabbed plugin, scrolling works in
>>>>                 all cases. I've
>>>>                 tried tabbedex, but the situation is still the same.
>>>>
>>>>                 I've found a similar bugreport
>>>>                 https://bugs.debian.org/cgi-__bin/bugreport.cgi?bug=511377
>>>>                 <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511377>
>>>>                 which says that
>>>>                 this was fixed in 9.14-15
>>>>                 The solution there was to add on_tt_write handler. My
>>>>                 perl/tabbed file
>>>>                 also has on_tt_write handler but it seems that it is
>>>>                 never called (tried
>>>>                 putting warn in it)
>>>>
>>>>                 Here is my ~/.Xresources file:
>>>>
>>>>             http://bpaste.net/show/__AddbC9C0d9U7qovNAa0R/
>>>>             <http://bpaste.net/show/AddbC9C0d9U7qovNAa0R/>
>>>>
>>>>
>>>>                 Also would be great if you could tell if you were able
>>>>                 to reproduce the
>>>>
>>>>             bug
>>>>
>>>>
>>>>
>>>>                 _________________________________________________
>>>>                 rxvt-unicode mailing list
>>>>                 [email protected]
>>>>                 <mailto:[email protected]>
>>>>                 
>>>> http://lists.schmorp.de/cgi-__bin/mailman/listinfo/rxvt-__unicode
>>>>                 
>>>> <http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> rxvt-unicode mailing list
>>>> [email protected]
>>>> http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
>>>>
>>>
>>>
>>> _______________________________________________
>>> rxvt-unicode mailing list
>>> [email protected]
>>> http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
>>>
>>
>>
>> _______________________________________________
>> rxvt-unicode mailing list
>> [email protected]
>> http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
>>
> 
> 
> _______________________________________________
> rxvt-unicode mailing list
> [email protected]
> http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
> 

diff -u rxvt-unicode-9.19.orig/src/command.C rxvt-unicode-9.19/src/command.C
--- rxvt-unicode-9.19.orig/src/command.C	2013-05-06 07:37:06.000000000 +0200
+++ rxvt-unicode-9.19/src/command.C	2014-03-02 20:28:17.045766536 +0100
@@ -410,6 +410,10 @@
   int valid_keysym;
   char kbuf[KBUFSZ];
 
+  // allow early handling of events for plugins
+  if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_END)))
+    return;
+
 #if ISO_14755
   if (iso14755buf & ISO_14755_52)
     return;
@@ -864,6 +902,10 @@
 void ecb_cold
 rxvt_term::key_release (XKeyEvent &ev)
 {
+  // allow early handling of events for plugins
+  if (HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_END)))
+    return;
+
 #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL
   KeySym keysym;
 
diff -u rxvt-unicode-9.19.orig/src/rxvtperl.xs rxvt-unicode-9.19/src/rxvtperl.xs
--- rxvt-unicode-9.19.orig/src/rxvtperl.xs	2013-10-03 02:55:37.000000000 +0200
+++ rxvt-unicode-9.19/src/rxvtperl.xs	2014-03-02 20:25:19.164884465 +0100
@@ -1535,6 +1535,9 @@
           THIS->key_release (xkey);
         else
           THIS->key_press (xkey);
+
+        // similar refresh check as in standalone x_cb() function
+        THIS->refresh_check();
 }
 
 void
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to