Skip to content

Commit acf9454

Browse files
committed
fix: the mouse cursor should be hidden when the window system exists
1 parent d9432be commit acf9454

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/cursor.c

+3
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ void LCUICursor_GetPos(LCUI_Pos *pos)
231231
int LCUICursor_Paint(LCUI_PaintContext paint)
232232
{
233233
int x, y;
234+
if (!cursor.visible) {
235+
return 0;
236+
}
234237
x = cursor.pos.x - paint->rect.x;
235238
y = cursor.pos.y - paint->rect.y;
236239
return Graph_Mix(&paint->canvas, &cursor.graph, x, y, FALSE);

src/main.c

+10
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,16 @@ void LCUI_Init(void)
524524
LCUI_InitKeyboard();
525525
LCUI_InitCursor();
526526
LCUI_InitIME();
527+
528+
switch (LCUI_GetAppId()) {
529+
case LCUI_APP_LINUX_X11:
530+
case LCUI_APP_UWP:
531+
case LCUI_APP_WINDOWS:
532+
LCUICursor_Hide();
533+
break;
534+
default:
535+
break;
536+
}
527537
}
528538

529539
int LCUI_Destroy(void)

src/platform/windows/uwp_app.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ void App::Load(Platform::String^ entryPoint)
227227
LCUI_InitDisplay(m_displayDriver);
228228
LCUI_InitIME();
229229
LCUI_InitCursor();
230+
LCUICursor_Hide();
230231
m_inputDriver->RegisterIME();
231232
m_inputDriver->SelectIME();
232233
UWPApp.app->Load(entryPoint);

0 commit comments

Comments
 (0)