#include <spice/enums.h>
#include <spice/macros.h>
#include <spice/qxl_dev.h>
+#include <spice/vd_agent.h>
#include "glyphs.h"
g_free(update);
}
-#define DEFAULT_WIDTH 640
-#define DEFAULT_HEIGHT 320
-
static int unique = 0x0ffff + 1;
static void
qxl_worker->create_primary_surface(qxl_worker, 0, &surface);
}
+void
+spice_screen_resize(SpiceScreen *spice_screen, uint32_t width,
+ uint32_t height)
+{
+ QXLWorker *qxl_worker = spice_screen->qxl_worker;
+
+ if (spice_screen->width == width && spice_screen->height == height) {
+ return;
+ }
+
+ qxl_worker->destroy_primary_surface(qxl_worker, 0);
+
+ create_primary_surface(spice_screen, width, height);
+}
+
+
QXLDevMemSlot slot = {
.slot_group_id = MEM_SLOT_GROUP_ID,
.slot_id = 0,
spice_screen->qxl_worker = _qxl_worker;
spice_screen->qxl_worker->add_memslot(spice_screen->qxl_worker, &slot);
- create_primary_surface(spice_screen, DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ create_primary_surface(spice_screen, spice_screen->width, spice_screen->height);
spice_screen->qxl_worker->start(spice_screen->qxl_worker);
}
.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)
+spice_screen_draw_char(SpiceScreen *spice_screen, int x, int y, gunichar2 ch,
+ TextAttributes attrib)
{
int fg, bg;
+ int invers;
if (attrib.invers) {
+ invers = attrib.selected ? 0 : 1;
+ } else {
+ invers = attrib.selected ? 1 : 0;
+ }
+
+ if (invers) {
bg = attrib.fgcol;
fg = attrib.bgcol;
} else {
}
SpiceScreen *
-spice_screen_new(SpiceCoreInterface *core, guint timeout)
+spice_screen_new(SpiceCoreInterface *core, uint32_t width, uint32_t height, guint timeout)
{
int port = 5912;
SpiceScreen *spice_screen = g_new0(SpiceScreen, 1);
SpiceServer* server = spice_server_new();
+ spice_screen->width = width;
+ spice_screen->height = height;
+
spice_screen->command_cond = g_cond_new();
spice_screen->command_mutex = g_mutex_new();
spice_server_add_interface(spice_screen->server, &spice_screen->qxl_instance.base);
- spice_server_add_interface(server, &vdagent_sin.base);
-
return spice_screen;
}