spice: set pointer position on hotspot
The Spice protocol uses cursor position on hotspot: the client is applying hotspot offset when drawing the cursor. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
		
							parent
							
								
									d0df04a156
								
							
						
					
					
						commit
						dc8dceee64
					
				@ -97,7 +97,8 @@ struct SimpleSpiceDisplay {
 | 
				
			|||||||
    /* cursor (without qxl): displaychangelistener -> spice server */
 | 
					    /* cursor (without qxl): displaychangelistener -> spice server */
 | 
				
			||||||
    SimpleSpiceCursor *ptr_define;
 | 
					    SimpleSpiceCursor *ptr_define;
 | 
				
			||||||
    SimpleSpiceCursor *ptr_move;
 | 
					    SimpleSpiceCursor *ptr_move;
 | 
				
			||||||
    uint16_t ptr_x, ptr_y;
 | 
					    int16_t ptr_x, ptr_y;
 | 
				
			||||||
 | 
					    int16_t hot_x, hot_y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* cursor (with qxl): qxl local renderer -> displaychangelistener */
 | 
					    /* cursor (with qxl): qxl local renderer -> displaychangelistener */
 | 
				
			||||||
    QEMUCursor *cursor;
 | 
					    QEMUCursor *cursor;
 | 
				
			||||||
 | 
				
			|||||||
@ -275,8 +275,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (c) {
 | 
					    if (c) {
 | 
				
			||||||
        ccmd->type = QXL_CURSOR_SET;
 | 
					        ccmd->type = QXL_CURSOR_SET;
 | 
				
			||||||
        ccmd->u.set.position.x = ssd->ptr_x;
 | 
					        ccmd->u.set.position.x = ssd->ptr_x + ssd->hot_x;
 | 
				
			||||||
        ccmd->u.set.position.y = ssd->ptr_y;
 | 
					        ccmd->u.set.position.y = ssd->ptr_y + ssd->hot_y;
 | 
				
			||||||
        ccmd->u.set.visible    = true;
 | 
					        ccmd->u.set.visible    = true;
 | 
				
			||||||
        ccmd->u.set.shape      = (uintptr_t)cursor;
 | 
					        ccmd->u.set.shape      = (uintptr_t)cursor;
 | 
				
			||||||
        cursor->header.unique     = ssd->unique++;
 | 
					        cursor->header.unique     = ssd->unique++;
 | 
				
			||||||
@ -290,8 +290,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
 | 
				
			|||||||
        memcpy(cursor->chunk.data, c->data, size);
 | 
					        memcpy(cursor->chunk.data, c->data, size);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        ccmd->type = QXL_CURSOR_MOVE;
 | 
					        ccmd->type = QXL_CURSOR_MOVE;
 | 
				
			||||||
        ccmd->u.position.x = ssd->ptr_x;
 | 
					        ccmd->u.position.x = ssd->ptr_x + ssd->hot_x;
 | 
				
			||||||
        ccmd->u.position.y = ssd->ptr_y;
 | 
					        ccmd->u.position.y = ssd->ptr_y + ssd->hot_y;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ccmd->release_info.id = (uintptr_t)(&update->ext);
 | 
					    ccmd->release_info.id = (uintptr_t)(&update->ext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -748,6 +748,8 @@ static void display_mouse_define(DisplayChangeListener *dcl,
 | 
				
			|||||||
    SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
 | 
					    SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qemu_mutex_lock(&ssd->lock);
 | 
					    qemu_mutex_lock(&ssd->lock);
 | 
				
			||||||
 | 
					    ssd->hot_x = c->hot_x;
 | 
				
			||||||
 | 
					    ssd->hot_y = c->hot_y;
 | 
				
			||||||
    if (ssd->ptr_move) {
 | 
					    if (ssd->ptr_move) {
 | 
				
			||||||
        g_free(ssd->ptr_move);
 | 
					        g_free(ssd->ptr_move);
 | 
				
			||||||
        ssd->ptr_move = NULL;
 | 
					        ssd->ptr_move = NULL;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user