SetCursor faulty under GTK2 => changes cursor for wrong control
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
- Create a project with an empty form.
- put a SpeedButton (or other TGraphicControl) on it.
- Add a handler
procedure TForm1.FormClick(Sender: TObject);
begin
SpeedButton1.Cursor:=crIBeam;
end;
Run, and click on the form (do not move the mouse)
The cursor will turn into IBeam. But it should not, since you are not over the Form, not over the SpeedButton.
The Problem is caused, because TGraphicControl do not have there own cursor with the widgetset.
So TControl.SetCursor calls TControl.SetTempCursor, whcih calls Parent.SetCursor (equals TWinControl.SetCursor)
TWinControl then instructs the widgetset to set the cursor for self (for the WinControl)
This should only be done, if the mouse-pointer is above the Control for which the cursor has changed.
The call to SetTempCursor must be kept. It ensures the Cursor is changed even if the mouse is not moved. This is important if an application wants for example to hide the Cursor (like many Textprocessors hide it when text is entered, and show it on mouse-move => so hiding can and must not rely on Mouse-Move)
SetTempCursor should include the calling control.
The check could either be done in the LCL, easy for all widgetsets. (Windows will have to implement immediate setting as well, for the above reason), or the Control could be passed to the WidgetSet, and the check could be done there
Alternatively, the widgetset SetCursor (which is given the WinControl and the TCursor value)could ignore the Value for the cursor, and ask the wincontrol for the control at the mouse-position
Mantis conversion info:
- Mantis ID: 14257
- Version: 0.9.27 (SVN)
- Fixed in revision: 47841 (#f6520207)
- Target version: 1.4