]> git.proxmox.com Git - spiceterm.git/commitdiff
use new unicode spice input extension
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 21 Aug 2013 05:36:44 +0000 (07:36 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 21 Aug 2013 05:36:44 +0000 (07:36 +0200)
spiceterm.c
test_display_base.c

index 7985ebb70bf74c2cad9b63c0a03f9942899c1577..80d97a337134f9ac3c7d6d1a1e66ba06ee2c73df 100644 (file)
@@ -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          
         }
index 74645e1ffc912ab47a58370592130e62ffaf32ff..17424602807355534648845c435dfbfe209b35fe 100644 (file)
@@ -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++;