Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maint hidden mouse-cursor #119

Open
wants to merge 3 commits into
base: maint
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/corelib/fpg_base.pas
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface

TMouseCursor = (mcDefault, mcArrow, mcCross, mcIBeam, mcSizeEW, mcSizeNS,
mcSizeNWSE, mcSizeNESW, mcSizeSWNE, mcSizeSENW, mcMove, mcHourGlass,
mcHand, mcDrag, mcNoDrop);
mcHand, mcDrag, mcNoDrop, mcNone);

TGradientDirection = (gdVertical, // Fill vertical
gdHorizontal); // Fill Horizontal
Expand Down
1 change: 1 addition & 0 deletions src/corelib/gdi/fpg_gdi.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,7 @@ procedure TfpgGDIWindow.DoSetMouseCursor;
mcCross: hc := wapplication.hcr_crosshair;
mcHourGlass: hc := wapplication.hcr_wait;
mcHand: hc := wapplication.hcr_hand;
mcNone: hc := 0;
else
hc := wapplication.hcr_default;
end;
Expand Down
12 changes: 10 additions & 2 deletions src/corelib/x11/fpg_x11.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2664,6 +2664,8 @@ procedure TfpgX11Window.DoSetMouseCursor;
var
xc: TCursor;
shape: integer;
color: PXColor;
bmp: QWord;
begin
if not HasHandle then
begin
Expand All @@ -2687,11 +2689,17 @@ procedure TfpgX11Window.DoSetMouseCursor;
mcHand: shape := XC_hand2;
mcDrag: shape := XC_target;
mcNoDrop: shape := XC_pirate;
else
mcNone: begin
fillchar(color,sizeof(color),0);
bmp:= xcreatebitmapfromdata(xapplication.Display,FWinHandle,@color,1,1); //dummy data
xc:= xcreatepixmapcursor(xapplication.Display,bmp,bmp,@color,@color,0,0);
xfreepixmap(xapplication.Display,bmp);
end;
else
shape := XC_left_ptr; //XC_arrow;
end;

xc := XCreateFontCursor(xapplication.Display, shape);
if FMouseCursor <> mcNone then xc := XCreateFontCursor(xapplication.Display, shape);
XDefineCursor(xapplication.Display, FWinHandle, xc);
XFreeCursor(xapplication.Display, xc);

Expand Down