fix (lm_)setcursor changes for gtk target

git-svn-id: trunk@5402 -
This commit is contained in:
micha 2004-04-11 18:58:26 +00:00
parent 2601703379
commit b4c61fa97d
7 changed files with 33 additions and 21 deletions

View File

@ -281,8 +281,8 @@ type
procedure WMMouseWheel(var Msg: TLMMouseEvent); message LM_MOUSEWHEEL; procedure WMMouseWheel(var Msg: TLMMouseEvent); message LM_MOUSEWHEEL;
{$ELSE} {$ELSE}
procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL; procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL;
{$ENDIF}
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR; procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
{$ENDIF}
procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS;
procedure WMSize(var Msg: TWMSize); message WM_SIZE; procedure WMSize(var Msg: TWMSize); message WM_SIZE;
procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL; procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL;
@ -7031,6 +7031,9 @@ begin
Result := FALSE; Result := FALSE;
end; end;
{$IFNDEF SYN_LAZARUS}
{ LCL never sends WM_SETCURSOR messages, use OnMouseMove and then set cursor }
procedure TCustomSynEdit.WMSetCursor(var Msg: TWMSetCursor); procedure TCustomSynEdit.WMSetCursor(var Msg: TWMSetCursor);
var var
ptCursor, ptLineCol: TPoint; ptCursor, ptLineCol: TPoint;
@ -7038,29 +7041,23 @@ begin
GetCursorPos(ptCursor); GetCursorPos(ptCursor);
ptCursor := ScreenToClient(ptCursor); ptCursor := ScreenToClient(ptCursor);
if (ptCursor.X < fGutterWidth) then if (ptCursor.X < fGutterWidth) then
{$IFNDEF SYN_LAZARUS}
// ToDo TStreenCursors // ToDo TStreenCursors
SetCursor(Screen.Cursors[fGutter.Cursor]) SetCursor(Screen.Cursors[fGutter.Cursor])
{$ENDIF}
else begin else begin
ptLineCol.X := (LeftChar * fCharWidth + ptCursor.X - fGutterWidth - 2) ptLineCol.X := (LeftChar * fCharWidth + ptCursor.X - fGutterWidth - 2)
div fCharWidth; div fCharWidth;
ptLineCol.Y := TopLine + ptCursor.Y div fTextHeight; ptLineCol.Y := TopLine + ptCursor.Y div fTextHeight;
if (eoDragDropEditing in fOptions) and IsPointInSelection(ptLineCol) then if (eoDragDropEditing in fOptions) and IsPointInSelection(ptLineCol) then
{$IFNDEF SYN_LAZARUS}
// ToDo TStreenCursors // ToDo TStreenCursors
SetCursor(Screen.Cursors[crDefault]) SetCursor(Screen.Cursors[crDefault])
{$ENDIF}
else else
{$IFNDEF SYN_LAZARUS}
// ToDo WMSetCursor // ToDo WMSetCursor
inherited WMSetCursor(Msg); inherited WMSetCursor(Msg);
{$ELSE}
;
{$ENDIF}
end; end;
end; end;
{$endif}
procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject); procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject);
begin begin
InvalidateGutter; InvalidateGutter;

View File

@ -1369,8 +1369,8 @@ begin
FHintTimer.Enabled := False; FHintTimer.Enabled := False;
// hide hint // hide hint
FHintTimer.Enabled := // FHintTimer.Enabled :=
(TheMessage.keys or (MK_LButton and MK_RButton and MK_MButton) = 0); // (TheMessage.keys or (MK_LButton and MK_RButton and MK_MButton) = 0);
if FHintWindow.Visible then if FHintWindow.Visible then
FHintWindow.Visible := False; FHintWindow.Visible := False;
end; end;

View File

@ -245,7 +245,7 @@ begin
end; end;
if TheWinControl<>nil then begin if TheWinControl<>nil then begin
SetCursor(TheWinControl, nil); SetCursor(TheWinControl, crDefault);
ConnectInternalWidgetsSignals(MainWidget,TheWinControl); ConnectInternalWidgetsSignals(MainWidget,TheWinControl);
{$IFDEF CustomFonts} {$IFDEF CustomFonts}
ModifyWidgetStyle(TheWinControl,Widget); ModifyWidgetStyle(TheWinControl,Widget);
@ -3070,6 +3070,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.226 2004/04/11 18:58:25 micha
fix (lm_)setcursor changes for gtk target
Revision 1.225 2004/04/09 11:25:20 mattias Revision 1.225 2004/04/09 11:25:20 mattias
changed OnKeyPress keys are not delegated back to the gtk changed OnKeyPress keys are not delegated back to the gtk

View File

@ -3147,8 +3147,6 @@ begin
ShowHide(Sender); ShowHide(Sender);
end; end;
LM_SetCursor : gtkproc.SetCursor(TWinControl(Sender), Data);
LM_SetLabel : SetLabel(Sender,Data); LM_SetLabel : SetLabel(Sender,Data);
LM_GETVALUE : Result := GetValue(Sender, data); LM_GETVALUE : Result := GetValue(Sender, data);
@ -3163,7 +3161,7 @@ begin
begin begin
// change cursor // change cursor
if Sender is TWinControl then if Sender is TWinControl then
gtkproc.SetCursor(TWinControl(Sender), Data); gtkproc.SetCursor(TWinControl(Sender), TCursor(Data));
end; end;
LM_RECREATEWND : Result := RecreateWnd(sender); LM_RECREATEWND : Result := RecreateWnd(sender);
@ -9384,6 +9382,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.494 2004/04/11 18:58:25 micha
fix (lm_)setcursor changes for gtk target
Revision 1.493 2004/04/09 22:59:09 mattias Revision 1.493 2004/04/09 22:59:09 mattias
fixed mem leak in CreateFilter menu items for file dialog fixed mem leak in CreateFilter menu items for file dialog

View File

@ -3412,7 +3412,7 @@ end;
Sets the cursor for a widget. Sets the cursor for a widget.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure SetCursor(AWinControl : TWinControl; Data: Pointer); procedure SetCursor(AWinControl : TWinControl; ACursor: TCursor);
procedure DoSetCursor(AWindow: PGdkWindow; Cursor: pGDKCursor); procedure DoSetCursor(AWindow: PGdkWindow; Cursor: pGDKCursor);
begin begin
@ -3451,10 +3451,10 @@ begin
AWindow:=GetControlWindow(AWidget); AWindow:=GetControlWindow(AWidget);
if AWindow = nil then exit; if AWindow = nil then exit;
if Data = nil then if ACursor = crDefault then
SetCursorRecursive(AWindow, GetGDKMouseCursor(crDefault)) SetCursorRecursive(AWindow, GetGDKMouseCursor(crDefault))
else begin else begin
NewCursor:= GetGDKMouseCursor(Integer(Data)); NewCursor:= GetGDKMouseCursor(ACursor);
if NewCursor <> nil then SetCursorRecursive(AWindow, NewCursor); if NewCursor <> nil then SetCursorRecursive(AWindow, NewCursor);
end; end;
@ -6747,6 +6747,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.275 2004/04/11 18:58:26 micha
fix (lm_)setcursor changes for gtk target
Revision 1.274 2004/04/08 18:27:51 mattias Revision 1.274 2004/04/08 18:27:51 mattias
fixed memleak in TDefaultComponentEditor.Edit fixed memleak in TDefaultComponentEditor.Edit

View File

@ -416,7 +416,7 @@ function GetWidgetOrigin(TheWidget: PGtkWidget): TPoint;
function GetWidgetClientOrigin(TheWidget: PGtkWidget): TPoint; function GetWidgetClientOrigin(TheWidget: PGtkWidget): TPoint;
function TranslateGdkPointToClientArea(SourceWindow: PGdkWindow; function TranslateGdkPointToClientArea(SourceWindow: PGdkWindow;
SourcePos: TPoint; DestinationWidget: PGtkWidget): TPoint; SourcePos: TPoint; DestinationWidget: PGtkWidget): TPoint;
procedure SetCursor(AWinControl: TWinControl; Data: Pointer); procedure SetCursor(AWinControl: TWinControl; ACursor: TCursor);
// mouse capturing // mouse capturing
procedure CaptureMouseForWidget(Widget: PGtkWidget; Owner: TMouseCaptureType); procedure CaptureMouseForWidget(Widget: PGtkWidget; Owner: TMouseCaptureType);

View File

@ -34,7 +34,7 @@ uses
// To get as little as posible circles, // To get as little as posible circles,
// uncomment only when needed for registration // uncomment only when needed for registration
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// Controls, Controls,
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
Classes, LMessages, Classes, LMessages,
WSControls, WSLCLClasses; WSControls, WSLCLClasses;
@ -55,6 +55,7 @@ type
private private
protected protected
public public
class procedure SetCursor(AControl: TControl; ACursor: TCursor); override;
end; end;
{ TGtkWSWinControl } { TGtkWSWinControl }
@ -96,6 +97,13 @@ implementation
uses uses
GtkProc, GtkDef, GtkInt; GtkProc, GtkDef, GtkInt;
{ TGtkWSControl }
procedure TGtkWSControl.SetCursor(AControl: TControl; ACursor: TCursor);
begin
{ TODO: Dangerous cast here! TControl.SetCursor exists }
gtkproc.SetCursor(AControl as TWinControl, ACursor);
end;
{ TGtkWSWinControl } { TGtkWSWinControl }
@ -131,7 +139,7 @@ initialization
// which actually implement something // which actually implement something
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// RegisterWSComponent(TDragImageList, TGtkWSDragImageList); // RegisterWSComponent(TDragImageList, TGtkWSDragImageList);
// RegisterWSComponent(TControl, TGtkWSControl); RegisterWSComponent(TControl, TGtkWSControl);
// RegisterWSComponent(TWinControl, TGtkWSWinControl); // RegisterWSComponent(TWinControl, TGtkWSWinControl);
// RegisterWSComponent(TGraphicControl, TGtkWSGraphicControl); // RegisterWSComponent(TGraphicControl, TGtkWSGraphicControl);
// RegisterWSComponent(TCustomControl, TGtkWSCustomControl); // RegisterWSComponent(TCustomControl, TGtkWSCustomControl);