Skip to content

Commit

Permalink
fix: the mouse cursor should be hidden when the window system exists
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Jul 22, 2018
1 parent d9432be commit acf9454
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ void LCUICursor_GetPos(LCUI_Pos *pos)
int LCUICursor_Paint(LCUI_PaintContext paint)
{
int x, y;
if (!cursor.visible) {
return 0;
}
x = cursor.pos.x - paint->rect.x;
y = cursor.pos.y - paint->rect.y;
return Graph_Mix(&paint->canvas, &cursor.graph, x, y, FALSE);
Expand Down
10 changes: 10 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,16 @@ void LCUI_Init(void)
LCUI_InitKeyboard();
LCUI_InitCursor();
LCUI_InitIME();

switch (LCUI_GetAppId()) {
case LCUI_APP_LINUX_X11:
case LCUI_APP_UWP:
case LCUI_APP_WINDOWS:
LCUICursor_Hide();
break;
default:
break;
}
}

int LCUI_Destroy(void)
Expand Down
1 change: 1 addition & 0 deletions src/platform/windows/uwp_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void App::Load(Platform::String^ entryPoint)
LCUI_InitDisplay(m_displayDriver);
LCUI_InitIME();
LCUI_InitCursor();
LCUICursor_Hide();
m_inputDriver->RegisterIME();
m_inputDriver->SelectIME();
UWPApp.app->Load(entryPoint);
Expand Down

0 comments on commit acf9454

Please sign in to comment.