Start work on supporting changing of entries in the color table

This commit is contained in:
Kovid Goyal
2016-11-24 15:28:52 +05:30
parent c983f002c1
commit 3031d41e72
11 changed files with 53 additions and 99 deletions
+14 -5
View File
@@ -199,14 +199,14 @@ void select_graphic_rendition(Screen *self, unsigned int *params, unsigned int c
switch(attr) { \
case 5: \
if (i < count) \
self->cursor->which = (params[i++] & 0xFF) << 8 | 2; \
self->cursor->which = (params[i++] & 0xFF) << 8 | 1; \
break; \
case 2: \
if (i < count - 2) { \
r = params[i++] & 0xFF; \
g = params[i++] & 0xFF; \
b = params[i++] & 0xFF; \
self->cursor->which = r << 24 | g << 16 | b << 8 | 3; \
self->cursor->which = r << 24 | g << 16 | b << 8 | 2; \
}\
break; \
} \
@@ -243,14 +243,18 @@ void select_graphic_rendition(Screen *self, unsigned int *params, unsigned int c
self->cursor->strikethrough = false; break;
START_ALLOW_CASE_RANGE
case 30 ... 37:
self->cursor->fg = ((attr - 30) << 8) | 1; break;
case 39:
case 90 ... 97:
self->cursor->fg = (attr << 8) | 1; break;
self->cursor->fg = 0; break;
case 40 ... 47:
self->cursor->bg = ((attr - 40) << 8) | 1; break;
case 49:
self->cursor->bg = 0; break;
case 90 ... 97:
self->cursor->fg = ((attr - 90 + 8) << 8) | 1; break;
case 100 ... 107:
self->cursor->bg = ((attr - 100 + 8) << 8) | 1; break;
END_ALLOW_CASE_RANGE
self->cursor->bg = (attr << 8) | 1; break;
case 38:
SET_COLOR(fg);
case 48:
@@ -810,6 +814,11 @@ void set_dynamic_color(Screen *self, unsigned int code, PyObject *color) {
if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); }
}
void set_color_table_color(Screen *self, unsigned int code, PyObject *color) {
PyObject_CallMethod(self->callbacks, "set_color_table_color", "IO", code, color);
if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); }
}
void screen_request_capabilities(Screen *self, PyObject *q) {
PyObject_CallMethod(self->callbacks, "request_capabilities", "O", q);
if (PyErr_Occurred()) { PyErr_Print(); PyErr_Clear(); }