6 * My thanks for this handly little piece of code below - saved me
7 * a lot of hassle with the buttons
11 Best viewed with vim5, using ts=4
13 wmgeneral was taken from wmppp.
15 It has a lot of routines which most of the wm* programs use.
17 ------------------------------------------------------------
19 Author: Martijn Pieterse (pieterse@xs4all.nl)
24 11/08/2002 (Brad Jorsch, anomie@users.sourceforge.net)
25 * Moved all the mouse region related stuff to mouse_regions.[ch]
27 28/08/2001 (Brad Jorsch, anomie@users.sourceforge.net)
28 * Added EnableMouseRegion and DisableMouseRegion
29 * Got annoyed with the 81-character lines. Fixed it. If you don't like
30 it, find a different copy of wmgeneral.c ;)
31 * GraphicsExpose events are enabled here.
32 * GetXPM is exported. It optionally takes an XpmColorSymbol array.
33 * GetColor is exported.
35 30/09/2000 (Brad Jorsch, anomie@users.sourceforge.net)
36 * You know, wmgen.mask sounds like a much nicer place to store the
37 mask... why don't we do that?
39 21/09/1999 (Brad Jorsch, anomie@users.sourceforge.net)
40 * Changed openXwindow to use only the filename, sans path,
41 as the name and class properties of the app.
43 14/09/1998 (Dave Clark, clarkd@skyia.com)
44 * Updated createXBMfromXPM routine
45 * Now supports >256 colors
46 11/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
47 * Removed a bug from parse_rcfile. You could
48 not use "start" in a command if a label was
50 * Changed the needed geometry string.
51 We don't use window size, and don't support
53 03/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
55 02/09/1998 (Martijn Pieterse, pieterse@xs4all.nl)
56 * Added -geometry support (untested)
57 28/08/1998 (Martijn Pieterse, pieterse@xs4all.nl)
58 * Added createXBMfromXPM routine
59 * Saves a lot of work with changing xpm's.
60 02/05/1998 (Martijn Pieterse, pieterse@xs4all.nl)
61 * changed the read_rc_file to parse_rcfile, as suggested by Marcelo E. Magallon
62 * debugged the parse_rc file.
63 30/04/1998 (Martijn Pieterse, pieterse@xs4all.nl)
64 * Ripped similar code from all the wm* programs,
65 and put them in a single file.
69 #include "mouse_regions.h"
83 MOUSE_REGION mouse_region
[MAX_MOUSE_REGION
];
85 /******************************************************************************\
87 \******************************************************************************/
89 void AddMouseRegion(unsigned index
, int left
, int top
, int right
, int bottom
) {
91 if (index
< MAX_MOUSE_REGION
) {
92 mouse_region
[index
].enable
= 1;
93 mouse_region
[index
].top
= top
;
94 mouse_region
[index
].left
= left
;
95 mouse_region
[index
].bottom
= bottom
;
96 mouse_region
[index
].right
= right
;
100 /******************************************************************************\
101 |* CheckMouseRegion *|
102 \******************************************************************************/
104 int CheckMouseRegion(int x
, int y
) {
110 for (i
=0; i
<MAX_MOUSE_REGION
&& !found
; i
++) {
111 if (mouse_region
[i
].enable
==1 &&
112 x
<= mouse_region
[i
].right
&&
113 x
>= mouse_region
[i
].left
&&
114 y
<= mouse_region
[i
].bottom
&&
115 y
>= mouse_region
[i
].top
)
118 if (!found
) return -1;
122 /******************************************************************************\
123 |* EnableMouseRegion *|
124 \******************************************************************************/
126 void EnableMouseRegion(int i
) {
127 if(i
<MAX_MOUSE_REGION
&& mouse_region
[i
].enable
==2)
128 mouse_region
[i
].enable
=1;
131 /******************************************************************************\
132 |* DisableMouseRegion *|
133 \******************************************************************************/
135 void DisableMouseRegion(int i
) {
136 if(i
<MAX_MOUSE_REGION
&& mouse_region
[i
].enable
==1)
137 mouse_region
[i
].enable
=2;