Expand PMF_FN_* macros.
[netbsd-mini2440.git] / usr.sbin / wsmoused / wsmoused.h
blob60ea5d46429f2be60fa81f99dbb56f843f837207
1 /* $NetBSD: wsmoused.h,v 1.8 2004/01/20 22:11:02 matt Exp $ */
3 /*
4 * Copyright (c) 2002, 2003, 2004 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. The name authors may not be used to endorse or promote products
16 * derived from this software without specific prior written
17 * permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
20 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _WSMOUSED_WSMOUSED_H
33 #define _WSMOUSED_WSMOUSED_H
35 #define IS_MOTION_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_DELTA_X) || \
36 ((type) == WSCONS_EVENT_MOUSE_DELTA_Y) || \
37 ((type) == WSCONS_EVENT_MOUSE_DELTA_Z))
38 #define IS_BUTTON_EVENT(type) (((type) == WSCONS_EVENT_MOUSE_UP) || \
39 ((type) == WSCONS_EVENT_MOUSE_DOWN))
41 struct mouse {
42 int m_devfd; /* File descriptor of wsmouse device */
43 int m_fifofd; /* File descriptor of fifo */
44 int m_statfd; /* File descriptor of wscons status device */
45 char *m_devname; /* File name of wsmouse device */
46 char *m_fifoname; /* File name of fifo */
47 int m_disabled; /* Whether if the mouse is disabled or not */
50 struct mode_bootstrap {
51 char *mb_name;
52 int (*mb_startup)(struct mouse *);
53 int (*mb_cleanup)(void);
54 void (*mb_wsmouse_event)(struct wscons_event);
55 void (*mb_wscons_event)(struct wscons_event, int);
56 void (*mb_poll_timeout)(void);
59 struct prop {
60 char *p_name;
61 char *p_value;
64 #define MAX_EVENTS 10
65 #define MAX_BLOCKS 10
66 #define MAX_PROPS 100
67 #define BLOCK_GLOBAL 1
68 #define BLOCK_MODE 2
69 #define BLOCK_EVENT 3
70 struct block {
71 char *b_name;
72 int b_type;
73 int b_prop_count;
74 int b_child_count;
75 struct prop *b_prop[MAX_PROPS];
76 struct block *b_child[MAX_BLOCKS];
77 struct block *b_parent;
80 /* Prototypes for wsmoused.c */
81 void log_err(int, const char *, ...);
82 void log_errx(int, const char *, ...);
83 void log_info(const char *, ...);
84 void log_warn(const char *, ...);
85 void log_warnx(const char *, ...);
87 /* Prototypes for config.c */
88 struct prop *prop_new(void);
89 void prop_free(struct prop *);
90 struct block *block_new(int);
91 void block_free(struct block *);
92 void block_add_prop(struct block *, struct prop *);
93 void block_add_child(struct block *, struct block *);
94 char *block_get_propval(struct block *, const char *, char *);
95 int block_get_propval_int(struct block *, const char *, int);
96 struct block *config_get_mode(const char *);
97 void config_read(const char *, int);
98 void config_free(void);
100 #endif /* _WSMOUSED_WSMOUSED_H */