Re: FVWM: emulating mouse button 2 on HP touchpad
[reviving an old thread that I lost track of] > On Sun, 14 May 2023, Thomas Adam wrote: > > On Sun, 14 May 2023 at 22:12, Lucio Chiappetti wrote: > >> So the problem is an incompatibility between xterm and fvwm syntethic > >> events (or a syntax problem with PointerKey ?) > > > No. By default generating synthetic events is considered a security > > risk. which is why so many applications now no longer support them. > > For my education ... what are *exactly* synthetic events ? My understanding is that synthetic events are events generated with the XSendEvent() function (and its corresponding part of the X protocol). This is a very old function that can be used by any X client, so the X server specifically marks its events and as Thomas Adam noted, many clients decided to distrust them so that some random (malicious) client couldn't inject keystrokes into your xterm session. Some programs, including xterm, can be set to accept such events, and these days there may not be too many security risks in doing so. Portions of what xdotool can do work despite this because they don't necessarily use XSendEvent; instead they (sometimes) use a newer protocol extension called XTEST, which was apparently originally created to test the X11 server with no user interaction. Events injected through XTEST are not specially flagged and so clients like xterm don't get to reject them. The xdotool manual page contains a bit of a discussion of this. > So what could be an "action" to be put at the end of a Key or PointerKey > directive to do a X11 native "paste from clipboard" (other that xdotool > click 2 which introduces a level of indirection) ? In general, as far as I know there is no way for an outside program to tell xterm 'paste from clipboard'. All an outside program can do is tell xterm things like 'mouse button 2 was clicked' or 'key X was pressed'. What xterm does in reaction to this depends on it, including what state xterm is in at the time (for example, if it's showing one of its menus). There are weird options here if you want to get deep into the weeds of xterm configuration. Xterm can be told to bind keys to internal actions, such as 'paste', so you can create a 'key' binding for a key and modifier combination you'll never type normally and use xdotool to inject it into xterm (with xterm set to allow that). More details on the general issue is in the xterm manpage; if you're interested in an example of xterm translations: https://utcc.utoronto.ca/~cks/space/blog/unix/XtermKeybinding - cks
Re: FVWM: emulating mouse button 2 on HP touchpad
On Mon, 15 May 2023, Lucio Chiappetti wrote: I'll be reading the libinput synaptics and synclient manpages. I've done this exercise and some tests ELAN076D: 00 04F3:3244 Mouse id=10 [slave pointer (2)] ELAN076D: 00 04F3:3244 Touchpadid=11 [slave pointer (2)] (not sure why it reports twice the same device as touchpad and mouse, there is no physical mouse attached) I've no idea, I suppose they are both loaded in case a mouse is attached. Synaptics driver and libinput (probably the correct, "modern" option). If I do xinput --list-props for device 11 (touchpad) it returns Synaptics and for device 10 (Mouse) it returns libinput. So I am assuming I have to use synclient to get my status. The current one has just the touchpad, but the lower part of it is "depressable". I believe this is what is technically called a "clickpad". The synaptics man page says that in principle one could set EmulateMidButtonTime to non-zero to do MB2 with simultaneous MB1-MB3 (as I was used on the old touchpad-with-buttons) but ClickPads do not support middle mouse button emulation ... so I gabe up on that. However looking at the synclient output I discovered parameters RTCornerButton = 2 RBCornerButton = 3 LTCornerButton = 0 LBCornerButton = 0 so this mean that TAPPING (not pressing-releasing as for the lower area) in the right-top corner of the touchpad is MB2. Since I found somehmoiw difficult to locate the exact area of such corner, and the tap somehow "hard" I decided to ... ... simply SWAP the actions for MB2 and MB3 with xinput set-button-map 11 1 3 2 4 5 6 7 8 9 10 11 12 This way I can click in the lower right corner to do MB2 (which I use often in any window to do quick paste, and more seldom in the root window to call IconMan), while I tap in the upper right corner to do MB3 (which I use seldom, I can think only of a browser window to get a context dependent menu) I'll keep this along with PointerKey assignment to right-control (which works except in xterms). If I'm satisfied I'll make it permanent. Thanks in oarticular to Mandar Mitra for addressing me to synaptics and xinput. -- Lucio Chiappetti
Re: FVWM: emulating mouse button 2 on HP touchpad
On Mon, 15 May 2023, Mandar Mitra wrote: You mention your laptop is new, so it is likely that the touchpad supports multitouch and other goodies. yes, brand new. So the OS (Xubuntu 22.04) Synaptics driver and libinput (probably the correct, "modern" option). xinput returns among others (when directly on the laptop, if ssh-ing from th3 desktop it returns the desktop stuff, which I suppose is correct) ELAN076D:00 04F3:3244 Mouse id=10 [slave pointer (2)] ELAN076D:00 04F3:3244 Touchpadid=11 [slave pointer (2)] (not sure why it reports twice the same device as touchpad and mouse, there is no physical mouse attached) Synaptics driver and libinput (probably the correct, "modern" option). If I do xinput --list-props for device 11 (touchpad) it returns Synaptics and for device 10 (Mouse) it returns libinput. What does it mean ? Which one is actually used ? It should be possible to configure the touchpad itself to send, for example, MB2 on a two finger tap. (the quite older - and now junked - laptop had two buttons below the touchpad, for MB1 and MB3, and simultaneous press of them got MB2). The current one has just the touchpad, but the lower part of it is "depressable". Depressing and releasing in the lower left part is MB1, in the lower right part is MB3. The exact boundary seems not reproducible unless one uses positions very close to the extrema. The damn thing is far too sensitive ! I'll be reading the libinput synaptics and synclient manpages. Any suggestion welcome
Re: FVWM: emulating mouse button 2 on HP touchpad
On Sun, 14 May 2023, Thomas Adam wrote: On Sun, 14 May 2023 at 22:12, Lucio Chiappetti wrote: So the problem is an incompatibility between xterm and fvwm syntethic events (or a syntax problem with PointerKey ?) No. By default generating synthetic events is considered a security risk. which is why so many applications now no longer support them. For my education ... what are *exactly* synthetic events ? - those generated by a command like xdotool click 2 ? (if executed after a sleep calling it into another window, it works in an xterm) - those generated by fvwm as actions of a Key or PointerKey directive ? I tried (from manpage) Key (xterm) V A C Echo ctrl-V-in-Term and it works and writes the message to .xsession-errors So what could be an "action" to be put at the end of a Key or PointerKey directive to do a X11 native "paste from clipboard" (other that xdotool click 2 which introduces a level of indirection) ? I am pursuing another suggestion (more to come), otherwise as last resort I will be forced to replace (on the laptop) usage of xterm with urxvt (I'll have to look for all my colours and font size settings) ... I do not like the newer console for xfce terminals.
Re: FVWM: emulating mouse button 2 on HP touchpad
Lucio Chiappetti wrote (Sun, May 14, 2023 at 11:11:41PM +0200): > This has nothing to do with xdotool. If in ANOTHER terminal I do > > sleep 5; xdotool click 2 > > and then qjuickly enough move the mouse to an xterm, the MB1 selection *is* > pasted. But of course this is a bit clumsy. > > So the problem is an incompatibility between xterm and fvwm syntethic events > (or a syntax problem with PointerKey ?) I don't understand this very well, so I have a related question: are all events generated by xdotool synthetic events? Does this mean that xdotool will not work for some modern, security-conscious applications? Thanks, Mandar.
Re: FVWM: emulating mouse button 2 on HP touchpad
Lucio Chiappetti wrote (Sat, May 13, 2023 at 11:44:36PM +0200): > I am since ages a keen fvwm user (2.6.8 bundled with ubuntu), mostly on a > desktop PC, with a personal configuration described in > http://sax.iasf-milano.inaf.it/~lucio/WWW/Opinions/window.html. > > In particular (independently of fvwm ?) I am used to do quick copy-and-paste > of text selecting it with mouse button 1 (MB1) and pasting with mouse button > 2 (MB2). Or shift-MB1 and shift-MB2 in my favourite editor (The Hessling > Editor), due to a peculiarity of the editor. > > Now I've got a new HP Probook laptop which has a touchpad without buttons. > Apparently tapping near the bottom left and bottom right corners of the > touchpad works as MB1 and MB3 ... but there is no MB2. You mention your laptop is new, so it is likely that the touchpad supports multitouch and other goodies. It should be possible to configure the touchpad itself to send, for example, MB2 on a two finger tap. The exact details would depend on the driver Ubuntu uses for the touchpad. I believe common options are the Synaptics driver and libinput (probably the correct, "modern" option). I don't clearly understand all details, but here's some output I get on my laptop that might give you an idea about what to expect. --- latitude3490$ xinput ⎡ Virtual core pointer id=2[master pointer (3)] ⎜ ↳ Virtual core XTEST pointerid=4[slave pointer (2)] ⎜ ↳ DELL0839:00 044E:120A Touchpadid=12 [slave pointer (2)] ⎜ ↳ AlpsPS/2 ALPS GlidePoint id=18 [slave pointer (2)] ⎜ ↳ DELL0839:00 044E:120A Mouse id=11 [slave pointer (2)] --- And then, for more detail: --- xinput list --long 12 # 12 is the device id for the touchpad DELL0839:00 044E:120A Touchpad id=12 [slave pointer (2)] Reporting 7 classes: Class originated from: 12. Type: XIButtonClass Buttons supported: 7 Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" ... --- HTH.
Re: FVWM: emulating mouse button 2 on HP touchpad
On Sun, 14 May 2023 at 22:12, Lucio Chiappetti wrote: > So the problem is an incompatibility between xterm and fvwm syntethic > events (or a syntax problem with PointerKey ?) > > Is there a solution ? No. By default generating synthetic events is considered a security risk. which is why so many applications now no longer support them. -- Thomas
Re: FVWM: emulating mouse button 2 on HP touchpad
On Sat, 13 May 2023, Lucio Chiappetti wrote: In particular (independently of fvwm ?) I am used to do quick copy-and-paste of text selecting it with mouse button 1 (MB1) and pasting with mouse button 2 (MB2). Or shift-MB1 and shift-MB2 in my favourite editor (Hessling ... Editor), due to a peculiarity of the editor. Now I've got a new HP Probook laptop which has a touchpad without buttons. I wonder whether there is a solution (either fvwm-specific or X11-generic) to achieve a decent emulation of the paste function. I have found a *partially* satisafactory solution. But it does no work in xterm. I inserted near the end of my .fvwmrc PointerKey Control_R WR A Exec exec /usr/bin/xdotool click 2 - this way if I press the right-control key while in the root menu, it invokes my FvwmIconMan WinLIst emulation. - If I press the right-control key in the xclipboard, or in a uxrvt or in a browser, this pastes my last MB1 selection. - If I press shift-right-control in my THE editor window it also pastes my last MB1 selection. - But in an xterm nothing happens. The fvwm manpage suggests to place in .Xdefaults XTerm*allowSendEvents: true This seems not to be honoured (as shown by ctl-MB1: allowsends is not set). However most of my xterms are started with class XTermNew. So I placed *allowSendEvents: true in ~/XTermNew (and also in ~/XTerm). This way allowsends appear to be set, but the control-right key does nothing. This has nothing to do with xdotool. If in ANOTHER terminal I do sleep 5; xdotool click 2 and then qjuickly enough move the mouse to an xterm, the MB1 selection *is* pasted. But of course this is a bit clumsy. So the problem is an incompatibility between xterm and fvwm syntethic events (or a syntax problem with PointerKey ?) Is there a solution ?
Re: FVWM: emulating mouse button 2 on HP touchpad
On Sat, 13 May 2023, E Frank Ball wrote: On Sat, May 13, 2023 at 11:44:36PM +0200, Lucio Chiappetti wrote: > In particular (independently of fvwm ?) I am used to do quick > copy-and-paste of text selecting it with mouse button 1 (MB1) and pasting > with mouse button 2 (MB2). Or shift-MB1 and shift-MB2 in my favourite > editor (The Hessling Editor), due to a peculiarity of the editor. > I wonder whether there is a solution (either fvwm-specific or X11-generic) > to achieve a decent emulation of the paste function. to paste. Unfortunately this seems not to work at all on the HP Probook laptop. It does work (though would not be optimal for me) on the desktop, where I don't need it :-) On the laptop is assigned to the f10 key (if used without the fn prefix). Despite the fact xev returns keycode 118 (keysym 0xff63, Insert), when I press the key on the laptop I get a tilde, not paste. (I'd say the soultion, even if working, would be not optimal, since while I could use MB1 to select and MB2 or to paste from a normal (e.g. terminal or browser) window into a normal window, I'd have to use shift-MB2 to paste into a THE (Hessling editor) window ... and how could I do ?) Sorry ...
Re: FVWM: emulating mouse button 2 on HP touchpad
On Sat, May 13, 2023 at 11:44:36PM +0200, Lucio Chiappetti wrote: > > In particular (independently of fvwm ?) I am used to do quick > copy-and-paste of text selecting it with mouse button 1 (MB1) and pasting > with mouse button 2 (MB2). Or shift-MB1 and shift-MB2 in my favourite > editor (The Hessling Editor), due to a peculiarity of the editor. > > Now I've got a new HP Probook laptop which has a touchpad without buttons. > Apparently tapping near the bottom left and bottom right corners of the > touchpad works as MB1 and MB3 ... but there is no MB2. > > I wonder whether there is a solution (either fvwm-specific or X11-generic) > to achieve a decent emulation of the paste function. to paste. E. Frank Ball III
FVWM: emulating mouse button 2 on HP touchpad
I am since ages a keen fvwm user (2.6.8 bundled with ubuntu), mostly on a desktop PC, with a personal configuration described in http://sax.iasf-milano.inaf.it/~lucio/WWW/Opinions/window.html. In particular (independently of fvwm ?) I am used to do quick copy-and-paste of text selecting it with mouse button 1 (MB1) and pasting with mouse button 2 (MB2). Or shift-MB1 and shift-MB2 in my favourite editor (The Hessling Editor), due to a peculiarity of the editor. Now I've got a new HP Probook laptop which has a touchpad without buttons. Apparently tapping near the bottom left and bottom right corners of the touchpad works as MB1 and MB3 ... but there is no MB2. I wonder whether there is a solution (either fvwm-specific or X11-generic) to achieve a decent emulation of the paste function. I found a sequence like this xkbset m ; xkbset exp 5 -m ; xmodmap -e "keycode 105 = Pointer_Button2" can temporarily assign the MB2-click (for paste) to my right-control key (I never use such key). The reason it has to be temporary is that xkbset m., enabling the mousekeys, disables the numeric keypad (but I make a lot of use of the numeric keypad - with Num Lock off - for specific functions in my editor configuration ... actually I quite insisted on having an "English International" keyboard to have the num keypad) I also found mention of a command like "xdotool click 2". Would it make sense to assign it with PointerKey in .fvwmrc ? Or are there simpler or better solutions " Thanks -- A middle rank researcher at end career is not rich but is in the top 5% of the Italian income tax taxpayers. Does it not sound strange ?