2001-12-27 23:30:36 +00:00
|
|
|
/*
|
|
|
|
|
* input.h
|
|
|
|
|
* This file is part of LCDd, the lcdproc server.
|
|
|
|
|
*
|
|
|
|
|
* This file is released under the GNU General Public License. Refer to the
|
|
|
|
|
* COPYING file distributed with this package.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 1999, William Ferrell, Scott Scriven
|
2003-02-27 21:20:20 +00:00
|
|
|
* 2003, Joris Robijn
|
2001-12-27 23:30:36 +00:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
1999-12-09 23:15:14 +00:00
|
|
|
#ifndef INPUT_H
|
|
|
|
|
#define INPUT_H
|
|
|
|
|
|
2002-05-26 19:21:23 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2001-12-30 00:15:25 +00:00
|
|
|
/* Accepts and uses keypad input while displaying screens... */
|
2007-04-02 21:29:53 +00:00
|
|
|
int handle_input(void);
|
1999-12-09 23:15:14 +00:00
|
|
|
|
2002-05-26 19:21:23 +00:00
|
|
|
#ifndef bool
|
|
|
|
|
# define bool short
|
|
|
|
|
# define true 1
|
|
|
|
|
# define false 0
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef struct KeyReservation {
|
2007-04-02 21:29:53 +00:00
|
|
|
char *key;
|
2002-05-26 19:21:23 +00:00
|
|
|
bool exclusive;
|
2007-04-02 21:29:53 +00:00
|
|
|
Client *client; /* NULL for internal clients */
|
2002-05-26 19:21:23 +00:00
|
|
|
} KeyReservation;
|
|
|
|
|
|
|
|
|
|
|
2007-04-02 21:29:53 +00:00
|
|
|
int input_init(void);
|
2002-05-26 19:21:23 +00:00
|
|
|
/* Init the input handling system */
|
2003-02-27 21:20:20 +00:00
|
|
|
|
2007-04-02 21:29:53 +00:00
|
|
|
int input_shutdown(void);
|
2002-08-04 20:58:51 +00:00
|
|
|
/* Shut it down */
|
2003-02-27 21:20:20 +00:00
|
|
|
|
2007-04-02 21:29:53 +00:00
|
|
|
int input_reserve_key(const char *key, bool exclusive, Client *client);
|
2002-05-26 19:21:23 +00:00
|
|
|
/* Reserves a key for a client */
|
|
|
|
|
/* Return -1 if reservation of key is not possible */
|
2003-02-27 21:20:20 +00:00
|
|
|
|
2007-04-02 21:29:53 +00:00
|
|
|
void input_release_key(const char *key, Client *client);
|
2002-05-26 19:21:23 +00:00
|
|
|
/* Releases a key reservation */
|
2003-02-27 21:20:20 +00:00
|
|
|
|
2007-04-02 21:29:53 +00:00
|
|
|
void input_release_client_keys(Client *client);
|
2002-05-26 19:21:23 +00:00
|
|
|
/* Releases all key reservations for a given client */
|
2003-02-27 21:20:20 +00:00
|
|
|
|
2007-04-02 21:29:53 +00:00
|
|
|
KeyReservation *input_find_key(const char *key, Client *client);
|
2002-05-26 19:21:23 +00:00
|
|
|
/* Finds if a key reservation causes a 'hit'.
|
|
|
|
|
* If the key was reserved exclusively, the client will be ignored.
|
|
|
|
|
* If the key was reserved shared, the client must match.
|
|
|
|
|
*/
|
2001-12-30 00:15:25 +00:00
|
|
|
|
1999-12-09 23:15:14 +00:00
|
|
|
#endif
|