[PATCH] Early hook invocation (was: Urxvt tabbed(ex) scroll doesn't work when mouse is not inside urxvt window)

Martin Pohlack mp26 at os.inf.tu-dresden.de
Sun Mar 2 20:35:05 CET 2014


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 <M.Traxler at gsi.de
>>>> <mailto:M.Traxler at gsi.de>> 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
>>>>         <mp26 at os.inf.tu-dresden.de
>>>>         <mailto:mp26 at os.inf.tu-dresden.de>>__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
>>>>                 rxvt-unicode at lists.schmorp.de
>>>>                 <mailto:rxvt-unicode at lists.schmorp.de>
>>>>                 http://lists.schmorp.de/cgi-__bin/mailman/listinfo/rxvt-__unicode
>>>>                 <http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> rxvt-unicode mailing list
>>>> rxvt-unicode at lists.schmorp.de
>>>> http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
>>>>
>>>
>>>
>>> _______________________________________________
>>> rxvt-unicode mailing list
>>> rxvt-unicode at lists.schmorp.de
>>> http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
>>>
>>
>>
>> _______________________________________________
>> rxvt-unicode mailing list
>> rxvt-unicode at lists.schmorp.de
>> http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
>>
> 
> 
> _______________________________________________
> rxvt-unicode mailing list
> rxvt-unicode at lists.schmorp.de
> http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hooks.patch
Type: text/x-patch
Size: 1246 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/rxvt-unicode/attachments/20140302/819de473/attachment.bin>


More information about the rxvt-unicode mailing list