mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 15:42:08 +02:00
gtk2: use another way of fixing cursor creating crash under window
git-svn-id: trunk@15379 -
This commit is contained in:
parent
0fb0403aed
commit
55fe69da9b
@ -74,12 +74,20 @@ var
|
|||||||
Width, Height: integer;
|
Width, Height: integer;
|
||||||
MaxWidth, MaxHeight: guint;
|
MaxWidth, MaxHeight: guint;
|
||||||
pixbuf, masked_pixbuf: PGdkPixbuf;
|
pixbuf, masked_pixbuf: PGdkPixbuf;
|
||||||
|
Old80807CW: Word;
|
||||||
|
|
||||||
|
procedure SetCW; inline;
|
||||||
|
begin
|
||||||
|
Old80807CW := Get8087CW;
|
||||||
|
Set8087CW($133F);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ResetCW; inline;
|
||||||
|
begin
|
||||||
|
Set8087CW(Old80807CW);
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF windows}
|
|
||||||
// read comments at bottom
|
|
||||||
Result := inherited CreateCursor(ACursorInfo);
|
|
||||||
exit;
|
|
||||||
{$endif}
|
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if not IsValidGDIObject(ACursorInfo^.hbmColor) then Exit;
|
if not IsValidGDIObject(ACursorInfo^.hbmColor) then Exit;
|
||||||
|
|
||||||
@ -114,9 +122,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// create cursor from pixbuf
|
// create cursor from pixbuf
|
||||||
// windows gtk2 crahes here, so it can load cursors at moment through gtk1 code
|
try
|
||||||
Result := HCursor(PtrUInt(gdk_cursor_new_from_pixbuf(gdk_display_get_default, pixbuf,
|
{$IFDEF Windows}
|
||||||
ACursorInfo^.xHotSpot, ACursorInfo^.yHotSpot)));
|
// we'll get 'division by zero' error in CMCheckColorsInGamut in other case
|
||||||
|
SetCW;
|
||||||
|
{$ENDIF}
|
||||||
|
Result := HCursor(PtrUInt(gdk_cursor_new_from_pixbuf(gdk_display_get_default, pixbuf,
|
||||||
|
ACursorInfo^.xHotSpot, ACursorInfo^.yHotSpot)));
|
||||||
|
finally
|
||||||
|
{$IFDEF Windows}
|
||||||
|
ResetCW;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk2WidgetSet.CreateFontIndirectEx(const LogFont: TLogFont;
|
function TGtk2WidgetSet.CreateFontIndirectEx(const LogFont: TLogFont;
|
||||||
|
Loading…
Reference in New Issue
Block a user