From 4ed8eb19f573d15b1b0526b2588bf20758b4f374 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 6 Jun 2020 22:58:53 +0200 Subject: tile -> window; opverlapping windows added --- code/fe310/eos/eve/screen/screen.c | 42 +++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'code/fe310/eos/eve/screen/screen.c') diff --git a/code/fe310/eos/eve/screen/screen.c b/code/fe310/eos/eve/screen/screen.c index c65e8fc..52015be 100644 --- a/code/fe310/eos/eve/screen/screen.c +++ b/code/fe310/eos/eve/screen/screen.c @@ -5,7 +5,7 @@ #include "eve_kbd.h" #include "screen.h" -#include "tile.h" +#include "window.h" int eve_screen_init(EVEScreen *screen, uint16_t w, uint16_t h) { memset(screen, 0, sizeof(EVEScreen)); @@ -29,11 +29,43 @@ void eve_screen_hide_kbd(EVEScreen *screen) { screen->kbd_active = 0; } -void eve_screen_add_tile(EVEScreen *screen, EVETile *tile) { - if (screen->tile_size < EVE_MAX_TILES) { - screen->tile[screen->tile_size] = tile; - screen->tile_size++; +int eve_screen_win_insert(EVEScreen *screen, EVEWindow *window, int idx) { + if (idx) { + int i; + EVEWindow *h = screen->win_head; + + for (i=1; inext; + if (h == NULL) return EVE_ERR; + } + window->next = h->next; + h->next = window; + } else { + window->next = screen->win_head; + screen->win_head = window; } + if (window->next == NULL) screen->win_tail = window; + return EVE_OK; +} + +int eve_screen_win_remove(EVEScreen *screen, EVEWindow *window) { + EVEWindow *h = screen->win_head; + if (h == NULL) return EVE_ERR; + if (h == window) { + screen->win_head = window->next; + if (screen->win_head == NULL) screen->win_tail = NULL; + } else { + while (h->next && (h->next != window)) h = h->next; + if (h->next == NULL) return EVE_ERR; + + h->next = window->next; + if (h->next == NULL) screen->win_tail = h; + } +} + +void eve_screen_win_append(EVEScreen *screen, EVEWindow *window) { + screen->win_tail->next = window; + screen->win_tail = window; } void eve_screen_handle_touch(EVEScreen *screen, uint8_t tag0, int touch_idx) { -- cgit v1.2.3