summaryrefslogtreecommitdiff
path: root/src/kernel/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/window.c')
-rw-r--r--src/kernel/window.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/kernel/window.c b/src/kernel/window.c
index 28798d1..078a194 100644
--- a/src/kernel/window.c
+++ b/src/kernel/window.c
@@ -99,7 +99,8 @@ got_window:
return w;
}
-void del_window(struct window *w) {
+static void del_no_paint(struct window *w) {
+//logf(LOG_INFO, "-- deleting window 0x%h", w);
if (w == top_window)
top_window = w->below;
if (w == bottom_window)
@@ -109,17 +110,37 @@ void del_window(struct window *w) {
if (w->above)
w->above->below = w->below;
+//logf(LOG_INFO, " -- action buffer was 0x%h", w->action_buffer);
free_pages(w->action_buffer, ACTION_BUFFER_PAGES);
w->pixel_buffer_pma = 0;
+}
+void del_window(struct window *w) {
+ del_no_paint(w);
paint_all();
}
-void resize_window(struct window *w, uint16_t width, uint16_t height) {
+void delete_any_windows_from(struct task_state *tstate) {
+//logf(LOG_INFO, "-- deleting windows from 0x%h", tstate);
+ bool need_to_paint = false;
+ for (struct window *w = windows; w < windows + MAX_WINDOWS; ++w)
+ if (w->pixel_buffer_pma && (w->from_task == tstate)) {
+ //logf(LOG_INFO, " -- found match at 0x%h", w);
+ del_no_paint(w);
+ need_to_paint = true;
+ }
+ if (need_to_paint) {
+ //logf(LOG_INFO, "-- trying to paint after deleting windows");
+ paint_all();
+ }
+}
+
+void resize_window(struct window *w, uint16_t width, uint16_t height, const void *pixel_buffer) {
const bool smaller = (width < w->width) || (height < w->height);
w->width = width;
w->height = height;
+ reassign_pixel_buffer(w, pixel_buffer);
if (smaller)
paint_all();