termptyesc: add focus reporting

devs/simotek/colorschemes
Boris Faure 11 months ago
parent 93b6d77944
commit fe47376460
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
  1. 2
      src/bin/termio.c
  2. 11
      src/bin/termpty.c
  3. 3
      src/bin/termpty.h
  4. 14
      src/bin/termptyesc.c

@ -2548,6 +2548,7 @@ termio_focus_in(Evas_Object *termio)
else
edje_object_signal_emit(sd->cursor.obj, "focus,in", "terminology");
if (!sd->win) return;
termpty_focus_report(sd->pty, EINA_TRUE);
}
void
@ -2562,6 +2563,7 @@ termio_focus_out(Evas_Object *termio)
sd->pty->selection.last_click = 0;
if (!sd->ctxpopup)
termio_remove_links(sd);
termpty_focus_report(sd->pty, EINA_FALSE);
term_unfocus(sd->term);
}

@ -1733,6 +1733,17 @@ hl_bitmap_clear_bit(Termpty *ty, uint16_t id)
*pos &= ~bit;
}
void
termpty_focus_report(Termpty *ty, Eina_Bool focus)
{
if (!ty || !ty->focus_reporting)
return;
if (focus)
TERMPTY_WRITE_STR("\033[I");
else
TERMPTY_WRITE_STR("\033[O");
}
Term_Link *
term_link_new(Termpty *ty)
{

@ -203,6 +203,7 @@ struct _Termpty
unsigned int mouse_ext : 2;
unsigned int bracketed_paste : 1;
unsigned int decoding_error : 1;
unsigned int focus_reporting : 1;
struct {
Term_Link *links;
uint8_t *bitmap;
@ -315,6 +316,8 @@ void term_link_free(Termpty *ty, Term_Link *link);
int
termpty_color_class_get(Termpty *ty, const char *key,
int *r, int *g, int *b, int *a);
void
termpty_focus_report(Termpty *ty, Eina_Bool focus);
extern int _termpty_log_dom;

@ -467,9 +467,17 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b,
else ty->mouse_mode = MOUSE_OFF;
DBG("set mouse (press+release+all motion) %i", mode);
break;
case 1004: // I don't know what focus reporting is?
WRN("TODO: enable focus reporting %i", mode);
ty->decoding_error = EINA_TRUE;
case 1004:
DBG("%s focus reporting", mode ? "enable" : "disable");
if (mode)
{
ty->focus_reporting = EINA_TRUE;
termpty_focus_report(ty, termio_is_focused(ty->obj));
}
else
{
ty->focus_reporting = EINA_FALSE;
}
break;
case 1005:
if (mode) ty->mouse_ext = MOUSE_EXT_UTF8;

Loading…
Cancel
Save