Home | History | Annotate | Line # | Download | only in wsmoused
wsmoused.h revision 1.3
      1 /* $NetBSD: wsmoused.h,v 1.3 2003/03/04 14:33:55 jmmv Exp $ */
      2 
      3 /*
      4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Julio Merino.
      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 struct mouse {
     36 	/* File descriptors and names */
     37 	int  fd;
     38 	int  tty_fd;
     39 	int  stat_fd;
     40 	int  fifo_fd;
     41 	char *device_name;
     42 	char *fifo_name;
     43 	char *tstat_name;
     44 
     45 	/* Screen coordinates */
     46 	size_t row, col;
     47 	size_t max_row, max_col;
     48 
     49 	/* Movement information */
     50 	size_t slowdown_x, slowdown_y;
     51 	size_t count_row, count_col;
     52 
     53 	int cursor;
     54 	int selecting;
     55 	int disabled;
     56 
     57 	/* Button configuration */
     58 	int but_select;
     59 	int but_paste;
     60 };
     61 
     62 struct prop {
     63 	char *p_name;
     64 	char *p_value;
     65 };
     66 
     67 #define MAX_EVENTS	10
     68 #define MAX_BLOCKS	10
     69 #define MAX_PROPS	100
     70 #define BLOCK_GLOBAL	1
     71 #define BLOCK_MODE	2
     72 #define BLOCK_EVENT	3
     73 struct block {
     74 	char *b_name;
     75 	int b_type;
     76 	int b_prop_count;
     77 	int b_child_count;
     78 	struct prop *b_prop[MAX_BLOCKS];
     79 	struct block *b_child[MAX_BLOCKS];
     80 	struct block *b_parent;
     81 };
     82 
     83 /* Prototypes for wsmoused.c */
     84 void char_invert(struct mouse *, size_t, size_t);
     85 void mouse_cursor_show(struct mouse *);
     86 void mouse_cursor_hide(struct mouse *);
     87 void mouse_open_tty(struct mouse *, int);
     88 
     89 /* Prototypes for config.c */
     90 struct prop *prop_new(void);
     91 void prop_free(struct prop *);
     92 struct block *block_new(int);
     93 void block_free(struct block *);
     94 void block_add_prop(struct block *, struct prop *);
     95 void block_add_child(struct block *, struct block *);
     96 char *block_get_propval(struct block *, char *, char *);
     97 int block_get_propval_int(struct block *, char *, int);
     98 struct block *config_get_mode(char *);
     99 void config_read(char *, int);
    100 void config_free(void);
    101 
    102 /* Prototypes for event.c */
    103 void mouse_motion_event(struct mouse *, struct wscons_event *);
    104 void mouse_button_event(struct mouse *, struct wscons_event *);
    105 void screen_event(struct mouse *, struct wscons_event *);
    106 
    107 /* Prototypes for selection.c */
    108 void mouse_sel_init(void);
    109 void mouse_sel_start(struct mouse *);
    110 void mouse_sel_end(struct mouse *);
    111 void mouse_sel_calculate(struct mouse *);
    112 void mouse_sel_hide(struct mouse *);
    113 void mouse_sel_show(struct mouse *);
    114 void mouse_sel_paste(struct mouse *);
    115 
    116 #endif /* _WSMOUSED_WSMOUSED_H */
    117