mirror of
git://git.proxmox.com/git/spiceterm.git
synced 2024-12-23 17:34:20 +03:00
use new unicode spice input extension
This commit is contained in:
parent
4cc3dc5a6a
commit
77133eeeca
24
spiceterm.c
24
spiceterm.c
@ -1468,6 +1468,7 @@ static void my_kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
|
||||
{
|
||||
vncTerm *vt = SPICE_CONTAINEROF(sin, vncTerm, keyboard_sin);
|
||||
|
||||
return;
|
||||
printf("MYKEYCODE %x\n", frag);
|
||||
|
||||
if (vt->ibuf_count < (IBUFSIZE - 32)) {
|
||||
@ -1479,6 +1480,26 @@ static void my_kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
|
||||
}
|
||||
}
|
||||
|
||||
static void my_kbd_push_unicode(SpiceKbdInstance *sin, uint32_t uc)
|
||||
{
|
||||
vncTerm *vt = SPICE_CONTAINEROF(sin, vncTerm, keyboard_sin);
|
||||
|
||||
printf("MYKEYVAL %x\n", uc);
|
||||
|
||||
if (vt->ibuf_count < (IBUFSIZE - 32)) {
|
||||
gchar buf[10];
|
||||
gint len = g_unichar_to_utf8(uc, buf);
|
||||
|
||||
if (len > 0) {
|
||||
int i;
|
||||
for (i = 0; i < len; i++) {
|
||||
vt->ibuf[vt->ibuf_count++] = buf[i];
|
||||
}
|
||||
}
|
||||
vt->screen->core->watch_update_mask(vt->screen->mwatch, SPICE_WATCH_EVENT_READ|SPICE_WATCH_EVENT_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t my_kbd_get_leds(SpiceKbdInstance *sin)
|
||||
{
|
||||
return 0;
|
||||
@ -1489,6 +1510,7 @@ static SpiceKbdInterface my_keyboard_sif = {
|
||||
.base.description = "spiceterm keyboard device",
|
||||
.base.major_version = SPICE_INTERFACE_KEYBOARD_MAJOR,
|
||||
.base.minor_version = SPICE_INTERFACE_KEYBOARD_MINOR,
|
||||
.push_unicode = my_kbd_push_unicode,
|
||||
.push_scan_freg = my_kbd_push_key,
|
||||
.get_leds = my_kbd_get_leds,
|
||||
};
|
||||
@ -1599,7 +1621,7 @@ static void master_watch(int master, int event, void *opaque)
|
||||
vncterm_puts (vt, buffer, c);
|
||||
} else {
|
||||
if (vt->ibuf_count > 0) {
|
||||
printf ("DEBUG: WRITE %d %d\n", vt->ibuf[0], vt->ibuf_count);
|
||||
printf ("DEBUG: WRITE %x %d\n", vt->ibuf[0], vt->ibuf_count);
|
||||
write (master, vt->ibuf, vt->ibuf_count);
|
||||
vt->ibuf_count = 0; // fixme: what if not all data written
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ static SimpleSpiceUpdate *test_draw_char(Test *test, int x, int y, int c)
|
||||
left = x*8;
|
||||
top = y*16;
|
||||
|
||||
printf("DRAWCHAR %d %d %d\n", left, top, c);
|
||||
// printf("DRAWCHAR %d %d %d\n", left, top, c);
|
||||
|
||||
unique++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user