xref: /minix3/minix/lib/libsys/fkey_ctl.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #include "sysutil.h"
2*433d6423SLionel Sambuc #include <string.h>
3*433d6423SLionel Sambuc 
4*433d6423SLionel Sambuc /*===========================================================================*
5*433d6423SLionel Sambuc  *				fkey_ctl				     *
6*433d6423SLionel Sambuc  *===========================================================================*/
fkey_ctl(request,fkeys,sfkeys)7*433d6423SLionel Sambuc int fkey_ctl(request, fkeys, sfkeys)
8*433d6423SLionel Sambuc int request;				/* request to perform */
9*433d6423SLionel Sambuc int *fkeys;				/* bit masks for F1-F12 keys */
10*433d6423SLionel Sambuc int *sfkeys;				/* bit masks for Shift F1-F12 keys */
11*433d6423SLionel Sambuc {
12*433d6423SLionel Sambuc /* Send a message to the TTY server to request notifications for function
13*433d6423SLionel Sambuc  * key presses or to disable notifications. Enabling succeeds unless the key
14*433d6423SLionel Sambuc  * is already bound to another process. Disabling only succeeds if the key is
15*433d6423SLionel Sambuc  * bound to the current process.
16*433d6423SLionel Sambuc  */
17*433d6423SLionel Sambuc     message m;
18*433d6423SLionel Sambuc     int s;
19*433d6423SLionel Sambuc     memset(&m, 0, sizeof(m));
20*433d6423SLionel Sambuc     m.m_lsys_tty_fkey_ctl.request = request;
21*433d6423SLionel Sambuc     m.m_lsys_tty_fkey_ctl.fkeys = (fkeys) ? *fkeys : 0;
22*433d6423SLionel Sambuc     m.m_lsys_tty_fkey_ctl.sfkeys = (sfkeys) ? *sfkeys : 0;
23*433d6423SLionel Sambuc     s = _taskcall(TTY_PROC_NR, TTY_FKEY_CONTROL, &m);
24*433d6423SLionel Sambuc     if (fkeys) *fkeys = m.m_tty_lsys_fkey_ctl.fkeys;
25*433d6423SLionel Sambuc     if (sfkeys) *sfkeys = m.m_tty_lsys_fkey_ctl.sfkeys;
26*433d6423SLionel Sambuc     return(s);
27*433d6423SLionel Sambuc }
28*433d6423SLionel Sambuc 
29*433d6423SLionel Sambuc 
30