]> git.proxmox.com Git - spiceterm.git/blobdiff - screen.c
start mouse support
[spiceterm.git] / screen.c
index d62ae34e5f89e1ed3ef6c9ffe6240998359dbad9..0646a3ffef62d21756abceb45dc01143c0025757 100644 (file)
--- a/screen.c
+++ b/screen.c
@@ -39,6 +39,7 @@
 #include <spice/enums.h>
 #include <spice/macros.h>
 #include <spice/qxl_dev.h>
+#include <spice/vd_agent.h>
 
 #include "glyphs.h"
 
@@ -186,7 +187,7 @@ spice_screen_update_from_bitmap_cmd(uint32_t surface_id, QXLRect bbox, uint8_t *
 
 static SimpleSpiceUpdate *
 spice_screen_draw_char_cmd(SpiceScreen *spice_screen, int x, int y, int c, 
-                           int fg, int bg)
+                           int fg, int bg, gboolean uline)
 {
     int top, left;
     uint8_t *dst;
@@ -196,7 +197,7 @@ spice_screen_draw_char_cmd(SpiceScreen *spice_screen, int x, int y, int c,
     QXLRect bbox;
     int cache_id = 0;
 
-    if (c < 256) {
+    if (!uline && c < 256) {
         cache_id = ((fg << 12) | (bg << 8) | (c & 255)) & 0x0ffff;
     }
 
@@ -222,12 +223,13 @@ spice_screen_draw_char_cmd(SpiceScreen *spice_screen, int x, int y, int c,
     unsigned char bgc_green = default_grn[bg];
 
     for (j = 0; j < 16; j++) {
+        gboolean ul = (j == 14) && uline;
         for (i = 0; i < 8; i++) {
-            if ((i&7) == 0) {
+            if (i == 0) {
                 d=*data;
                 data++;
             }
-            if (d&0x80) {
+            if (ul || d&0x80) {
                  *(dst) = fgc_blue;
                  *(dst+1) = fgc_green;
                  *(dst+2) = fgc_red;
@@ -630,41 +632,6 @@ QXLInterface display_sif = {
     .set_client_capabilities = set_client_capabilities,
 };
 
-/* vdagent interface - not sure why we need that? */
-static int 
-vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
-{
-    return len;
-}
-
-static int 
-vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
-{
-    return 0;
-}
-
-static void 
-vmc_state(SpiceCharDeviceInstance *sin, int connected)
-{
-
-}
-
-static SpiceCharDeviceInterface vdagent_sif = {
-    .base.type          = SPICE_INTERFACE_CHAR_DEVICE,
-    .base.description   = "spice virtual channel char device",
-    .base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
-    .base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
-    .state              = vmc_state,
-    .write              = vmc_write,
-    .read               = vmc_read,
-};
-
-SpiceCharDeviceInstance vdagent_sin = {
-    .base = {
-        .sif = &vdagent_sif.base,
-    },
-    .subtype = "vdagent",
-};
 
 void 
 spice_screen_draw_char(SpiceScreen *spice_screen, int x, int y, gunichar2 ch, TextAttributes attrib)
@@ -685,20 +652,15 @@ spice_screen_draw_char(SpiceScreen *spice_screen, int x, int y, gunichar2 ch, Te
 
     // unsuported attributes = (attrib.blink || attrib.unvisible)
 
-    // fixme:
-    //if (attrib.uline) {
-    //rfbDrawLine (vt->screen, rx, ry + 14, rxe, ry + 14, fg);
-    //}
-
     int c = vt_fontmap[ch];
 
     SimpleSpiceUpdate *update;
-    update = spice_screen_draw_char_cmd(spice_screen, x, y, c, fg, bg);
+    update = spice_screen_draw_char_cmd(spice_screen, x, y, c, fg, bg, attrib.uline);
     push_command(spice_screen, &update->ext);
 }
 
 SpiceScreen *
-spice_screen_new(SpiceCoreInterface *core)
+spice_screen_new(SpiceCoreInterface *core, guint timeout)
 {
     int port = 5912;
     SpiceScreen *spice_screen = g_new0(SpiceScreen, 1);
@@ -730,13 +692,10 @@ spice_screen_new(SpiceCoreInterface *core)
 
     cursor_init();
 
-    int timeout = 10; // max time to wait for client connection
     spice_screen->conn_timeout_timer = core->timer_add(do_conn_timeout, spice_screen);
     spice_screen->core->timer_start(spice_screen->conn_timeout_timer, timeout*1000);
 
     spice_server_add_interface(spice_screen->server, &spice_screen->qxl_instance.base);
 
-    spice_server_add_interface(server, &vdagent_sin.base);
-
     return spice_screen;
 }