Recent

Author Topic: (PARTLY SOLVED) Custom cursor in Linux application  (Read 4595 times)

han

  • Jr. Member
  • **
  • Posts: 96
(PARTLY SOLVED) Custom cursor in Linux application
« on: June 02, 2016, 10:44:19 pm »
The latest FPC compiler supports .RES resource files and doesn't required a .LRS resource anymore.  See
http://wiki.freepascal.org/Lazarus_Resources
In MSWindows, I can modify the cursor to a custom cursor from the .RES resource file. This doesn't work in Linux. The cursors simply disappears. Previous topics are referring to .LRS resources. Attached sample program works in MSWindows but not in Linux  (FPC 3.0.0, Lazarus 1.6, VMWare LXLE virtual machine)  :( What is wrong? See attached sample program and code below.

Thanks in advance.

uses
  .....,   LCLintf; 

implementation
{$R *.lfm}
{$R hcursors.res}   {FOR CURSORS}

{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
  screen.cursors[1]:=loadcursor(hinstance,'cursor_1'); {load cursor from res file}
  screen.cursors[2]:=loadcursor(hinstance,'cursor_2'); {load cursor from res file}
  form1.cursor:=1;
end;


« Last Edit: June 14, 2016, 10:12:14 pm by han »

han

  • Jr. Member
  • **
  • Posts: 96
Re: (PARTLY SOLVED) Custom cursor in Linux application
« Reply #1 on: June 14, 2016, 10:29:11 pm »
After a long search the problem is partly solved. The code used above is correct. The problem is that Linux or FPC can't deal with cursors containing the two special colors which are drawn in the pen.mode=pmNotXor. So in MSWindows, the cursor is white in a black background and  black on a white background. In Linux they become invisible.

Is cursors in the resource file of above code are drawn in white & black they become visible in Linux. :) Not if they are drawn in the special "red" & Aqua colors.  I used an old Windows Delphi resource program to make these cursors. The cursors have in principle 2 colors but besides white/black, the resource editor allow aqua color for transparent and red for NotXOR. 

Does this NotXor functionality exist in Linux and if so how to fix?

 

TinyPortal © 2005-2018