From c063acb4a6a0ddd8a4948c844c28ee34399a6e1d Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 8 Mar 2020 19:52:40 +0800 Subject: [PATCH] fix a bug: call SyncUpdate when cursor moved; cursor surface lost when it was moved --- src/kernel/cursor-procs.c | 3 ++- src/newgal/pcxvfb/pcxvfb.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/kernel/cursor-procs.c b/src/kernel/cursor-procs.c index 8cef5fe5..d797507f 100644 --- a/src/kernel/cursor-procs.c +++ b/src/kernel/cursor-procs.c @@ -933,6 +933,7 @@ BOOL kernel_RefreshCursor (int* x, int* y, int* button) } showcursor (); + GAL_SyncUpdate (__gal_screen); } // GAL_SyncUpdate (__gal_screen); @@ -944,7 +945,7 @@ BOOL kernel_RefreshCursor (int* x, int* y, int* button) if (csr_bmp.bmBits) { hidecursor (); showcursor (); - // GAL_SyncUpdate (__gal_screen); + GAL_SyncUpdate (__gal_screen); } else { PCURSOR pcsr = (PCURSOR)CSR_CURRENT; diff --git a/src/newgal/pcxvfb/pcxvfb.c b/src/newgal/pcxvfb/pcxvfb.c index a0f5eeb8..ad18ad73 100644 --- a/src/newgal/pcxvfb/pcxvfb.c +++ b/src/newgal/pcxvfb/pcxvfb.c @@ -277,6 +277,7 @@ static int PCXVFB_SetCursor (_THIS, GAL_Surface *surface, int hot_x, int hot_y) PCXVFB_UpdateRects (this, 1, &rect); } + PCXVFB_SyncUpdate (this); return 0; } @@ -288,6 +289,7 @@ static int PCXVFB_MoveCursor (_THIS, int x, int y) } if (this->hidden->cursor) { + GAL_Surface* tmp; GAL_Rect rect; rect.x = boxleft (this); rect.y = boxtop (this); @@ -295,10 +297,12 @@ static int PCXVFB_MoveCursor (_THIS, int x, int y) rect.h = CURSORHEIGHT; /* update screen to hide cursor */ + tmp = this->hidden->cursor; this->hidden->cursor = NULL; PCXVFB_UpdateRects (this, 1, &rect); /* update screen to show cursor */ + this->hidden->cursor = tmp; this->hidden->csr_x = x; this->hidden->csr_y = y; @@ -307,6 +311,7 @@ static int PCXVFB_MoveCursor (_THIS, int x, int y) rect.w = CURSORWIDTH; rect.h = CURSORHEIGHT; PCXVFB_UpdateRects (this, 1, &rect); + PCXVFB_SyncUpdate (this); } else { this->hidden->csr_x = x;