File: kbdsupport.c

package info (click to toggle)
amiwm 0.21pl2-1
  • links: PTS
  • area: non-free
  • in suites: buster
  • size: 1,004 kB
  • sloc: ansic: 9,800; perl: 443; makefile: 253; yacc: 241; lex: 215; sh: 211
file content (23 lines) | stat: -rw-r--r-- 488 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <stdlib.h>
#include <string.h>
#include "libami.h"
#include "module.h"


int md_grabkey(int keycode, unsigned int modifiers)
{
  int pkt[2], res=-1;
  char *ptr=NULL;
  pkt[0]=keycode; pkt[1]=modifiers;
  if(md_command(None, MCMD_ADD_KEYGRAB, pkt, sizeof(pkt), &ptr)>=sizeof(int))
    res=*((int*)ptr);
  if(ptr) free(ptr);
  return res;
}

int md_ungrabkey(int id)
{
  return md_command0(None, MCMD_DEL_KEYGRAB, &id, sizeof(id));
}