File: key_release.c

package info (click to toggle)
garlic 1.5-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,324 kB
  • ctags: 1,378
  • sloc: ansic: 50,306; makefile: 1,088
file content (81 lines) | stat: -rw-r--r-- 1,608 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* Copyright (C) 2000 Damir Zucic */

/*=============================================================================

				key_release.c

Purpose:
	Handle KeyRelease events (just reset some flags).

Input:
	(1) Pointer to GUIS structure, with GUI data.
	(2) Pointer to XKeyEvent structure.

Output:
	(1) One flag changed in GUIS structure.
	(2) Return value.

Return value:
	(1) Positive on success.
	(2) Negative on failure.

========includes:============================================================*/

#include <stdio.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>

#include <X11/keysym.h>

#include "defines.h"
#include "typedefs.h"

/*======handle KeyRelease events:============================================*/

int KeyRelease_ (GUIS *guiSP, XKeyEvent *key_eventSP)
{
char			stringA[STRINGSIZE];
KeySym			key_symID;
XComposeStatus		compose_statusS;

/* Get the KeySym: */
XLookupString (key_eventSP, stringA, STRINGSIZE, &key_symID, &compose_statusS);

/* Select the proper action for a given KeySym: */
switch (key_symID)
	{
	/* Shift key released: */
	case XK_Shift_L:
	case XK_Shift_R:
		guiSP->shift_pressedF = 0;
		break;

	/* Control key released: */
	case XK_Control_L:
	case XK_Control_R:
		guiSP->control_pressedF = 0;
		break;

	/* Alt or meta key released: */
	case XK_Alt_L:
	case XK_Alt_R:
	case XK_Meta_L:
	case XK_Meta_R:
		guiSP->alt_pressedF = 0;
		break;

	/* All other cases are ignored: */
	default:
		;
	}

/* Return positive value: */
return 1;
}

/*===========================================================================*/