TIP 464: Support for Multimedia Keys on Windows

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Author:         Ralf Fassel <ralfixx@gmx.de>
Author:         Andreas Leitgeb <avl@logic.at>
State:          Final
Type:           Project
Vote:           Done
Created:        28-Jan-2017
Post-History:   
Keywords:       Tk,keyboard,keycode
Tcl-Version:    8.5

Abstract

This TIP proposes adding support for the multimedia keys present on many modern keyboards.

Rationale

Tk is lacking support for the multimedia keys as described on https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx

VK_VOLUME_DOWN        0xAE   Volume Down key
VK_VOLUME_UP          0xAF   Volume Up key
VK_MEDIA_NEXT_TRACK   0xB0   Next Track key
VK_MEDIA_PREV_TRACK   0xB1   Previous Track key
VK_MEDIA_STOP         0xB2   Stop Media key
VK_MEDIA_PLAY_PAUSE   0xB3   Play/Pause Media key

Linux supports these as, e.g., XF86AudioPlay, XF86AudioPrev, XF86AudioNext. Tk should support them as well so that application programmers can make use of the keys as appropriate.

Because this is driven by changing external circumstances, it is propsed that this TIP be backported to all future-releaseable versions of Tk (i.e., 8.5 onwards).

Proposal

The table of supported keys should be extended to include the following named keys:

  • XF86AudioLowerVolume - the volume-down key

  • XF86AudioMute - the volume-mute key

  • XF86AudioNext - the next-track key

  • XF86AudioPlay - the start-playback key

  • XF86AudioPrev - the previous-track key

  • XF86AudioRaiseVolume - the volume-up key

  • XF86AudioStop - the stop-playback key

The above list does not imply any ordering in the implementation.

Implementation

The support can be added by extending some keymapping lookup tables in Tk.

A Ticket already exists with a proposed patch http://core.tcl.tk/tk/tktview/499526180d6cd5ca7c02eed96c10e9d3630a807c and fvogel has also created a branch http://core.tcl.tk/tk/timeline?r=tip-464 .

Copyright

This document has been placed in the public domain.

History