1 |
673 |
markom |
/*
|
2 |
|
|
* NanoWM- the NanoGUI window manager.
|
3 |
|
|
* Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
|
4 |
|
|
*/
|
5 |
|
|
|
6 |
|
|
#ifndef __NANOWM_H
|
7 |
|
|
#define __NANOWM_H
|
8 |
|
|
|
9 |
|
|
#ifdef DEBUG
|
10 |
|
|
#define Dprintf printf
|
11 |
|
|
#else
|
12 |
|
|
#define Dprintf(ignore...)
|
13 |
|
|
#endif
|
14 |
|
|
|
15 |
|
|
/* Where to place the first window on the screen */
|
16 |
|
|
#define FIRST_WINDOW_LOCATION 2
|
17 |
|
|
|
18 |
|
|
/* The distance to leave between windows when deciding where to place */
|
19 |
|
|
#define WINDOW_STEP 20
|
20 |
|
|
|
21 |
|
|
/* The different window types which can be used in windowlist->type */
|
22 |
|
|
enum {
|
23 |
|
|
WINDOW_TYPE_ROOT,
|
24 |
|
|
WINDOW_TYPE_CONTAINER,
|
25 |
|
|
WINDOW_TYPE_CLIENT
|
26 |
|
|
/***WINDOW_TYPE_TOPBAR,
|
27 |
|
|
WINDOW_TYPE_LEFTBAR,
|
28 |
|
|
WINDOW_TYPE_RIGHTBAR,
|
29 |
|
|
WINDOW_TYPE_BOTTOMBAR,
|
30 |
|
|
WINDOW_TYPE_LEFTRESIZE,
|
31 |
|
|
WINDOW_TYPE_RIGHTRESIZE,
|
32 |
|
|
WINDOW_TYPE_CLOSEBUTTON,
|
33 |
|
|
WINDOW_TYPE_MAXIMISEBUTTON,
|
34 |
|
|
WINDOW_TYPE_RESTOREBUTTON,
|
35 |
|
|
WINDOW_TYPE_ICONISEBUTTON,
|
36 |
|
|
WINDOW_TYPE_ICON,
|
37 |
|
|
WINDOW_TYPE_UTILITYBUTTON,
|
38 |
|
|
WINDOW_TYPE_UTILITYMENU,
|
39 |
|
|
WINDOW_TYPE_UTILITYMENUENTRY,
|
40 |
|
|
WINDOW_TYPE_ROOTMENU,
|
41 |
|
|
WINDOW_TYPE_ROOTMENUENTRY**/
|
42 |
|
|
};
|
43 |
|
|
|
44 |
|
|
/*
|
45 |
|
|
* Used to keep a list of all the windows we know about so we can quickly
|
46 |
|
|
* find out whether a window is "one of ours", and if it is, what kind of
|
47 |
|
|
* window it is (title bar, side bar, button, icon, root menu, etc.), who
|
48 |
|
|
* it's a child of, and any special data associated with it (the title
|
49 |
|
|
* used in the title, the text of a root menu entry, the pixmap of an
|
50 |
|
|
* icon, etc.).
|
51 |
|
|
*/
|
52 |
|
|
struct windowlist {
|
53 |
|
|
GR_WINDOW_ID wid; /* The ID of this window */
|
54 |
|
|
GR_WINDOW_ID pid; /* The ID of this window's parent */
|
55 |
|
|
GR_WINDOW_ID clientid; /* clientid for container window*/
|
56 |
|
|
int type; /* What kind of window this is */
|
57 |
|
|
int sizing; /* True if in the middle of a sizing request */
|
58 |
|
|
int active; /* Whether this window is active or not */
|
59 |
|
|
void *data; /* Data associated with this window */
|
60 |
|
|
struct windowlist *next; /* The next window in the list */
|
61 |
|
|
};
|
62 |
|
|
typedef struct windowlist win;
|
63 |
|
|
|
64 |
|
|
/*
|
65 |
|
|
* Used to record the offset position when performing a move.
|
66 |
|
|
*/
|
67 |
|
|
struct position {
|
68 |
|
|
GR_COORD x;
|
69 |
|
|
GR_COORD y;
|
70 |
|
|
};
|
71 |
|
|
|
72 |
|
|
/*
|
73 |
|
|
* Used to record the original position, original size, and offset position
|
74 |
|
|
* when performing a resize.
|
75 |
|
|
*/
|
76 |
|
|
struct pos_size {
|
77 |
|
|
GR_COORD xoff;
|
78 |
|
|
GR_COORD yoff;
|
79 |
|
|
GR_COORD xorig;
|
80 |
|
|
GR_COORD yorig;
|
81 |
|
|
GR_SIZE width;
|
82 |
|
|
GR_SIZE height;
|
83 |
|
|
};
|
84 |
|
|
|
85 |
|
|
#if 0000
|
86 |
|
|
/*
|
87 |
|
|
* Used to record some general information about the client.
|
88 |
|
|
*/
|
89 |
|
|
struct clientinfo {
|
90 |
|
|
GR_WINDOW_ID cid;
|
91 |
|
|
};
|
92 |
|
|
#endif
|
93 |
|
|
|
94 |
|
|
/* Function prototypes */
|
95 |
|
|
win *find_window(GR_WINDOW_ID wid);
|
96 |
|
|
int add_window(win *window);
|
97 |
|
|
int remove_window(win *window);
|
98 |
|
|
int remove_window_and_children(win *window);
|
99 |
|
|
int new_client_window(GR_WINDOW_ID wid);
|
100 |
|
|
void client_window_destroy(win *window);
|
101 |
|
|
void redraw_ncarea(win *window);
|
102 |
|
|
void do_exposure(GR_EVENT_EXPOSURE *event);
|
103 |
|
|
void do_button_down(GR_EVENT_BUTTON *event);
|
104 |
|
|
void do_button_up(GR_EVENT_BUTTON *event);
|
105 |
|
|
void do_mouse_enter(GR_EVENT_GENERAL *event);
|
106 |
|
|
void do_mouse_exit(GR_EVENT_GENERAL *event);
|
107 |
|
|
void do_mouse_moved(GR_EVENT_MOUSE *event);
|
108 |
|
|
void do_focus_in(GR_EVENT_GENERAL *event);
|
109 |
|
|
void do_key_down(GR_EVENT_KEYSTROKE *event);
|
110 |
|
|
void do_key_up(GR_EVENT_KEYSTROKE *event);
|
111 |
|
|
void do_focus_in(GR_EVENT_GENERAL *event);
|
112 |
|
|
void do_focus_out(GR_EVENT_GENERAL *event);
|
113 |
|
|
void do_update(GR_EVENT_UPDATE *event);
|
114 |
|
|
void do_chld_update(GR_EVENT_UPDATE *event);
|
115 |
|
|
void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
116 |
|
|
void container_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
117 |
|
|
void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
118 |
|
|
void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
119 |
|
|
void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
120 |
|
|
void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
121 |
|
|
void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
122 |
|
|
void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
123 |
|
|
void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
124 |
|
|
void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
125 |
|
|
void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
126 |
|
|
void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
127 |
|
|
void icon_exposure(win *window, GR_EVENT_EXPOSURE *event);
|
128 |
|
|
void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event);
|
129 |
|
|
void container_buttondown(win *window, GR_EVENT_BUTTON *event);
|
130 |
|
|
void topbar_buttondown(win *window, GR_EVENT_BUTTON *event);
|
131 |
|
|
void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event);
|
132 |
|
|
void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
|
133 |
|
|
void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
|
134 |
|
|
void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
|
135 |
|
|
void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
|
136 |
|
|
void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event);
|
137 |
|
|
void icon_buttondown(win *window, GR_EVENT_BUTTON *event);
|
138 |
|
|
void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event);
|
139 |
|
|
void container_buttonup(win *window, GR_EVENT_BUTTON *event);
|
140 |
|
|
void topbar_buttonup(win *window, GR_EVENT_BUTTON *event);
|
141 |
|
|
void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event);
|
142 |
|
|
void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
|
143 |
|
|
void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
|
144 |
|
|
void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
|
145 |
|
|
void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
|
146 |
|
|
void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event);
|
147 |
|
|
void icon_buttonup(win *window, GR_EVENT_BUTTON *event);
|
148 |
|
|
void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
|
149 |
|
|
void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
|
150 |
|
|
void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
151 |
|
|
void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
152 |
|
|
void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
153 |
|
|
void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
154 |
|
|
void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
155 |
|
|
void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
156 |
|
|
void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
157 |
|
|
void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
158 |
|
|
void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
|
159 |
|
|
void container_mousemoved(win *window, GR_EVENT_MOUSE *event);
|
160 |
|
|
void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
|
161 |
|
|
void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
|
162 |
|
|
void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
|
163 |
|
|
void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event);
|
164 |
|
|
void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
|
165 |
|
|
void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
|
166 |
|
|
|
167 |
|
|
extern GR_SCREEN_INFO si;
|
168 |
|
|
extern win *windows;
|
169 |
|
|
extern GR_BITMAP utilitybutton_notpressed[];
|
170 |
|
|
extern GR_BITMAP utilitybutton_pressed[];
|
171 |
|
|
extern GR_BITMAP maximisebutton_notpressed[];
|
172 |
|
|
extern GR_BITMAP maximisebutton_pressed[];
|
173 |
|
|
extern GR_BITMAP iconisebutton_notpressed[];
|
174 |
|
|
extern GR_BITMAP iconisebutton_pressed[];
|
175 |
|
|
extern GR_BITMAP closebutton_notpressed[];
|
176 |
|
|
extern GR_BITMAP closebutton_pressed[];
|
177 |
|
|
extern GR_BITMAP restorebutton_notpressed[];
|
178 |
|
|
extern GR_BITMAP restorebutton_pressed[];
|
179 |
|
|
extern GR_BITMAP horizontal_resize_fg[];
|
180 |
|
|
extern GR_BITMAP horizontal_resize_bg[];
|
181 |
|
|
extern GR_BITMAP vertical_resize_fg[];
|
182 |
|
|
extern GR_BITMAP vertical_resize_bg[];
|
183 |
|
|
extern GR_BITMAP righthand_resize_fg[];
|
184 |
|
|
extern GR_BITMAP righthand_resize_bg[];
|
185 |
|
|
extern GR_BITMAP lefthand_resize_fg[];
|
186 |
|
|
extern GR_BITMAP lefthand_resize_bg[];
|
187 |
|
|
extern int horizontal_resize_columns, horizontal_resize_rows;
|
188 |
|
|
extern int horizontal_resize_hotx, horizontal_resize_hoty;
|
189 |
|
|
extern int vertical_resize_columns, vertical_resize_rows;
|
190 |
|
|
extern int vertical_resize_hotx, vertical_resize_hoty;
|
191 |
|
|
extern int lefthand_resize_columns, lefthand_resize_rows;
|
192 |
|
|
extern int lefthand_resize_hotx, lefthand_resize_hoty;
|
193 |
|
|
extern int righthand_resize_columns, righthand_resize_rows;
|
194 |
|
|
extern int righthand_resize_hotx, righthand_resize_hoty;
|
195 |
|
|
|
196 |
|
|
#endif
|