1 #pragma once
2 #include <stdint.h>
3 
4 typedef enum {
5 	WINTYPE_UNKNOWN,
6 	WINTYPE_DESKTOP,
7 	WINTYPE_DOCK,
8 	WINTYPE_TOOLBAR,
9 	WINTYPE_MENU,
10 	WINTYPE_UTILITY,
11 	WINTYPE_SPLASH,
12 	WINTYPE_DIALOG,
13 	WINTYPE_NORMAL,
14 	WINTYPE_DROPDOWN_MENU,
15 	WINTYPE_POPUP_MENU,
16 	WINTYPE_TOOLTIP,
17 	WINTYPE_NOTIFICATION,
18 	WINTYPE_COMBO,
19 	WINTYPE_DND,
20 	NUM_WINTYPES
21 } wintype_t;
22 
23 /// Enumeration type of window painting mode.
24 typedef enum {
25 	WMODE_TRANS,              // The window body is (potentially) transparent
26 	WMODE_FRAME_TRANS,        // The window body is opaque, but the frame is not
27 	WMODE_SOLID,              // The window is opaque including the frame
28 } winmode_t;
29 
30 /// Transition table:
31 /// (DESTROYED is when the win struct is destroyed and freed)
32 /// ('o' means in all other cases)
33 /// (Window is created in the UNMAPPED state)
34 /// +-------------+---------+----------+-------+-------+--------+--------+---------+
35 /// |             |UNMAPPING|DESTROYING|MAPPING|FADING |UNMAPPED| MAPPED |DESTROYED|
36 /// +-------------+---------+----------+-------+-------+--------+--------+---------+
37 /// |  UNMAPPING  |    o    |  Window  |Window |  -    | Fading |  -     |    -    |
38 /// |             |         |destroyed |mapped |       |finished|        |         |
39 /// +-------------+---------+----------+-------+-------+--------+--------+---------+
40 /// |  DESTROYING |    -    |    o     |   -   |  -    |   -    |  -     | Fading  |
41 /// |             |         |          |       |       |        |        |finished |
42 /// +-------------+---------+----------+-------+-------+--------+--------+---------+
43 /// |   MAPPING   | Window  |  Window  |   o   |Opacity|   -    | Fading |    -    |
44 /// |             |unmapped |destroyed |       |change |        |finished|         |
45 /// +-------------+---------+----------+-------+-------+--------+--------+---------+
46 /// |    FADING   | Window  |  Window  |   -   |  o    |   -    | Fading |    -    |
47 /// |             |unmapped |destroyed |       |       |        |finished|         |
48 /// +-------------+---------+----------+-------+-------+--------+--------+---------+
49 /// |   UNMAPPED  |    -    |    -     |Window |  -    |   o    |   -    | Window  |
50 /// |             |         |          |mapped |       |        |        |destroyed|
51 /// +-------------+---------+----------+-------+-------+--------+--------+---------+
52 /// |    MAPPED   | Window  |  Window  |   -   |Opacity|   -    |   o    |    -    |
53 /// |             |unmapped |destroyed |       |change |        |        |         |
54 /// +-------------+---------+----------+-------+-------+--------+--------+---------+
55 typedef enum {
56 	// The window is being faded out because it's unmapped.
57 	WSTATE_UNMAPPING,
58 	// The window is being faded out because it's destroyed,
59 	WSTATE_DESTROYING,
60 	// The window is being faded in
61 	WSTATE_MAPPING,
62 	// Window opacity is not at the target level
63 	WSTATE_FADING,
64 	// The window is mapped, no fading is in progress.
65 	WSTATE_MAPPED,
66 	// The window is unmapped, no fading is in progress.
67 	WSTATE_UNMAPPED,
68 } winstate_t;
69 
70 enum win_flags {
71 	// Note: *_NONE flags are mostly redudant and meant for detecting logical errors
72 	// in the code
73 
74 	/// pixmap is out of date, will be update in win_process_flags
75 	WIN_FLAGS_PIXMAP_STALE = 1,
76 	/// window does not have pixmap bound
77 	WIN_FLAGS_PIXMAP_NONE = 2,
78 	/// there was an error trying to bind the images
79 	WIN_FLAGS_IMAGE_ERROR = 4,
80 	/// shadow is out of date, will be updated in win_process_flags
81 	WIN_FLAGS_SHADOW_STALE = 8,
82 	/// shadow has not been generated
83 	WIN_FLAGS_SHADOW_NONE = 16,
84 	/// the client window needs to be updated
85 	WIN_FLAGS_CLIENT_STALE = 32,
86 	/// the window is mapped by X, we need to call map_win_start for it
87 	WIN_FLAGS_MAPPED = 64,
88 };
89 
90 static const uint64_t WIN_FLAGS_IMAGES_STALE = WIN_FLAGS_PIXMAP_STALE | WIN_FLAGS_SHADOW_STALE;
91 
92 #define WIN_FLAGS_IMAGES_NONE (WIN_FLAGS_PIXMAP_NONE | WIN_FLAGS_SHADOW_NONE)
93