Libmacro  0.2
Libmacro is an extensible macro and hotkey library.
abs_key_dispatcher.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 
22 #ifndef MCR_STANDARD_KEY_DISPATCHER_H_
23 #define MCR_STANDARD_KEY_DISPATCHER_H_
24 
25 #include "mcr/standard/key.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
32  struct mcr_IDispatcher idispatcher;
33  /* down, up, generic or MCR_BOTH is both
34  * apply type + key => array of receivers */
35  struct {
36  struct mcr_ReceiverMapElement *key_receivers[2];
37  size_t key_receiver_count[2];
38  };
39 };
40 
46 MCR_API void mcr_AbsKeyDispatcher_ctor(struct mcr_AbsKeyDispatcher *keyDispatcherPt,
47  struct mcr_context *ctx, void (*deinit)(struct mcr_IDispatcher *),
49  void (*clear)(struct mcr_IDispatcher *), mcr_IDispatcher_remove_fnc remove,
50  void (*trim)(struct mcr_IDispatcher *));
51 
53 MCR_API bool mcr_AbsKeyDispatcher_dispatch(struct mcr_IDispatcher *idispPt,
54  struct mcr_Signal *signalPt, unsigned int mods);
56 MCR_API void mcr_AbsKeyDispatcher_modifier(struct mcr_IDispatcher *idispPt,
57  struct mcr_Signal *signalPt, unsigned int *modsPt);
58 
64  *keyDispatcher, enum mcr_ApplyType forApplyType,
65  struct mcr_ReceiverMapElement *receivers, size_t receiverCount);
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif
MCR_API void mcr_AbsKeyDispatcher_set_receivers(struct mcr_AbsKeyDispatcher *keyDispatcher, enum mcr_ApplyType forApplyType, struct mcr_ReceiverMapElement *receivers, size_t receiverCount)
void(* mcr_IDispatcher_remove_fnc)(struct mcr_IDispatcher *idispPt, void *remReceiver)
Definition: idispatcher.h:66
MCR_API void mcr_AbsKeyDispatcher_ctor(struct mcr_AbsKeyDispatcher *keyDispatcherPt, struct mcr_context *ctx, void(*deinit)(struct mcr_IDispatcher *), mcr_IDispatcher_add_fnc add, void(*clear)(struct mcr_IDispatcher *), mcr_IDispatcher_remove_fnc remove, void(*trim)(struct mcr_IDispatcher *))
MCR_API void mcr_AbsKeyDispatcher_modifier(struct mcr_IDispatcher *idispPt, struct mcr_Signal *signalPt, unsigned int *modsPt)
struct mcr_DispatchReceiver * receivers
Definition: types.h:85
MCR_API bool mcr_AbsKeyDispatcher_dispatch(struct mcr_IDispatcher *idispPt, struct mcr_Signal *signalPt, unsigned int mods)
int(* mcr_IDispatcher_add_fnc)(struct mcr_IDispatcher *idispPt, struct mcr_Signal *sigPt, void *receiver, mcr_dispatch_receive_fnc receiverFnc)
Definition: idispatcher.h:57
mcr_Key - Simulate keyboard keys.
mcr_ApplyType
Definition: types.h:160