added OSC for color buttons
This commit is contained in:
+1
-1
Submodule front-end updated: 445d78d4e1...30af1ad2f6
@@ -44,6 +44,10 @@ handle_espterm_osc(int n0, int n1, char *buffer)
|
|||||||
// Button message
|
// Button message
|
||||||
screen_set_button_message(n1, buffer);
|
screen_set_button_message(n1, buffer);
|
||||||
}
|
}
|
||||||
|
else if (n0 == 30) {
|
||||||
|
// Button color
|
||||||
|
screen_set_button_color(n1, buffer);
|
||||||
|
}
|
||||||
else goto bad;
|
else goto bad;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
+31
-10
@@ -1218,12 +1218,13 @@ void ICACHE_FLASH_ATTR
|
|||||||
screen_set_button_text(int num, const char *text)
|
screen_set_button_text(int num, const char *text)
|
||||||
{
|
{
|
||||||
NOTIFY_LOCK();
|
NOTIFY_LOCK();
|
||||||
if (num == 1) strncpy(termconf_live.btn1, text, TERM_BTN_LEN);
|
|
||||||
else if (num == 2) strncpy(termconf_live.btn2, text, TERM_BTN_LEN);
|
if (num >= 1 && num <= TERM_BTN_COUNT) {
|
||||||
else if (num == 3) strncpy(termconf_live.btn3, text, TERM_BTN_LEN);
|
char *buf = TERM_BTN_N(&termconf_live, num - 1);
|
||||||
else if (num == 4) strncpy(termconf_live.btn4, text, TERM_BTN_LEN);
|
strncpy(buf, text, TERM_BTN_MSG_LEN);
|
||||||
else if (num == 5) strncpy(termconf_live.btn5, text, TERM_BTN_LEN);
|
}
|
||||||
else ansi_warn("Bad button num: %d", num);
|
else ansi_warn("Bad button num: %d", num);
|
||||||
|
|
||||||
NOTIFY_DONE(TOPIC_CHANGE_BUTTONS);
|
NOTIFY_DONE(TOPIC_CHANGE_BUTTONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1236,12 +1237,32 @@ void ICACHE_FLASH_ATTR
|
|||||||
screen_set_button_message(int num, const char *msg)
|
screen_set_button_message(int num, const char *msg)
|
||||||
{
|
{
|
||||||
NOTIFY_LOCK();
|
NOTIFY_LOCK();
|
||||||
if (num == 1) strncpy(termconf_live.bm1, msg, TERM_BTN_MSG_LEN);
|
|
||||||
else if (num == 2) strncpy(termconf_live.bm2, msg, TERM_BTN_MSG_LEN);
|
if (num >= 1 && num <= TERM_BTN_COUNT) {
|
||||||
else if (num == 3) strncpy(termconf_live.bm3, msg, TERM_BTN_MSG_LEN);
|
char *buf = TERM_BM_N(&termconf_live, num - 1);
|
||||||
else if (num == 4) strncpy(termconf_live.bm4, msg, TERM_BTN_MSG_LEN);
|
strncpy(buf, msg, TERM_BTN_MSG_LEN);
|
||||||
else if (num == 5) strncpy(termconf_live.bm5, msg, TERM_BTN_MSG_LEN);
|
}
|
||||||
else ansi_warn("Bad button num: %d", num);
|
else ansi_warn("Bad button num: %d", num);
|
||||||
|
|
||||||
|
NOTIFY_DONE(TOPIC_CHANGE_BUTTONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to set terminal button label
|
||||||
|
* @param num - button number 1-5
|
||||||
|
* @param str - button text
|
||||||
|
*/
|
||||||
|
void ICACHE_FLASH_ATTR
|
||||||
|
screen_set_button_color(int num, const char *buf)
|
||||||
|
{
|
||||||
|
NOTIFY_LOCK();
|
||||||
|
|
||||||
|
if (num >= 1 && num <= TERM_BTN_COUNT) {
|
||||||
|
u32 *fieldptr = &termconf_live.bc1 + (num-1);
|
||||||
|
xset_term_color("", fieldptr, buf, NULL);
|
||||||
|
}
|
||||||
|
else ansi_warn("Bad button num: %d", num);
|
||||||
|
|
||||||
NOTIFY_DONE(TOPIC_CHANGE_BUTTONS);
|
NOTIFY_DONE(TOPIC_CHANGE_BUTTONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ void screen_set_title(const char *title);
|
|||||||
/** Set a button text */
|
/** Set a button text */
|
||||||
void screen_set_button_text(int num, const char *text);
|
void screen_set_button_text(int num, const char *text);
|
||||||
void screen_set_button_message(int num, const char *msg);
|
void screen_set_button_message(int num, const char *msg);
|
||||||
|
void screen_set_button_color(int num, const char *buf);
|
||||||
void screen_set_button_count(int count);
|
void screen_set_button_count(int count);
|
||||||
/** Change backdrop */
|
/** Change backdrop */
|
||||||
void screen_set_backdrop(const char *url);
|
void screen_set_backdrop(const char *url);
|
||||||
|
|||||||
Reference in New Issue
Block a user