spiceterm_show_cursor(vt, 1);
}
+static void
+spiceterm_clear_screen(spiceTerm *vt)
+{
+ int x, y;
+
+ for (y = 0; y <= vt->height; y++) {
+ int y1 = (vt->y_base + y) % vt->total_height;
+ TextCell *c = &vt->cells[y1 * vt->width];
+ for (x = 0; x < vt->width; x++) {
+ c->ch = ' ';
+ c->attrib = vt->default_attrib;
+ c->attrib.fgcol = vt->cur_attrib.fgcol;
+ c->attrib.bgcol = vt->cur_attrib.bgcol;
+
+ c++;
+ }
+ }
+
+ spice_screen_clear(vt->screen, 0, 0, vt->screen->primary_width,
+ vt->screen->primary_height);
+}
+
void
spiceterm_unselect_all(spiceTerm *vt)
{
- int i;
+ int x, y, y1;
- for (i = 0; i < vt->width*vt->total_height; i++) {
- if (vt->cells[i].attrib.selected) {
- vt->cells[i].attrib.selected = 0;
+ y1 = vt->y_displ;
+ for(y = 0; y < vt->total_height; y++) {
+ TextCell *c = vt->cells + y1 * vt->width;
+ for(x = 0; x < vt->width; x++) {
+ if (c->attrib.selected) {
+ c->attrib.selected = 0;
+ if (y < vt->height) {
+ draw_char_at(vt, x, y, c->ch, c->attrib);
+ }
+ }
+ c++;
}
+ if (++y1 == vt->total_height)
+ y1 = 0;
}
-
- spiceterm_refresh(vt);
}
static void
break;
case 2:
/* clear entire screen */
- for (y = 0; y <= vt->height; y++) {
- for (x = 0; x < vt->width; x++) {
- spiceterm_clear_xy(vt, x, y);
- }
- }
+ spiceterm_clear_screen(vt);
break;
}
break;
}
static void
-my_kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
-{
- // spiceTerm *vt = SPICE_CONTAINEROF(sin, spiceTerm, keyboard_sin);
-
- /* we no not need this */
-
- return;
-}
-
-static void
-spiceterm_push_keyval(spiceTerm *vt, uint32_t keySym, uint32_t flags)
+spiceterm_push_keysym(spiceTerm *vt, uint32_t keySym, uint32_t flags)
{
static int control = 0;
static int shift = 0;
DPRINTF(1, "flags=%d keySym=%08x", flags, keySym);
- if (flags & VD_AGENT_KEYVAL_FLAG_DOWN) {
+ if (flags & SPICE_KEYBOARD_FLAG_DOWN) {
if (keySym == GDK_KEY_Shift_L || keySym == GDK_KEY_Shift_R) {
shift = 1;
} if (keySym == GDK_KEY_Control_L || keySym == GDK_KEY_Control_R) {
ret:
- if (!(flags & VD_AGENT_KEYVAL_FLAG_DOWN)) { // UP
+ if (flags & SPICE_KEYBOARD_FLAG_UP) {
if (keySym == GDK_KEY_Shift_L || keySym == GDK_KEY_Shift_R) {
shift = 0;
} else if (keySym == GDK_KEY_Control_L || keySym == GDK_KEY_Control_R) {
return 0;
}
+static void
+my_kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
+{
+ // spiceTerm *vt = SPICE_CONTAINEROF(sin, spiceTerm, keyboard_sin);
+
+ /* we no not need this */
+
+ return;
+}
+
+static void
+my_kbd_push_x11_keysym(SpiceKbdInstance *sin, uint32_t keysym, uint32_t flags,
+ uint8_t code_len, uint8_t *code)
+{
+ spiceTerm *vt = SPICE_CONTAINEROF(sin, spiceTerm, keyboard_sin);
+
+ DPRINTF(1, "flags=%d keySym=%08x code_len=%d", flags, keysym, code_len);
+
+ if (keysym) {
+ spiceterm_push_keysym(vt, keysym, flags);
+ }
+
+ return;
+}
+
static SpiceKbdInterface my_keyboard_sif = {
.base.type = SPICE_INTERFACE_KEYBOARD,
.base.description = "spiceterm keyboard device",
.base.minor_version = SPICE_INTERFACE_KEYBOARD_MINOR,
.push_scan_freg = my_kbd_push_key,
.get_leds = my_kbd_get_leds,
+ .push_x11_keysym = my_kbd_push_x11_keysym,
};
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_SELECTION);
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG);
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_GUEST_LINEEND_LF);
- VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_KEYVAL);
int msg_size = sizeof(VDIChunkHeader) + sizeof(VDAgentMessage) + size;
g_assert((vdagent_write_buffer_pos + msg_size) < VDAGENT_WBUF_SIZE);
DPRINTF(1, "%d %d %d %d", len, hdr->port, msg->protocol, msg->type);
switch (msg->type) {
- case VD_AGENT_KEYVAL: {
- VDAgentKeyval *info = (VDAgentKeyval *)&msg[1];
- spiceterm_push_keyval(vt, info->keyval, info->flags);
- break;
- }
case VD_AGENT_MOUSE_STATE: {
VDAgentMouseState *info = (VDAgentMouseState *)&msg[1];
spiceterm_motion_event(vt, info->x, info->y, info->buttons);