mirror of
git://git.proxmox.com/git/spiceterm.git
synced 2025-08-29 13:27:36 +00:00
cleanup cursor code
This commit is contained in:
parent
baa9598b32
commit
622c777f6e
41
screen.c
41
screen.c
@ -55,9 +55,6 @@ static int debug = 0;
|
|||||||
|
|
||||||
#define MEM_SLOT_GROUP_ID 0
|
#define MEM_SLOT_GROUP_ID 0
|
||||||
|
|
||||||
#define NOTIFY_DISPLAY_BATCH (SINGLE_PART/2)
|
|
||||||
#define NOTIFY_CURSOR_BATCH 10
|
|
||||||
|
|
||||||
/* these colours are from linux kernel drivers/char/vt.c */
|
/* these colours are from linux kernel drivers/char/vt.c */
|
||||||
/* the default colour table, for VGA+ colour systems */
|
/* the default colour table, for VGA+ colour systems */
|
||||||
int default_red[] = {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,
|
int default_red[] = {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,
|
||||||
@ -535,41 +532,33 @@ cursor_init()
|
|||||||
static int
|
static int
|
||||||
get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext)
|
get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext)
|
||||||
{
|
{
|
||||||
SpiceScreen *spice_screen = SPICE_CONTAINEROF(qin, SpiceScreen, qxl_instance);
|
//SpiceScreen *spice_screen = SPICE_CONTAINEROF(qin, SpiceScreen, qxl_instance);
|
||||||
static int set = 1;
|
static int set = 1;
|
||||||
static int x = 0, y = 0;
|
|
||||||
QXLCursorCmd *cursor_cmd;
|
QXLCursorCmd *cursor_cmd;
|
||||||
QXLCommandExt *cmd;
|
QXLCommandExt *cmd;
|
||||||
|
|
||||||
if (!spice_screen->cursor_notify) {
|
if (!set) return FALSE;
|
||||||
return FALSE;
|
set = 0;
|
||||||
}
|
|
||||||
|
|
||||||
spice_screen->cursor_notify--;
|
|
||||||
cmd = calloc(sizeof(QXLCommandExt), 1);
|
cmd = calloc(sizeof(QXLCommandExt), 1);
|
||||||
cursor_cmd = calloc(sizeof(QXLCursorCmd), 1);
|
cursor_cmd = calloc(sizeof(QXLCursorCmd), 1);
|
||||||
|
|
||||||
cursor_cmd->release_info.id = (unsigned long)cmd;
|
cursor_cmd->release_info.id = (unsigned long)cmd;
|
||||||
|
|
||||||
if (set) {
|
cursor_cmd->type = QXL_CURSOR_SET;
|
||||||
cursor_cmd->type = QXL_CURSOR_SET;
|
cursor_cmd->u.set.position.x = 0;
|
||||||
cursor_cmd->u.set.position.x = 0;
|
cursor_cmd->u.set.position.y = 0;
|
||||||
cursor_cmd->u.set.position.y = 0;
|
cursor_cmd->u.set.visible = TRUE;
|
||||||
cursor_cmd->u.set.visible = TRUE;
|
cursor_cmd->u.set.shape = (unsigned long)&cursor;
|
||||||
cursor_cmd->u.set.shape = (unsigned long)&cursor;
|
// white rect as cursor
|
||||||
// white rect as cursor
|
memset(cursor.data, 255, sizeof(cursor.data));
|
||||||
memset(cursor.data, 255, sizeof(cursor.data));
|
|
||||||
set = 0;
|
|
||||||
} else {
|
|
||||||
cursor_cmd->type = QXL_CURSOR_MOVE;
|
|
||||||
cursor_cmd->u.position.x = x++ % spice_screen->primary_width;
|
|
||||||
cursor_cmd->u.position.y = y++ % spice_screen->primary_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd->cmd.data = (unsigned long)cursor_cmd;
|
cmd->cmd.data = (unsigned long)cursor_cmd;
|
||||||
cmd->cmd.type = QXL_CMD_CURSOR;
|
cmd->cmd.type = QXL_CMD_CURSOR;
|
||||||
cmd->group_id = MEM_SLOT_GROUP_ID;
|
cmd->group_id = MEM_SLOT_GROUP_ID;
|
||||||
cmd->flags = 0;
|
cmd->flags = 0;
|
||||||
*ext = *cmd;
|
*ext = *cmd;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -733,8 +722,6 @@ spice_screen_new(SpiceCoreInterface *core, uint32_t width, uint32_t height, guin
|
|||||||
spice_screen->core = core;
|
spice_screen->core = core;
|
||||||
spice_screen->server = server;
|
spice_screen->server = server;
|
||||||
|
|
||||||
spice_screen->cursor_notify = NOTIFY_CURSOR_BATCH;
|
|
||||||
|
|
||||||
printf("listening on port %d (unsecure)\n", port);
|
printf("listening on port %d (unsecure)\n", port);
|
||||||
|
|
||||||
spice_server_set_port(server, port);
|
spice_server_set_port(server, port);
|
||||||
|
@ -45,8 +45,6 @@ struct SpiceScreen {
|
|||||||
SpiceTimer *conn_timeout_timer;
|
SpiceTimer *conn_timeout_timer;
|
||||||
SpiceWatch *mwatch; /* watch master pty */
|
SpiceWatch *mwatch; /* watch master pty */
|
||||||
|
|
||||||
int cursor_notify;
|
|
||||||
|
|
||||||
// Current mode (set by create_primary)
|
// Current mode (set by create_primary)
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user