Bug 244354

Summary: x11/plasma5-plasma: Pressing either 'Down' or 'End' key pops up the main menu
Product: Ports & Packages Reporter: Patricio Villar <patovm04>
Component: Individual Port(s)Assignee: freebsd-kde (group) <kde>
Status: Closed FIXED    
Severity: Affects Many People CC: Alexander88207, bezspam, doctorwhoguy, drs-freebsd, grahamperrin, jmc-freebsd2, lapo, me, mikael, oleg.nauman, rnejdl, skrechy, slava, sv, swills, tcberner, transitive, waitman, zeising
Priority: Normal Flags: tcberner: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   

Description Patricio Villar 2020-02-24 00:32:13 UTC
Since the latest big Xorg update, some keys act weird and do more than they should.
The 'Meta' key no longer opens up the Application Launcher/Menu, but the 'Down' or 'End' key both do so. The mentioned keys still do their actual jobs nevertheless.
The only workaround I've found at the moment is disabling the keyboard shortcut for opening the menu... Any ideas?
Comment 1 Serge Volkov 2020-02-24 07:54:00 UTC
I confirm. After upgrading xorg-server to version 1.20.7,1 the 'Meta' key no longer opens up the Application Launcher/Menu. But if I press the 'Down Arrow' key or 'End' key on the keyboard the Application Launcher/Menu pops up. It’s impossible to work normally.

Can anyone help?
Comment 2 Niclas Zeising freebsd_committer freebsd_triage 2020-02-24 09:15:02 UTC
This looks like a duplicate of pr 244339.
Can you have a look at this and see if this helps: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244339#c2
Comment 3 Niclas Zeising freebsd_committer freebsd_triage 2020-02-24 09:20:50 UTC
You can also have a look at the following mail list threads: https://lists.freebsd.org/pipermail/freebsd-x11/2020-February/024971.html
And this thread:
https://lists.freebsd.org/pipermail/freebsd-x11/2020-February/025004.html
Comment 4 me 2020-02-24 09:44:07 UTC
My workaround is to put the desired shortcut (Alt+F1 in my case, which was the default in some earlier version) from "Global" to "Global Alternate" and leave "Global" empty. This has stopped the release of the down key to "Activate Application Launcher Widget". It does not bring back pressing and releasing the Meta key, but at least I can work again and still use Alt+F1.
Comment 5 Serge Volkov 2020-02-24 11:16:07 UTC
(In reply to me from comment #4)
Please explain in more detail where "Global" and "Global Alternate" is located in the Plasma5 Systemsettings?
Comment 6 Serge Volkov 2020-02-24 11:24:28 UTC
(In reply to Niclas Zeising from comment #3)

Script from thread https://lists.freebsd.org/pipermail/freebsd-x11/2020-February/025004.html did not help me. This script suggests removing the xf86-input-synaptics package. But plasma5-plasma-desktop package depends on this package. But even if you execute the command

pkg delete -f xf86-input-synaptics

this does not affect the operation of my keyboard.
Comment 7 Patricio Villar 2020-02-24 14:15:31 UTC
(In reply to Niclas Zeising from comment #2)
Sadly it didn't help :/
Comment 8 Patricio Villar 2020-02-24 14:16:37 UTC
(In reply to Niclas Zeising from comment #3)
No luck with these either...
Comment 9 Graham Perrin freebsd_committer freebsd_triage 2020-02-24 19:58:19 UTC
I'm here indirectly via https://redd.it/f8bcrk (found by Google) where someone has the same symptoms (maybe some overlap with bug 244339) on Ubuntu Linux.
Comment 10 Mikael Urankar freebsd_committer freebsd_triage 2020-02-28 20:18:13 UTC
I also have the issue, is there any fix available?
Comment 11 Spas Marinov 2020-03-04 13:22:22 UTC
I also have the issue.
Comment 12 Tobias C. Berner freebsd_committer freebsd_triage 2020-03-05 07:17:55 UTC
Moin moin


I'll try to find a fix for this this weekend.


Mfg Tobias
Comment 13 oleg.nauman 2020-03-05 17:29:26 UTC
Hello,

Also please note that we have another two bugs related to "Down" and "Left" arrows after implementing workaround with Global key redefinition:
a ) Keyboard repeat does not work for "Down" and "Left" arrows;
b ) Every time I'm logging into KDE keyboard shortcuts for "Activate Application Menu Widget" reset to default so I need to modify it again.

Thank you
Comment 14 Niclas Zeising freebsd_committer freebsd_triage 2020-03-05 18:20:53 UTC
Hi!

For those of you with this issue, is it possible for you to test the patch in https://reviews.freebsd.org/D23860 ?  I'm not sure that it will help the issue, but I'd like help in testing it anyway.  Thanks!
Comment 15 Serge Volkov 2020-03-05 21:52:24 UTC
(In reply to Niclas Zeising from comment #14)

I rebuilt the x11/libxkbcommon with patches from https://reviews.freebsd.org/D23860
And that solved the problem. The keyboard now works as expected. I am satisfied.
Comment 16 oleg.nauman 2020-03-06 09:49:25 UTC
(In reply to Niclas Zeising from comment #14)

It fixes the issue with "Down arrow key pops up the main menu", but keyboard repeat still does not work or Left and Down arrow keys.
Interesting enough that XKB_DEFAULT_RULES=xorg does not work for me while XKB_DEFAULT_RULES=evdev works at least partially.
The second interesting thing that arrow keys do not work at all under twm window manager ( XKB_DEFAULT_RULES=evdev is set in my case )

Some keyboard details from Xorg.log:


[  2730.633] (II) config/udev: Adding input device System keyboard multiplexer (/dev/input/event0)
[  2730.633] (**) System keyboard multiplexer: Applying InputClass "evdev keyboard catchall"
[  2730.633] (**) System keyboard multiplexer: Applying InputClass "Evdev keyboard"
[  2730.633] (**) System keyboard multiplexer: Applying InputClass "libinput keyboard catchall"
[  2730.633] (**) System keyboard multiplexer: Applying InputClass "libinput keyboard catchall"
[  2730.635] (II) Using input driver 'libinput' for 'System keyboard multiplexer'
[  2730.635] (**) System keyboard multiplexer: always reports core events
[  2730.636] (II) event0  - System keyboard multiplexer: is tagged by udev as: Keyboard
[  2730.636] (II) event0  - System keyboard multiplexer: device is a keyboard
[  2730.636] (II) event0  - System keyboard multiplexer: device removed
[  2730.636] (II) XINPUT: Adding extended input device "System keyboard multiplexer" (type: KEYBOARD, id 6)
[  2730.674] (II) event0  - System keyboard multiplexer: is tagged by udev as: Keyboard
[  2730.674] (II) event0  - System keyboard multiplexer: device is a keyboard
[  2730.676] (**) Sleep Button: Applying InputClass "evdev keyboard catchall"
[  2730.676] (**) Sleep Button: Applying InputClass "Evdev keyboard"
[  2730.676] (**) Sleep Button: Applying InputClass "libinput keyboard catchall"
[  2730.676] (**) Sleep Button: Applying InputClass "libinput keyboard catchall"
[  2730.676] (II) event2  - Sleep Button: device is a keyboard
[  2730.677] (II) event2  - Sleep Button: device is a keyboard
[  2730.677] (**) Power Button: Applying InputClass "evdev keyboard catchall"
[  2730.677] (**) Power Button: Applying InputClass "Evdev keyboard"
[  2730.677] (**) Power Button: Applying InputClass "libinput keyboard catchall"
[  2730.677] (**) Power Button: Applying InputClass "libinput keyboard catchall"
[  2730.677] (II) event3  - Power Button: device is a keyboard
[  2730.678] (II) event3  - Power Button: device is a keyboard
[  2730.678] (II) config/udev: Adding input device AT keyboard (/dev/input/event4)
[  2730.678] (**) AT keyboard: Applying InputClass "evdev keyboard catchall"
[  2730.678] (**) AT keyboard: Applying InputClass "Evdev keyboard"
[  2730.678] (**) AT keyboard: Applying InputClass "libinput keyboard catchall"
[  2730.678] (**) AT keyboard: Applying InputClass "libinput keyboard catchall"
[  2730.678] (II) Using input driver 'libinput' for 'AT keyboard'
[  2730.678] (**) AT keyboard: always reports core events
[  2730.678] (II) event4  - AT keyboard: is tagged by udev as: Keyboard
[  2730.679] (II) event4  - AT keyboard: device is a keyboard
[  2730.679] (II) event4  - AT keyboard: device removed
[  2730.679] (II) XINPUT: Adding extended input device "AT keyboard" (type: KEYBOARD, id 10)
[  2730.679] (II) event4  - AT keyboard: is tagged by udev as: Keyboard
[  2730.679] (II) event4  - AT keyboard: device is a keyboard


> cat /usr/local/etc/X11/xorg.conf.d/99-myinput.conf 
Section "InputClass"
    Identifier "libinput keyboard catchall"
    MatchIsKeyboard "on"
    MatchDevicePath "/dev/input/event*"
    Driver "libinput"
    Option "XkbRules" "evdev"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "us, ru"
    Option "XkbVariant" ",qwerty"
    Option "XkbOptions" "grp:caps_toggle"

The list of installed ports related to X input:

libinput-1.15.2                Generic input library
libwacom-1.2_1                 Adds tablet support to libinput
py37-evdev-0.8.1_1             Bindings to the Linux input handling subsystem
xf86-input-evdev-2.10.6_5      X.Org event device input driver
xf86-input-keyboard-1.9.0_4    X.Org keyboard input driver
xf86-input-libinput-0.28.2_1   X.Org libinput input driver
xf86-input-mouse-1.9.3_3       X.Org mouse input driver



Thank you
Comment 17 Serge Volkov 2020-03-06 10:10:06 UTC
(In reply to oleg.nauman from comment #16)

I do not use any configuration files for xorg or XKB_DEFAULT_RULES. I use a simple USB keyboard "Microsoft Wired Keyboard 200". I work in KDE Plasma5. And keyboard repeat works as expected for all keys. I do not have any issues with keyboard after fix x11/libxkbcommon.

Maybe I need to provide some logs?
Comment 18 Robert Cina 2020-03-06 15:50:29 UTC
The suggested patch for x11/libxkbcommon in comment 14 above seems to have fixed this issue for me with the down arrow key and end key.
Comment 19 Tobias C. Berner freebsd_committer freebsd_triage 2020-03-08 07:13:20 UTC
(In reply to Niclas Zeising from comment #14)
I can confirm the patch in the differential makes it work properly again for me too. I have the folloing input conf (I removed 'XkbRules "xorg"' from it):

Section "InputClass"
        Identifier      "Keyboard Input"
        MatchIsKeyboard "on"
        Option          "XkbLayout"     "ch"
        Option          "XkbVariant"    "de_nodeadkeys"
EndSection
Comment 20 Spas Marinov 2020-03-09 11:01:57 UTC
The suggested patch for x11/libxkbcommon in comment 14 above seems to have fixed this issue for me with the down arrow key and end key.
However keyboard repeat doesn't work for any key.
Comment 21 Mike Clarke 2020-03-09 17:23:10 UTC
(In reply to Niclas Zeising from comment #14)

The patch works fine for me.
The down arrow and end keys now work correctly
Keyboard repeat is functioning correctly
The 'Windows' key now activates the Application Launcher

I'm running kde 19.12.3 with FreeBSD 12.1-RELEASE-p2 GENERIC  amd64

Apart from the patched version of libxkbcommon everything is installed from packages at pkg+http://pkg.FreeBSD.org/${ABI}/latest
Comment 22 Tobias C. Berner freebsd_committer freebsd_triage 2020-03-09 18:16:27 UTC
(In reply to Spas Marinov from comment #20)
Moin moin

Key repeat works just fine for me too without any issues.
Do you have any keyboard settings applied?


mfg Tobias
Comment 23 Spas Marinov 2020-03-09 22:02:21 UTC
(In reply to Tobias C. Berner from comment #22)
I restarted X server again and this time everything works as expected. The only issue I have (for) now is Meta+Digit (Meta=Win) doesn't activate corresponding window in the taskbar. kde5-5.18.2.19.12.2.
Comment 24 Serge Volkov 2020-03-09 22:23:10 UTC
(In reply to Spas Marinov from comment #23)

Activating windows on the taskbar using a Meta+Digit (Meta=Win) buttons works fine for me without any issues. I have latest packages installed.

12.1-RELEASE-p2 amd64, KDE Plasma 5.18.2, KDE Frameworks 5.67.0.
Comment 25 oleg.nauman 2020-03-11 15:23:00 UTC
I have workaround implemented for keyboard repeat issues. 
My laptop expose two keyboards : /dev/kbd0 and /dev/kbd1 , with /dev/kbdmux linked to /dev/kbd1. 
libinput list-devices lists 4 keyboards:

 Device:           System keyboard multiplexer
Kernel:           /dev/input/event0
Group:            1
Seat:             seat0, default
Capabilities:     keyboard 
.............................
Device:           Sleep Button
Kernel:           /dev/input/event2
Group:            3
Seat:             seat0, default
Capabilities:     keyboard 
------------------------------
Device:           Power Button
Kernel:           /dev/input/event3
Group:            4
Seat:             seat0, default
Capabilities:     keyboard 
------------------------------------
Device:           AT keyboard
Kernel:           /dev/input/event4
Group:            5
Seat:             seat0, default
Capabilities:     keyboard 

where /dev/input/event0 it is /dev/kbdmux -> /dev/kbd1
and /dev/input/event4 it is /dev/kbd0

I have changed 
MatchDevicePath "/dev/input/event*"
to
MatchDevicePath "/dev/input/event4"
in my /usr/local/etc/X11/xorg.conf.d/99-myinput.conf Xorg configuration file so Xorg keyboard mapped to AT keyboard. It fixes issue with keyboard repeat.
I dislike this solution because it possibly will break Xorg libinput keyboard enumeration when new device attached ( at least some USB mices emulating USB keyboard as well )
Comment 26 waitman 2020-03-14 11:31:01 UTC
I've had this issue on two laptops, running 12.1-RELEASE and FreeBSD-CURRENT, my workaround has been to open system settings / shortcut keys and hitting "Defaults" then "Apply". Fixes the down key problem. But after reboot the problem returns, so I have to restore defaults again. I suppose if you have custom shortcut keys you might not want to restore defaults.

"restore defaults" seems to make one change to shortcuts file:

it removes Alt+F1 from "Activate Application Launcher Widget"

diff kglobalshortcutsrc .config/kglobalshortcutsrc 279c279
< activate widget 3=none,none,Activate Application Launcher Widget
> activate widget 3=Alt+F1,none,Activate Application Launcher Widget

It's not clear why this solves the problem on my laptops. I updated the libevdev port to 1.9.0 and it didn't seem to fix it.
Comment 27 Serge Volkov 2020-03-14 12:13:41 UTC
(In reply to waitman from comment #26)

> I've had this issue on two laptops, running 12.1-RELEASE and FreeBSD-CURRENT

Try adding a line

export XKB_DEFAULT_RULES=evdev

in file /etc/xprofile or ~/.xprofile

This solved the problem for me without patching libxkbcommon as described in comment 14.
Comment 28 Patricio Villar 2020-03-14 19:04:14 UTC
(In reply to Serge Volkov from comment #27)
I did the same and I can confirm it fixes my keyboard issues. Hope the patched x11/libxkbcommon lands soon in the ports tree.
Comment 29 skrech 2020-03-16 12:22:54 UTC
I had to manually set XKB_DEFAULT_RULES to evdev to fix the problem.

Not settings anything didn't work.
Setting it manually to "xorg" didn't work.
Comment 30 Slava 2020-03-16 23:31:37 UTC
Hello,

Having also having this issue on Thinkpad X1 Carbon (gen1) since updating xorg on freebsd 12.1.

Serge's suggestion in comment #27 fixed this for me.  

Thanks Serge!
Comment 31 commit-hook freebsd_committer freebsd_triage 2020-03-20 23:40:24 UTC
A commit references this bug:

Author: zeising
Date: Fri Mar 20 23:39:38 UTC 2020
New revision: 528813
URL: https://svnweb.freebsd.org/changeset/ports/528813

Log:
  x11/libxkbcommon: Switch to evdev rules by default

  Switch x11/libxkbcommon to use evdev rules rather than legacy rules by
  default, to improve support for keyboards when using evdev.
  For users using the legacy configuration, or running xorg on FreeBSD 11,
  please consult UPDATING for instructions in case of issues.

  PR:		244354 [1]
  Submitted by:	jbeich (fix)
  Reported by:	Patricio Villar [1]
  Differential Revision:	https://reviews.freebsd.org/D23860

Changes:
  head/UPDATING
  head/x11/libxkbcommon/Makefile
  head/x11/libxkbcommon/pkg-message
Comment 32 Niclas Zeising freebsd_committer freebsd_triage 2020-03-20 23:44:26 UTC
the updated libxkbcommon has been committed.
Comment 33 Patricio Villar 2020-03-27 01:02:13 UTC
(In reply to Niclas Zeising from comment #32)
Thank you very much! Now everything works as expected :)
Comment 34 Tobias C. Berner freebsd_committer freebsd_triage 2020-03-29 17:42:26 UTC
I'll close this for now.

With the recent commit by zeising everything is working as expected again.