mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-11-04 06:31:54 +00:00 
			
		
		
		
	[client] render_queue: support cursor operations
This commit is contained in:
		@@ -103,6 +103,31 @@ void renderQueue_spiceShow(bool show)
 | 
			
		||||
  app_invalidateWindow(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void renderQueue_cursorState(bool visible, int x, int y, int hx, int hy)
 | 
			
		||||
{
 | 
			
		||||
  RenderCommand * cmd      = malloc(sizeof(*cmd));
 | 
			
		||||
  cmd->op                  = CURSOR_OP_STATE;
 | 
			
		||||
  cmd->cursorState.visible = visible;
 | 
			
		||||
  cmd->cursorState.x       = x;
 | 
			
		||||
  cmd->cursorState.y       = y;
 | 
			
		||||
  cmd->cursorState.hx      = hx;
 | 
			
		||||
  cmd->cursorState.hy      = hy;
 | 
			
		||||
  ll_push(l_renderQueue, cmd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void renderQueue_cursorImage(bool monochrome, int width, int height, int pitch,
 | 
			
		||||
    uint8_t * data)
 | 
			
		||||
{
 | 
			
		||||
  RenderCommand * cmd         = malloc(sizeof(*cmd));
 | 
			
		||||
  cmd->op                     = CURSOR_OP_IMAGE;
 | 
			
		||||
  cmd->cursorImage.monochrome = monochrome;
 | 
			
		||||
  cmd->cursorImage.width      = width;
 | 
			
		||||
  cmd->cursorImage.height     = height;
 | 
			
		||||
  cmd->cursorImage.pitch      = pitch;
 | 
			
		||||
  cmd->cursorImage.data       = data;
 | 
			
		||||
  ll_push(l_renderQueue, cmd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void renderQueue_process(void)
 | 
			
		||||
{
 | 
			
		||||
  RenderCommand * cmd;
 | 
			
		||||
@@ -136,6 +161,18 @@ void renderQueue_process(void)
 | 
			
		||||
        if (cmd->spiceShow.show)
 | 
			
		||||
          overlaySplash_show(false);
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      case CURSOR_OP_STATE:
 | 
			
		||||
        RENDERER(onMouseEvent, cmd->cursorState.visible, cmd->cursorState.x,
 | 
			
		||||
            cmd->cursorState.y, cmd->cursorState.hx, cmd->cursorState.hy);
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
      case CURSOR_OP_IMAGE:
 | 
			
		||||
        RENDERER(onMouseShape,
 | 
			
		||||
            cmd->cursorImage.monochrome ? LG_CURSOR_MONOCHROME : LG_CURSOR_COLOR,
 | 
			
		||||
            cmd->cursorImage.width, cmd->cursorImage.height,
 | 
			
		||||
            cmd->cursorImage.pitch, cmd->cursorImage.data);
 | 
			
		||||
        free(cmd->cursorImage.data);
 | 
			
		||||
    }
 | 
			
		||||
    free(cmd);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,9 @@ typedef struct
 | 
			
		||||
    SPICE_OP_CONFIGURE,
 | 
			
		||||
    SPICE_OP_DRAW_FILL,
 | 
			
		||||
    SPICE_OP_DRAW_BITMAP,
 | 
			
		||||
    SPICE_OP_SHOW
 | 
			
		||||
    SPICE_OP_SHOW,
 | 
			
		||||
    CURSOR_OP_STATE,
 | 
			
		||||
    CURSOR_OP_IMAGE,
 | 
			
		||||
  }
 | 
			
		||||
  op;
 | 
			
		||||
 | 
			
		||||
@@ -62,6 +64,26 @@ typedef struct
 | 
			
		||||
      bool show;
 | 
			
		||||
    }
 | 
			
		||||
    spiceShow;
 | 
			
		||||
 | 
			
		||||
    struct
 | 
			
		||||
    {
 | 
			
		||||
      bool visible;
 | 
			
		||||
      int  x;
 | 
			
		||||
      int  y;
 | 
			
		||||
      int  hx;
 | 
			
		||||
      int  hy;
 | 
			
		||||
    }
 | 
			
		||||
    cursorState;
 | 
			
		||||
 | 
			
		||||
    struct
 | 
			
		||||
    {
 | 
			
		||||
      bool      monochrome;
 | 
			
		||||
      int       width;
 | 
			
		||||
      int       height;
 | 
			
		||||
      int       pitch;
 | 
			
		||||
      uint8_t * data;
 | 
			
		||||
    }
 | 
			
		||||
    cursorImage;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
RenderCommand;
 | 
			
		||||
@@ -80,3 +102,8 @@ void renderQueue_spiceDrawBitmap(int x, int y, int width, int height, int stride
 | 
			
		||||
    void * data, bool topDown);
 | 
			
		||||
 | 
			
		||||
void renderQueue_spiceShow(bool show);
 | 
			
		||||
 | 
			
		||||
void renderQueue_cursorState(bool visible, int x, int y, int hx, int hy);
 | 
			
		||||
 | 
			
		||||
void renderQueue_cursorImage(bool monochrome, int width, int height, int pitch,
 | 
			
		||||
    uint8_t * data);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user