6
6
#include " graphics/elements/warning.h"
7
7
#include " input/cursor.h"
8
8
#include " input/scroll.h"
9
+ #include " graphics/elements/ui.h"
9
10
10
11
#define MAX_QUEUE 6
11
12
@@ -25,11 +26,13 @@ static void noop(void) {
25
26
}
26
27
static void noop_input (const mouse* m, const hotkeys* h) {
27
28
}
29
+
28
30
static void reset_input () {
29
31
mouse_reset_button_state ();
30
32
reset_touches (1 );
31
33
scroll_stop ();
32
34
}
35
+
33
36
static void increase_queue_index () {
34
37
auto & data = g_window;
35
38
data.queue_index ++;
@@ -78,15 +81,20 @@ void window_show(const window_type* window) {
78
81
auto & data = g_window;
79
82
// push window into queue of screens to render
80
83
reset_input ();
84
+ ui::begin_frame ();
81
85
increase_queue_index ();
82
86
data.window_queue [data.queue_index ] = *window;
83
87
data.current_window = &data.window_queue [data.queue_index ];
84
88
if (!data.current_window ->draw_background )
85
89
data.current_window ->draw_background = noop;
90
+
86
91
if (!data.current_window ->draw_foreground )
87
92
data.current_window ->draw_foreground = noop;
88
- if (!data.current_window ->handle_input )
93
+
94
+ if (!data.current_window ->handle_input ) {
89
95
data.current_window ->handle_input = noop_input;
96
+ }
97
+
90
98
window_invalidate ();
91
99
}
92
100
@@ -97,20 +105,23 @@ void window_go_back() {
97
105
data.current_window = &data.window_queue [data.queue_index ];
98
106
window_invalidate ();
99
107
}
108
+
100
109
static void update_input_before () {
101
110
if (!touch_to_mouse ()) {
102
111
mouse_determine_button_state (); // touch overrides mouse
103
112
}
104
113
105
114
hotkey_handle_global_keys ();
106
115
}
116
+
107
117
void window_update_input_after () {
108
118
auto & data = g_window;
109
119
reset_touches (0 );
110
120
mouse_reset_scroll ();
111
121
input_cursor_update (data.current_window ->id );
112
122
hotkey_reset_state ();
113
123
}
124
+
114
125
void window_draw (int force) {
115
126
auto & data = g_window;
116
127
// draw the current (top) window in the queue
0 commit comments