termpty: add termpty_color_class_get()

This commit is contained in:
Boris Faure 2019-05-26 22:55:22 +02:00
parent f6d6ce481e
commit 7e677abfb9
3 changed files with 54 additions and 1 deletions

View File

@ -7,8 +7,11 @@
#include "termptyesc.h"
#include "termptyops.h"
#include "termptysave.h"
#include "termio.h"
#include "keyin.h"
#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS)
# include "win.h"
#endif
#include "termio.h"
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
@ -1839,3 +1842,34 @@ term_link_free(Termpty *ty, Term_Link *link)
/* Remove from bitmap */
hl_bitmap_clear_bit(ty, id);
}
#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS)
int
termpty_color_class_get(Termpty *ty, const char *key,
int *r, int *g, int *b, int *a)
{
Term *term;
term = termio_term_get(ty->obj);
if (term)
{
Evas_Object *bg = term_bg_get(term);
if (!edje_object_color_class_get(bg, key,
r,
g,
b,
a,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL))
{
ERR("color class BG not found in theme");
return -1;
}
}
else
{
ERR("term not found");
return -1;
}
return 0;
}
#endif

View File

@ -314,6 +314,10 @@ void termpty_handle_block_codepoint_overwrite_heavy(Termpty *ty, int oldc, int n
Term_Link * term_link_new(Termpty *ty);
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);
extern int _termpty_log_dom;
#define TERMPTY_SCREEN(Tpty, X, Y) \

View File

@ -226,6 +226,21 @@ termio_set_cursor_shape(Evas_Object *obj EINA_UNUSED,
{
}
#endif
int
termpty_color_class_get(Termpty *ty EINA_UNUSED, const char *key,
int *r, int *g, int *b, int *a)
{
if (strncmp(key, "BG", strlen("BG")) == 0)
{
*r = 131;
*g = 132;
*b = 133;
*a = 134;
return 0;
}
return -1;
}
/* }}} */