forked from ghaerr/microwindows
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnanowm.h
More file actions
153 lines (137 loc) · 4.95 KB
/
Copy pathnanowm.h
File metadata and controls
153 lines (137 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* NanoWM - The Nano-X window manager.
* Copyright (C) 2000, 2010, 2019 Greg Haerr <greg@censoft.com>
* Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
*/
#ifndef __NANOWM_H
#define __NANOWM_H
#include "mwconfig.h"
/* configurable options*/
#define OUTLINE_MOVE 0 /* draw outline only during window move*/
#define NO_CORNER_RESIZE 0 /* don't resize windows on corner drag*/
#define NO_AUTO_MOVE 0 /* don't auto position window on new windows*/
#define WINDOW_STEP 20 /* x,y step between new window placements*/
#define MAXSYSCOLORS 22 /* # of GR_COLOR_* system colors*/
/* default window style for GR_WM_PROPS_APPWINDOW*/
#define DEFAULT_WINDOW_STYLE (GR_WM_PROPS_APPFRAME | GR_WM_PROPS_CAPTION | GR_WM_PROPS_CLOSEBOX)
/* nxPaintNCArea window drawing and color scheme*/
#if NUKLEARUI /* draw window frames/colors to match Nuklear style*/
#define SCHEME_NUKLEAR /* nuklear color scheme*/
#define CXBORDER 1 /* 3d border width*/
#define CYBORDER 1 /* 3d border height*/
#define CYCAPTION 29 /* height of caption*/
#define CXCLOSEBOX 20 /* width of closebox*/
#define CYCLOSEBOX 20 /* height of closebox*/
#define CXFRAME (CXBORDER*2) /* width of frame*/
#define CYFRAME (CYBORDER*2) /* height of frame*/
#else
#define SCHEME_TAN /* tan color scheme*/
#define CXBORDER 3 /* 3d border width*/
#define CYBORDER 3 /* 3d border height*/
#define CYCAPTION 12 /* height of caption*/
#define CXCLOSEBOX 9 /* width of closebox*/
#define CYCLOSEBOX 9 /* height of closebox*/
#define CXFRAME (CXBORDER*2) /* width of frame*/
#define CYFRAME (CYBORDER*2) /* height of frame*/
#endif
#if DEBUG_NANOWM
#define Dprintf printf
#else
#define Dprintf(...)
#endif
/* GrGetSystemColor color scheme definitions*/
extern const GR_COLOR nxSysColors[MAXSYSCOLORS];
/* The different window types which can be used in windowlist->type */
enum {
WINDOW_TYPE_ROOT,
WINDOW_TYPE_CONTAINER,
WINDOW_TYPE_CLIENT
/*
WINDOW_TYPE_TOPBAR,
WINDOW_TYPE_LEFTBAR,
WINDOW_TYPE_RIGHTBAR,
WINDOW_TYPE_BOTTOMBAR,
WINDOW_TYPE_LEFTRESIZE,
WINDOW_TYPE_RIGHTRESIZE,
WINDOW_TYPE_CLOSEBUTTON,
WINDOW_TYPE_MAXIMISEBUTTON,
WINDOW_TYPE_RESTOREBUTTON,
WINDOW_TYPE_ICONISEBUTTON,
WINDOW_TYPE_ICON,
WINDOW_TYPE_UTILITYBUTTON,
WINDOW_TYPE_UTILITYMENU,
WINDOW_TYPE_UTILITYMENUENTRY,
WINDOW_TYPE_ROOTMENU,
WINDOW_TYPE_ROOTMENUENTRY
*/
};
/*
* Used to keep a list of all the windows we know about so we can quickly
* find out whether a window is "one of ours", and if it is, what kind of
* window it is (title bar, side bar, button, icon, root menu, etc.), who
* it's a child of, and any special data associated with it (the title
* used in the title, the text of a root menu entry, the pixmap of an
* icon, etc.).
*/
struct windowlist {
GR_WINDOW_ID wid; /* The ID of this window */
GR_WINDOW_ID pid; /* The ID of this window's parent */
GR_WINDOW_ID clientid; /* clientid for container window*/
int type; /* What kind of window this is */
int sizing; /* True if in the middle of a sizing request */
int close; /* Close button pressed*/
int active; /* Whether this window is active or not */
void *data; /* Data associated with this window */
struct windowlist *next; /* The next window in the list */
};
typedef struct windowlist win;
/*
* Used to record the offset position when performing a move.
*/
struct position {
GR_COORD x;
GR_COORD y;
};
/*
* Used to record the original position, original size, and offset position
* when performing a resize.
*/
struct pos_size {
GR_COORD xoff;
GR_COORD yoff;
GR_COORD xorig;
GR_COORD yorig;
GR_SIZE width;
GR_SIZE height;
};
/* Function prototypes */
win *wm_find_window(GR_WINDOW_ID wid);
int wm_add_window(win *window);
int wm_remove_window(win *window);
int wm_remove_window_and_children(win *window);
int wm_new_client_window(GR_WINDOW_ID wid);
void wm_client_window_resize(win *window);
void wm_client_window_destroy(win *window);
void wm_client_window_remap(win *window);
void wm_client_window_unmap(win *window);
void wm_redraw_ncarea(win *window);
int wm_exposure(GR_EVENT_EXPOSURE *event);
int wm_button_down(GR_EVENT_BUTTON *event);
int wm_button_up(GR_EVENT_BUTTON *event);
int wm_mouse_enter(GR_EVENT_GENERAL *event);
int wm_mouse_exit(GR_EVENT_GENERAL *event);
int wm_mouse_moved(GR_EVENT_MOUSE *event);
int wm_focus_in(GR_EVENT_GENERAL *event);
int wm_key_down(GR_EVENT_KEYSTROKE *event);
int wm_key_up(GR_EVENT_KEYSTROKE *event);
int wm_focus_in(GR_EVENT_GENERAL *event);
int wm_focus_out(GR_EVENT_GENERAL *event);
int wm_chld_update(GR_EVENT_UPDATE *event);
int wm_chld_update(GR_EVENT_UPDATE *event);
void wm_container_exposure(win *window, GR_EVENT_EXPOSURE *event);
void wm_container_buttondown(win *window, GR_EVENT_BUTTON *event);
void wm_container_buttonup(win *window, GR_EVENT_BUTTON *event);
void wm_container_mousemoved(win *window, GR_EVENT_MOUSE *event);
void wm_container_mouse_enter(win *window, GR_EVENT_GENERAL *event);
void wm_container_mouse_exit(win *window, GR_EVENT_GENERAL *event);
#endif /* __NANOWM_H*/