Libmacro  0.2
Libmacro is an extensible macro and hotkey library.
p_grabber.h
Go to the documentation of this file.
1 /* Libmacro - A multi-platform, extendable macro and hotkey C library
2  Copyright (C) 2013 Jonathan Pelletier, New Paradigm Software
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
23 #ifndef MCR_INTERCEPT_LINUX_P_GRABBER_H_
24 #define MCR_INTERCEPT_LINUX_P_GRABBER_H_
25 
26 #include "mcr/standard/standard.h"
27 #include "mcr/standard/linux/p_standard.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
34 struct mcr_Grabber {
35  struct mcr_context *context;
39  bool blocking;
41  int fd;
43  const char *path;
44  // \todo bool value for in-thread and reading?
45 };
46 
48 MCR_API void mcr_Grabber_init(struct mcr_Grabber *grabPt, struct mcr_context *ctx);
49 MCR_API void mcr_Grabber_ctor(struct mcr_Grabber *grabPt, struct mcr_context *ctx, bool blocking, const char *path);
50 MCR_API int mcr_Grabber_deinit(struct mcr_Grabber *grabPt);
51 
53 MCR_API bool mcr_Grabber_blocking(struct mcr_Grabber *grabPt);
56 MCR_API int mcr_Grabber_set_blocking(struct mcr_Grabber *grabPt, bool enable);
58 MCR_API const char *mcr_Grabber_path(struct mcr_Grabber *grabPt);
60 MCR_API int mcr_Grabber_set_path(struct mcr_Grabber *grabPt, const char *path);
64 MCR_API bool mcr_Grabber_enabled(struct mcr_Grabber *grabPt);
69 MCR_API int mcr_Grabber_set_enabled(struct mcr_Grabber *grabPt, bool enable);
70 
71 #define MCR_EVENTINDEX(keyCode) \
72 ((keyCode) / 8)
73 
74 #define MCR_EVENTBIT(keyCode) \
75 (1 << ((keyCode) % 8))
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif
bool blocking
Definition: p_grabber.h:39
MCR_API int mcr_Grabber_set_blocking(struct mcr_Grabber *grabPt, bool enable)
MCR_API void mcr_Grabber_init(struct mcr_Grabber *grabPt, struct mcr_context *ctx)
MCR_API bool mcr_Grabber_blocking(struct mcr_Grabber *grabPt)
const char * path
Definition: p_grabber.h:43
MCR_API const char * mcr_Grabber_path(struct mcr_Grabber *grabPt)
MCR_API bool mcr_Grabber_enabled(struct mcr_Grabber *grabPt)
MCR_API int mcr_Grabber_set_enabled(struct mcr_Grabber *grabPt, bool enable)
MCR_API int mcr_Grabber_set_path(struct mcr_Grabber *grabPt, const char *path)
Standard signal and trigger types.