[PATCH] XF86keysym: Add XF86XK_RotationLockToggle
Hans de Goede
hdegoede at redhat.com
Tue Jan 22 09:31:18 UTC 2019
Hi,
On 22-01-19 09:22, Walter Harms wrote:
>
>
>> Hans de Goede <hdegoede at redhat.com> hat am 21. Januar 2019 um 20:23
>> geschrieben:
>>
>>
>> Add XF86XK_RotationLockToggle keysym, to be used as mapping for evdev's
>> KEY_ROTATE_LOCK_TOGGLE.
>>
>> I've a Point of View P1006W-232 Windows tablet which actually has a
>> rotate-lock toggle-button. The latest kernel correctly generates
>> KEY_ROTATE_LOCK_TOGGLE events for this. So now I'm hooking up support for
>> it through all the higher layers.
>>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>> include/X11/XF86keysym.h | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/include/X11/XF86keysym.h b/include/X11/XF86keysym.h
>> index 9ad8948..dd287e2 100644
>> --- a/include/X11/XF86keysym.h
>> +++ b/include/X11/XF86keysym.h
>> @@ -205,6 +205,8 @@
>>
>> #define XF86XK_AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g.
>> theatre-mode */
>>
>> +#define XF86XK_RotationLockToggle 0x1008FFB7 /* Toggle screen rotation lock
>> on/off */
>> +
>> /* Keys for special action keys (hot keys) */
>> /* Virtual terminals on some operating systems */
>> #define XF86XK_Switch_VT_1 0x1008FE01
>> --
>> 2.20.1
>>
>
> This is ok with me but i have a general question:
> Is there a policy what to add ? ( i coud not find one).
> E.g. i have seems a keyboard with a key to change the backlight
> of the keyboard (do ot ask, not mine) Do we simply add everything
> found in the wild ? or are there limitations ?
In generally yes we add anything found in the wild (and not just in specs).
The limitation is applying common sense, e.g. the toggle screen rotation lock
button already has an evdev button code, KEY_ROTATE_LOCK_TOGGLE and on
devices with an accelerometer GNOME-shell has a toggle in its system
menu (the top right menu with wifi options, etc.) to lock / unlock
auto-rotating the screen. So my intention is to hook the button on the
Point of View P1006W-232 Windows tablet up all the way to the gnome-shell
level, so that it actually toggles that setting.
IOW I would like to see adding new keysyms limited to adding keysyms which
we plan to actually use. Either for a specific use-case, or as a button
which will be useful as a generic(ish) button for a user to bind an action
to (e.g. launch a new terminal, launch <whatever> settings pane of the
control panel, ...).
Note this is just my 2 cents.
As for your specific example, the kernel already has:
#define KEY_KBDILLUMTOGGLE 228
#define KEY_KBDILLUMDOWN 229
#define KEY_KBDILLUMUP 230
And xkeyboard-config/rules/inet has:
key <I236> { [ XF86KbdLightOnOff ] }; // KEY_KBDILLUMTOGGLE
key <I237> { [ XF86KbdBrightnessDown ] }; // KEY_KBDILLUMDOWN
key <I238> { [ XF86KbdBrightnessUp ] }; // KEY_KBDILLUMUP
(note the X "scancodes" are eight higher then the kernel ones)
And GNOME actually responds to these and does the right thing,
assuming there is a *kbd_backlight interface under /sys/class/leds for it
to control :)
Regards,
Hans
More information about the xorg-devel
mailing list