Home | History | Annotate | Line # | Download | only in wsmoused
wsmoused.h revision 1.4
      1 /* $NetBSD: wsmoused.h,v 1.4 2003/08/06 18:07:53 jmmv Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Julio M. Merino Vidal.
      9  *
     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.
     18  *
     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.
     30  */
     31 
     32 #ifndef _WSMOUSED_WSMOUSED_H
     33 #define _WSMOUSED_WSMOUSED_H
     34 
     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))
     40 
     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 */
     48 };
     49 
     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);
     56 	void (*mb_poll_timeout)(void);
     57 };
     58 
     59 struct prop {
     60 	char *p_name;
     61 	char *p_value;
     62 };
     63 
     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_BLOCKS];
     76 	struct block *b_child[MAX_BLOCKS];
     77 	struct block *b_parent;
     78 };
     79 
     80 /* Prototypes for config.c */
     81 struct prop *prop_new(void);
     82 void prop_free(struct prop *);
     83 struct block *block_new(int);
     84 void block_free(struct block *);
     85 void block_add_prop(struct block *, struct prop *);
     86 void block_add_child(struct block *, struct block *);
     87 char *block_get_propval(struct block *, const char *, char *);
     88 int block_get_propval_int(struct block *, const char *, int);
     89 struct block *config_get_mode(const char *);
     90 void config_read(const char *, int);
     91 void config_free(void);
     92 
     93 #endif /* _WSMOUSED_WSMOUSED_H */
     94