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