Fix cursor disappearing on Windows

This commit is contained in:
loki
2021-08-18 11:05:14 +02:00
parent 9e224987f7
commit 1876de0a68
2 changed files with 8 additions and 4 deletions

View File

@@ -69,9 +69,11 @@ struct cursor_t {
class gpu_cursor_t { class gpu_cursor_t {
public: public:
gpu_cursor_t() : cursor_view { 0, 0, 0, 0, 0.0f, 1.0f } {}; gpu_cursor_t() : cursor_view { 0, 0, 0, 0, 0.0f, 1.0f } {};
void set_pos(LONG rel_x, LONG rel_y) { void set_pos(LONG rel_x, LONG rel_y, bool visible) {
cursor_view.TopLeftX = rel_x; cursor_view.TopLeftX = rel_x;
cursor_view.TopLeftY = rel_y; cursor_view.TopLeftY = rel_y;
this->visible = visible;
} }
void set_texture(LONG width, LONG height, texture2d_t &&texture) { void set_texture(LONG width, LONG height, texture2d_t &&texture) {
@@ -85,6 +87,8 @@ public:
shader_res_t input_res; shader_res_t input_res;
D3D11_VIEWPORT cursor_view; D3D11_VIEWPORT cursor_view;
bool visible;
}; };
class duplication_t { class duplication_t {

View File

@@ -673,7 +673,7 @@ capture_e display_vram_t::snapshot(platf::img_t *img_base, std::chrono::millisec
} }
if(frame_info.LastMouseUpdateTime.QuadPart) { if(frame_info.LastMouseUpdateTime.QuadPart) {
cursor.set_pos(frame_info.PointerPosition.Position.x, frame_info.PointerPosition.Position.y); cursor.set_pos(frame_info.PointerPosition.Position.x, frame_info.PointerPosition.Position.y, frame_info.PointerPosition.Visible && cursor_visible);
} }
if(frame_update_flag) { if(frame_update_flag) {
@@ -687,10 +687,10 @@ capture_e display_vram_t::snapshot(platf::img_t *img_base, std::chrono::millisec
} }
device_ctx->CopyResource(img->texture.get(), src.get()); device_ctx->CopyResource(img->texture.get(), src.get());
if(frame_info.PointerPosition.Visible && cursor_visible) { if(cursor.visible) {
D3D11_VIEWPORT view { D3D11_VIEWPORT view {
0.0f, 0.0f, 0.0f, 0.0f,
width, height, (float)width, (float)height,
0.0f, 1.0f 0.0f, 1.0f
}; };