Re: Binding a function to key+mousebutton

Frank Steiner <[email protected]>
Newsgroups gmane.comp.window-managers.ctwm
Message-ID <[email protected]>
Hi Matthew,

thanks for testing! I sill suspect there is a bug i ctwm as it
works fine in twm, see below.

Matthew D. Fuller wrote:

> On Tue, Jun 25, 2019 at 09:58:12AM +0200 I heard the voice of
> Frank Steiner, and lo! it spake thus:
>>
>> The 3rd/5th/7th...ctrl+left mouse button click it will work again,
>> the 4th/6th... will show the icon.
> 
> In a little testing, I can't reproduce it here; always seems normal
> for some Ctrl-<mouse,kbd> bindings for me.  You could try playing with
> xev and see if the second click has a different state flag; maybe your
> environment is doing something surprising?
  
xev looks fine until ctwm takes control of this combination:

KeyPress event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701407095, (18,129), root:(617,267),
     state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
     XLookupString gives 0 bytes:
     XmbLookupString gives 0 bytes:
     XFilterEvent returns: False

ButtonPress event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701407346, (18,129), root:(617,267),
     state 0x4, button 1, same_screen YES

ButtonRelease event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701407469, (18,129), root:(617,267),
     state 0x104, button 1, same_screen YES

KeyRelease event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701407641, (18,129), root:(617,267),
     state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
     XLookupString gives 0 bytes:
     XFilterEvent returns: False


Looks reasonable for "Press Ctrl, click left button, release left button,
release Ctrl".

But as soon as I define
Button1= c:window	            :f.exec "true"
in .ctwmrc and restart, the first Ctrl+Click looks like this:

KeyPress event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701289882, (3,137), root:(602,275),
     state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
     XLookupString gives 0 bytes:
     XmbLookupString gives 0 bytes:
     XFilterEvent returns: False

LeaveNotify event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701290623, (3,137), root:(602,275),
     mode NotifyGrab, detail NotifyAncestor, same_screen YES,
     focus YES, state 260

EnterNotify event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701290624, (3,137), root:(602,275),
     mode NotifyUngrab, detail NotifyAncestor, same_screen YES,
     focus YES, state 260

KeymapNotify event, serial 35, synthetic NO, window 0x0,
     keys:  4294967189 0   0   0   32  0   0   0   0   0   0   0   0   0   0   0
            0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

ButtonRelease event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701290754, (3,137), root:(602,275),
     state 0x104, button 1, same_screen YES

KeyRelease event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701290884, (3,137), root:(602,275),
     state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
     XLookupString gives 0 bytes:
     XFilterEvent returns: False


and the second like that:
KeyPress event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701291751, (3,137), root:(602,275),
     state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
     XLookupString gives 0 bytes:
     XmbLookupString gives 0 bytes:
     XFilterEvent returns: False

LeaveNotify event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701292046, (3,137), root:(602,275),
     mode NotifyGrab, detail NotifyAncestor, same_screen YES,
     focus YES, state 260

EnterNotify event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701292153, (3,137), root:(602,275),
     mode NotifyUngrab, detail NotifyAncestor, same_screen YES,
     focus YES, state 4

KeymapNotify event, serial 35, synthetic NO, window 0x0,
     keys:  0   0   0   0   32  0   0   0   0   0   0   0   0   0   0   0
            0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

KeyRelease event, serial 35, synthetic NO, window 0x5200001,
     root 0x295, subw 0x0, time 701292270, (3,137), root:(602,275),
     state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
     XLookupString gives 0 bytes:
     XFilterEvent returns: False


It looks like ctwm turns the mouse click into some keymap event
and hides the mouse click from xev. I suspect it's a bug in the
first click that the ReleaseButton shows up, because I tried the
same with twm. And there every click looks like this:

KeyPress event, serial 29, synthetic NO, window 0x5800001,
     root 0x295, subw 0x0, time 701969827, (6,91), root:(843,526),
     state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
     XLookupString gives 0 bytes:
     XmbLookupString gives 0 bytes:
     XFilterEvent returns: False

LeaveNotify event, serial 32, synthetic NO, window 0x5800001,
     root 0x295, subw 0x0, time 701970086, (6,91), root:(843,526),
     mode NotifyGrab, detail NotifyAncestor, same_screen YES,
     focus YES, state 260

EnterNotify event, serial 32, synthetic NO, window 0x5800001,
     root 0x295, subw 0x0, time 701970195, (6,91), root:(843,526),
     mode NotifyUngrab, detail NotifyAncestor, same_screen YES,
     focus YES, state 4

KeymapNotify event, serial 32, synthetic NO, window 0x0,
     keys:  4294967189 0   0   0   32  0   0   0   0   0   0   0   0   0   0   0
            0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

KeyRelease event, serial 32, synthetic NO, window 0x5800001,
     root 0x295, subw 0x0, time 701970434, (6,91), root:(843,526),
     state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
     XLookupString gives 0 bytes:
     XFilterEvent returns: False


Thus I guess in the first/3rd/... click in ctwm the ButtonRelease event
slips through, and then in the 2nd/4th/... click the keys line in the
KeymapNotify event is wrong.

cu,
Frank


-- 
Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.