From da6c5bf5bef396cb2e7d30628d48ea00020ef886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Thu, 28 Sep 2017 21:50:51 +0200 Subject: [PATCH] re-arranged attr bits and changed string encoding for labels and title to use terminator rather than byte length --- user/screen.c | 19 ++++++++++++------- user/screen.h | 14 +++++++------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/user/screen.c b/user/screen.c index e24aee5..c4c5f70 100644 --- a/user/screen.c +++ b/user/screen.c @@ -1803,8 +1803,7 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics, #define TOPICMARK_DEBUG 'D' #define TOPICMARK_BELL '!' #define TOPICMARK_CURSOR 'C' -#define TOPICMARK_SCREEN_ALL 'S' -#define TOPICMARK_SCREEN_PART 's' +#define TOPICMARK_SCREEN 'S' if (ss == NULL) { // START! @@ -1826,7 +1825,7 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics, bufput_c('U'); // - stands for "update" - bufput_utf8(topics & ~TOPIC_INTERNAL); + bufput_utf8(topics); } int begun_topic = 0; @@ -1880,10 +1879,10 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics, bufput_c(TOPICMARK_TITLE); int len = (int) strlen(termconf_live.title); - bufput_utf8(len); memcpy(bb, termconf_live.title, len); bb += len; remain -= len; + bufput_c('\x01'); END_TOPIC BEGIN_TOPIC(TOPIC_CHANGE_BUTTONS, (TERM_BTN_LEN+4)*TERM_BTN_COUNT+1+4) @@ -1893,10 +1892,10 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics, for (int i = 0; i < TERM_BTN_COUNT; i++) { int len = (int) strlen(termconf_live.btn[i]); - bufput_utf8(len); memcpy(bb, termconf_live.btn[i], len); bb += len; remain -= len; + bufput_c('\x01'); } END_TOPIC @@ -1952,10 +1951,16 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics, } } - // screen contents - TODO implement partial update + // screen contents int i = ss->index; if (i == 0) { - bufput_c(TOPICMARK_SCREEN_ALL); // desired update mode is in `ss->current_topic` + bufput_c(TOPICMARK_SCREEN); // desired update mode is in `ss->current_topic` + + // TODO implement partial + bufput_utf8(0); // Y0 + bufput_utf8(0); // X0 + bufput_utf8(H); // height + bufput_utf8(W); // width ss->index = 0; ss->lastBg = 0xFF; diff --git a/user/screen.h b/user/screen.h index 2e4251b..fc496d1 100644 --- a/user/screen.h +++ b/user/screen.h @@ -156,13 +156,13 @@ typedef enum { enum ScreenSerializeTopic { TOPIC_CHANGE_SCREEN_OPTS = (1<<0), - TOPIC_CHANGE_TITLE = (1<<1), - TOPIC_CHANGE_BUTTONS = (1<<2), - TOPIC_BELL = (1<<3), // beep - TOPIC_CHANGE_CURSOR = (1<<4), - TOPIC_CHANGE_CONTENT_ALL = (1<<5), - TOPIC_CHANGE_CONTENT_PART = (1<<6), - TOPIC_INTERNAL = (1<<7), // debugging internal state + TOPIC_CHANGE_CONTENT_ALL = (1<<1), + TOPIC_CHANGE_CONTENT_PART = (1<<2), + TOPIC_CHANGE_TITLE = (1<<3), + TOPIC_CHANGE_BUTTONS = (1<<4), + TOPIC_CHANGE_CURSOR = (1<<5), + TOPIC_INTERNAL = (1<<6), // debugging internal state + TOPIC_BELL = (1<<7), // beep // combos TOPIC_INITIAL = TOPIC_CHANGE_SCREEN_OPTS |