I hope this is the last remaining bug (or missing feature?) for a perfect Linux build of ZGE projects: the mouse cursor doesn't show up.
I already tried to play with option App.MouseVisible.
Maybe it is something related to SDL2? I'm going to dig that later.
[FIXED] Mouse cursor isn't showing up on Linux
Moderator: Moderators
[FIXED] Mouse cursor isn't showing up on Linux
Last edited by Ats on Mon May 03, 2021 2:27 pm, edited 1 time in total.
Re: Mouse cursor isn't showing up on Linux
Bug happens in windowed mode and full-screen.
writeln(SDL_ShowCursor(vals[Visible])); returns 1
Is it possible that the mouse is showing before (and behind) the viewport?
I already tried toying with the order of initialization inside procedure TZApplication.CreateWindow;
Or maybe we need to create the cursor with SDL_CreateCursor on Linux? I remember needed to do that years ago for a PSP homebrew relying on SDL and OpenGL.
writeln(SDL_ShowCursor(vals[Visible])); returns 1
Is it possible that the mouse is showing before (and behind) the viewport?
I already tried toying with the order of initialization inside procedure TZApplication.CreateWindow;
Or maybe we need to create the cursor with SDL_CreateCursor on Linux? I remember needed to do that years ago for a PSP homebrew relying on SDL and OpenGL.
Last edited by Ats on Fri Apr 30, 2021 5:02 pm, edited 1 time in total.
Re: Mouse cursor isn't showing up on Linux
SDL_CreateCursor doesn't solve the problem:
(but maybe I messed up with the UInt8 and pointer...)
Code: Select all
procedure Platform_ShowMouse(Visible : boolean);
const vals : array[boolean] of integer = (0,1);
var
data: UInt8 = 150;
p: ^UInt8;
begin
p := @data;
SDL_CreateCursor(p, p, 4, 4, 0, 0);
SDL_ShowCursor(vals[Visible]);
writeln(SDL_GetError());
end;
Re: Mouse cursor isn't showing up on Linux
I got the cursor to show up with "SDL_ShowCursor(1);" instead of "SDL_ShowCursor(vals[Visible])".
The problem is that "writeln(vals[Visible]);" returns 0, either App.MouseVisible is ticked or not.
The problem is that "writeln(vals[Visible]);" returns 0, either App.MouseVisible is ticked or not.
Re: Mouse cursor isn't showing up on Linux
Maybe change it like this:
Code: Select all
if Visible then
SDL_ShowCursor(1)
else
SDL_ShowCursor(0);
Re: Mouse cursor isn't showing up on Linux
Yep. As simple as that. It's working
ZPlatform_SDL.inc
ZPlatform_SDL.inc
Code: Select all
procedure Platform_ShowMouse(Visible : boolean);
begin
if Visible then
SDL_ShowCursor(1)
else
SDL_ShowCursor(0);
end;